opal-rails 1.0.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/build.yml +38 -0
  3. data/.gitignore +1 -0
  4. data/Appraisals +10 -14
  5. data/CHANGELOG.md +62 -0
  6. data/Gemfile +7 -4
  7. data/README.md +45 -9
  8. data/app/helpers/opal_helper.rb +6 -5
  9. data/bin/rackup +29 -0
  10. data/bin/rails +8 -0
  11. data/bin/rails-engine +13 -0
  12. data/bin/rails-sandbox +18 -0
  13. data/bin/rake +29 -0
  14. data/bin/rspec +29 -0
  15. data/bin/sandbox +39 -0
  16. data/bin/sandbox-setup +14 -0
  17. data/bin/setup +8 -0
  18. data/gemfiles/rails_6_0_opal_1_0.gemfile +9 -0
  19. data/gemfiles/rails_6_0_opal_1_1.gemfile +9 -0
  20. data/gemfiles/rails_6_1_opal_1_0.gemfile +9 -0
  21. data/gemfiles/rails_6_1_opal_1_1.gemfile +9 -0
  22. data/lib/assets/javascripts/opal_ujs.js.rb +1 -4
  23. data/lib/generators/opal/assets/assets_generator.rb +7 -0
  24. data/lib/{rails/generators → generators}/opal/assets/templates/javascript.js.rb +0 -0
  25. data/lib/generators/opal/install/USAGE +8 -0
  26. data/lib/generators/opal/install/install_generator.rb +12 -0
  27. data/lib/generators/opal/install/templates/application.js.rb +12 -0
  28. data/lib/opal/rails.rb +0 -4
  29. data/lib/opal/rails/engine.rb +9 -2
  30. data/lib/opal/rails/template_handler.rb +16 -7
  31. data/lib/opal/rails/version.rb +1 -1
  32. data/opal-rails.gemspec +45 -40
  33. data/spec/helpers/opal_helper_spec.rb +23 -9
  34. data/spec/integration/assigns_spec.rb +58 -2
  35. data/spec/integration/source_map_spec.rb +9 -5
  36. data/spec/support/capybara.rb +2 -0
  37. data/test_apps/{application_controller.rb → app/application_controller.rb} +1 -1
  38. data/test_apps/app/assets/config/manifest.js +1 -0
  39. data/test_apps/{assets → app/assets}/javascripts/application.js.rb +1 -0
  40. data/test_apps/{assets → app/assets}/javascripts/bar.rb +0 -0
  41. data/test_apps/{assets → app/assets}/javascripts/foo.js.rb +0 -0
  42. data/test_apps/{assets → app/assets}/javascripts/source_map_example.js.rb +0 -0
  43. data/test_apps/{assets → app/assets}/javascripts/with_assignments.js.rb +0 -0
  44. data/test_apps/{rails5.rb → rails6.rb} +1 -3
  45. metadata +49 -84
  46. data/.travis.yml +0 -42
  47. data/gemfiles/rails_5_1_opal_1_0.gemfile +0 -12
  48. data/gemfiles/rails_5_1_opal_master.gemfile +0 -11
  49. data/gemfiles/rails_5_2_opal_1_0.gemfile +0 -12
  50. data/gemfiles/rails_5_2_opal_master.gemfile +0 -11
  51. data/lib/rails/generators/opal/assets/assets_generator.rb +0 -12
  52. data/spec/integration/template_spec.rb +0 -9
  53. data/test_apps/rails4.rb +0 -47
@@ -1,12 +0,0 @@
1
- require 'rails/generators/named_base'
2
-
3
- module Opal
4
- module Generators
5
- class AssetsGenerator < ::Rails::Generators::NamedBase
6
- source_root __dir__+'/templates'
7
- def copy_opal
8
- template 'javascript.js.rb', File.join('app/assets/javascripts', class_path, "#{file_name}.js.rb")
9
- end
10
- end
11
- end
12
- end
@@ -1,9 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'template handler' do
4
- it 'has the correct content type' do
5
- get '/application/with_assignments.js'
6
- expect(response).to be_successful
7
- expect(response.headers['Content-Type']).to eq('text/javascript; charset=utf-8')
8
- end
9
- end
data/test_apps/rails4.rb DELETED
@@ -1,47 +0,0 @@
1
- # FROM: http://www.rubytutorial.io/how-to-test-your-gem-against-multiple-rails/
2
-
3
- # test/apps/rails4.rb
4
- require 'rails'
5
- require 'rails/all'
6
- require 'action_view/testing/resolvers'
7
-
8
- require 'opal-rails' # our gem
9
-
10
- module RailsApp
11
- class Application < Rails::Application
12
- config.root = __dir__
13
- config.cache_classes = true
14
- config.eager_load = false
15
- config.serve_static_files = true
16
- config.static_cache_control = 'public, max-age=3600'
17
- config.consider_all_requests_local = true
18
- config.action_controller.perform_caching = false
19
- config.action_dispatch.show_exceptions = false
20
- config.action_controller.allow_forgery_protection = false
21
- config.active_support.deprecation = :stderr
22
- config.secret_key_base = '49837489qkuweoiuoqwe'
23
-
24
- config.middleware.delete 'Rack::Lock'
25
- config.middleware.delete 'ActionDispatch::Flash'
26
- config.middleware.delete 'ActionDispatch::BestStandardsSupport'
27
-
28
- routes.append do
29
- get '/' => 'application#index'
30
- get '/application/with_assignments' => 'application#with_assignments'
31
-
32
- # just to reduce noise
33
- get '/apple-touch-icon-precomposed.png' => -> { [404,{},[]] }
34
- get '/favicon.ico' => -> { [404,{},[]] }
35
- end
36
-
37
- config.assets.paths << File.join(__dir__, 'assets/javascripts')
38
- config.assets.debug = true
39
- config.assets.digest = true
40
-
41
- # Opal specific:
42
- config.opal.source_map_enabled = true
43
- end
44
- end
45
-
46
- require_relative './application_controller'
47
- RailsApp::Application.initialize!