welaika-suspenders 2.28.0 → 2.29.0.alpha.1
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/.travis.yml +3 -1
- data/CONTRIBUTING.md +8 -3
- data/NEWS.md +35 -0
- data/README.md +1 -1
- data/RELEASING.md +6 -7
- data/Rakefile +1 -1
- data/diff_suspenders.sh +15 -0
- data/lib/suspenders.rb +21 -8
- data/lib/suspenders/actions.rb +55 -8
- data/lib/suspenders/app_builder.rb +20 -191
- data/lib/suspenders/generators/app_generator.rb +26 -55
- data/lib/suspenders/generators/ci_generator.rb +22 -0
- data/lib/suspenders/generators/db_optimizations_generator.rb +30 -0
- data/lib/suspenders/generators/decorator_generator.rb +19 -0
- data/lib/suspenders/generators/error_reporting_generator.rb +55 -0
- data/lib/suspenders/generators/factories_generator.rb +23 -0
- data/lib/suspenders/generators/faker_generator.rb +19 -0
- data/lib/suspenders/generators/forms_generator.rb +18 -0
- data/lib/suspenders/generators/js_driver_generator.rb +20 -0
- data/lib/suspenders/generators/lint_generator.rb +35 -0
- data/lib/suspenders/generators/production/email_generator.rb +45 -0
- data/lib/suspenders/generators/production/force_tls_generator.rb +14 -0
- data/lib/suspenders/generators/production/timeout_generator.rb +21 -0
- data/lib/suspenders/generators/security_generator.rb +29 -0
- data/lib/suspenders/generators/testing_generator.rb +72 -0
- data/lib/suspenders/generators/views_generator.rb +44 -0
- data/lib/suspenders/version.rb +2 -2
- data/spec/features/api_spec.rb +18 -0
- data/spec/features/new_project_spec.rb +9 -21
- data/spec/features/production/email_spec.rb +47 -0
- data/spec/support/contain_json_matcher.rb +24 -0
- data/spec/support/exist_as_a_file_matcher.rb +7 -0
- data/spec/support/match_contents_matcher.rb +6 -0
- data/spec/support/suspenders.rb +113 -30
- data/suspenders.gemspec +2 -2
- data/templates/Gemfile.erb +8 -31
- data/templates/Procfile +1 -1
- data/templates/_css_overrides.html.slim +4 -0
- data/templates/_javascript.html.slim +3 -3
- data/templates/action_mailer.rb +2 -0
- data/templates/app.json.erb +0 -15
- data/templates/brakeman.rake +2 -0
- data/templates/bundler_audit.rake +3 -1
- data/templates/capybara_helpers.rb +15 -0
- data/templates/chromedriver.rb +20 -0
- data/templates/dev.rake +4 -2
- data/templates/dotfiles/.env +2 -1
- data/templates/email.rb +5 -0
- data/templates/errors.rb +2 -0
- data/templates/factory_bot_rspec.rb +5 -0
- data/templates/faker_rspec.rb +2 -0
- data/templates/flashes_helper.rb +2 -0
- data/templates/i18n.rb +2 -0
- data/templates/json_encoding.rb +2 -0
- data/templates/puma.rb +2 -0
- data/templates/queries_helper_rspec.rb +2 -0
- data/templates/rack_mini_profiler.rb +2 -0
- data/templates/rails_helper.rb +11 -1
- data/templates/rubocop.rake +2 -0
- data/templates/rubocop.yml +2 -22
- data/templates/sentry.rb +8 -0
- data/templates/shoulda_matchers_config_rspec.rb +2 -0
- data/templates/slim-lint.rake +2 -0
- data/templates/slim.rb +2 -0
- data/templates/smtp.rb +2 -4
- data/templates/spec_helper.rb +12 -3
- data/templates/suspenders_layout.html.slim +3 -3
- metadata +42 -36
- data/lib/suspenders/generators/enforce_ssl_generator.rb +0 -12
- data/lib/suspenders/generators/initialize_active_job_generator.rb +0 -19
- data/templates/_css_overrides.html.erb +0 -7
- data/templates/active_job.rb +0 -13
- data/templates/capybara.rb +0 -29
- data/templates/circle.yml.erb +0 -15
- data/templates/database_cleaner_rspec.rb +0 -28
- data/templates/errbit.rb +0 -12
- data/templates/factories.rb +0 -2
- data/templates/factory_girl_rspec.rb +0 -3
- data/templates/fixtures_helper_rspec.rb +0 -9
- data/templates/sample_service.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f2bc8b6b54027c607ac3d40740602bb464a24c69baebdccbf0274b6bcf52b541
|
4
|
+
data.tar.gz: c6145805c840fd18b6e4b40e63332de24bc626f6f0de7b8f7fc83b816f2b7e5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d92f5e43680df4e9dca8a24618153f3d98cd5ee5de61504b0b8a0fddc796a33b25b90a9189d501150ace679d85343de2a566bcc97e66092cead0ebc9545b55c
|
7
|
+
data.tar.gz: 90adc4777638db3f20b4caac5ca84a7fadb5a7acf3662f041a396d9a304fca49483c871e65b86f62fb9841393b42620336e63c12548fcc62b6df8c1f3f913f9e
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.5.1
|
data/.travis.yml
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
language: ruby
|
2
|
-
rvm: 2.
|
2
|
+
rvm: 2.5.1
|
3
3
|
cache: bundler
|
4
4
|
sudo: false
|
5
5
|
before_install:
|
6
6
|
- "echo '--colour' > ~/.rspec"
|
7
7
|
- git config --global user.name 'Travis CI'
|
8
8
|
- git config --global user.email 'travis-ci@example.com'
|
9
|
+
- gem install bundler
|
10
|
+
- gem update --system
|
9
11
|
install: bundle install
|
10
12
|
notifications:
|
11
13
|
email: false
|
data/CONTRIBUTING.md
CHANGED
@@ -13,9 +13,6 @@ Set up your machine:
|
|
13
13
|
|
14
14
|
./bin/setup
|
15
15
|
|
16
|
-
If you're having trouble installing `capybara-webkit` check their [installation
|
17
|
-
instructions](https://github.com/thoughtbot/capybara-webkit#qt-dependency-and-installation-issues).
|
18
|
-
|
19
16
|
Make sure the tests pass:
|
20
17
|
|
21
18
|
rake
|
@@ -52,3 +49,11 @@ We may suggest changes.
|
|
52
49
|
|
53
50
|
To update the Ruby version,
|
54
51
|
change `.ruby-version` and `.travis.yml`.
|
52
|
+
|
53
|
+
If you see this error while running tests:
|
54
|
+
|
55
|
+
```
|
56
|
+
Your Ruby version is XXX, but your Gemfile specified YYY (Bundler::RubyVersionMismatch)
|
57
|
+
```
|
58
|
+
|
59
|
+
Try removing the `tmp/` directory and re-running the tests.
|
data/NEWS.md
CHANGED
@@ -1,3 +1,38 @@
|
|
1
|
+
* Bug fix: change production timeouts generator to use working configuration
|
2
|
+
method with latest version of Rack::Timeout
|
3
|
+
|
4
|
+
1.47.0 (May 25, 2018)
|
5
|
+
|
6
|
+
* Bug fix: normalize.css Sass import is concatenated with other styles now
|
7
|
+
* Bug fix: the suspenders gem itself is not needed in production
|
8
|
+
* Bug fix: bundle install after adding a gem
|
9
|
+
* Breaking: remove Refills
|
10
|
+
* Breaking: rename suspenders:enforce_ssl to suspenders:production:force_tls
|
11
|
+
* Upgrade: update to Ruby 2.5.1
|
12
|
+
* Upgrade: update to Rails 5.2.0
|
13
|
+
* New generator: production email
|
14
|
+
* New generator: production timeouts
|
15
|
+
|
16
|
+
1.46.0 (January 26, 2018)
|
17
|
+
|
18
|
+
* Bug fix: Fix for action mailer asset_host
|
19
|
+
* Bug fix: Lock pg to ~> 0.18
|
20
|
+
* Breaking: Remove Database Cleaner
|
21
|
+
* Upgrade: Update to Rails 5.1.4
|
22
|
+
* Upgrade: Update to Ruby 2.5.0
|
23
|
+
* Upgrade: Update bourbon from 5.0.0.beta.8 to 5.0.0
|
24
|
+
* Upgrade: Update FactoryGirl to FactoryBot
|
25
|
+
* Generators: Analytics generator
|
26
|
+
* Generators: CI generator
|
27
|
+
* Generators: DB optimization generator
|
28
|
+
* Generators: Factories generator
|
29
|
+
* Generators: Forms generator
|
30
|
+
* Generators: Javascript driver generator
|
31
|
+
* Generators: Jobs generator
|
32
|
+
* Generators: Lint generator
|
33
|
+
* Generators: Testing driver generator
|
34
|
+
* Generators: Views generator
|
35
|
+
|
1
36
|
1.45.0 (September 8, 2017)
|
2
37
|
|
3
38
|
* Bump Rails to 5.1.3 (#857)
|
data/README.md
CHANGED
@@ -64,7 +64,7 @@ List of changes we made since [this is commit](https://github.com/thoughtbot/sus
|
|
64
64
|
- add some html meta tags
|
65
65
|
- use EU region as default for Heroku
|
66
66
|
- use CDATA wrapper for javascript
|
67
|
-
- create common folders like `app/queries`, `app/
|
67
|
+
- create common folders like `app/queries`, `app/interactions`, etc.
|
68
68
|
- use `application.sass` instead of `application.scss`
|
69
69
|
- add `brakeman` gem
|
70
70
|
- set `Rome` as `time_zone`
|
data/RELEASING.md
CHANGED
@@ -1,19 +1,18 @@
|
|
1
1
|
# Releasing
|
2
2
|
|
3
|
-
1. Update `
|
4
|
-
2. Update `
|
3
|
+
1. Update `NEWS.md` to reflect the changes since last release.
|
4
|
+
2. Update `lib/suspenders/version.rb` file accordingly.
|
5
5
|
3. Commit changes. There shouldn't be code changes, and thus CI doesn't need to
|
6
|
-
run
|
6
|
+
run; you can add `[ci skip]` to the commit message.
|
7
7
|
4. Tag the release: `git tag vVERSION -a -s`. The tag message should contain the
|
8
8
|
appropriate `NEWS.md` subsection.
|
9
9
|
5. Push changes: `git push --tags`
|
10
10
|
6. Build and publish to rubygems:
|
11
|
-
```
|
11
|
+
```sh
|
12
12
|
gem build suspenders.gemspec
|
13
13
|
gem push suspenders-*.gem
|
14
14
|
```
|
15
|
-
|
16
15
|
7. Add a new GitHub release:
|
17
16
|
https://github.com/thoughtbot/suspenders/releases/new?tag=vVERSION
|
18
|
-
8. Announce the new release, making sure to
|
19
|
-
|
17
|
+
8. Announce the new release, making sure to thank the contributors who helped
|
18
|
+
shape this version!
|
data/Rakefile
CHANGED
data/diff_suspenders.sh
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
diff --minimal \
|
4
|
+
--brief \
|
5
|
+
--ignore-all-space \
|
6
|
+
--recursive \
|
7
|
+
--exclude=".git" \
|
8
|
+
--exclude="pkg" \
|
9
|
+
--exclude="tmp" \
|
10
|
+
--exclude="README.md" \
|
11
|
+
--exclude="NEWS.md" \
|
12
|
+
--exclude="USAGE" \
|
13
|
+
--exclude="LICENSE" \
|
14
|
+
--exclude="Gemfile.lock" \
|
15
|
+
./ ../suspenders
|
data/lib/suspenders.rb
CHANGED
@@ -1,9 +1,22 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require "suspenders/generators/
|
4
|
-
require "suspenders/generators/
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
1
|
+
require "suspenders/version"
|
2
|
+
require "suspenders/generators/app_generator"
|
3
|
+
require "suspenders/generators/static_generator"
|
4
|
+
require "suspenders/generators/stylesheet_base_generator"
|
5
|
+
require "suspenders/generators/forms_generator"
|
6
|
+
require "suspenders/generators/ci_generator"
|
7
|
+
require "suspenders/generators/db_optimizations_generator"
|
8
|
+
require "suspenders/generators/factories_generator"
|
9
|
+
require "suspenders/generators/lint_generator"
|
10
|
+
require "suspenders/generators/views_generator"
|
11
|
+
require "suspenders/generators/js_driver_generator"
|
12
|
+
require "suspenders/generators/testing_generator"
|
13
|
+
require "suspenders/generators/decorator_generator"
|
14
|
+
require "suspenders/generators/error_reporting_generator"
|
15
|
+
require "suspenders/generators/faker_generator"
|
16
|
+
require "suspenders/generators/security_generator"
|
17
|
+
require "suspenders/generators/production/force_tls_generator"
|
18
|
+
require "suspenders/generators/production/email_generator"
|
19
|
+
require "suspenders/generators/production/timeout_generator"
|
20
|
+
require "suspenders/actions"
|
8
21
|
require "suspenders/adapters/heroku"
|
9
|
-
require
|
22
|
+
require "suspenders/app_builder"
|
data/lib/suspenders/actions.rb
CHANGED
@@ -19,14 +19,6 @@ module Suspenders
|
|
19
19
|
configure_environment(rails_env, config)
|
20
20
|
end
|
21
21
|
|
22
|
-
def configure_application_file(config)
|
23
|
-
inject_into_file(
|
24
|
-
"config/application.rb",
|
25
|
-
"\n\n #{config}",
|
26
|
-
before: "\n end"
|
27
|
-
)
|
28
|
-
end
|
29
|
-
|
30
22
|
def configure_environment(rails_env, config)
|
31
23
|
inject_into_file(
|
32
24
|
"config/environments/#{rails_env}.rb",
|
@@ -34,5 +26,60 @@ module Suspenders
|
|
34
26
|
before: "\nend"
|
35
27
|
)
|
36
28
|
end
|
29
|
+
|
30
|
+
def expand_json(file, data)
|
31
|
+
action ExpandJson.new(destination_root, file, data)
|
32
|
+
end
|
33
|
+
|
34
|
+
class ExpandJson
|
35
|
+
def initialize(destination_root, file, data)
|
36
|
+
@destination_root = destination_root
|
37
|
+
@file = file
|
38
|
+
@data = data
|
39
|
+
end
|
40
|
+
|
41
|
+
def invoke!
|
42
|
+
write_out { |existing_json| existing_json.merge(data) }
|
43
|
+
end
|
44
|
+
|
45
|
+
def revoke!
|
46
|
+
write_out { |existing_json| hash_unmerge(existing_json, data) }
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
attr_reader :destination_root, :file, :data
|
52
|
+
|
53
|
+
def write_out
|
54
|
+
new_json = yield(existing_json)
|
55
|
+
IO.write(destination_file, JSON.pretty_generate(new_json))
|
56
|
+
end
|
57
|
+
|
58
|
+
def destination_file
|
59
|
+
File.join(destination_root, file)
|
60
|
+
end
|
61
|
+
|
62
|
+
def existing_json
|
63
|
+
JSON.parse(IO.read(destination_file))
|
64
|
+
rescue Errno::ENOENT
|
65
|
+
{}
|
66
|
+
end
|
67
|
+
|
68
|
+
def hash_unmerge(hash, subhash)
|
69
|
+
subhash.reduce(hash) do |acc, (k, v)|
|
70
|
+
if hash.has_key?(k)
|
71
|
+
if v == hash[k]
|
72
|
+
acc.except(k)
|
73
|
+
elsif v.is_a?(Hash)
|
74
|
+
acc.merge(k => hash_unmerge(hash[k], v))
|
75
|
+
else
|
76
|
+
acc
|
77
|
+
end
|
78
|
+
else
|
79
|
+
acc
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
37
84
|
end
|
38
85
|
end
|
@@ -55,23 +55,6 @@ module Suspenders
|
|
55
55
|
)
|
56
56
|
end
|
57
57
|
|
58
|
-
def add_bullet_gem_configuration
|
59
|
-
config = <<-RUBY
|
60
|
-
config.after_initialize do
|
61
|
-
Bullet.enable = true
|
62
|
-
Bullet.bullet_logger = true
|
63
|
-
Bullet.rails_logger = true
|
64
|
-
end
|
65
|
-
|
66
|
-
RUBY
|
67
|
-
|
68
|
-
inject_into_file(
|
69
|
-
"config/environments/development.rb",
|
70
|
-
config,
|
71
|
-
after: "config.action_mailer.raise_delivery_errors = true\n",
|
72
|
-
)
|
73
|
-
end
|
74
|
-
|
75
58
|
def raise_on_unpermitted_parameters
|
76
59
|
config = <<-RUBY
|
77
60
|
config.action_controller.action_on_unpermitted_parameters = :raise
|
@@ -93,15 +76,10 @@ module Suspenders
|
|
93
76
|
run "chmod a+x bin/setup"
|
94
77
|
end
|
95
78
|
|
96
|
-
def provide_dev_prime_task
|
97
|
-
copy_file 'dev.rake', 'lib/tasks/dev.rake'
|
98
|
-
end
|
99
|
-
|
100
79
|
def configure_generators
|
101
80
|
config = <<-RUBY
|
102
81
|
|
103
82
|
config.generators do |generate|
|
104
|
-
generate.controller_specs false
|
105
83
|
generate.helper false
|
106
84
|
generate.javascripts false
|
107
85
|
generate.request_specs false
|
@@ -116,33 +94,8 @@ module Suspenders
|
|
116
94
|
inject_into_class 'config/application.rb', 'Application', config
|
117
95
|
end
|
118
96
|
|
119
|
-
def
|
120
|
-
copy_file
|
121
|
-
end
|
122
|
-
|
123
|
-
def add_helpers_for_rspec
|
124
|
-
copy_file 'queries_helper_rspec.rb', 'spec/support/queries_helper.rb'
|
125
|
-
copy_file 'fixtures_helper_rspec.rb', 'spec/support/fixtures_helper.rb'
|
126
|
-
end
|
127
|
-
|
128
|
-
def set_up_faker
|
129
|
-
copy_file 'faker_rspec.rb', 'spec/support/faker.rb'
|
130
|
-
end
|
131
|
-
|
132
|
-
def configure_smtp
|
133
|
-
copy_file 'smtp.rb', 'config/smtp.rb'
|
134
|
-
|
135
|
-
prepend_file 'config/environments/production.rb',
|
136
|
-
%{require Rails.root.join("config/smtp")\n}
|
137
|
-
|
138
|
-
config = <<-RUBY
|
139
|
-
|
140
|
-
config.action_mailer.delivery_method = :smtp
|
141
|
-
config.action_mailer.smtp_settings = SMTP_SETTINGS
|
142
|
-
RUBY
|
143
|
-
|
144
|
-
inject_into_file 'config/environments/production.rb', config,
|
145
|
-
after: "config.action_mailer.raise_delivery_errors = false"
|
97
|
+
def configure_local_mail
|
98
|
+
copy_file "email.rb", "config/initializers/email.rb"
|
146
99
|
end
|
147
100
|
|
148
101
|
def enable_rack_canonical_host
|
@@ -167,9 +120,11 @@ module Suspenders
|
|
167
120
|
"# config.action_controller.asset_host = 'http://assets.example.com'",
|
168
121
|
'config.action_controller.asset_host = ENV.fetch("ASSET_HOST", ENV.fetch("APPLICATION_HOST"))'
|
169
122
|
|
170
|
-
|
171
|
-
|
172
|
-
|
123
|
+
if File.exist?("config/initializers/assets.rb")
|
124
|
+
replace_in_file 'config/initializers/assets.rb',
|
125
|
+
"config.assets.version = '1.0'",
|
126
|
+
'config.assets.version = (ENV["ASSETS_VERSION"] || "1.0")'
|
127
|
+
end
|
173
128
|
|
174
129
|
config = <<-EOD
|
175
130
|
config.public_file_server.headers = {
|
@@ -188,33 +143,6 @@ config.public_file_server.headers = {
|
|
188
143
|
remove_file "config/initializers/wrap_parameters.rb"
|
189
144
|
end
|
190
145
|
|
191
|
-
def create_partials_directory
|
192
|
-
empty_directory 'app/views/application'
|
193
|
-
end
|
194
|
-
|
195
|
-
def create_shared_flashes
|
196
|
-
copy_file '_flashes.html.slim', 'app/views/application/_flashes.html.slim'
|
197
|
-
copy_file "flashes_helper.rb", "app/helpers/flashes_helper.rb"
|
198
|
-
end
|
199
|
-
|
200
|
-
def create_shared_javascripts
|
201
|
-
copy_file '_javascript.html.slim', 'app/views/application/_javascript.html.slim'
|
202
|
-
end
|
203
|
-
|
204
|
-
def create_shared_css_overrides
|
205
|
-
copy_file(
|
206
|
-
"_css_overrides.html.erb",
|
207
|
-
"app/views/application/_css_overrides.html.erb",
|
208
|
-
)
|
209
|
-
end
|
210
|
-
|
211
|
-
def create_application_layout
|
212
|
-
remove_file 'app/views/layouts/application.html.erb'
|
213
|
-
template 'suspenders_layout.html.slim',
|
214
|
-
'app/views/layouts/application.html.slim',
|
215
|
-
force: true
|
216
|
-
end
|
217
|
-
|
218
146
|
def use_postgres_config_template
|
219
147
|
template 'postgresql_database.yml.erb', 'config/database.yml',
|
220
148
|
force: true
|
@@ -234,58 +162,19 @@ config.public_file_server.headers = {
|
|
234
162
|
end
|
235
163
|
end
|
236
164
|
|
237
|
-
def
|
165
|
+
def ruby_version
|
238
166
|
create_file '.ruby-version', "#{Suspenders::RUBY_VERSION}\n"
|
239
167
|
end
|
240
168
|
|
241
|
-
def enable_database_cleaner
|
242
|
-
copy_file 'database_cleaner_rspec.rb', 'spec/support/database_cleaner.rb'
|
243
|
-
end
|
244
|
-
|
245
|
-
def provide_shoulda_matchers_config
|
246
|
-
copy_file(
|
247
|
-
"shoulda_matchers_config_rspec.rb",
|
248
|
-
"spec/support/shoulda_matchers.rb"
|
249
|
-
)
|
250
|
-
end
|
251
|
-
|
252
|
-
def configure_spec_support_features
|
253
|
-
empty_directory_with_keep_file 'spec/features'
|
254
|
-
empty_directory_with_keep_file 'spec/support/features'
|
255
|
-
end
|
256
|
-
|
257
|
-
def configure_rspec
|
258
|
-
remove_file "spec/rails_helper.rb"
|
259
|
-
remove_file "spec/spec_helper.rb"
|
260
|
-
copy_file "rails_helper.rb", "spec/rails_helper.rb"
|
261
|
-
copy_file "spec_helper.rb", "spec/spec_helper.rb"
|
262
|
-
end
|
263
|
-
|
264
|
-
def configure_ci
|
265
|
-
template "circle.yml.erb", "circle.yml"
|
266
|
-
end
|
267
|
-
|
268
|
-
def configure_i18n_for_test_environment
|
269
|
-
copy_file "i18n.rb", "spec/support/i18n.rb"
|
270
|
-
end
|
271
|
-
|
272
169
|
def configure_i18n_for_missing_translations
|
273
170
|
raise_on_missing_translations_in("development")
|
274
171
|
raise_on_missing_translations_in("test")
|
275
172
|
end
|
276
173
|
|
277
|
-
def configure_background_jobs_for_rspec
|
278
|
-
run 'rails g delayed_job:active_record'
|
279
|
-
end
|
280
|
-
|
281
174
|
def configure_action_mailer_in_specs
|
282
175
|
copy_file 'action_mailer.rb', 'spec/support/action_mailer.rb'
|
283
176
|
end
|
284
177
|
|
285
|
-
def configure_capybara
|
286
|
-
copy_file "capybara.rb", "spec/support/capybara.rb"
|
287
|
-
end
|
288
|
-
|
289
178
|
def configure_locales_and_time_zone
|
290
179
|
remove_file "config/locales/en.yml"
|
291
180
|
template "config_locales_it.yml.erb", "config/locales/it.yml"
|
@@ -299,34 +188,6 @@ config.public_file_server.headers = {
|
|
299
188
|
inject_into_class 'config/application.rb', 'Application', config
|
300
189
|
end
|
301
190
|
|
302
|
-
def configure_rack_timeout
|
303
|
-
rack_timeout_config = <<-RUBY
|
304
|
-
Rack::Timeout.timeout = (ENV["RACK_TIMEOUT"] || 10).to_i
|
305
|
-
RUBY
|
306
|
-
|
307
|
-
append_file "config/environments/production.rb", rack_timeout_config
|
308
|
-
end
|
309
|
-
|
310
|
-
def configure_slim
|
311
|
-
copy_file 'slim.rb', 'config/initializers/slim.rb'
|
312
|
-
end
|
313
|
-
|
314
|
-
def configure_simple_form
|
315
|
-
bundle_command "exec rails generate simple_form:install"
|
316
|
-
end
|
317
|
-
|
318
|
-
def configure_draper
|
319
|
-
bundle_command "exec rails generate draper:install"
|
320
|
-
end
|
321
|
-
|
322
|
-
def configure_active_interaction
|
323
|
-
copy_file "sample_service.rb", "app/services/sample_service.rb"
|
324
|
-
end
|
325
|
-
|
326
|
-
def configure_errbit
|
327
|
-
copy_file "errbit.rb", "config/initializers/errbit.rb"
|
328
|
-
end
|
329
|
-
|
330
191
|
def configure_action_mailer
|
331
192
|
action_mailer_host "development", %{"localhost:3000"}
|
332
193
|
action_mailer_asset_host "development", %{"http://localhost:3000"}
|
@@ -339,17 +200,6 @@ Rack::Timeout.timeout = (ENV["RACK_TIMEOUT"] || 10).to_i
|
|
339
200
|
)
|
340
201
|
end
|
341
202
|
|
342
|
-
def configure_active_job
|
343
|
-
configure_application_file(
|
344
|
-
"config.active_job.queue_adapter = :delayed_job"
|
345
|
-
)
|
346
|
-
configure_environment "test", "config.active_job.queue_adapter = :inline"
|
347
|
-
end
|
348
|
-
|
349
|
-
def generate_rspec
|
350
|
-
generate 'rspec:install'
|
351
|
-
end
|
352
|
-
|
353
203
|
def replace_default_puma_configuration
|
354
204
|
copy_file "puma.rb", "config/puma.rb", force: true
|
355
205
|
end
|
@@ -363,16 +213,17 @@ Rack::Timeout.timeout = (ENV["RACK_TIMEOUT"] || 10).to_i
|
|
363
213
|
'app/decorators',
|
364
214
|
'app/forms',
|
365
215
|
'app/queries',
|
366
|
-
'app/
|
216
|
+
'app/interactions',
|
367
217
|
'app/views/pages',
|
218
|
+
'spec/lib',
|
219
|
+
'spec/controllers',
|
220
|
+
'spec/helpers',
|
368
221
|
'spec/decorators',
|
369
|
-
'spec/fixtures',
|
370
222
|
'spec/forms',
|
371
|
-
'spec/helpers',
|
372
|
-
'spec/lib',
|
373
223
|
'spec/queries',
|
374
|
-
'spec/
|
375
|
-
'spec/
|
224
|
+
'spec/interactions',
|
225
|
+
'spec/fixtures',
|
226
|
+
'spec/factories',
|
376
227
|
'spec/support/matchers',
|
377
228
|
'spec/support/mixins',
|
378
229
|
'spec/support/shared_examples'
|
@@ -408,35 +259,10 @@ you can deploy to staging and production with:
|
|
408
259
|
run "chmod a+x bin/deploy"
|
409
260
|
end
|
410
261
|
|
411
|
-
def setup_brakeman
|
412
|
-
copy_file "brakeman.rake", "lib/tasks/brakeman.rake"
|
413
|
-
end
|
414
|
-
|
415
|
-
def setup_slim_lint
|
416
|
-
copy_file "slim-lint.rake", "lib/tasks/slim-lint.rake"
|
417
|
-
copy_file "slim-lint.yml", ".slim-lint.yml"
|
418
|
-
end
|
419
|
-
|
420
|
-
def setup_rubocop
|
421
|
-
copy_file "rubocop.rake", "lib/tasks/rubocop.rake"
|
422
|
-
copy_file "rubocop.yml", ".rubocop.yml"
|
423
|
-
copy_file "rubocop_todo.yml", ".rubocop_todo.yml"
|
424
|
-
end
|
425
|
-
|
426
|
-
def setup_bundler_audit
|
427
|
-
copy_file "bundler_audit.rake", "lib/tasks/bundler_audit.rake"
|
428
|
-
end
|
429
|
-
|
430
262
|
def setup_spring
|
431
263
|
bundle_command "exec spring binstub --all"
|
432
264
|
end
|
433
265
|
|
434
|
-
def create_binstubs
|
435
|
-
bundle_command "binstubs brakeman"
|
436
|
-
bundle_command "binstubs rubocop"
|
437
|
-
bundle_command "binstubs slim_lint"
|
438
|
-
end
|
439
|
-
|
440
266
|
def copy_miscellaneous_files
|
441
267
|
copy_file "browserslist", "browserslist"
|
442
268
|
copy_file "errors.rb", "config/initializers/errors.rb"
|
@@ -451,8 +277,11 @@ you can deploy to staging and production with:
|
|
451
277
|
EOS
|
452
278
|
|
453
279
|
%w(500 404 422).each do |page|
|
454
|
-
|
455
|
-
|
280
|
+
path = "public/#{page}.html"
|
281
|
+
if File.exist?(path)
|
282
|
+
inject_into_file path, meta_tags, after: "<head>\n"
|
283
|
+
replace_in_file path, /<!--.+-->\n/, ''
|
284
|
+
end
|
456
285
|
end
|
457
286
|
end
|
458
287
|
|