diff options
Diffstat (limited to 'actioncable')
-rw-r--r-- | actioncable/.gitignore | 2 | ||||
-rw-r--r-- | actioncable/Rakefile | 35 | ||||
-rw-r--r-- | actioncable/actioncable.gemspec | 7 | ||||
-rw-r--r-- | actioncable/app/assets/javascripts/action_cable/index.js | 1 | ||||
-rw-r--r-- | actioncable/app/assets/javascripts/action_cable/source/connection.coffee (renamed from actioncable/lib/assets/javascripts/action_cable/connection.coffee) | 0 | ||||
-rw-r--r-- | actioncable/app/assets/javascripts/action_cable/source/connection_monitor.coffee (renamed from actioncable/lib/assets/javascripts/action_cable/connection_monitor.coffee) | 0 | ||||
-rw-r--r-- | actioncable/app/assets/javascripts/action_cable/source/consumer.coffee (renamed from actioncable/lib/assets/javascripts/action_cable/consumer.coffee) | 8 | ||||
-rw-r--r-- | actioncable/app/assets/javascripts/action_cable/source/index.coffee.erb (renamed from actioncable/lib/assets/javascripts/action_cable.coffee.erb) | 2 | ||||
-rw-r--r-- | actioncable/app/assets/javascripts/action_cable/source/subscription.coffee (renamed from actioncable/lib/assets/javascripts/action_cable/subscription.coffee) | 0 | ||||
-rw-r--r-- | actioncable/app/assets/javascripts/action_cable/source/subscriptions.coffee (renamed from actioncable/lib/assets/javascripts/action_cable/subscriptions.coffee) | 0 |
10 files changed, 48 insertions, 7 deletions
diff --git a/actioncable/.gitignore b/actioncable/.gitignore new file mode 100644 index 0000000000..8ded114548 --- /dev/null +++ b/actioncable/.gitignore @@ -0,0 +1,2 @@ +/lib/assets/javascripts/action_cable.js +/tmp diff --git a/actioncable/Rakefile b/actioncable/Rakefile index b6c56e9195..0a036e3e3d 100644 --- a/actioncable/Rakefile +++ b/actioncable/Rakefile @@ -1,4 +1,8 @@ require 'rake/testtask' +require 'pathname' +require 'sprockets' +require 'coffee-script' +require 'action_cable' dir = File.dirname(__FILE__) @@ -11,3 +15,34 @@ Rake::TestTask.new do |t| t.verbose = true t.ruby_opts = ["--dev"] if defined?(JRUBY_VERSION) end + +namespace :assets do + desc "Compile dist/action_cable.js" + task :compile do + puts 'Compiling Action Cable assets...' + + asset_mapping = { "source.js" => "action_cable.js" } + + root_path = Pathname.new(dir) + load_path = root_path.join("app/assets/javascripts/action_cable") + destination_path = root_path.join("lib/assets/javascripts") + + compile_path = root_path.join("tmp/sprockets") + compile_path.rmtree if compile_path.exist? + compile_path.mkpath + + environment = Sprockets::Environment.new + environment.append_path(load_path) + + manifest = Sprockets::Manifest.new(environment.index, compile_path) + manifest.compile(asset_mapping.keys) + + asset_mapping.each do |logical_path, dist_path| + fingerprint_path = manifest.assets[logical_path] + FileUtils.cp(compile_path.join(fingerprint_path), destination_path.join(dist_path)) + end + + puts '======' + puts 'Action Cable assets compiled successfully!' + end +end diff --git a/actioncable/actioncable.gemspec b/actioncable/actioncable.gemspec index 14f968f1ef..0976895ef7 100644 --- a/actioncable/actioncable.gemspec +++ b/actioncable/actioncable.gemspec @@ -24,9 +24,12 @@ Gem::Specification.new do |s| s.add_dependency 'nio4r', '~> 1.2' s.add_dependency 'websocket-driver', '~> 0.6.1' - s.add_development_dependency 'em-hiredis', '~> 0.3.0' + s.add_development_dependency 'coffee-script', '~> 2.4.1' + s.add_development_dependency 'coffee-script-source', '~> 1.10.0' + s.add_development_dependency 'em-hiredis', '~> 0.3.0' s.add_development_dependency 'mocha' s.add_development_dependency 'pg' s.add_development_dependency 'puma' - s.add_development_dependency 'redis', '~> 3.0' + s.add_development_dependency 'redis', '~> 3.0' + s.add_development_dependency 'sprockets', '~> 3.5.2' end diff --git a/actioncable/app/assets/javascripts/action_cable/index.js b/actioncable/app/assets/javascripts/action_cable/index.js new file mode 100644 index 0000000000..e97870c3b0 --- /dev/null +++ b/actioncable/app/assets/javascripts/action_cable/index.js @@ -0,0 +1 @@ +//= require_tree ./source diff --git a/actioncable/lib/assets/javascripts/action_cable/connection.coffee b/actioncable/app/assets/javascripts/action_cable/source/connection.coffee index fbd7dbd35b..fbd7dbd35b 100644 --- a/actioncable/lib/assets/javascripts/action_cable/connection.coffee +++ b/actioncable/app/assets/javascripts/action_cable/source/connection.coffee diff --git a/actioncable/lib/assets/javascripts/action_cable/connection_monitor.coffee b/actioncable/app/assets/javascripts/action_cable/source/connection_monitor.coffee index 99b9a1c6d5..99b9a1c6d5 100644 --- a/actioncable/lib/assets/javascripts/action_cable/connection_monitor.coffee +++ b/actioncable/app/assets/javascripts/action_cable/source/connection_monitor.coffee diff --git a/actioncable/lib/assets/javascripts/action_cable/consumer.coffee b/actioncable/app/assets/javascripts/action_cable/source/consumer.coffee index fcd8d0fb6c..717c0641a9 100644 --- a/actioncable/lib/assets/javascripts/action_cable/consumer.coffee +++ b/actioncable/app/assets/javascripts/action_cable/source/consumer.coffee @@ -1,7 +1,7 @@ -#= require action_cable/connection -#= require action_cable/connection_monitor -#= require action_cable/subscriptions -#= require action_cable/subscription +#= require ./connection +#= require ./connection_monitor +#= require ./subscriptions +#= require ./subscription # The ActionCable.Consumer establishes the connection to a server-side Ruby Connection object. Once established, # the ActionCable.ConnectionMonitor will ensure that its properly maintained through heartbeats and checking for stale updates. diff --git a/actioncable/lib/assets/javascripts/action_cable.coffee.erb b/actioncable/app/assets/javascripts/action_cable/source/index.coffee.erb index 7daea4ebcd..f4615b7502 100644 --- a/actioncable/lib/assets/javascripts/action_cable.coffee.erb +++ b/actioncable/app/assets/javascripts/action_cable/source/index.coffee.erb @@ -1,5 +1,5 @@ #= require_self -#= require action_cable/consumer +#= require ./consumer @ActionCable = INTERNAL: <%= ActionCable::INTERNAL.to_json %> diff --git a/actioncable/lib/assets/javascripts/action_cable/subscription.coffee b/actioncable/app/assets/javascripts/action_cable/source/subscription.coffee index 339d676933..339d676933 100644 --- a/actioncable/lib/assets/javascripts/action_cable/subscription.coffee +++ b/actioncable/app/assets/javascripts/action_cable/source/subscription.coffee diff --git a/actioncable/lib/assets/javascripts/action_cable/subscriptions.coffee b/actioncable/app/assets/javascripts/action_cable/source/subscriptions.coffee index ae041ffa2b..ae041ffa2b 100644 --- a/actioncable/lib/assets/javascripts/action_cable/subscriptions.coffee +++ b/actioncable/app/assets/javascripts/action_cable/source/subscriptions.coffee |