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.
- checksums.yaml +4 -4
- data/.github/workflows/build.yml +38 -0
- data/.gitignore +1 -0
- data/Appraisals +10 -14
- data/CHANGELOG.md +62 -0
- data/Gemfile +7 -4
- data/README.md +45 -9
- data/app/helpers/opal_helper.rb +6 -5
- data/bin/rackup +29 -0
- data/bin/rails +8 -0
- data/bin/rails-engine +13 -0
- data/bin/rails-sandbox +18 -0
- data/bin/rake +29 -0
- data/bin/rspec +29 -0
- data/bin/sandbox +39 -0
- data/bin/sandbox-setup +14 -0
- data/bin/setup +8 -0
- data/gemfiles/rails_6_0_opal_1_0.gemfile +9 -0
- data/gemfiles/rails_6_0_opal_1_1.gemfile +9 -0
- data/gemfiles/rails_6_1_opal_1_0.gemfile +9 -0
- data/gemfiles/rails_6_1_opal_1_1.gemfile +9 -0
- data/lib/assets/javascripts/opal_ujs.js.rb +1 -4
- data/lib/generators/opal/assets/assets_generator.rb +7 -0
- data/lib/{rails/generators → generators}/opal/assets/templates/javascript.js.rb +0 -0
- data/lib/generators/opal/install/USAGE +8 -0
- data/lib/generators/opal/install/install_generator.rb +12 -0
- data/lib/generators/opal/install/templates/application.js.rb +12 -0
- data/lib/opal/rails.rb +0 -4
- data/lib/opal/rails/engine.rb +9 -2
- data/lib/opal/rails/template_handler.rb +16 -7
- data/lib/opal/rails/version.rb +1 -1
- data/opal-rails.gemspec +45 -40
- data/spec/helpers/opal_helper_spec.rb +23 -9
- data/spec/integration/assigns_spec.rb +58 -2
- data/spec/integration/source_map_spec.rb +9 -5
- data/spec/support/capybara.rb +2 -0
- data/test_apps/{application_controller.rb → app/application_controller.rb} +1 -1
- data/test_apps/app/assets/config/manifest.js +1 -0
- data/test_apps/{assets → app/assets}/javascripts/application.js.rb +1 -0
- data/test_apps/{assets → app/assets}/javascripts/bar.rb +0 -0
- data/test_apps/{assets → app/assets}/javascripts/foo.js.rb +0 -0
- data/test_apps/{assets → app/assets}/javascripts/source_map_example.js.rb +0 -0
- data/test_apps/{assets → app/assets}/javascripts/with_assignments.js.rb +0 -0
- data/test_apps/{rails5.rb → rails6.rb} +1 -3
- metadata +49 -84
- data/.travis.yml +0 -42
- data/gemfiles/rails_5_1_opal_1_0.gemfile +0 -12
- data/gemfiles/rails_5_1_opal_master.gemfile +0 -11
- data/gemfiles/rails_5_2_opal_1_0.gemfile +0 -12
- data/gemfiles/rails_5_2_opal_master.gemfile +0 -11
- data/lib/rails/generators/opal/assets/assets_generator.rb +0 -12
- data/spec/integration/template_spec.rb +0 -9
- 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!
|