reactive_rails_generator 0.1.2 → 0.1.3

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
  SHA1:
3
- metadata.gz: 5803d719ad896dccda1b87c1441f2ad1e40fb54f
4
- data.tar.gz: 061cf172fe62ff09ca194e2e6dc23eee88ed02a2
3
+ metadata.gz: 261804c681fdc92a75b361581d50b3dc8c1f5e3a
4
+ data.tar.gz: f5b6ba12186b4682a3289e98c683b3752e840bb5
5
5
  SHA512:
6
- metadata.gz: e4233b04f162f3dec69ad777a99320dace76dc08a4fb496dec3d01c6e5823c7de3639ac4a31cb8ebcd111389f6bc644a55b49050079ff14962ee1fbd7e557f08
7
- data.tar.gz: 4284a31879ea6b7ba9c0a252310e76a6bd993af80e2bbd1abd327a3cdecc67a4c4fe3c9024b9376559839692d44abf373ea5431eed2eb031161b7367d742008f
6
+ metadata.gz: ebb8d0deb79fb6b62498482aa7c4bbb2694cd3e2c29f9ffadf7b8a7736069f96135bf7eaaa4a4945c6209c6fff5fc9fce2d1ab3389105801ac745cd154864fe6
7
+ data.tar.gz: b345cd8d5410ddebb8f231bd6b2eff4982158c8950334a3adf3c63d466e1ea8e22bfcec8f8ff57e38c6a53dc95ff125dafcd7c2a764bfc386f614492e2d6cf7f
@@ -7,19 +7,17 @@ module Reactrb
7
7
  class_option :all, :type => :boolean
8
8
 
9
9
  def inject_react_file_js
10
- inject_into_file 'app/assets/javascripts/application.js', after: "// about supported directives.\n" do <<-'RUBY'
10
+ inject_into_file 'app/assets/javascripts/application.js', after: "// about supported directives.\n" do <<-'JS'
11
11
  //= require 'components'
12
+ //= require 'react'
12
13
  //= require 'react_ujs'
13
- RUBY
14
+ JS
14
15
  end
15
16
 
16
- if options[:"opal-jquery"] || options[:all]
17
- inject_into_file 'app/assets/javascripts/application.js', after: "//= require jquery_ujs\n" do <<-'RUBY'
18
- //= require 'opal-jquery'
19
- RUBY
20
- end
17
+ inject_into_file 'app/assets/javascripts/application.js', after: "//= require jquery_ujs\n" do <<-'JS'
18
+ Opal.load('components');
19
+ JS
21
20
  end
22
-
23
21
  end
24
22
 
25
23
  def inject_engine_to_routes
@@ -38,6 +36,13 @@ module Reactrb
38
36
  # app/react/components.rb
39
37
  require 'opal'
40
38
  require 'reactive-ruby'
39
+ if React::IsomorphicHelpers.on_opal_client?
40
+ require 'opal-jquery'
41
+ require 'browser'
42
+ require 'browser/interval'
43
+ require 'browser/delay'
44
+ # add any requires that can ONLY run on client here
45
+ end
41
46
  #{"require 'reactive-router'" if options[:"reactive-router"] || options[:all]}
42
47
  #{"require 'reactive-record'" if options[:"reactive-record"] || options[:all]}
43
48
  #{"require 'models'" if options[:"reactive-record"] || options[:all]}
@@ -54,7 +59,12 @@ require_tree './models'
54
59
 
55
60
  def add_config
56
61
  application "config.assets.paths << ::Rails.root.join('app', 'react').to_s"
62
+ application 'config.autoload_paths += %W(#{config.root}/app/react/components)'
57
63
  application 'config.autoload_paths += %W(#{config.root}/app/react/models)' if options[:"reactive-record"] || options[:all]
64
+ application 'config.eager_load_paths += %W(#{config.root}/app/react/components)'
65
+ application 'config.eager_load_paths += %W(#{config.root}/app/react/models)' if options[:"reactive-record"] || options[:all]
66
+ application 'config.watchable_files.concat Dir["#{config.root}/app/react/**/*.rb"]', env: :development
67
+ application 'config.react.variant = :development', env: :development
58
68
  end
59
69
 
60
70
  def add_gems
@@ -68,4 +78,4 @@ require_tree './models'
68
78
  gem 'reactive-record' if options[:"reactive-record"] || options[:all]
69
79
  end
70
80
  end
71
- end
81
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reactive_rails_generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Loic Boutet