philosophies-suspenders 2.2.2 → 2.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.ruby-version +1 -1
- data/Gemfile.lock +79 -70
- data/README.md +53 -4
- data/lib/suspenders/app_builder.rb +56 -16
- data/lib/suspenders/generators/app_generator.rb +27 -6
- data/lib/suspenders/version.rb +2 -2
- data/templates/.env.example +2 -0
- data/templates/.overcommit.yml +10 -0
- data/templates/.rubocop.yml +9 -0
- data/templates/Gemfile.erb +2 -8
- data/templates/PULL_REQUEST_TEMPLATE.md.erb +4 -1
- data/templates/README.md.erb +5 -2
- data/templates/application.js +1 -2
- data/templates/rails_helper.rb +8 -1
- data/templates/setup.rb +32 -4
- data/templates/suspenders_gitignore +4 -0
- metadata +8 -7
- data/templates/factory_girl_rspec.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6145015cc7cf247da559b6698ea96b82f587872c71d4d5cc52a8bf3d7b259b02
|
4
|
+
data.tar.gz: d71686dcbb08fca7f4a11a1dc7754af80ac39c5bd35eb9cc7491f47d4b84cfc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 465e8ee43f554f3ecd4fe26495c2103ed1154cf8190915882935880e1211577122e4c5ad641416b72729d953346a735fdf779c907090f7f44cdebf0d63c751a2
|
7
|
+
data.tar.gz: 0bafe8476435b1b28f3e2fe4a157fc96bd66d47675794b4344415426bff7cb45dddc92841566e6e059ed0d97226b7171d1af57ab21bec2fad96c8e8399cacbca
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.5.1
|
data/Gemfile.lock
CHANGED
@@ -1,75 +1,83 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
philosophies-suspenders (2.2.
|
4
|
+
philosophies-suspenders (2.2.3)
|
5
5
|
bundler (~> 1.3)
|
6
|
-
rails (~> 5.
|
6
|
+
rails (~> 5.2.1)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
actioncable (5.
|
12
|
-
actionpack (= 5.
|
13
|
-
nio4r (
|
14
|
-
websocket-driver (
|
15
|
-
actionmailer (5.
|
16
|
-
actionpack (= 5.
|
17
|
-
actionview (= 5.
|
18
|
-
activejob (= 5.
|
11
|
+
actioncable (5.2.1)
|
12
|
+
actionpack (= 5.2.1)
|
13
|
+
nio4r (~> 2.0)
|
14
|
+
websocket-driver (>= 0.6.1)
|
15
|
+
actionmailer (5.2.1)
|
16
|
+
actionpack (= 5.2.1)
|
17
|
+
actionview (= 5.2.1)
|
18
|
+
activejob (= 5.2.1)
|
19
19
|
mail (~> 2.5, >= 2.5.4)
|
20
20
|
rails-dom-testing (~> 2.0)
|
21
|
-
actionpack (5.
|
22
|
-
actionview (= 5.
|
23
|
-
activesupport (= 5.
|
21
|
+
actionpack (5.2.1)
|
22
|
+
actionview (= 5.2.1)
|
23
|
+
activesupport (= 5.2.1)
|
24
24
|
rack (~> 2.0)
|
25
|
-
rack-test (
|
25
|
+
rack-test (>= 0.6.3)
|
26
26
|
rails-dom-testing (~> 2.0)
|
27
27
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
28
|
-
actionview (5.
|
29
|
-
activesupport (= 5.
|
28
|
+
actionview (5.2.1)
|
29
|
+
activesupport (= 5.2.1)
|
30
30
|
builder (~> 3.1)
|
31
|
-
|
31
|
+
erubi (~> 1.4)
|
32
32
|
rails-dom-testing (~> 2.0)
|
33
33
|
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
34
|
-
activejob (5.
|
35
|
-
activesupport (= 5.
|
34
|
+
activejob (5.2.1)
|
35
|
+
activesupport (= 5.2.1)
|
36
36
|
globalid (>= 0.3.6)
|
37
|
-
activemodel (5.
|
38
|
-
activesupport (= 5.
|
39
|
-
activerecord (5.
|
40
|
-
activemodel (= 5.
|
41
|
-
activesupport (= 5.
|
42
|
-
arel (
|
43
|
-
|
37
|
+
activemodel (5.2.1)
|
38
|
+
activesupport (= 5.2.1)
|
39
|
+
activerecord (5.2.1)
|
40
|
+
activemodel (= 5.2.1)
|
41
|
+
activesupport (= 5.2.1)
|
42
|
+
arel (>= 9.0)
|
43
|
+
activestorage (5.2.1)
|
44
|
+
actionpack (= 5.2.1)
|
45
|
+
activerecord (= 5.2.1)
|
46
|
+
marcel (~> 0.3.1)
|
47
|
+
activesupport (5.2.1)
|
44
48
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
45
|
-
i18n (
|
49
|
+
i18n (>= 0.7, < 2)
|
46
50
|
minitest (~> 5.1)
|
47
51
|
tzinfo (~> 1.1)
|
48
|
-
arel (
|
52
|
+
arel (9.0.0)
|
49
53
|
builder (3.2.3)
|
50
54
|
byebug (4.0.5)
|
51
55
|
columnize (= 0.9.0)
|
52
56
|
coderay (1.1.0)
|
53
57
|
columnize (0.9.0)
|
54
58
|
concurrent-ruby (1.0.5)
|
59
|
+
crass (1.0.4)
|
55
60
|
diff-lcs (1.3)
|
56
|
-
|
57
|
-
globalid (0.4.
|
61
|
+
erubi (1.7.1)
|
62
|
+
globalid (0.4.1)
|
58
63
|
activesupport (>= 4.2.0)
|
59
|
-
i18n (
|
60
|
-
|
64
|
+
i18n (1.1.0)
|
65
|
+
concurrent-ruby (~> 1.0)
|
66
|
+
loofah (2.2.2)
|
67
|
+
crass (~> 1.0.2)
|
61
68
|
nokogiri (>= 1.5.9)
|
62
|
-
mail (2.
|
63
|
-
|
69
|
+
mail (2.7.0)
|
70
|
+
mini_mime (>= 0.1.1)
|
71
|
+
marcel (0.3.2)
|
72
|
+
mimemagic (~> 0.3.2)
|
64
73
|
method_source (0.8.2)
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
mini_portile2 (~> 2.2.0)
|
74
|
+
mimemagic (0.3.2)
|
75
|
+
mini_mime (1.0.0)
|
76
|
+
mini_portile2 (2.3.0)
|
77
|
+
minitest (5.11.3)
|
78
|
+
nio4r (2.3.1)
|
79
|
+
nokogiri (1.8.4)
|
80
|
+
mini_portile2 (~> 2.3.0)
|
73
81
|
pry (0.10.1)
|
74
82
|
coderay (~> 1.1.0)
|
75
83
|
method_source (~> 0.8.1)
|
@@ -77,33 +85,34 @@ GEM
|
|
77
85
|
pry-byebug (3.1.0)
|
78
86
|
byebug (~> 4.0)
|
79
87
|
pry (~> 0.10)
|
80
|
-
rack (2.0.
|
81
|
-
rack-test (
|
82
|
-
rack (>= 1.0)
|
83
|
-
rails (5.
|
84
|
-
actioncable (= 5.
|
85
|
-
actionmailer (= 5.
|
86
|
-
actionpack (= 5.
|
87
|
-
actionview (= 5.
|
88
|
-
activejob (= 5.
|
89
|
-
activemodel (= 5.
|
90
|
-
activerecord (= 5.
|
91
|
-
|
92
|
-
|
93
|
-
|
88
|
+
rack (2.0.5)
|
89
|
+
rack-test (1.1.0)
|
90
|
+
rack (>= 1.0, < 3)
|
91
|
+
rails (5.2.1)
|
92
|
+
actioncable (= 5.2.1)
|
93
|
+
actionmailer (= 5.2.1)
|
94
|
+
actionpack (= 5.2.1)
|
95
|
+
actionview (= 5.2.1)
|
96
|
+
activejob (= 5.2.1)
|
97
|
+
activemodel (= 5.2.1)
|
98
|
+
activerecord (= 5.2.1)
|
99
|
+
activestorage (= 5.2.1)
|
100
|
+
activesupport (= 5.2.1)
|
101
|
+
bundler (>= 1.3.0)
|
102
|
+
railties (= 5.2.1)
|
94
103
|
sprockets-rails (>= 2.0.0)
|
95
104
|
rails-dom-testing (2.0.3)
|
96
105
|
activesupport (>= 4.2.0)
|
97
106
|
nokogiri (>= 1.6)
|
98
|
-
rails-html-sanitizer (1.0.
|
99
|
-
loofah (~> 2.
|
100
|
-
railties (5.
|
101
|
-
actionpack (= 5.
|
102
|
-
activesupport (= 5.
|
107
|
+
rails-html-sanitizer (1.0.4)
|
108
|
+
loofah (~> 2.2, >= 2.2.2)
|
109
|
+
railties (5.2.1)
|
110
|
+
actionpack (= 5.2.1)
|
111
|
+
activesupport (= 5.2.1)
|
103
112
|
method_source
|
104
113
|
rake (>= 0.8.7)
|
105
|
-
thor (>= 0.
|
106
|
-
rake (12.
|
114
|
+
thor (>= 0.19.0, < 2.0)
|
115
|
+
rake (12.3.1)
|
107
116
|
rspec (3.6.0)
|
108
117
|
rspec-core (~> 3.6.0)
|
109
118
|
rspec-expectations (~> 3.6.0)
|
@@ -118,20 +127,20 @@ GEM
|
|
118
127
|
rspec-support (~> 3.6.0)
|
119
128
|
rspec-support (3.6.0)
|
120
129
|
slop (3.6.0)
|
121
|
-
sprockets (3.7.
|
130
|
+
sprockets (3.7.2)
|
122
131
|
concurrent-ruby (~> 1.0)
|
123
132
|
rack (> 1, < 3)
|
124
|
-
sprockets-rails (3.2.
|
133
|
+
sprockets-rails (3.2.1)
|
125
134
|
actionpack (>= 4.0)
|
126
135
|
activesupport (>= 4.0)
|
127
136
|
sprockets (>= 3.0.0)
|
128
|
-
thor (0.
|
137
|
+
thor (0.20.0)
|
129
138
|
thread_safe (0.3.6)
|
130
|
-
tzinfo (1.2.
|
139
|
+
tzinfo (1.2.5)
|
131
140
|
thread_safe (~> 0.1)
|
132
|
-
websocket-driver (0.
|
141
|
+
websocket-driver (0.7.0)
|
133
142
|
websocket-extensions (>= 0.1.0)
|
134
|
-
websocket-extensions (0.1.
|
143
|
+
websocket-extensions (0.1.3)
|
135
144
|
|
136
145
|
PLATFORMS
|
137
146
|
ruby
|
@@ -143,4 +152,4 @@ DEPENDENCIES
|
|
143
152
|
rspec (~> 3.6)
|
144
153
|
|
145
154
|
BUNDLED WITH
|
146
|
-
1.
|
155
|
+
1.16.2
|
data/README.md
CHANGED
@@ -88,7 +88,6 @@ And testing gems like:
|
|
88
88
|
|
89
89
|
Suspenders also comes with:
|
90
90
|
|
91
|
-
* [Stairs][stairs] for new developer setup
|
92
91
|
* Rails' flashes set up and in application layout
|
93
92
|
* A few nice time formats set up for localization
|
94
93
|
* `Rack::Deflater` to [compress responses with Gzip][compress]
|
@@ -99,14 +98,20 @@ Suspenders also comes with:
|
|
99
98
|
environments
|
100
99
|
* The analytics adapter [Segment][segment] (and therefore config for Google
|
101
100
|
Analytics, Intercom, Facebook Ads, Twitter Ads, etc.)
|
101
|
+
* Webpacker (optional)
|
102
102
|
|
103
|
-
[stairs]: https://github.com/philosophie/stairs
|
104
103
|
[compress]: http://robots.thoughtbot.com/content-compression-with-rack-deflater/
|
105
104
|
[pool]: https://devcenter.heroku.com/articles/concurrency-and-database-connections
|
106
105
|
[binstub]: https://github.com/thoughtbot/suspenders/pull/282
|
107
106
|
[i18n]: https://github.com/thoughtbot/suspenders/pull/304
|
108
107
|
[segment]: https://segment.com
|
109
108
|
|
109
|
+
## Webpack(er)
|
110
|
+
|
111
|
+
Optionally use Webpacker instead of (or in addition to) asset pipeline:
|
112
|
+
|
113
|
+
philosophies-suspenders my_new_app --webpack
|
114
|
+
|
110
115
|
## CSS Frameworks
|
111
116
|
|
112
117
|
You can optionally install a CSS Framework
|
@@ -127,6 +132,8 @@ By default, suspenders will:
|
|
127
132
|
* Adds free Airbrake add-on
|
128
133
|
* Adds free Papertrail add-on
|
129
134
|
|
135
|
+
Please ensure your Heroku account has a verified credit card in order for the above addons to be installed.
|
136
|
+
|
130
137
|
[rails-12factor]: https://github.com/heroku/rails_12factor
|
131
138
|
|
132
139
|
You can optionally specify alternate Heroku flags:
|
@@ -140,7 +147,7 @@ See all possible Heroku flags:
|
|
140
147
|
|
141
148
|
You can bypass all Heroku functionality with the `--skip-heroku` option:
|
142
149
|
|
143
|
-
suspenders app --skip-heroku true
|
150
|
+
philosophies-suspenders app --skip-heroku true
|
144
151
|
|
145
152
|
## Git
|
146
153
|
|
@@ -150,10 +157,12 @@ By default, suspenders will:
|
|
150
157
|
* Create `staging` and `production` branches for deployment
|
151
158
|
* Make an initial commit
|
152
159
|
|
160
|
+
By default, pre-commit hooks are setup to run `bin/rails`. To override this while committing pass the `--no-verify` option to your commit.
|
161
|
+
|
153
162
|
You can optionally provide a remote URL via the `--origin` option and suspenders
|
154
163
|
will push all branches to that remote.
|
155
164
|
|
156
|
-
suspenders app --origin git@github.com:philosopie/app.git
|
165
|
+
philosophies-suspenders app --origin git@github.com:philosopie/app.git
|
157
166
|
|
158
167
|
You can bypass all git functionality with the `--skip-git` option:
|
159
168
|
|
@@ -207,6 +216,46 @@ Philosophie's Suspenders is meant to support the core functionality of a new rai
|
|
207
216
|
- if you are able to, create a PR for the new functionality
|
208
217
|
- if you need help creating a PR find someone to pair with
|
209
218
|
|
219
|
+
## Deploy new version to rubygems
|
220
|
+
|
221
|
+
- sign up to [rubygems.org](https://rubygems.org)
|
222
|
+
|
223
|
+
- get an existing owner to add you to publish permissions using
|
224
|
+
```
|
225
|
+
gem owner philosophies-suspenders -a <email address>
|
226
|
+
```
|
227
|
+
|
228
|
+
- clone the repo locally and verify install
|
229
|
+
```
|
230
|
+
git clone git@github.com:philosophie/suspenders.git
|
231
|
+
cd suspenders
|
232
|
+
bundle
|
233
|
+
```
|
234
|
+
|
235
|
+
- make changes
|
236
|
+
- PR and commit to master
|
237
|
+
- bump the version straight to master
|
238
|
+
```
|
239
|
+
#lib/suspenders/version.rb
|
240
|
+
VERSION = "x.x.x"
|
241
|
+
```
|
242
|
+
|
243
|
+
- signin as rubygems user
|
244
|
+
```
|
245
|
+
gem signin
|
246
|
+
```
|
247
|
+
|
248
|
+
- release to rubygems
|
249
|
+
```
|
250
|
+
rake release
|
251
|
+
```
|
252
|
+
|
253
|
+
#### Update to newest ruby and rails versions
|
254
|
+
|
255
|
+
- update ruby version in ```lib/suspenders/version.rb```
|
256
|
+
- update ruby version in ```.ruby-version```
|
257
|
+
|
258
|
+
|
210
259
|
## License
|
211
260
|
|
212
261
|
Suspenders is Copyright © 2008-2015 thoughtbot.
|
@@ -32,7 +32,8 @@ module Suspenders
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def provide_setup_script
|
35
|
-
|
35
|
+
run "rm bin/setup"
|
36
|
+
template "setup.rb", "bin/setup"
|
36
37
|
end
|
37
38
|
|
38
39
|
def configure_generators
|
@@ -53,10 +54,6 @@ module Suspenders
|
|
53
54
|
inject_into_class 'config/application.rb', 'Application', config
|
54
55
|
end
|
55
56
|
|
56
|
-
def set_up_factory_girl_for_rspec
|
57
|
-
copy_file 'factory_girl_rspec.rb', 'spec/support/factory_girl.rb'
|
58
|
-
end
|
59
|
-
|
60
57
|
def configure_newrelic
|
61
58
|
template 'newrelic.yml.erb', 'config/newrelic.yml'
|
62
59
|
end
|
@@ -218,6 +215,18 @@ end
|
|
218
215
|
create_file '.ruby-version', "#{Suspenders::RUBY_VERSION}\n"
|
219
216
|
end
|
220
217
|
|
218
|
+
def add_webpacker
|
219
|
+
inject_into_file(
|
220
|
+
"Gemfile",
|
221
|
+
%{\ngem "webpacker"},
|
222
|
+
after: /gem "puma"/
|
223
|
+
)
|
224
|
+
end
|
225
|
+
|
226
|
+
def run_webpacker_install
|
227
|
+
bundle_command "exec rails webpacker:install"
|
228
|
+
end
|
229
|
+
|
221
230
|
def setup_heroku_specific_gems
|
222
231
|
inject_into_file(
|
223
232
|
"Gemfile",
|
@@ -316,6 +325,22 @@ end
|
|
316
325
|
create_empty_directory('app/assets/javascripts/application')
|
317
326
|
end
|
318
327
|
|
328
|
+
def inject_webpacker_into_layout
|
329
|
+
inject_into_file(
|
330
|
+
'app/views/application/_javascript.html.erb',
|
331
|
+
%{\n<%= javascript_pack_tag 'application' %>},
|
332
|
+
after: Regexp.new("<%= javascript_include_tag :application %>")
|
333
|
+
)
|
334
|
+
end
|
335
|
+
|
336
|
+
def inject_webpacker_into_setup
|
337
|
+
inject_into_file(
|
338
|
+
'bin/setup',
|
339
|
+
%{\nsystem! 'npm install -g yarn'\nsystem! 'yarn install'\n},
|
340
|
+
after: /# Install JavaScript dependencies if using Yarn/
|
341
|
+
)
|
342
|
+
end
|
343
|
+
|
319
344
|
def install_bourbon_n_friends
|
320
345
|
inject_into_file(
|
321
346
|
'Gemfile',
|
@@ -420,6 +445,10 @@ end
|
|
420
445
|
|
421
446
|
def init_git
|
422
447
|
run 'git init'
|
448
|
+
template '.overcommit.yml', '.overcommit.yml'
|
449
|
+
bundle_command 'exec overcommit --install'
|
450
|
+
bundle_command 'exec overcommit --sign'
|
451
|
+
bundle_command 'exec overcommit --sign pre-commit'
|
423
452
|
end
|
424
453
|
|
425
454
|
def setup_deployment_environment_branches
|
@@ -427,9 +456,15 @@ end
|
|
427
456
|
run 'git branch production'
|
428
457
|
end
|
429
458
|
|
459
|
+
def run_autofixes
|
460
|
+
run 'rm -rf test/'
|
461
|
+
bundle_command 'exec rubocop -a'
|
462
|
+
run 'i18n-tasks normalize'
|
463
|
+
end
|
464
|
+
|
430
465
|
def create_initial_commit
|
431
466
|
run 'git add -A'
|
432
|
-
run 'git commit -m "Initial app setup."'
|
467
|
+
run 'git commit -m "Initial app setup." --no-verify'
|
433
468
|
end
|
434
469
|
|
435
470
|
def setup_and_push_to_origin_remote(remote_url)
|
@@ -441,7 +476,7 @@ end
|
|
441
476
|
rack_env = "RACK_ENV=staging RAILS_ENV=staging"
|
442
477
|
app_name = heroku_app_name_for("staging")
|
443
478
|
|
444
|
-
run_heroku "create #{app_name}
|
479
|
+
run_heroku "create #{app_name} #{flags}", "staging"
|
445
480
|
run_heroku "config:add #{rack_env}", "staging"
|
446
481
|
configure_heroku_app("staging")
|
447
482
|
end
|
@@ -449,7 +484,7 @@ end
|
|
449
484
|
def create_production_heroku_app(flags)
|
450
485
|
app_name = heroku_app_name_for("production")
|
451
486
|
|
452
|
-
run_heroku "create #{app_name}
|
487
|
+
run_heroku "create #{app_name} #{flags}", "production"
|
453
488
|
configure_heroku_app("production")
|
454
489
|
end
|
455
490
|
|
@@ -460,7 +495,7 @@ end
|
|
460
495
|
|
461
496
|
def configure_heroku_app(environment)
|
462
497
|
run_heroku "addons:create sendgrid", environment
|
463
|
-
run_heroku "addons:create airbrake:free-
|
498
|
+
run_heroku "addons:create airbrake:hrk-free-2018", environment
|
464
499
|
run_heroku "addons:create papertrail", environment
|
465
500
|
run_heroku "addons:create heroku-postgresql:hobby-dev", environment
|
466
501
|
run_heroku "addons:create newrelic:wayne", environment
|
@@ -563,9 +598,14 @@ end
|
|
563
598
|
template 'airbrake.rb', 'config/initializers/airbrake.rb'
|
564
599
|
end
|
565
600
|
|
566
|
-
def
|
567
|
-
|
568
|
-
|
601
|
+
def copy_env_example
|
602
|
+
template ".env.example", ".env.example"
|
603
|
+
append_file ".env.example", "SECRET_KEY_BASE=#{generate_secret}"
|
604
|
+
end
|
605
|
+
|
606
|
+
def run_bin_setup
|
607
|
+
run "chmod 755 bin/setup"
|
608
|
+
run "bin/setup"
|
569
609
|
end
|
570
610
|
|
571
611
|
def configure_quiet_assets
|
@@ -585,6 +625,10 @@ end
|
|
585
625
|
inject_into_class "config/application.rb", "Application", config
|
586
626
|
end
|
587
627
|
|
628
|
+
def generate_secret
|
629
|
+
SecureRandom.hex(64)
|
630
|
+
end
|
631
|
+
|
588
632
|
private
|
589
633
|
|
590
634
|
def raise_on_missing_translations_in(environment)
|
@@ -605,10 +649,6 @@ end
|
|
605
649
|
run "#{path_addition} heroku #{command} --remote #{environment}"
|
606
650
|
end
|
607
651
|
|
608
|
-
def generate_secret
|
609
|
-
SecureRandom.hex(64)
|
610
|
-
end
|
611
|
-
|
612
652
|
def serve_static_files_line
|
613
653
|
"config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?\n"
|
614
654
|
end
|
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'rails/generators'
|
2
2
|
require 'rails/generators/rails/app/app_generator'
|
3
|
-
require 'pry-byebug'
|
4
3
|
|
5
4
|
module Suspenders
|
6
5
|
class AppGenerator < Rails::Generators::AppGenerator
|
@@ -34,6 +33,14 @@ module Suspenders
|
|
34
33
|
class_option :skip_git, type: :boolean, default: false,
|
35
34
|
desc: "Don't create and commit to git repository"
|
36
35
|
|
36
|
+
def initialize(*args)
|
37
|
+
super
|
38
|
+
|
39
|
+
if options[:webpack] && `which yarn`.empty?
|
40
|
+
raise Rails::Generators::Error, 'ERROR: yarn is required in order to use webpack'
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
37
44
|
def finish_template
|
38
45
|
invoke :suspenders_customization
|
39
46
|
super
|
@@ -61,7 +68,8 @@ module Suspenders
|
|
61
68
|
invoke :setup_segment
|
62
69
|
invoke :setup_bundler_audit
|
63
70
|
invoke :setup_spring
|
64
|
-
invoke :
|
71
|
+
invoke :run_setup
|
72
|
+
invoke :run_autofixes
|
65
73
|
invoke :initial_commit_and_branching
|
66
74
|
invoke :push_to_origin
|
67
75
|
invoke :setup_css_framework
|
@@ -76,6 +84,7 @@ module Suspenders
|
|
76
84
|
def customize_gemfile
|
77
85
|
build :replace_gemfile
|
78
86
|
build :set_ruby_to_version_being_used
|
87
|
+
build :add_webpacker if options[:webpack]
|
79
88
|
|
80
89
|
unless options[:skip_heroku]
|
81
90
|
build :setup_heroku_specific_gems
|
@@ -110,7 +119,6 @@ module Suspenders
|
|
110
119
|
|
111
120
|
def setup_test_environment
|
112
121
|
say 'Setting up the test environment'
|
113
|
-
build :set_up_factory_girl_for_rspec
|
114
122
|
build :generate_rspec
|
115
123
|
build :configure_rspec
|
116
124
|
build :enable_database_cleaner
|
@@ -168,8 +176,9 @@ module Suspenders
|
|
168
176
|
end
|
169
177
|
|
170
178
|
def setup_javascripts
|
171
|
-
say 'Set up
|
179
|
+
say 'Set up javascript'
|
172
180
|
build :setup_javascripts
|
181
|
+
build :inject_webpacker_into_layout if options[:webpack]
|
173
182
|
end
|
174
183
|
|
175
184
|
def setup_css_framework
|
@@ -192,6 +201,11 @@ module Suspenders
|
|
192
201
|
end
|
193
202
|
end
|
194
203
|
|
204
|
+
def run_autofixes
|
205
|
+
say 'Running rubocop and i18n autofixes'
|
206
|
+
build :run_autofixes
|
207
|
+
end
|
208
|
+
|
195
209
|
def initial_commit_and_branching
|
196
210
|
if !options[:skip_git]
|
197
211
|
say 'Creating initial commit and branches'
|
@@ -260,8 +274,15 @@ module Suspenders
|
|
260
274
|
build :remove_routes_comment_lines
|
261
275
|
end
|
262
276
|
|
263
|
-
def
|
264
|
-
build :
|
277
|
+
def run_setup
|
278
|
+
build :copy_env_example
|
279
|
+
if options[:webpack]
|
280
|
+
build :inject_webpacker_into_setup
|
281
|
+
build :run_bin_setup
|
282
|
+
build :run_webpacker_install
|
283
|
+
else
|
284
|
+
build :run_bin_setup
|
285
|
+
end
|
265
286
|
end
|
266
287
|
|
267
288
|
def outro
|
data/lib/suspenders/version.rb
CHANGED
data/templates/.rubocop.yml
CHANGED
@@ -23,8 +23,17 @@ AllCops:
|
|
23
23
|
- "config/**/*"
|
24
24
|
- "Rakefile"
|
25
25
|
- "spec/i18n_spec.rb"
|
26
|
+
- "node_modules/**/*"
|
26
27
|
|
27
28
|
BlockLength:
|
28
29
|
Exclude:
|
29
30
|
- "spec/**/*"
|
30
31
|
- "app/admin/**/*"
|
32
|
+
|
33
|
+
MultilineMethodCallIndentation:
|
34
|
+
Exclude:
|
35
|
+
- "spec/**/*"
|
36
|
+
|
37
|
+
AmbiguousBlockAssociation:
|
38
|
+
Exclude:
|
39
|
+
- "spec/**/*"
|
data/templates/Gemfile.erb
CHANGED
@@ -6,7 +6,6 @@ gem "rails", "<%= Suspenders::RAILS_VERSION %>"
|
|
6
6
|
gem "airbrake", require: false
|
7
7
|
gem "autoprefixer-rails"
|
8
8
|
gem "bundler"
|
9
|
-
gem "coffee-rails"
|
10
9
|
gem "flutie"
|
11
10
|
gem "i18n-tasks"
|
12
11
|
gem "newrelic_rpm"
|
@@ -20,24 +19,19 @@ gem "title"
|
|
20
19
|
gem "uglifier"
|
21
20
|
gem "puma"
|
22
21
|
|
23
|
-
source "https://rails-assets.org" do
|
24
|
-
gem "rails-assets-jquery"
|
25
|
-
gem "rails-assets-jquery-ujs"
|
26
|
-
end
|
27
|
-
|
28
22
|
group :development do
|
29
23
|
gem "better_errors"
|
30
24
|
gem "binding_of_caller"
|
25
|
+
gem "overcommit"
|
31
26
|
gem "spring"
|
32
27
|
gem "spring-commands-rspec"
|
33
|
-
gem "stairs"
|
34
28
|
end
|
35
29
|
|
36
30
|
group :development, :test do
|
37
31
|
gem "listen"
|
38
32
|
gem "bundler-audit", require: false
|
39
33
|
gem "dotenv-rails"
|
40
|
-
gem
|
34
|
+
gem 'factory_bot_rails'
|
41
35
|
gem "pry-byebug"
|
42
36
|
gem "pry-rails"
|
43
37
|
gem "rspec-rails"
|
@@ -1,5 +1,8 @@
|
|
1
1
|
- [ ] Be well-tested according to our Automated Testing Policy, and the test suite must be passing.
|
2
2
|
- [ ] Conform to the Ruby Community Styleguide via rubocop.
|
3
3
|
- [ ] Update the seed file with any new data that QA will need to accept your feature
|
4
|
-
- [ ] Ensure that any new ENV vars are added to
|
4
|
+
- [ ] Ensure that any new ENV vars are added to `.env.example` and updated on CI and servers
|
5
5
|
- [ ] Views render correctly in all supported browsers
|
6
|
+
- [ ] New images are compressed
|
7
|
+
- [ ] New dependencies are appropriately licensed as per our MSA with the client (ask if you don't know)
|
8
|
+
- [ ] If this code involves sensitive data like PII, credit card, or bank info, ensure that it is properly safeguarded
|
data/templates/README.md.erb
CHANGED
@@ -3,10 +3,13 @@
|
|
3
3
|
## Setup
|
4
4
|
|
5
5
|
```bash
|
6
|
-
$
|
7
|
-
$ rake newb
|
6
|
+
$ bin/setup
|
8
7
|
```
|
9
8
|
|
9
|
+
## Git
|
10
|
+
|
11
|
+
By default, pre-commit hooks are setup to run `bin/rails`. To override this while committing pass the `--no-verify` option to your commit.
|
12
|
+
|
10
13
|
## Definition of Done
|
11
14
|
|
12
15
|
In addition to satisfying acceptance criteria, new functionality/changes/etc
|
data/templates/application.js
CHANGED
data/templates/rails_helper.rb
CHANGED
@@ -10,7 +10,7 @@ require 'shoulda/matchers'
|
|
10
10
|
Dir[Rails.root.join('spec/support/**/*.rb')].sort.each { |file| require file }
|
11
11
|
|
12
12
|
RSpec.configure do |config|
|
13
|
-
config.include
|
13
|
+
config.include FactoryBot::Syntax::Methods
|
14
14
|
config.infer_base_class_for_anonymous_controllers = false
|
15
15
|
config.infer_spec_type_from_file_location!
|
16
16
|
config.use_transactional_fixtures = false
|
@@ -18,3 +18,10 @@ end
|
|
18
18
|
|
19
19
|
ActiveRecord::Migration.maintain_test_schema!
|
20
20
|
Capybara.javascript_driver = :webkit
|
21
|
+
|
22
|
+
Shoulda::Matchers.configure do |config|
|
23
|
+
config.integrate do |with|
|
24
|
+
with.test_framework :rspec
|
25
|
+
with.library :rails
|
26
|
+
end
|
27
|
+
end
|
data/templates/setup.rb
CHANGED
@@ -1,5 +1,33 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
require 'fileutils'
|
4
|
+
include FileUtils
|
4
5
|
|
5
|
-
|
6
|
+
# path to your application root.
|
7
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
8
|
+
|
9
|
+
def system!(*args)
|
10
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
11
|
+
end
|
12
|
+
|
13
|
+
chdir APP_ROOT do
|
14
|
+
# This script is a starting point to setup your application.
|
15
|
+
# Add necessary setup steps to this file.
|
16
|
+
|
17
|
+
puts '== Installing dependencies =='
|
18
|
+
system! 'gem install bundler --conservative'
|
19
|
+
system('bundle check') || system!('bundle install')
|
20
|
+
|
21
|
+
# Install JavaScript dependencies if using Yarn
|
22
|
+
|
23
|
+
puts "\n== Copying .env sample file =="
|
24
|
+
unless File.exist?('.env')
|
25
|
+
cp '.env.example', '.env'
|
26
|
+
end
|
27
|
+
|
28
|
+
puts "\n== Preparing database =="
|
29
|
+
system! 'bin/rails db:setup'
|
30
|
+
|
31
|
+
puts "\n== Installing git pre-commit hooks =="
|
32
|
+
system! 'overcommit --install'
|
33
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: philosophies-suspenders
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Philosophie
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 5.
|
33
|
+
version: 5.2.1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 5.
|
40
|
+
version: 5.2.1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: pry
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -119,6 +119,8 @@ files:
|
|
119
119
|
- spec/support/fake_heroku.rb
|
120
120
|
- spec/support/suspenders.rb
|
121
121
|
- suspenders.gemspec
|
122
|
+
- templates/.env.example
|
123
|
+
- templates/.overcommit.yml
|
122
124
|
- templates/.rubocop.yml
|
123
125
|
- templates/Gemfile.erb
|
124
126
|
- templates/PULL_REQUEST_TEMPLATE.md.erb
|
@@ -136,7 +138,6 @@ files:
|
|
136
138
|
- templates/config_locales_en.yml.erb
|
137
139
|
- templates/database_cleaner_rspec.rb
|
138
140
|
- templates/errors.rb
|
139
|
-
- templates/factory_girl_rspec.rb
|
140
141
|
- templates/flashes_helper.rb
|
141
142
|
- templates/i18n.rb
|
142
143
|
- templates/json_encoding.rb
|
@@ -164,7 +165,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
164
165
|
requirements:
|
165
166
|
- - ">="
|
166
167
|
- !ruby/object:Gem::Version
|
167
|
-
version: 2.
|
168
|
+
version: 2.5.1
|
168
169
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
169
170
|
requirements:
|
170
171
|
- - ">="
|
@@ -172,7 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
172
173
|
version: '0'
|
173
174
|
requirements: []
|
174
175
|
rubyforge_project:
|
175
|
-
rubygems_version: 2.6
|
176
|
+
rubygems_version: 2.7.6
|
176
177
|
signing_key:
|
177
178
|
specification_version: 4
|
178
179
|
summary: Generate a Rails app using Philosophie's best practices.
|