opal-rails 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 49586db0f49f4f31e3e289e1f813275e1b81ab083aa5e771887e5e93bc08b83b
4
- data.tar.gz: 02d8db2458c45f4fe2554028571288b2664f8cfc64bba320a62d59a9ea120567
3
+ metadata.gz: 165e5b957c73079681eae29566b10478bddd1bb0a959d7cc2ce772ffe5778b85
4
+ data.tar.gz: 4f6dd4337a2f84796852b4ceb87e15decb2ae85afdc1c5012c1f0ab586c08e1c
5
5
  SHA512:
6
- metadata.gz: ec6e2d6ce3226094ef31bcb2b75a5317b7d0a1e05cb3af627022dfd00697787ad1ed6fdd739cfb485a741685e4cfd8b746d3fb29a1e4a29b6bcc1b6163aef362
7
- data.tar.gz: eac8d359fbd8589edd16c7df490a619fe9d2e3a09640ab0d1d14ece16cd5f6d1fa31cb2d82f9bacb8ffe8bf6bf164a565ff72181e89f109f45566992d8a72631
6
+ metadata.gz: 4537a41a8f9c848acbf0a440aa1767d5f40737dca75e62e8711efd860a369a44d8c093c2d981ee759090b135b42720a35953f65a559be21fbd86c04763ed9f8d
7
+ data.tar.gz: '05853c6bb0945b217118c92af19694771a3b8fe35207fe8c2ca1e4906b652808fab63beb25e0b96efdc00f1c979abfa9e1ad36864afe35ad1e58b94db0bccb58'
data/CHANGELOG.md CHANGED
@@ -18,9 +18,24 @@ Whitespace conventions:
18
18
  - 1 spaces before normal text
19
19
  -->
20
20
 
21
- ## [2.0](https://github.com/opal/opal-rails/compare/v1.1.2...v2.0.0) - unreleased
22
21
 
23
- *Bumping a major version, since this version will make a number of dependencies opt-in and drop older Rails and Sprockets versions*
22
+
23
+ ## [2.0.1](https://github.com/opal/opal-rails/compare/v2.0.0...v2.0.1) - 2021-03-03
24
+
25
+
26
+ ### Added
27
+
28
+ - The install generator now will add an `opal.rb` initializer with a default compiler configuration and the template assign support disabled
29
+
30
+ ### Fixed
31
+
32
+ - The install generator was missing a newline when changing the app layout
33
+
34
+
35
+ ## [2.0.0](https://github.com/opal/opal-rails/compare/v1.1.2...v2.0.0) - 2021-02-23
36
+
37
+ *This is a major version, since a number of dependencies are going to be opt-in and support for older Rails
38
+ and Sprockets versions is dropped*
24
39
 
25
40
  ### Added
26
41
 
data/README.md CHANGED
@@ -32,27 +32,37 @@ bin/rails opal:install
32
32
 
33
33
  ### Configuration
34
34
 
35
- Add your configuration in `config/initializers/assets.rb` with the following contents:
35
+ #### For the compiler
36
+
37
+ Add your configuration for the compiler:
38
+
39
+ `config/initializers/opal.rb`
36
40
 
