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 +4 -4
- data/lib/generators/reactrb/install_generator.rb +19 -9
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 261804c681fdc92a75b361581d50b3dc8c1f5e3a
|
4
|
+
data.tar.gz: f5b6ba12186b4682a3289e98c683b3752e840bb5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 <<-'
|
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
|
-
|
14
|
+
JS
|
14
15
|
end
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
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
|