welaika-suspenders 2.30.0 → 2.31.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +1 -1
- data/README.md +9 -42
- data/lib/suspenders.rb +1 -0
- data/lib/suspenders/generators/app_generator.rb +1 -0
- data/lib/suspenders/generators/decorator_generator.rb +1 -1
- data/lib/suspenders/generators/faker_generator.rb +1 -1
- data/lib/suspenders/generators/import_dump_generator.rb +25 -0
- data/lib/suspenders/generators/security_generator.rb +1 -1
- data/lib/suspenders/version.rb +2 -2
- data/spec/features/import_dump_spec.rb +20 -0
- data/spec/features/new_project_spec.rb +1 -1
- data/templates/README.md.erb +46 -6
- data/templates/bin_deploy +0 -0
- data/templates/bin_import_dump.erb +13 -0
- data/templates/email.rb +3 -1
- data/templates/gitlab-ci.yml.erb +14 -0
- data/templates/suspenders_gitignore +1 -0
- metadata +9 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 481695d6f96c668275a33508d56f895dc39e4db46449ef9ab2c9a033660ecef4
|
4
|
+
data.tar.gz: 25c5807eec92e54601a670a33909230c9152fd41adaf7bce883cdaf71be17308
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85bfef921287615e993923e897ba6e19228fc866bd8481678e56fef63794ce395c3672eb29645671ca20464f3b4861b42e51d448d691cfa377717f66ac4160fc
|
7
|
+
data.tar.gz: 9f01d5156c6515a5d5a30215228953c36015ca73dc13f71a79ebd4602c966ec0b3abe63b64feab78f187f990e0dea152481d773c20e87a83a86c485ca4216a20
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.6.
|
1
|
+
2.6.2
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -8,7 +8,7 @@ Big thanks to [thoughtbot](http://thoughtbot.com/community) for providing such a
|
|
8
8
|
|
9
9
|
First ensure you have PostgreSQL, npm, yarn and chromedriver
|
10
10
|
|
11
|
-
$ brew install postgresql
|
11
|
+
$ brew install postgresql@10
|
12
12
|
$ brew install node
|
13
13
|
$ npm install npm@latest -g # To update npm if you have already installed it
|
14
14
|
$ brew install yarn
|
@@ -47,47 +47,14 @@ If you want to add an empty bare repository as origin, run
|
|
47
47
|
|
48
48
|
git remote add origin git@github.com:welaika/projectname.git
|
49
49
|
|
50
|
+
## Sentry && Heroku
|
51
|
+
|
52
|
+
After deploying for the first time on Heroku, please run
|
53
|
+
|
54
|
+
`heroku labs:enable runtime-dyno-metadata`
|
55
|
+
|
56
|
+
for Sentry's release detection to work correctly.
|
57
|
+
|
50
58
|
## Version number
|
51
59
|
|
52
60
|
`welaika-suspenders` version number isn't related to thoughbot's [suspenders](https://github.com/thoughtbot/suspenders).
|
53
|
-
|
54
|
-
## Changelog
|
55
|
-
|
56
|
-
We merge commits from thoughbot's [suspenders](https://github.com/thoughtbot/suspenders) periodically.
|
57
|
-
|
58
|
-
List of changes we made since [this is commit](https://github.com/thoughtbot/suspenders/tree/d24d6eab4cc254f8bebfd73fd2b26fbbd2647e86):
|
59
|
-
- remove `host` key in database.yml
|
60
|
-
- add [priscilla](https://github.com/Arkham/priscilla) gem
|
61
|
-
- add [rails-i18n](https://github.com/svenfuchs/rails-i18n) gem and use italian, english as available locales
|
62
|
-
- add [letter_opener](https://github.com/ryanb/letter_opener) gem
|
63
|
-
- add [faker](https://github.com/stympy/faker) gem
|
64
|
-
- remove segment.io javascript code
|
65
|
-
- add [slim-rails](https://github.com/slim-template/slim-rails) gem
|
66
|
-
- add some html meta tags
|
67
|
-
- use EU region as default for Heroku
|
68
|
-
- use CDATA wrapper for javascript
|
69
|
-
- create common folders like `app/queries`, `app/interactions`, etc.
|
70
|
-
- use `application.sass` instead of `application.scss`
|
71
|
-
- add `brakeman` gem
|
72
|
-
- set `Rome` as `time_zone`
|
73
|
-
- set `:it` as `default_locale`
|
74
|
-
- add [simplecov](https://github.com/colszowka/simplecov)
|
75
|
-
- add [simplecov-json](https://github.com/vicentllongo/simplecov-json)
|
76
|
-
- add fixtures helper for `rspec`
|
77
|
-
- add queries helper for `rspec`
|
78
|
-
- configure asset host for capybara
|
79
|
-
- add helpers for capybara (`page!`, `screenshot!`)
|
80
|
-
- drop support for IE 9 in AutoPrefixer
|
81
|
-
- remove [hound](https://houndci.com) configuration
|
82
|
-
- add [draper](https://github.com/drapergem/draper) gem and rename `presenters` folder to `decorators`
|
83
|
-
- add [rubocop](https://github.com/bbatsov/rubocop) and a template of `.rubocop.yml`
|
84
|
-
- change rake default task: now includes rubocop and brakeman too
|
85
|
-
- prefer a single file for each `factory_girl` factories
|
86
|
-
- remove new-relic
|
87
|
-
- add [email-validator](https://github.com/balexand/email_validator) gem
|
88
|
-
- remove circle-ci
|
89
|
-
- remove bitters and refills
|
90
|
-
- lint factory girl's factories
|
91
|
-
- remove automatic deployment
|
92
|
-
- use airbrake instead of honeybadger
|
93
|
-
- use coffeescript instead of es6
|
data/lib/suspenders.rb
CHANGED
@@ -13,6 +13,7 @@ require "suspenders/generators/testing_generator"
|
|
13
13
|
require "suspenders/generators/decorator_generator"
|
14
14
|
require "suspenders/generators/faker_generator"
|
15
15
|
require "suspenders/generators/security_generator"
|
16
|
+
require "suspenders/generators/import_dump_generator"
|
16
17
|
require "suspenders/generators/production/force_tls_generator"
|
17
18
|
require "suspenders/generators/production/email_generator"
|
18
19
|
require "suspenders/generators/production/timeout_generator"
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require_relative "base"
|
2
|
+
|
3
|
+
module Suspenders
|
4
|
+
class ImportDumpGenerator < Generators::Base
|
5
|
+
def copy_script
|
6
|
+
template "bin_import_dump.erb", "bin/import_dump"
|
7
|
+
chmod "bin/import_dump", 0o755
|
8
|
+
end
|
9
|
+
|
10
|
+
def inform_user
|
11
|
+
instructions = <<~MARKDOWN
|
12
|
+
|
13
|
+
## Importing a dump from Heroku
|
14
|
+
|
15
|
+
If you have configured the heroku remotes successfully,
|
16
|
+
you can import a fresh dump from staging or production with:
|
17
|
+
|
18
|
+
% ./bin/import_dump staging
|
19
|
+
% ./bin/import_dump production
|
20
|
+
MARKDOWN
|
21
|
+
|
22
|
+
append_file "README.md", instructions
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/lib/suspenders/version.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
module Suspenders
|
2
2
|
RAILS_VERSION = "~> 5.2.2".freeze
|
3
|
-
POSTGRES_VERSION = "10.
|
3
|
+
POSTGRES_VERSION = "10.6".freeze # Used in CI
|
4
4
|
RUBY_VERSION = IO.
|
5
5
|
read("#{File.dirname(__FILE__)}/../../.ruby-version").
|
6
6
|
strip.
|
7
7
|
freeze
|
8
|
-
VERSION = "2.
|
8
|
+
VERSION = "2.31.0".freeze
|
9
9
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe "suspenders:import_dump", type: :generator do
|
4
|
+
it "generates the configuration for dump import from heroku" do
|
5
|
+
rm "bin/import_dump"
|
6
|
+
|
7
|
+
with_app { generate("suspenders:import_dump") }
|
8
|
+
|
9
|
+
expect("bin/import_dump").to exist_as_a_file
|
10
|
+
expect("bin/import_dump").to be_executable
|
11
|
+
end
|
12
|
+
|
13
|
+
it "destroys the configuration for dump import from heroku" do
|
14
|
+
touch "bin/import_dump"
|
15
|
+
|
16
|
+
with_app { destroy("suspenders:import_dump") }
|
17
|
+
|
18
|
+
expect("bin/import_dump").not_to exist_as_a_file
|
19
|
+
end
|
20
|
+
end
|
@@ -170,7 +170,7 @@ RSpec.describe "Suspend a new project with default configuration" do
|
|
170
170
|
email_config = IO.read(email_file)
|
171
171
|
|
172
172
|
expect(email_config).
|
173
|
-
to include(%{RecipientInterceptor.new(ENV["EMAIL_RECIPIENTS"]
|
173
|
+
to include(%{RecipientInterceptor.new(ENV["EMAIL_RECIPIENTS"], subject_prefix: '[STAGING]'})
|
174
174
|
end
|
175
175
|
|
176
176
|
it "configs bullet gem in development" do
|
data/templates/README.md.erb
CHANGED
@@ -14,12 +14,14 @@ or the [rvm guide](https://rvm.io/rvm/install).
|
|
14
14
|
|
15
15
|
To install Postgres:
|
16
16
|
|
17
|
-
$ brew install postgresql
|
17
|
+
$ brew install postgresql@10
|
18
18
|
|
19
19
|
To install Node:
|
20
20
|
|
21
21
|
$ brew install node
|
22
22
|
|
23
|
+
(or use [nvm](https://github.com/creationix/nvm) if you want).
|
24
|
+
|
23
25
|
To update Node:
|
24
26
|
|
25
27
|
$ npm install npm@latest -g
|
@@ -32,12 +34,50 @@ To install Chromedriver (for integration test):
|
|
32
34
|
|
33
35
|
$ brew cask install chromedriver
|
34
36
|
|
35
|
-
To install ImageMagick:
|
37
|
+
To install ImageMagick (delete if not applicable):
|
38
|
+
|
39
|
+
$ brew install imagemagick@6
|
40
|
+
|
41
|
+
After setting up, you can run the application using [Heroku Local](https://devcenter.heroku.com/articles/heroku-local):
|
42
|
+
|
43
|
+
$ heroku local
|
44
|
+
|
45
|
+
## Setup on Heroku (delete if not applicable):
|
46
|
+
|
47
|
+
### Database
|
48
|
+
|
49
|
+
https://elements.heroku.com/addons/heroku-postgresql
|
50
|
+
|
51
|
+
Choose the PostgreSQL version you want to use (e.g. 10):
|
52
|
+
|
53
|
+
$ heroku addons:create heroku-postgresql:hobby-dev --version=10 --remote=staging
|
54
|
+
$ heroku addons:create heroku-postgresql:hobby-dev --version=10 --remote=production
|
55
|
+
|
56
|
+
Further reading:
|
57
|
+
|
58
|
+
https://devcenter.heroku.com/articles/heroku-postgres-plans
|
59
|
+
|
60
|
+
### Logs
|
61
|
+
|
62
|
+
https://elements.heroku.com/addons/logentries
|
63
|
+
|
64
|
+
$ heroku addons:create logentries:le_tryit --remote=staging
|
65
|
+
$ heroku addons:create logentries:le_tryit --remote=production
|
66
|
+
|
67
|
+
### Cronjobs (if you need them):
|
68
|
+
|
69
|
+
https://elements.heroku.com/addons/scheduler
|
70
|
+
|
71
|
+
$ https://elements.heroku.com/addons/scheduler
|
72
|
+
|
73
|
+
### Sentry
|
74
|
+
|
75
|
+
For Sentry's release detection to work correctly, please run
|
36
76
|
|
37
|
-
$
|
77
|
+
$ heroku labs:enable runtime-dyno-metadata
|
38
78
|
|
39
|
-
|
79
|
+
### Redis (if you need for Sidekiq):
|
40
80
|
|
41
|
-
|
81
|
+
https://elements.heroku.com/addons/heroku-redis
|
42
82
|
|
43
|
-
|
83
|
+
$ heroku addons:create heroku-redis:hobby-dev
|
data/templates/bin_deploy
CHANGED
File without changes
|
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
# Downloads a live dump from Heroku remote
|
4
|
+
|
5
|
+
# Exit if any subcommand fails
|
6
|
+
set -e
|
7
|
+
|
8
|
+
target="${1:-staging}"
|
9
|
+
|
10
|
+
heroku pg:backups:capture --remote "$target"
|
11
|
+
heroku pg:backups:download --remote "$target"
|
12
|
+
pg_restore --verbose --clean --no-acl --no-owner -h localhost -U $(whoami) -d <%= app_name %>_development latest.dump
|
13
|
+
rm latest.dump
|
data/templates/email.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
if ENV["EMAIL_RECIPIENTS"].present?
|
4
|
-
Mail.register_interceptor
|
4
|
+
Mail.register_interceptor(
|
5
|
+
RecipientInterceptor.new(ENV["EMAIL_RECIPIENTS"], subject_prefix: '[STAGING]')
|
6
|
+
)
|
5
7
|
end
|
data/templates/gitlab-ci.yml.erb
CHANGED
@@ -9,6 +9,13 @@ variables:
|
|
9
9
|
POSTGRES_PASSWORD: ''
|
10
10
|
SELENIUM_REMOTE_URL: "http://selenium__standalone-chrome:4444/wd/hub/"
|
11
11
|
|
12
|
+
.job-creation-policy: &job-creation-policy
|
13
|
+
only:
|
14
|
+
- master
|
15
|
+
- merge_requests
|
16
|
+
except:
|
17
|
+
- staging
|
18
|
+
|
12
19
|
.services: &rails-services
|
13
20
|
- postgres:<%= Suspenders::POSTGRES_VERSION %>
|
14
21
|
- selenium/standalone-chrome:latest
|
@@ -26,6 +33,7 @@ stages:
|
|
26
33
|
- test
|
27
34
|
|
28
35
|
prepare:
|
36
|
+
<<: *job-creation-policy
|
29
37
|
stage: setup
|
30
38
|
cache:
|
31
39
|
<<: *cache-settings
|
@@ -34,6 +42,7 @@ prepare:
|
|
34
42
|
- bundle install --retry 3 --deployment --jobs $(nproc)
|
35
43
|
|
36
44
|
quality:rubocop:
|
45
|
+
<<: *job-creation-policy
|
37
46
|
stage: quality
|
38
47
|
cache:
|
39
48
|
<<: *cache-settings
|
@@ -42,6 +51,7 @@ quality:rubocop:
|
|
42
51
|
- bundle exec rubocop
|
43
52
|
|
44
53
|
quality:slim_lint:
|
54
|
+
<<: *job-creation-policy
|
45
55
|
stage: quality
|
46
56
|
cache:
|
47
57
|
<<: *cache-settings
|
@@ -50,6 +60,7 @@ quality:slim_lint:
|
|
50
60
|
- bundle exec slim-lint app/views/
|
51
61
|
|
52
62
|
quality:bundler-audit:
|
63
|
+
<<: *job-creation-policy
|
53
64
|
stage: quality
|
54
65
|
cache:
|
55
66
|
<<: *cache-settings
|
@@ -58,6 +69,7 @@ quality:bundler-audit:
|
|
58
69
|
- bundle exec bundle-audit check --update
|
59
70
|
|
60
71
|
quality:brakeman:
|
72
|
+
<<: *job-creation-policy
|
61
73
|
stage: quality
|
62
74
|
cache:
|
63
75
|
<<: *cache-settings
|
@@ -66,6 +78,7 @@ quality:brakeman:
|
|
66
78
|
- bundle exec brakeman -z --skip-files vendor/bundle
|
67
79
|
|
68
80
|
quality:rubycritic:
|
81
|
+
<<: *job-creation-policy
|
69
82
|
stage: quality
|
70
83
|
cache:
|
71
84
|
<<: *cache-settings
|
@@ -74,6 +87,7 @@ quality:rubycritic:
|
|
74
87
|
- bundle exec rubycritic app/ config/ lib/ --no-browser --minimum-score 94 --format console
|
75
88
|
|
76
89
|
test:rspec:
|
90
|
+
<<: *job-creation-policy
|
77
91
|
stage: test
|
78
92
|
services: *rails-services
|
79
93
|
cache:
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: welaika-suspenders
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.31.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- thoughtbot
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-03-
|
12
|
+
date: 2019-03-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -69,7 +69,7 @@ dependencies:
|
|
69
69
|
version: '1.8'
|
70
70
|
description: 'weLaika''s fork of the famous thoughbot suspenders gem.
|
71
71
|
|
72
|
-
'
|
72
|
+
'
|
73
73
|
email: info@welaika.com
|
74
74
|
executables:
|
75
75
|
- welaika-suspenders
|
@@ -106,6 +106,7 @@ files:
|
|
106
106
|
- lib/suspenders/generators/decorator_generator.rb
|
107
107
|
- lib/suspenders/generators/factories_generator.rb
|
108
108
|
- lib/suspenders/generators/faker_generator.rb
|
109
|
+
- lib/suspenders/generators/import_dump_generator.rb
|
109
110
|
- lib/suspenders/generators/js_driver_generator.rb
|
110
111
|
- lib/suspenders/generators/json_generator.rb
|
111
112
|
- lib/suspenders/generators/lint_generator.rb
|
@@ -128,6 +129,7 @@ files:
|
|
128
129
|
- spec/features/api_spec.rb
|
129
130
|
- spec/features/cli_help_spec.rb
|
130
131
|
- spec/features/heroku_spec.rb
|
132
|
+
- spec/features/import_dump_spec.rb
|
131
133
|
- spec/features/json_spec.rb
|
132
134
|
- spec/features/new_project_spec.rb
|
133
135
|
- spec/features/production/deployment_spec.rb
|
@@ -153,6 +155,7 @@ files:
|
|
153
155
|
- templates/action_mailer.rb
|
154
156
|
- templates/application.sass
|
155
157
|
- templates/bin_deploy
|
158
|
+
- templates/bin_import_dump.erb
|
156
159
|
- templates/bin_setup
|
157
160
|
- templates/bin_setup_review_app.erb
|
158
161
|
- templates/chromedriver.rb
|
@@ -204,14 +207,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
204
207
|
requirements:
|
205
208
|
- - ">="
|
206
209
|
- !ruby/object:Gem::Version
|
207
|
-
version: 2.6.
|
210
|
+
version: 2.6.2
|
208
211
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
209
212
|
requirements:
|
210
213
|
- - ">="
|
211
214
|
- !ruby/object:Gem::Version
|
212
215
|
version: 2.7.4
|
213
216
|
requirements: []
|
214
|
-
rubygems_version: 3.0.
|
217
|
+
rubygems_version: 3.0.3
|
215
218
|
signing_key:
|
216
219
|
specification_version: 4
|
217
220
|
summary: Generate a Rails app using thoughtbot's best practices.
|
@@ -221,6 +224,7 @@ test_files:
|
|
221
224
|
- spec/features/api_spec.rb
|
222
225
|
- spec/features/cli_help_spec.rb
|
223
226
|
- spec/features/heroku_spec.rb
|
227
|
+
- spec/features/import_dump_spec.rb
|
224
228
|
- spec/features/json_spec.rb
|
225
229
|
- spec/features/new_project_spec.rb
|
226
230
|
- spec/features/production/deployment_spec.rb
|