37
41
  ```ruby
38
42
  # Compiler options
39
- Rails.application.config.opal.method_missing = true
40
- Rails.application.config.opal.optimized_operators = true
41
- Rails.application.config.opal.arity_check = !Rails.env.production?
42
- Rails.application.config.opal.const_missing = true
43
+ Rails.application.config.opal.method_missing_enabled = true
44
+ Rails.application.config.opal.const_missing_enabled = true
45
+ Rails.application.config.opal.arity_check_enabled = true
46
+ Rails.application.config.opal.freezing_stubs_enabled = true
43
47
  Rails.application.config.opal.dynamic_require_severity = :ignore
48
+ ```
49
+
50
+ Check out the full list of the available configuration options at: [lib/opal/config.rb](https://github.com/opal/opal/blob/master/lib/opal/config.rb).
44
51
 
45
- # Other options
52
+ #### For template assigns
46
53
 
47
- # Send local and instance variables down to the view after converting
48
- # thier value with `.to_json`
54
+ Add your configuration for rendering assigns when using the template handler from actions:
55
+
56
+ `config/initializers/opal.rb`
57
+
58
+ ```ruby
49
59
  Rails.application.config.opal.assigns_in_templates = true
50
60
  Rails.application.config.opal.assigns_in_templates = :locals # only locals
51
61
  Rails.application.config.opal.assigns_in_templates = :ivars # only instance variables
52
62
  ```
53
63
 
54
- For a full list of the available configuration options for the compiler please refer to: [lib/opal/config.rb](https://github.com/opal/opal/blob/master/lib/opal/config.rb).
55
64
 
65
+ Local and instance variables will be sent down to the view after converting their values to JSON.
56
66
 
57
67
 
58
68
  ## Usage
data/bin/sandbox-setup CHANGED
@@ -4,7 +4,7 @@ require 'pathname'
4
4
 
5
5
  root = Pathname('sandbox')
6
6
 
7
- system 'bin/rails opal:install'
7
+ system 'bin/rails g opal:install'
8
8
  system 'bin/rails g controller home index -f'
9
9
 
10
10
  root.join('config/routes.rb').write <<~RUBY
@@ -4,9 +4,11 @@ class Opal::InstallGenerator < Rails::Generators::Base
4
4
  def configure_sprockets
5
5
  append_to_file 'app/assets/config/manifest.js', '//= link_directory ../javascript .js'
6
6
  template "application.js.rb", "app/assets/javascript/application.js.rb"
7
+ template "initializer.rb", "config/initializers/opal.rb"
7
8
 
8
9
  # Add the javascript tag to the application head tag
9
- gsub_file 'app/views/layouts/application.html.erb', %r{^( *)</head>},
10
- '\1 <%= javascript_include_tag "application", "data-turbolinks-track": "reload" %>\1</head>'
10
+ gsub_file 'app/views/layouts/application.html.erb', %r{(\n *)</head>},
11
+ '\1 <%= javascript_include_tag "application", "data-turbolinks-track": "reload" %>' \
12
+ '\1</head>'
11
13
  end
12
14
  end
@@ -0,0 +1,22 @@
1
+ # Check out the full list of the available configuration options at
2
+ # https://github.com/opal/opal/blob/master/lib/opal/config.rb
3
+
4
+ Rails.application.configure do
5
+ # We suggest keeping the configuration above as default for all environments,
6
+ # disabling some of them might slightly reduce the bundle size or reduce performance
7
+ # by degrading some ruby features.
8
+ config.opal.method_missing_enabled = true
9
+ config.opal.const_missing_enabled = true
10
+ config.opal.arity_check_enabled = true
11
+ config.opal.freezing_stubs_enabled = true
12
+ config.opal.dynamic_require_severity = :ignore
13
+
14
+ # To enable passing assigns from the controller to the opal template handler
15
+ # change the following configuration to one of these values:
16
+ #
17
+ # - true # both locals and instance variables
18
+ # - :locals # only locals
19
+ # - :ivars # only instance variables
20
+ #
21
+ config.opal.assigns_in_templates = false
22
+ end
@@ -1,5 +1,5 @@
1
1
  module Opal
2
2
  module Rails
3
- VERSION = '2.0.0'
3
+ VERSION = '2.0.1'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opal-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elia Schito
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-23 00:00:00.000000000 Z
11
+ date: 2021-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -221,6 +221,7 @@ files:
221
221
  - lib/generators/opal/install/USAGE
222
222
  - lib/generators/opal/install/install_generator.rb
223
223
  - lib/generators/opal/install/templates/application.js.rb
224
+ - lib/generators/opal/install/templates/initializer.rb
224
225
  - lib/opal-rails.rb
225
226
  - lib/opal/rails.rb
226
227
  - lib/opal/rails/engine.rb