schienenzeppelin 0.1 → 0.2
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/.gitignore +2 -0
- data/.rubocop.yml +5 -1
- data/.tool-versions +1 -1
- data/CHANGELOG.md +1 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +78 -71
- data/TODO.md +37 -25
- data/lib/schienenzeppelin.rb +5 -2
- data/lib/schienenzeppelin/add_on.rb +68 -0
- data/lib/schienenzeppelin/{helpers → addons}/annotate.rb +4 -2
- data/lib/schienenzeppelin/{helpers → addons}/capistrano.rb +2 -2
- data/lib/schienenzeppelin/{helpers → addons}/continuous_integration.rb +2 -2
- data/lib/schienenzeppelin/{helpers → addons}/credentials.rb +2 -2
- data/lib/schienenzeppelin/{helpers → addons}/devise.rb +6 -3
- data/lib/schienenzeppelin/addons/docker.rb +12 -0
- data/lib/schienenzeppelin/addons/docker_compose.rb +11 -0
- data/lib/schienenzeppelin/addons/dotenv.rb +11 -0
- data/lib/schienenzeppelin/{helpers → addons}/errors.rb +5 -2
- data/lib/schienenzeppelin/{helpers → addons}/factory_bot.rb +6 -2
- data/lib/schienenzeppelin/addons/foreman.rb +13 -0
- data/lib/schienenzeppelin/addons/generators.rb +30 -0
- data/lib/schienenzeppelin/{helpers → addons}/high_voltage.rb +4 -2
- data/lib/schienenzeppelin/addons/inline_svg.rb +9 -0
- data/lib/schienenzeppelin/{helpers/scaffold.rb → addons/irbrc.rb} +3 -3
- data/lib/schienenzeppelin/addons/jb.rb +9 -0
- data/lib/schienenzeppelin/{helpers/hotwire.rb → addons/lograge.rb} +3 -3
- data/lib/schienenzeppelin/addons/oj.rb +9 -0
- data/lib/schienenzeppelin/{helpers → addons}/pundit.rb +2 -2
- data/lib/schienenzeppelin/{helpers → addons}/rspec.rb +4 -2
- data/lib/schienenzeppelin/{helpers → addons}/rubocop.rb +2 -2
- data/lib/schienenzeppelin/addons/ruby_version.rb +11 -0
- data/lib/schienenzeppelin/addons/scaffold.rb +13 -0
- data/lib/schienenzeppelin/{helpers → addons}/services.rb +2 -2
- data/lib/schienenzeppelin/addons/shoulda.rb +13 -0
- data/lib/schienenzeppelin/{helpers → addons}/sidekiq.rb +3 -4
- data/lib/schienenzeppelin/{helpers → addons}/stimulus.rb +4 -2
- data/lib/schienenzeppelin/{helpers → addons}/stimulus_components.rb +4 -2
- data/lib/schienenzeppelin/{helpers → addons}/tailwind.rb +4 -2
- data/lib/schienenzeppelin/{helpers/home.rb → addons/views.rb} +5 -3
- data/lib/schienenzeppelin/app_builder.rb +2 -50
- data/lib/schienenzeppelin/app_generator.rb +53 -61
- data/lib/schienenzeppelin/context.rb +26 -0
- data/lib/schienenzeppelin/dependencies.rb +33 -0
- data/lib/schienenzeppelin/generator_utils.rb +77 -0
- data/lib/schienenzeppelin/version.rb +2 -2
- data/schienenzeppelin.gemspec +0 -1
- data/templates/.irbrc.erb +2 -2
- data/templates/Dockerfile.erb +1 -1
- data/templates/Gemfile.erb +39 -10
- data/templates/Procfile.dev.erb +5 -1
- data/templates/Procfile.erb +2 -0
- data/templates/app/views/shared/_navbar.html.erb.tt +19 -4
- data/templates/app/workers/application_worker.rb +5 -0
- data/templates/docker-compose.yml.erb +2 -2
- data/templates/spec/rails_helper.rb +1 -1
- metadata +41 -27
- data/.rspec_status +0 -3
- data/lib/schienenzeppelin/helper_base.rb +0 -28
- data/lib/schienenzeppelin/helpers/generators.rb +0 -26
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ee71ebdb69f1db2ac35da5916949e0a712630861a068fc1b737a8d0e0d4cd045
|
|
4
|
+
data.tar.gz: 2cf011f2ed4d0ba7e9b172bf33fbcda4b2217b46058e4cb5ef8867f1a9a94ad5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d50a1100d4d4467fc4e7ef03151a7fb2346d010b65782e209abaf6c3d5c3a40de8141ffe0c7d55fd2d2a31c8cecc8a408b6fab4b2ed2345bc2193d55c6e6213c
|
|
7
|
+
data.tar.gz: 3f497b097a977ebdc12caa3c2ac5b68f9fc7b6674c081a897099eaa4774b398da372dd9901d1dcf741a0a7010484421db0165dc48c7b800a11ca6c7d860309d5
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
|
@@ -5,9 +5,13 @@ AllCops:
|
|
|
5
5
|
Naming/AccessorMethodName:
|
|
6
6
|
Enabled: false
|
|
7
7
|
|
|
8
|
+
Metrics/ClassLength:
|
|
9
|
+
Max: 300
|
|
10
|
+
|
|
8
11
|
Metrics/MethodLength:
|
|
9
12
|
CountAsOne: ['array', 'heredoc']
|
|
10
13
|
IgnoredMethods: ['describe', 'context']
|
|
14
|
+
Max: 20
|
|
11
15
|
|
|
12
16
|
Metrics/BlockLength:
|
|
13
17
|
IgnoredMethods: ['describe', 'context']
|
|
@@ -17,7 +21,7 @@ Layout/LineLength:
|
|
|
17
21
|
Max: 120
|
|
18
22
|
|
|
19
23
|
Layout/MultilineMethodCallIndentation:
|
|
20
|
-
EnforcedStyle:
|
|
24
|
+
EnforcedStyle: indented_relative_to_receiver
|
|
21
25
|
|
|
22
26
|
Style/BlockDelimiters:
|
|
23
27
|
Exclude:
|
data/.tool-versions
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
ruby
|
|
1
|
+
ruby 3.0.0
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,72 +1,73 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
schienenzeppelin (0.
|
|
5
|
-
rails (~> 6.1.
|
|
4
|
+
schienenzeppelin (0.2)
|
|
5
|
+
rails (~> 6.1.3)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: https://rubygems.org/
|
|
9
9
|
specs:
|
|
10
|
-
actioncable (6.1.
|
|
11
|
-
actionpack (= 6.1.
|
|
12
|
-
activesupport (= 6.1.
|
|
10
|
+
actioncable (6.1.3.1)
|
|
11
|
+
actionpack (= 6.1.3.1)
|
|
12
|
+
activesupport (= 6.1.3.1)
|
|
13
13
|
nio4r (~> 2.0)
|
|
14
14
|
websocket-driver (>= 0.6.1)
|
|
15
|
-
actionmailbox (6.1.
|
|
16
|
-
actionpack (= 6.1.
|
|
17
|
-
activejob (= 6.1.
|
|
18
|
-
activerecord (= 6.1.
|
|
19
|
-
activestorage (= 6.1.
|
|
20
|
-
activesupport (= 6.1.
|
|
15
|
+
actionmailbox (6.1.3.1)
|
|
16
|
+
actionpack (= 6.1.3.1)
|
|
17
|
+
activejob (= 6.1.3.1)
|
|
18
|
+
activerecord (= 6.1.3.1)
|
|
19
|
+
activestorage (= 6.1.3.1)
|
|
20
|
+
activesupport (= 6.1.3.1)
|
|
21
21
|
mail (>= 2.7.1)
|
|
22
|
-
actionmailer (6.1.
|
|
23
|
-
actionpack (= 6.1.
|
|
24
|
-
actionview (= 6.1.
|
|
25
|
-
activejob (= 6.1.
|
|
26
|
-
activesupport (= 6.1.
|
|
22
|
+
actionmailer (6.1.3.1)
|
|
23
|
+
actionpack (= 6.1.3.1)
|
|
24
|
+
actionview (= 6.1.3.1)
|
|
25
|
+
activejob (= 6.1.3.1)
|
|
26
|
+
activesupport (= 6.1.3.1)
|
|
27
27
|
mail (~> 2.5, >= 2.5.4)
|
|
28
28
|
rails-dom-testing (~> 2.0)
|
|
29
|
-
actionpack (6.1.
|
|
30
|
-
actionview (= 6.1.
|
|
31
|
-
activesupport (= 6.1.
|
|
29
|
+
actionpack (6.1.3.1)
|
|
30
|
+
actionview (= 6.1.3.1)
|
|
31
|
+
activesupport (= 6.1.3.1)
|
|
32
32
|
rack (~> 2.0, >= 2.0.9)
|
|
33
33
|
rack-test (>= 0.6.3)
|
|
34
34
|
rails-dom-testing (~> 2.0)
|
|
35
35
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
|
36
|
-
actiontext (6.1.
|
|
37
|
-
actionpack (= 6.1.
|
|
38
|
-
activerecord (= 6.1.
|
|
39
|
-
activestorage (= 6.1.
|
|
40
|
-
activesupport (= 6.1.
|
|
36
|
+
actiontext (6.1.3.1)
|
|
37
|
+
actionpack (= 6.1.3.1)
|
|
38
|
+
activerecord (= 6.1.3.1)
|
|
39
|
+
activestorage (= 6.1.3.1)
|
|
40
|
+
activesupport (= 6.1.3.1)
|
|
41
41
|
nokogiri (>= 1.8.5)
|
|
42
|
-
actionview (6.1.
|
|
43
|
-
activesupport (= 6.1.
|
|
42
|
+
actionview (6.1.3.1)
|
|
43
|
+
activesupport (= 6.1.3.1)
|
|
44
44
|
builder (~> 3.1)
|
|
45
45
|
erubi (~> 1.4)
|
|
46
46
|
rails-dom-testing (~> 2.0)
|
|
47
47
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
|
48
|
-
activejob (6.1.
|
|
49
|
-
activesupport (= 6.1.
|
|
48
|
+
activejob (6.1.3.1)
|
|
49
|
+
activesupport (= 6.1.3.1)
|
|
50
50
|
globalid (>= 0.3.6)
|
|
51
|
-
activemodel (6.1.
|
|
52
|
-
activesupport (= 6.1.
|
|
53
|
-
activerecord (6.1.
|
|
54
|
-
activemodel (= 6.1.
|
|
55
|
-
activesupport (= 6.1.
|
|
56
|
-
activestorage (6.1.
|
|
57
|
-
actionpack (= 6.1.
|
|
58
|
-
activejob (= 6.1.
|
|
59
|
-
activerecord (= 6.1.
|
|
60
|
-
activesupport (= 6.1.
|
|
61
|
-
marcel (~> 0.
|
|
62
|
-
|
|
63
|
-
activesupport (6.1.
|
|
51
|
+
activemodel (6.1.3.1)
|
|
52
|
+
activesupport (= 6.1.3.1)
|
|
53
|
+
activerecord (6.1.3.1)
|
|
54
|
+
activemodel (= 6.1.3.1)
|
|
55
|
+
activesupport (= 6.1.3.1)
|
|
56
|
+
activestorage (6.1.3.1)
|
|
57
|
+
actionpack (= 6.1.3.1)
|
|
58
|
+
activejob (= 6.1.3.1)
|
|
59
|
+
activerecord (= 6.1.3.1)
|
|
60
|
+
activesupport (= 6.1.3.1)
|
|
61
|
+
marcel (~> 1.0.0)
|
|
62
|
+
mini_mime (~> 1.0.2)
|
|
63
|
+
activesupport (6.1.3.1)
|
|
64
64
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
65
65
|
i18n (>= 1.6, < 2)
|
|
66
66
|
minitest (>= 5.1)
|
|
67
67
|
tzinfo (~> 2.0)
|
|
68
68
|
zeitwerk (~> 2.3)
|
|
69
69
|
ast (2.4.2)
|
|
70
|
+
attr_extras (6.2.4)
|
|
70
71
|
builder (3.2.4)
|
|
71
72
|
concurrent-ruby (1.1.8)
|
|
72
73
|
crass (1.0.6)
|
|
@@ -74,58 +75,59 @@ GEM
|
|
|
74
75
|
erubi (1.10.0)
|
|
75
76
|
globalid (0.4.2)
|
|
76
77
|
activesupport (>= 4.2.0)
|
|
77
|
-
i18n (1.8.
|
|
78
|
+
i18n (1.8.10)
|
|
78
79
|
concurrent-ruby (~> 1.0)
|
|
79
|
-
loofah (2.9.
|
|
80
|
+
loofah (2.9.1)
|
|
80
81
|
crass (~> 1.0.2)
|
|
81
82
|
nokogiri (>= 1.5.9)
|
|
82
83
|
mail (2.7.1)
|
|
83
84
|
mini_mime (>= 0.1.1)
|
|
84
|
-
marcel (0.
|
|
85
|
-
mimemagic (~> 0.3.2)
|
|
85
|
+
marcel (1.0.1)
|
|
86
86
|
method_source (1.0.0)
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
nokogiri (1.11.1-x86_64-linux)
|
|
87
|
+
mini_mime (1.0.3)
|
|
88
|
+
minitest (5.14.4)
|
|
89
|
+
nio4r (2.5.7)
|
|
90
|
+
nokogiri (1.11.3-x86_64-linux)
|
|
92
91
|
racc (~> 1.4)
|
|
92
|
+
optimist (3.0.1)
|
|
93
93
|
parallel (1.20.1)
|
|
94
94
|
parser (3.0.0.0)
|
|
95
95
|
ast (~> 2.4.1)
|
|
96
|
+
patience_diff (1.2.0)
|
|
97
|
+
optimist (~> 3.0)
|
|
96
98
|
racc (1.5.2)
|
|
97
99
|
rack (2.2.3)
|
|
98
100
|
rack-test (1.1.0)
|
|
99
101
|
rack (>= 1.0, < 3)
|
|
100
|
-
rails (6.1.
|
|
101
|
-
actioncable (= 6.1.
|
|
102
|
-
actionmailbox (= 6.1.
|
|
103
|
-
actionmailer (= 6.1.
|
|
104
|
-
actionpack (= 6.1.
|
|
105
|
-
actiontext (= 6.1.
|
|
106
|
-
actionview (= 6.1.
|
|
107
|
-
activejob (= 6.1.
|
|
108
|
-
activemodel (= 6.1.
|
|
109
|
-
activerecord (= 6.1.
|
|
110
|
-
activestorage (= 6.1.
|
|
111
|
-
activesupport (= 6.1.
|
|
102
|
+
rails (6.1.3.1)
|
|
103
|
+
actioncable (= 6.1.3.1)
|
|
104
|
+
actionmailbox (= 6.1.3.1)
|
|
105
|
+
actionmailer (= 6.1.3.1)
|
|
106
|
+
actionpack (= 6.1.3.1)
|
|
107
|
+
actiontext (= 6.1.3.1)
|
|
108
|
+
actionview (= 6.1.3.1)
|
|
109
|
+
activejob (= 6.1.3.1)
|
|
110
|
+
activemodel (= 6.1.3.1)
|
|
111
|
+
activerecord (= 6.1.3.1)
|
|
112
|
+
activestorage (= 6.1.3.1)
|
|
113
|
+
activesupport (= 6.1.3.1)
|
|
112
114
|
bundler (>= 1.15.0)
|
|
113
|
-
railties (= 6.1.
|
|
115
|
+
railties (= 6.1.3.1)
|
|
114
116
|
sprockets-rails (>= 2.0.0)
|
|
115
117
|
rails-dom-testing (2.0.3)
|
|
116
118
|
activesupport (>= 4.2.0)
|
|
117
119
|
nokogiri (>= 1.6)
|
|
118
120
|
rails-html-sanitizer (1.3.0)
|
|
119
121
|
loofah (~> 2.3)
|
|
120
|
-
railties (6.1.
|
|
121
|
-
actionpack (= 6.1.
|
|
122
|
-
activesupport (= 6.1.
|
|
122
|
+
railties (6.1.3.1)
|
|
123
|
+
actionpack (= 6.1.3.1)
|
|
124
|
+
activesupport (= 6.1.3.1)
|
|
123
125
|
method_source
|
|
124
126
|
rake (>= 0.8.7)
|
|
125
127
|
thor (~> 1.0)
|
|
126
128
|
rainbow (3.0.0)
|
|
127
129
|
rake (13.0.3)
|
|
128
|
-
regexp_parser (2.
|
|
130
|
+
regexp_parser (2.1.1)
|
|
129
131
|
rexml (3.2.4)
|
|
130
132
|
rspec (3.10.0)
|
|
131
133
|
rspec-core (~> 3.10.0)
|
|
@@ -136,11 +138,11 @@ GEM
|
|
|
136
138
|
rspec-expectations (3.10.1)
|
|
137
139
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
138
140
|
rspec-support (~> 3.10.0)
|
|
139
|
-
rspec-mocks (3.10.
|
|
141
|
+
rspec-mocks (3.10.2)
|
|
140
142
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
141
143
|
rspec-support (~> 3.10.0)
|
|
142
|
-
rspec-support (3.10.
|
|
143
|
-
rubocop (1.
|
|
144
|
+
rspec-support (3.10.2)
|
|
145
|
+
rubocop (1.11.0)
|
|
144
146
|
parallel (~> 1.10)
|
|
145
147
|
parser (>= 3.0.0.0)
|
|
146
148
|
rainbow (>= 2.2.2, < 4.0)
|
|
@@ -161,6 +163,10 @@ GEM
|
|
|
161
163
|
actionpack (>= 4.0)
|
|
162
164
|
activesupport (>= 4.0)
|
|
163
165
|
sprockets (>= 3.0.0)
|
|
166
|
+
super_diff (0.6.1)
|
|
167
|
+
attr_extras (>= 6.2.4)
|
|
168
|
+
diff-lcs
|
|
169
|
+
patience_diff
|
|
164
170
|
thor (1.1.0)
|
|
165
171
|
tzinfo (2.0.4)
|
|
166
172
|
concurrent-ruby (~> 1.0)
|
|
@@ -179,6 +185,7 @@ DEPENDENCIES
|
|
|
179
185
|
rubocop (~> 1.9)
|
|
180
186
|
rubocop-rspec (~> 1.40)
|
|
181
187
|
schienenzeppelin!
|
|
188
|
+
super_diff
|
|
182
189
|
|
|
183
190
|
BUNDLED WITH
|
|
184
|
-
2.2.
|
|
191
|
+
2.2.14
|
data/TODO.md
CHANGED
|
@@ -1,32 +1,44 @@
|
|
|
1
|
-
|
|
2
1
|
# TODO
|
|
3
2
|
|
|
4
|
-
##
|
|
5
|
-
- Schienenzeppelin Repo CI (notify gem releases, tests)
|
|
6
|
-
- Loads of testing
|
|
7
|
-
- Hide generators and scaffolds in sz gem, don't copy as templates. See JB, use railtie
|
|
3
|
+
## Next up
|
|
8
4
|
|
|
9
|
-
|
|
10
|
-
-
|
|
5
|
+
- Dependency management for options e.g.
|
|
6
|
+
- Testing framework
|
|
7
|
+
- Deployment framework
|
|
8
|
+
- Background processing
|
|
11
9
|
- Take advantage of saved config (as rails new does)
|
|
12
|
-
- Licensing?
|
|
13
|
-
- Homepage & Newsletter
|
|
14
|
-
- Goodies for Business:
|
|
15
|
-
- Admin pages
|
|
16
|
-
- Social Logins
|
|
17
|
-
- Cloud Storage ?
|
|
18
|
-
- Payments
|
|
19
|
-
- Monitoring (Skylight, ...)
|
|
20
|
-
- Email Providers (Mailgun, ...)
|
|
21
|
-
- Reporting (Bugsnag, ...)
|
|
22
|
-
- Dockerfile
|
|
23
|
-
- https://dev.to/citronak/modern-rails-flash-messages-part-1-viewcomponent-stimulus-tailwind-css-3alm
|
|
24
|
-
- Configuration wizard via command line
|
|
25
|
-
- Alternative configurations:
|
|
26
|
-
- Differernt DB
|
|
27
|
-
- Different BG Jobs
|
|
28
|
-
- Different Deployment
|
|
29
|
-
|
|
30
10
|
- Additional Gems:
|
|
31
11
|
- Pagy
|
|
12
|
+
|
|
13
|
+
- More dependency stuff:
|
|
14
|
+
- Adapt test command in CI
|
|
15
|
+
- Adapt capfile for skips (sidekiq)
|
|
16
|
+
- Adapt docker-compose for skips (database, webpack...)
|
|
17
|
+
- Adapt dockerfile & entrypoint for skips (database, webpack...)
|
|
18
|
+
- Adapt dotenv for skips (database)
|
|
19
|
+
- Adapt setup for skips (database, sidekiq...)
|
|
20
|
+
|
|
21
|
+
## Future
|
|
22
|
+
|
|
23
|
+
- Proper Icon
|
|
24
|
+
- Homepage & Newsletter & Docs
|
|
25
|
+
|
|
26
|
+
## Far Future
|
|
27
|
+
|
|
28
|
+
- Licensing?
|
|
29
|
+
- Goodies for Business:
|
|
30
|
+
- Admin pages
|
|
31
|
+
- Social Logins
|
|
32
|
+
- Cloud Storage ?
|
|
33
|
+
- Payments
|
|
34
|
+
- Monitoring (Skylight, ...)
|
|
35
|
+
- Email Providers (Mailgun, ...)
|
|
36
|
+
- Reporting (Bugsnag, ...)
|
|
37
|
+
- Dockerfile
|
|
38
|
+
- https://dev.to/citronak/modern-rails-flash-messages-part-1-viewcomponent-stimulus-tailwind-css-3alm
|
|
39
|
+
- Configuration wizard via command line
|
|
40
|
+
- Alternative configurations:
|
|
41
|
+
- Differernt DB
|
|
42
|
+
- Different BG Jobs
|
|
43
|
+
- Different Deployment
|
|
32
44
|
- Ansible repo setup if deploy is Capistrano
|
data/lib/schienenzeppelin.rb
CHANGED
|
@@ -8,8 +8,11 @@ require 'rails/generators/rails/app/app_generator'
|
|
|
8
8
|
require 'bundler'
|
|
9
9
|
|
|
10
10
|
require_relative 'schienenzeppelin/version'
|
|
11
|
-
require_relative 'schienenzeppelin/
|
|
12
|
-
|
|
11
|
+
require_relative 'schienenzeppelin/context'
|
|
12
|
+
require_relative 'schienenzeppelin/dependencies'
|
|
13
|
+
require_relative 'schienenzeppelin/add_on'
|
|
14
|
+
Dir[File.join(__dir__, 'schienenzeppelin', 'addons', '*.rb')].each { |file| require file }
|
|
15
|
+
require_relative 'schienenzeppelin/generator_utils'
|
|
13
16
|
require_relative 'schienenzeppelin/app_generator'
|
|
14
17
|
require_relative 'schienenzeppelin/app_builder'
|
|
15
18
|
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Schienenzeppelin
|
|
4
|
+
class AddOn < Rails::Generators::Base
|
|
5
|
+
include Thor::Actions
|
|
6
|
+
include Rails::Generators::Actions
|
|
7
|
+
include Rails::Generators::AppName
|
|
8
|
+
|
|
9
|
+
attr_reader :dependencies, :context
|
|
10
|
+
|
|
11
|
+
def initialize(context)
|
|
12
|
+
super
|
|
13
|
+
@context = context
|
|
14
|
+
@dependencies = self.class.dependencies || []
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def apply; end
|
|
18
|
+
|
|
19
|
+
no_commands do
|
|
20
|
+
def options
|
|
21
|
+
@context.options
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def uses?(identifier = nil)
|
|
25
|
+
identifier ||= self.class.identifier
|
|
26
|
+
options = @context.options
|
|
27
|
+
return false if options["skip_#{identifier}".to_sym]
|
|
28
|
+
|
|
29
|
+
return true if @context.default_addons.include?(identifier)
|
|
30
|
+
|
|
31
|
+
clazz = identifier.nil? ? self.class : self.class.get(identifier)
|
|
32
|
+
Dependencies.new(clazz, @context).satisfied?
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
class << self
|
|
37
|
+
def default_source_root
|
|
38
|
+
File.expand_path(File.join('..', '..', 'templates'), __dir__)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def apply(context = Context.new({}))
|
|
42
|
+
instance = new(context)
|
|
43
|
+
return unless instance.uses?
|
|
44
|
+
|
|
45
|
+
instance.apply
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def get(addon)
|
|
49
|
+
addon = addon.to_s.capitalize.camelize
|
|
50
|
+
"Schienenzeppelin::AddOns::#{addon}".constantize
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def identifier
|
|
54
|
+
name.demodulize.underscore.to_sym
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def dependencies
|
|
58
|
+
@dependencies ||= []
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
protected
|
|
62
|
+
|
|
63
|
+
def depends_on(*addon)
|
|
64
|
+
@dependencies = addon.map(&:to_sym)
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Schienenzeppelin
|
|
4
|
-
module
|
|
5
|
-
class Annotate <
|
|
4
|
+
module AddOns
|
|
5
|
+
class Annotate < AddOn
|
|
6
|
+
depends_on :active_record
|
|
7
|
+
|
|
6
8
|
def apply
|
|
7
9
|
template('lib/tasks/auto_annotate_models.rake', force: true)
|
|
8
10
|
end
|