hyper-rails 0.3.0 → 0.4.0
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/hyperloop/install_generator.rb +38 -22
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9283b7e105a7586095ee4d390814806e57d0cace
|
4
|
+
data.tar.gz: 8cd6a49c0af0f8e2ab7b2a93496f86d31bdb4914
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 592162996aaff48519514cc91ed0dbd77cdbe6696003b9c8e4b7fab8e73708b153ad268510d4ed49bec6be5067be8a91e85f9c9dbfb8404a163fe2d8af721809
|
7
|
+
data.tar.gz: 3813ecd460c9a8a34069d0eaafad764eb04b6d41e252d162067fe949633991250b5384bc9e03957f1e1ec5f83c9e0f48771d720eba341a47398e9547f74597b3
|
@@ -1,40 +1,56 @@
|
|
1
1
|
require 'rails/generators'
|
2
2
|
module Hyperloop
|
3
3
|
class InstallGenerator < Rails::Generators::Base
|
4
|
-
class_option :'
|
4
|
+
class_option :'hyper-mesh', type: :boolean
|
5
5
|
class_option :'opal-jquery', type: :boolean
|
6
|
-
class_option :'
|
6
|
+
class_option :'hyper-router', type: :boolean
|
7
7
|
class_option :all, type: :boolean
|
8
8
|
|
9
9
|
def inject_react_file_js
|
10
|
-
|
11
|
-
after: "// about supported directives.\n" do
|
10
|
+
prepend_file 'app/assets/javascripts/application.js' do
|
12
11
|
<<-'JS'
|
12
|
+
// added by hyper-rails: These lines must preceed other requires especially turbo_links
|
13
13
|
//= require 'components'
|
14
14
|
//= require 'react_ujs'
|
15
15
|
JS
|
16
16
|
end
|
17
|
-
|
18
|
-
after: "//= require jquery_ujs\n" do
|
19
|
-
<<-'JS'
|
20
|
-
Opal.load('components');
|
21
|
-
JS
|
22
|
-
end
|
17
|
+
append_file 'app/assets/javascripts/application.js', "Opal.load('components');\n"
|
23
18
|
end
|
24
19
|
|
25
20
|
def inject_engine_to_routes
|
26
|
-
if options[:'
|
27
|
-
route 'mount
|
21
|
+
if options[:'hyper-mesh'] || options[:all]
|
22
|
+
route 'mount HyperMesh::Engine => \'/rr\''
|
28
23
|
end
|
29
24
|
end
|
30
25
|
|
31
26
|
def create_components_directory
|
32
27
|
create_file 'app/views/components/.keep', ''
|
33
|
-
if options[:'
|
28
|
+
if options[:'hyper-mesh'] || options[:all]
|
34
29
|
create_file 'app/models/public/.keep', ''
|
35
30
|
end
|
36
31
|
end
|
37
32
|
|
33
|
+
def create_policies_directory
|
34
|
+
if options[:'hyper-mesh'] || options[:all]
|
35
|
+
create_file 'app/policies/application_policy.rb', <<-RUBY
|
36
|
+
# app/policies/application_policy
|
37
|
+
|
38
|
+
# Policies regulate access to your public models
|
39
|
+
# The following policy will open up full access (but only in development)
|
40
|
+
# The policy system is very flexible and powerful. See the documentation
|
41
|
+
# for complete details.
|
42
|
+
class ApplicationPolicy
|
43
|
+
# Allow any session to connect:
|
44
|
+
always_allow_connection
|
45
|
+
# Send all attributes from all public models
|
46
|
+
regulate_all_broadcasts { |policy| policy.send_all }
|
47
|
+
# Allow all changes to public models
|
48
|
+
allow_change(to: :all, on: [:create, :update, :destroy]) { true }
|
49
|
+
end if Rails.env.development?
|
50
|
+
RUBY
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
38
54
|
def create_manifests
|
39
55
|
create_file 'app/views/components.rb', <<-FILE
|
40
56
|
# app/views/components.rb
|
@@ -48,13 +64,13 @@ if React::IsomorphicHelpers.on_opal_client?
|
|
48
64
|
require 'browser/delay'
|
49
65
|
# add any additional requires that can ONLY run on client here
|
50
66
|
end
|
51
|
-
#{"require '
|
52
|
-
#{'require \'
|
53
|
-
#{'require \'models\'' if options[:'
|
67
|
+
#{"require 'hyper-router'\nrequire 'react_router'" if options[:'hyper-router'] || options[:all]}
|
68
|
+
#{'require \'hyper-mesh\'' if options[:'hyper-mesh'] || options[:all]}
|
69
|
+
#{'require \'models\'' if options[:'hyper-mesh'] || options[:all]}
|
54
70
|
require_tree './components'
|
55
71
|
FILE
|
56
72
|
|
57
|
-
if options[:'
|
73
|
+
if options[:'hyper-mesh'] || options[:all]
|
58
74
|
create_file 'app/models/models.rb', <<-FILE
|
59
75
|
# app/models/models.rb
|
60
76
|
require_tree './public'
|
@@ -65,11 +81,11 @@ require_tree './public'
|
|
65
81
|
def add_config
|
66
82
|
application 'config.assets.paths << ::Rails.root.join(\'app\', \'models\').to_s'
|
67
83
|
application 'config.autoload_paths += %W(#{config.root}/app/views/components)'
|
68
|
-
if options[:'
|
84
|
+
if options[:'hyper-mesh'] || options[:all]
|
69
85
|
application 'config.autoload_paths += %W(#{config.root}/app/models/public)'
|
70
86
|
end
|
71
87
|
application 'config.eager_load_paths += %W(#{config.root}/app/views/components)'
|
72
|
-
if options[:'
|
88
|
+
if options[:'hyper-mesh'] || options[:all]
|
73
89
|
application 'config.eager_load_paths += %W(#{config.root}/app/models/public)'
|
74
90
|
end
|
75
91
|
application 'config.watchable_files.concat Dir["#{config.root}/app/views/**/*.rb"]',
|
@@ -85,11 +101,11 @@ require_tree './public'
|
|
85
101
|
gem 'therubyracer', platforms: :ruby
|
86
102
|
|
87
103
|
# optional gems
|
88
|
-
if options[:'
|
104
|
+
if options[:'hyper-router'] || options[:all]
|
89
105
|
gem 'react-router-rails', '~> 0.13.3'
|
90
|
-
gem '
|
106
|
+
gem 'hyper-router'
|
91
107
|
end
|
92
|
-
gem '
|
108
|
+
gem 'hyper-mesh' if options[:'hyper-mesh'] || options[:all]
|
93
109
|
end
|
94
110
|
end
|
95
111
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hyper-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Loic Boutet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|