diff options
Diffstat (limited to 'actioncable')
-rw-r--r-- | actioncable/Rakefile | 40 | ||||
-rw-r--r-- | actioncable/app/assets/javascripts/action_cable.coffee.erb | 7 | ||||
-rw-r--r-- | actioncable/blade.yml | 6 |
3 files changed, 11 insertions, 42 deletions
diff --git a/actioncable/Rakefile b/actioncable/Rakefile index 58c18dd457..aa62265ac9 100644 --- a/actioncable/Rakefile +++ b/actioncable/Rakefile @@ -1,15 +1,14 @@ require 'rake/testtask' require 'pathname' -require 'sprockets' -require 'coffee-script' require 'action_cable' +require 'blade' dir = File.dirname(__FILE__) task :default => :test task :package => "assets:compile" -task "package:clean" => "assets:clean" +task "package:clean" Rake::TestTask.new do |t| t.libs << "test" @@ -27,44 +26,13 @@ namespace :test do end task :javascript do - require 'blade' Blade.start(interface: :runner) end end namespace :assets do - root_path = Pathname.new(dir) - destination_path = root_path.join("lib/assets/compiled") - - desc "Compile dist/action_cable.js" + desc "Compile Action Cable assets" task :compile do - puts 'Compiling Action Cable assets...' - - precompile_list = %w(action_cable.js) - - environment = Sprockets::Environment.new - environment.gzip = false - Pathname.glob(root_path.join("app/assets/*/")) do |subdir| - environment.append_path subdir - end - - compile_path = root_path.join("tmp/sprockets") - compile_path.rmtree if compile_path.exist? - compile_path.mkpath - - manifest = Sprockets::Manifest.new(environment.index, compile_path) - manifest.compile(precompile_list) - - destination_path.rmtree if destination_path.exist? - manifest.assets.each do |path, fingerprint_path| - destination_path.join(path).dirname.mkpath - FileUtils.cp(compile_path.join(fingerprint_path), destination_path.join(path)) - end - - puts 'Done' - end - - task :clean do - destination_path.rmtree if destination_path.exist? + Blade.build end end diff --git a/actioncable/app/assets/javascripts/action_cable.coffee.erb b/actioncable/app/assets/javascripts/action_cable.coffee.erb index 32f9f517f4..210a3ae17e 100644 --- a/actioncable/app/assets/javascripts/action_cable.coffee.erb +++ b/actioncable/app/assets/javascripts/action_cable.coffee.erb @@ -1,3 +1,4 @@ +#= export ActionCable #= require_self #= require ./action_cable/consumer @@ -33,9 +34,3 @@ if @debugging messages.push(Date.now()) console.log("[ActionCable]", messages...) - -# NOTE: We expose ActionCable as a browser global so we can reference it -# internally without concern for how the module is loaded. -window?.ActionCable = @ActionCable - -module?.exports = @ActionCable diff --git a/actioncable/blade.yml b/actioncable/blade.yml index 7980f3d101..9cdb318c97 100644 --- a/actioncable/blade.yml +++ b/actioncable/blade.yml @@ -5,3 +5,9 @@ load_paths: logical_paths: - test.js + +build: + logical_paths: + - action_cable.js + path: lib/assets/compiled + clean: true |