suspenders 1.34.0 → 1.35.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/NEWS.md +14 -4
- data/README.md +15 -12
- data/bin/setup +1 -1
- data/lib/suspenders/adapters/heroku.rb +55 -2
- data/lib/suspenders/app_builder.rb +15 -40
- data/lib/suspenders/generators/app_generator.rb +3 -1
- data/lib/suspenders/version.rb +1 -1
- data/spec/features/heroku_spec.rb +21 -0
- data/spec/features/new_project_spec.rb +24 -12
- data/spec/support/fake_heroku.rb +8 -0
- data/templates/Gemfile.erb +2 -3
- data/templates/app.json.erb +39 -0
- data/templates/{bin_setup.erb → bin_setup} +1 -6
- data/templates/bin_setup_review_app.erb +19 -0
- data/templates/circle.yml.erb +0 -3
- data/templates/{sample.env → dotfiles/.env} +2 -0
- data/templates/errors.rb +3 -3
- data/templates/i18n.rb +1 -1
- data/templates/suspenders_gitignore +1 -1
- data/templates/suspenders_layout.html.erb.erb +1 -1
- metadata +8 -7
- data/templates/config_i18n_tasks.yml +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d6e0976e91ec4917e8119de4459892b4c11f6e8
|
4
|
+
data.tar.gz: f94cb991a1498ca9337f6c5b06c5445cd7ab9a47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83fae0c577a776372fce11421f90f7e30a2f6dec55302638f54af395ae23a777a521b4717f6fafbfb561df229162a19d6373ec998db33c0c4e074feac858838d
|
7
|
+
data.tar.gz: dc25306dcd657edbc7d300ce384fe50a97060a8b4d0848da6e09489462c39d9a9cad3bd1f27f4d14dd7576110fba3703c6653920e9ea1d29314b5252abf54f80
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.3.0
|
data/.travis.yml
CHANGED
data/NEWS.md
CHANGED
@@ -1,17 +1,27 @@
|
|
1
|
-
1.
|
1
|
+
1.35.0 (December 30, 2015)
|
2
|
+
|
3
|
+
* Introduce Heroku Pipelines support
|
4
|
+
* Update to Ruby 2.3.0
|
5
|
+
* Heroku commands run on staging by default
|
6
|
+
* Git ignore `.env.local` instead of `.env`
|
7
|
+
* Add ability to use byebug navigation commands inside of Pry using the
|
8
|
+
`pry-byebug` gem
|
9
|
+
* Remove `i18n-tasks` from generated Gemfile
|
10
|
+
* Accessibility: Add `lang` attribute to `html` element in layout
|
11
|
+
|
12
|
+
1.34.0 (November 15, 2015)
|
2
13
|
|
3
14
|
* Fix `block_unknown_urls` deprecation warning with capybara_webkit when running
|
4
15
|
Javascript tests
|
5
16
|
* Inherit staging's `action_mailer_host` config from production
|
6
17
|
* Suspenders command line responds to `-v` and `--version` options
|
7
18
|
* Clean up `bin/rake`
|
8
|
-
* Remove email_validator gem from generated Gemfile
|
19
|
+
* Remove `email_validator` gem from generated Gemfile
|
9
20
|
* Fix Circle deploys by removing redundant remote
|
10
|
-
* Add bullet as development dependency
|
21
|
+
* Add `bullet` as development dependency
|
11
22
|
* Use Heroku Local (Forego) instead of Foreman
|
12
23
|
* Raise on missing Sprockets assets in test environment
|
13
24
|
|
14
|
-
|
15
25
|
1.33.0 (October 23, 2015)
|
16
26
|
|
17
27
|
* Add `quiet_assets` as development dependency
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Suspenders [![Build Status](https://secure.travis-ci.org/thoughtbot/suspenders.svg?branch=master)](http://travis-ci.org/thoughtbot/suspenders)
|
2
2
|
|
3
3
|
Suspenders is the base Rails application used at
|
4
|
-
[thoughtbot](
|
4
|
+
[thoughtbot](https://thoughtbot.com/).
|
5
5
|
|
6
6
|
![Suspenders boy](http://media.tumblr.com/1TEAMALpseh5xzf0Jt6bcwSMo1_400.png)
|
7
7
|
|
@@ -17,6 +17,12 @@ Then run:
|
|
17
17
|
|
18
18
|
This will create a Rails app in `projectname` using the latest version of Rails.
|
19
19
|
|
20
|
+
### Associated services
|
21
|
+
|
22
|
+
* Enable [Circle CI](https://circleci.com/) Continuous Integration
|
23
|
+
* Enable [GitHub auto deploys to Heroku staging and review
|
24
|
+
apps](https://dashboard.heroku.com/apps/app-name-staging/deploy/github).
|
25
|
+
|
20
26
|
## Gemfile
|
21
27
|
|
22
28
|
To see the latest and greatest gems, look at Suspenders'
|
@@ -41,7 +47,7 @@ It includes application gems like:
|
|
41
47
|
* [Postgres](https://github.com/ged/ruby-pg) for access to the Postgres database
|
42
48
|
* [Rack Canonical Host](https://github.com/tylerhunt/rack-canonical-host) to
|
43
49
|
ensure all requests are served from the same domain
|
44
|
-
* [Rack Timeout](https://github.com/
|
50
|
+
* [Rack Timeout](https://github.com/heroku/rack-timeout) to abort requests that are
|
45
51
|
taking too long
|
46
52
|
* [Recipient Interceptor](https://github.com/croaky/recipient_interceptor) to
|
47
53
|
avoid accidentally sending emails to real people from staging
|
@@ -60,6 +66,8 @@ And development gems like:
|
|
60
66
|
objects
|
61
67
|
* [ByeBug](https://github.com/deivid-rodriguez/byebug) for interactively
|
62
68
|
debugging behavior
|
69
|
+
* [Bullet](https://github.com/flyerhzm/bullet) for help to kill N+1 queries and
|
70
|
+
unused eager loading
|
63
71
|
* [Bundler Audit](https://github.com/rubysec/bundler-audit) for scanning the
|
64
72
|
Gemfile for insecure dependencies based on published CVEs
|
65
73
|
* [Spring](https://github.com/rails/spring) for fast Rails actions via
|
@@ -81,7 +89,7 @@ And testing gems like:
|
|
81
89
|
* [RSpec Mocks](https://github.com/rspec/rspec-mocks) for stubbing and spying
|
82
90
|
* [Shoulda Matchers](https://github.com/thoughtbot/shoulda-matchers) for common
|
83
91
|
RSpec matchers
|
84
|
-
* [Timecop](https://github.com/
|
92
|
+
* [Timecop](https://github.com/ferndopolis/timecop-console) for testing time
|
85
93
|
|
86
94
|
## Other goodies
|
87
95
|
|
@@ -102,8 +110,8 @@ Suspenders also comes with:
|
|
102
110
|
* The analytics adapter [Segment][segment] (and therefore config for Google
|
103
111
|
Analytics, Intercom, Facebook Ads, Twitter Ads, etc.)
|
104
112
|
|
105
|
-
[setup]:
|
106
|
-
[compress]:
|
113
|
+
[setup]: https://robots.thoughtbot.com/bin-setup
|
114
|
+
[compress]: https://robots.thoughtbot.com/content-compression-with-rack-deflater
|
107
115
|
[pool]: https://devcenter.heroku.com/articles/concurrency-and-database-connections
|
108
116
|
[binstub]: https://github.com/thoughtbot/suspenders/pull/282
|
109
117
|
[i18n]: https://github.com/thoughtbot/suspenders/pull/304
|
@@ -126,9 +134,11 @@ This:
|
|
126
134
|
* Adds the [Rails Stdout Logging][logging-gem] gem
|
127
135
|
to configure the app to log to standard out,
|
128
136
|
which is how [Heroku's logging][heroku-logging] works.
|
137
|
+
* Creates a [Heroku Pipeline] for review apps
|
129
138
|
|
130
139
|
[logging-gem]: https://github.com/heroku/rails_stdout_logging
|
131
140
|
[heroku-logging]: https://devcenter.heroku.com/articles/logging#writing-to-your-log
|
141
|
+
[Heroku Pipeline]: https://devcenter.heroku.com/articles/pipelines
|
132
142
|
|
133
143
|
You can optionally specify alternate Heroku flags:
|
134
144
|
|
@@ -200,13 +210,6 @@ Thank you, [contributors]!
|
|
200
210
|
|
201
211
|
[contributors]: https://github.com/thoughtbot/suspenders/graphs/contributors
|
202
212
|
|
203
|
-
## Need Help?
|
204
|
-
|
205
|
-
We offer 1-on-1 coaching. We can help you set up a new Rails application, write
|
206
|
-
your first feature, and get up and running on Heroku. [Get in touch].
|
207
|
-
|
208
|
-
[Get in touch]: http://coaching.thoughtbot.com/rails/?utm_source=github
|
209
|
-
|
210
213
|
## License
|
211
214
|
|
212
215
|
Suspenders is Copyright © 2008-2015 thoughtbot.
|
data/bin/setup
CHANGED
@@ -7,10 +7,10 @@ module Suspenders
|
|
7
7
|
|
8
8
|
def set_heroku_remotes
|
9
9
|
remotes = <<-SHELL.strip_heredoc
|
10
|
-
|
11
|
-
# Set up the staging and production apps.
|
12
10
|
#{command_to_join_heroku_app('staging')}
|
13
11
|
#{command_to_join_heroku_app('production')}
|
12
|
+
|
13
|
+
git config heroku.remote staging
|
14
14
|
SHELL
|
15
15
|
|
16
16
|
app_builder.append_file "bin/setup", remotes
|
@@ -24,6 +24,20 @@ module Suspenders
|
|
24
24
|
)
|
25
25
|
end
|
26
26
|
|
27
|
+
def create_staging_heroku_app(flags)
|
28
|
+
rack_env = "RACK_ENV=staging RAILS_ENV=staging"
|
29
|
+
app_name = heroku_app_name_for("staging")
|
30
|
+
|
31
|
+
run_toolbelt_command "create #{app_name} #{flags}", "staging"
|
32
|
+
run_toolbelt_command "config:add #{rack_env}", "staging"
|
33
|
+
end
|
34
|
+
|
35
|
+
def create_production_heroku_app(flags)
|
36
|
+
app_name = heroku_app_name_for("production")
|
37
|
+
|
38
|
+
run_toolbelt_command "create #{app_name} #{flags}", "production"
|
39
|
+
end
|
40
|
+
|
27
41
|
def set_heroku_rails_secrets
|
28
42
|
%w(staging production).each do |environment|
|
29
43
|
run_toolbelt_command(
|
@@ -33,6 +47,44 @@ module Suspenders
|
|
33
47
|
end
|
34
48
|
end
|
35
49
|
|
50
|
+
def provide_review_apps_setup_script
|
51
|
+
app_builder.template(
|
52
|
+
"bin_setup_review_app.erb",
|
53
|
+
"bin/setup_review_app",
|
54
|
+
force: true,
|
55
|
+
)
|
56
|
+
app_builder.run "chmod a+x bin/setup_review_app"
|
57
|
+
end
|
58
|
+
|
59
|
+
def create_heroku_pipelines_config_file
|
60
|
+
app_builder.template "app.json.erb", "app.json"
|
61
|
+
end
|
62
|
+
|
63
|
+
def create_heroku_pipeline
|
64
|
+
pipelines_plugin = `heroku plugins | grep pipelines`
|
65
|
+
if pipelines_plugin.empty?
|
66
|
+
puts "You need heroku pipelines plugin. Run: heroku plugins:install heroku-pipelines"
|
67
|
+
exit 1
|
68
|
+
end
|
69
|
+
|
70
|
+
heroku_app_name = app_builder.app_name.dasherize
|
71
|
+
%w(staging production).each do |environment|
|
72
|
+
run_toolbelt_command(
|
73
|
+
"pipelines:create #{heroku_app_name} -a #{heroku_app_name}-#{environment} --stage #{environment}",
|
74
|
+
environment,
|
75
|
+
)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def set_heroku_serve_static_files
|
80
|
+
%w(staging production).each do |environment|
|
81
|
+
run_toolbelt_command(
|
82
|
+
"config:add RAILS_SERVE_STATIC_FILES=true",
|
83
|
+
environment,
|
84
|
+
)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
36
88
|
private
|
37
89
|
|
38
90
|
attr_reader :app_builder
|
@@ -40,6 +92,7 @@ module Suspenders
|
|
40
92
|
def command_to_join_heroku_app(environment)
|
41
93
|
heroku_app_name = heroku_app_name_for(environment)
|
42
94
|
<<-SHELL
|
95
|
+
|
43
96
|
if heroku join --app #{heroku_app_name} &> /dev/null; then
|
44
97
|
git remote add #{environment} git@heroku.com:#{heroku_app_name}.git || true
|
45
98
|
printf 'You are a collaborator on the "#{heroku_app_name}" Heroku app\n'
|
@@ -6,9 +6,15 @@ module Suspenders
|
|
6
6
|
extend Forwardable
|
7
7
|
|
8
8
|
def_delegators :heroku_adapter,
|
9
|
+
:create_heroku_pipelines_config_file,
|
10
|
+
:create_heroku_pipeline,
|
11
|
+
:create_production_heroku_app,
|
12
|
+
:create_staging_heroku_app,
|
13
|
+
:provide_review_apps_setup_script,
|
14
|
+
:set_heroku_rails_secrets,
|
9
15
|
:set_heroku_remotes,
|
10
|
-
:
|
11
|
-
:
|
16
|
+
:set_heroku_serve_static_files,
|
17
|
+
:set_up_heroku_specific_gems
|
12
18
|
|
13
19
|
def readme
|
14
20
|
template 'README.md.erb', 'README.md'
|
@@ -69,7 +75,7 @@ module Suspenders
|
|
69
75
|
end
|
70
76
|
|
71
77
|
def provide_setup_script
|
72
|
-
template "bin_setup
|
78
|
+
template "bin_setup", "bin/setup", force: true
|
73
79
|
run "chmod a+x bin/setup"
|
74
80
|
end
|
75
81
|
|
@@ -130,6 +136,10 @@ module Suspenders
|
|
130
136
|
def enable_rack_canonical_host
|
131
137
|
config = <<-RUBY
|
132
138
|
|
139
|
+
if ENV.fetch("HEROKU_APP_NAME", "").include?("staging-pr-")
|
140
|
+
ENV["APPLICATION_HOST"] = ENV["HEROKU_APP_NAME"] + ".herokuapp.com"
|
141
|
+
end
|
142
|
+
|
133
143
|
# Ensure requests are only served from one, canonical host name
|
134
144
|
config.middleware.use Rack::CanonicalHost, ENV.fetch("APPLICATION_HOST")
|
135
145
|
RUBY
|
@@ -137,7 +147,7 @@ module Suspenders
|
|
137
147
|
inject_into_file(
|
138
148
|
"config/environments/production.rb",
|
139
149
|
config,
|
140
|
-
after:
|
150
|
+
after: "Rails.application.configure do",
|
141
151
|
)
|
142
152
|
end
|
143
153
|
|
@@ -266,11 +276,6 @@ end
|
|
266
276
|
raise_on_missing_translations_in("test")
|
267
277
|
end
|
268
278
|
|
269
|
-
def configure_i18n_tasks
|
270
|
-
run "cp $(i18n-tasks gem-path)/templates/rspec/i18n_spec.rb spec/"
|
271
|
-
copy_file "config_i18n_tasks.yml", "config/i18n-tasks.yml"
|
272
|
-
end
|
273
|
-
|
274
279
|
def configure_background_jobs_for_rspec
|
275
280
|
run 'rails g delayed_job:active_record'
|
276
281
|
end
|
@@ -330,8 +335,7 @@ Rack::Timeout.timeout = (ENV["RACK_TIMEOUT"] || 10).to_i
|
|
330
335
|
end
|
331
336
|
|
332
337
|
def set_up_forego
|
333
|
-
copy_file
|
334
|
-
copy_file 'Procfile', 'Procfile'
|
338
|
+
copy_file "Procfile", "Procfile"
|
335
339
|
end
|
336
340
|
|
337
341
|
def setup_stylesheets
|
@@ -375,31 +379,11 @@ Rack::Timeout.timeout = (ENV["RACK_TIMEOUT"] || 10).to_i
|
|
375
379
|
run 'git init'
|
376
380
|
end
|
377
381
|
|
378
|
-
def create_staging_heroku_app(flags)
|
379
|
-
rack_env = "RACK_ENV=staging RAILS_ENV=staging"
|
380
|
-
app_name = heroku_app_name_for("staging")
|
381
|
-
|
382
|
-
run_heroku "create #{app_name} #{flags}", "staging"
|
383
|
-
run_heroku "config:add #{rack_env}", "staging"
|
384
|
-
end
|
385
|
-
|
386
|
-
def create_production_heroku_app(flags)
|
387
|
-
app_name = heroku_app_name_for("production")
|
388
|
-
|
389
|
-
run_heroku "create #{app_name} #{flags}", "production"
|
390
|
-
end
|
391
|
-
|
392
382
|
def create_heroku_apps(flags)
|
393
383
|
create_staging_heroku_app(flags)
|
394
384
|
create_production_heroku_app(flags)
|
395
385
|
end
|
396
386
|
|
397
|
-
def set_heroku_serve_static_files
|
398
|
-
%w(staging production).each do |environment|
|
399
|
-
run_heroku "config:add RAILS_SERVE_STATIC_FILES=true", environment
|
400
|
-
end
|
401
|
-
end
|
402
|
-
|
403
387
|
def provide_deploy_script
|
404
388
|
copy_file "bin_deploy", "bin/deploy"
|
405
389
|
|
@@ -419,7 +403,6 @@ you can deploy to staging and production with:
|
|
419
403
|
end
|
420
404
|
|
421
405
|
def configure_automatic_deployment
|
422
|
-
staging_remote_name = heroku_app_name_for("staging")
|
423
406
|
deploy_command = <<-YML.strip_heredoc
|
424
407
|
deployment:
|
425
408
|
staging:
|
@@ -524,10 +507,6 @@ end
|
|
524
507
|
uncomment_lines("config/environments/#{environment}.rb", config)
|
525
508
|
end
|
526
509
|
|
527
|
-
def run_heroku(command, environment)
|
528
|
-
run "heroku #{command} --remote #{environment}"
|
529
|
-
end
|
530
|
-
|
531
510
|
def heroku_adapter
|
532
511
|
@heroku_adapter ||= Adapters::Heroku.new(self)
|
533
512
|
end
|
@@ -535,9 +514,5 @@ end
|
|
535
514
|
def serve_static_files_line
|
536
515
|
"config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?\n"
|
537
516
|
end
|
538
|
-
|
539
|
-
def heroku_app_name_for(environment)
|
540
|
-
"#{app_name.dasherize}-#{environment}"
|
541
|
-
end
|
542
517
|
end
|
543
518
|
end
|
@@ -105,7 +105,6 @@ module Suspenders
|
|
105
105
|
build :configure_spec_support_features
|
106
106
|
build :configure_ci
|
107
107
|
build :configure_i18n_for_test_environment
|
108
|
-
build :configure_i18n_tasks
|
109
108
|
build :configure_action_mailer_in_specs
|
110
109
|
build :configure_capybara_webkit
|
111
110
|
end
|
@@ -177,9 +176,12 @@ module Suspenders
|
|
177
176
|
if options[:heroku]
|
178
177
|
say "Creating Heroku apps"
|
179
178
|
build :create_heroku_apps, options[:heroku_flags]
|
179
|
+
build :provide_review_apps_setup_script
|
180
180
|
build :set_heroku_serve_static_files
|
181
181
|
build :set_heroku_remotes
|
182
182
|
build :set_heroku_rails_secrets
|
183
|
+
build :create_heroku_pipelines_config_file
|
184
|
+
build :create_heroku_pipeline
|
183
185
|
build :provide_deploy_script
|
184
186
|
build :configure_automatic_deployment
|
185
187
|
end
|
data/lib/suspenders/version.rb
CHANGED
@@ -20,12 +20,22 @@ RSpec.describe "Heroku" do
|
|
20
20
|
"production",
|
21
21
|
"SECRET_KEY_BASE",
|
22
22
|
)
|
23
|
+
expect(FakeHeroku).to have_setup_pipeline_for(app_name)
|
23
24
|
|
24
25
|
bin_setup_path = "#{project_path}/bin/setup"
|
25
26
|
bin_setup = IO.read(bin_setup_path)
|
26
27
|
|
27
28
|
expect(bin_setup).to include("heroku join --app #{app_name}-production")
|
28
29
|
expect(bin_setup).to include("heroku join --app #{app_name}-staging")
|
30
|
+
expect(bin_setup).to include("git config heroku.remote staging")
|
31
|
+
expect(File.stat(bin_setup_path)).to be_executable
|
32
|
+
|
33
|
+
bin_setup_path = "#{project_path}/bin/setup_review_app"
|
34
|
+
bin_setup = IO.read(bin_setup_path)
|
35
|
+
|
36
|
+
expect(bin_setup).to include("heroku run rake db:migrate --app #{app_name}-staging-pr-$1")
|
37
|
+
expect(bin_setup).to include("heroku ps:scale worker=1 --app #{app_name}-staging-pr-$1")
|
38
|
+
expect(bin_setup).to include("heroku restart --app #{app_name}-staging-pr-$1")
|
29
39
|
expect(File.stat(bin_setup_path)).to be_executable
|
30
40
|
|
31
41
|
bin_deploy_path = "#{project_path}/bin/deploy"
|
@@ -50,6 +60,17 @@ RSpec.describe "Heroku" do
|
|
50
60
|
- bin/deploy staging
|
51
61
|
YML
|
52
62
|
end
|
63
|
+
|
64
|
+
it "adds app.json file" do
|
65
|
+
expect(File).to exist("#{project_path}/app.json")
|
66
|
+
end
|
67
|
+
|
68
|
+
it "includes application name in app.json file" do
|
69
|
+
app_json_file = IO.read("#{project_path}/app.json")
|
70
|
+
app_name = SuspendersTestHelpers::APP_NAME.dasherize
|
71
|
+
|
72
|
+
expect(app_json_file).to match(/"name":"#{app_name}"/)
|
73
|
+
end
|
53
74
|
end
|
54
75
|
|
55
76
|
context "--heroku with region flag" do
|
@@ -30,7 +30,9 @@ RSpec.describe "Suspend a new project with default configuration" do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
it "copies dotfiles" do
|
33
|
-
|
33
|
+
%w[.ctags .env].each do |dotfile|
|
34
|
+
expect(File).to exist("#{project_path}/#{dotfile}")
|
35
|
+
end
|
34
36
|
end
|
35
37
|
|
36
38
|
it "loads secret_key_base from env" do
|
@@ -39,6 +41,16 @@ RSpec.describe "Suspend a new project with default configuration" do
|
|
39
41
|
expect(secrets_file).to match(/secret_key_base: <%= ENV\["SECRET_KEY_BASE"\] %>/)
|
40
42
|
end
|
41
43
|
|
44
|
+
it "adds bin/setup file" do
|
45
|
+
expect(File).to exist("#{project_path}/bin/setup")
|
46
|
+
end
|
47
|
+
|
48
|
+
it "makes bin/setup executable" do
|
49
|
+
bin_setup_path = "#{project_path}/bin/setup"
|
50
|
+
|
51
|
+
expect(File.stat(bin_setup_path)).to be_executable
|
52
|
+
end
|
53
|
+
|
42
54
|
it "adds support file for action mailer" do
|
43
55
|
expect(File).to exist("#{project_path}/spec/support/action_mailer.rb")
|
44
56
|
end
|
@@ -98,17 +110,8 @@ RSpec.describe "Suspend a new project with default configuration" do
|
|
98
110
|
end
|
99
111
|
end
|
100
112
|
|
101
|
-
it "adds specs for missing or unused translations" do
|
102
|
-
expect(File).to exist("#{project_path}/spec/i18n_spec.rb")
|
103
|
-
end
|
104
|
-
|
105
|
-
it "configs i18n-tasks" do
|
106
|
-
expect(File).to exist("#{project_path}/config/i18n-tasks.yml")
|
107
|
-
end
|
108
|
-
|
109
113
|
it "evaluates en.yml.erb" do
|
110
114
|
locales_en_file = IO.read("#{project_path}/config/locales/en.yml")
|
111
|
-
app_name = SuspendersTestHelpers::APP_NAME
|
112
115
|
|
113
116
|
expect(locales_en_file).to match(/application: #{app_name.humanize}/)
|
114
117
|
end
|
@@ -129,6 +132,12 @@ RSpec.describe "Suspend a new project with default configuration" do
|
|
129
132
|
expect(prod_env_file).not_to match(/"HOST"/)
|
130
133
|
end
|
131
134
|
|
135
|
+
it "configures language in html element" do
|
136
|
+
layout_path = "/app/views/layouts/application.html.erb"
|
137
|
+
layout_file = IO.read("#{project_path}#{layout_path}")
|
138
|
+
expect(layout_file).to match(/<html lang="en">/)
|
139
|
+
end
|
140
|
+
|
132
141
|
it "configs active job queue adapter" do
|
133
142
|
application_config = IO.read("#{project_path}/config/application.rb")
|
134
143
|
test_config = IO.read("#{project_path}/config/environments/test.rb")
|
@@ -160,10 +169,9 @@ RSpec.describe "Suspend a new project with default configuration" do
|
|
160
169
|
it "adds spring to binstubs" do
|
161
170
|
expect(File).to exist("#{project_path}/bin/spring")
|
162
171
|
|
163
|
-
spring_line = /^ +load File.expand_path\('\.\.\/spring', __FILE__\)$/
|
164
172
|
bin_stubs = %w(rake rails rspec)
|
165
173
|
bin_stubs.each do |bin_stub|
|
166
|
-
expect(IO.read("#{project_path}/bin/#{bin_stub}")).to match(
|
174
|
+
expect(IO.read("#{project_path}/bin/#{bin_stub}")).to match(/spring/)
|
167
175
|
end
|
168
176
|
end
|
169
177
|
|
@@ -186,6 +194,10 @@ RSpec.describe "Suspend a new project with default configuration" do
|
|
186
194
|
expect(File).to exist("#{project_path}/spec/factories.rb")
|
187
195
|
end
|
188
196
|
|
197
|
+
def app_name
|
198
|
+
SuspendersTestHelpers::APP_NAME
|
199
|
+
end
|
200
|
+
|
189
201
|
def analytics_partial
|
190
202
|
IO.read("#{project_path}/app/views/application/_analytics.html.erb")
|
191
203
|
end
|
data/spec/support/fake_heroku.rb
CHANGED
@@ -6,6 +6,9 @@ class FakeHeroku
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def run!
|
9
|
+
if @args.first == "plugins"
|
10
|
+
puts "heroku-pipelines@0.29.0"
|
11
|
+
end
|
9
12
|
File.open(RECORDER, 'a') do |file|
|
10
13
|
file.puts @args.join(' ')
|
11
14
|
end
|
@@ -39,6 +42,11 @@ class FakeHeroku
|
|
39
42
|
commands_ran =~ /^config:add #{var}=.+ --remote #{remote_name}\n/
|
40
43
|
end
|
41
44
|
|
45
|
+
def self.has_setup_pipeline_for?(app_name)
|
46
|
+
commands_ran =~ /^pipelines:create #{app_name} -a #{app_name}-staging --stage staging/ &&
|
47
|
+
commands_ran =~ /^pipelines:create #{app_name} -a #{app_name}-production --stage production/
|
48
|
+
end
|
49
|
+
|
42
50
|
def self.commands_ran
|
43
51
|
@commands_ran ||= File.read(RECORDER)
|
44
52
|
end
|
data/templates/Gemfile.erb
CHANGED
@@ -35,12 +35,11 @@ group :development, :test do
|
|
35
35
|
gem "awesome_print"
|
36
36
|
gem "bullet"
|
37
37
|
gem "bundler-audit", require: false
|
38
|
-
gem "byebug"
|
39
38
|
gem "dotenv-rails"
|
40
39
|
gem "factory_girl_rails"
|
41
|
-
gem "
|
40
|
+
gem "pry-byebug"
|
42
41
|
gem "pry-rails"
|
43
|
-
gem "rspec-rails", "~> 3.
|
42
|
+
gem "rspec-rails", "~> 3.4.0"
|
44
43
|
end
|
45
44
|
|
46
45
|
group :test do
|
@@ -0,0 +1,39 @@
|
|
1
|
+
{
|
2
|
+
"name":"<%= app_name.dasherize %>",
|
3
|
+
"scripts":{},
|
4
|
+
"env":{
|
5
|
+
"AIRBRAKE_API_KEY":{
|
6
|
+
"required":true
|
7
|
+
},
|
8
|
+
"EMAIL_RECIPIENTS":{
|
9
|
+
"required":true
|
10
|
+
},
|
11
|
+
"RACK_ENV":{
|
12
|
+
"required":true
|
13
|
+
},
|
14
|
+
"RAILS_ENV":{
|
15
|
+
"required":true
|
16
|
+
},
|
17
|
+
"SECRET_KEY_BASE":{
|
18
|
+
"generator":"secret"
|
19
|
+
},
|
20
|
+
"SMTP_ADDRESS":{
|
21
|
+
"required":true
|
22
|
+
},
|
23
|
+
"SMTP_DOMAIN":{
|
24
|
+
"required":true
|
25
|
+
},
|
26
|
+
"SMTP_PASSWORD":{
|
27
|
+
"required":true
|
28
|
+
},
|
29
|
+
"SMTP_USERNAME":{
|
30
|
+
"required":true
|
31
|
+
},
|
32
|
+
"WEB_CONCURRENCY":{
|
33
|
+
"required":true
|
34
|
+
}
|
35
|
+
},
|
36
|
+
"addons":[
|
37
|
+
"heroku-postgresql"
|
38
|
+
]
|
39
|
+
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#!/
|
1
|
+
#!/bin/sh
|
2
2
|
|
3
3
|
# Set up Rails app. Run this script immediately after cloning the codebase.
|
4
4
|
# https://github.com/thoughtbot/guides/tree/master/protocol
|
@@ -10,11 +10,6 @@ set -e
|
|
10
10
|
gem install bundler --conservative
|
11
11
|
bundle check || bundle install
|
12
12
|
|
13
|
-
# Set up configurable environment variables
|
14
|
-
if [ ! -f .env ]; then
|
15
|
-
cp .sample.env .env
|
16
|
-
fi
|
17
|
-
|
18
13
|
# Set up database and add any development seed data
|
19
14
|
bin/rake dev:prime
|
20
15
|
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
# Run this script to set up a review app's database and worker dyno
|
4
|
+
|
5
|
+
set -e
|
6
|
+
|
7
|
+
if [ -z "$1" ]; then
|
8
|
+
printf "You must provide a review app (same as the pull request) id.\n"
|
9
|
+
exit 64
|
10
|
+
fi
|
11
|
+
|
12
|
+
heroku pg:backups restore \
|
13
|
+
`heroku pg:backups public-url -a <%= app_name.dasherize %>-staging` \
|
14
|
+
DATABASE_URL \
|
15
|
+
--confirm <%= app_name.dasherize %>-staging-pr-$1 \
|
16
|
+
--app <%= app_name.dasherize %>-staging-pr-$1
|
17
|
+
heroku run rake db:migrate --app <%= app_name.dasherize %>-staging-pr-$1
|
18
|
+
heroku ps:scale worker=1 --app <%= app_name.dasherize %>-staging-pr-$1
|
19
|
+
heroku restart --app <%= app_name.dasherize %>-staging-pr-$1
|
data/templates/circle.yml.erb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# https://github.com/ddollar/forego
|
2
2
|
ASSET_HOST=localhost:3000
|
3
3
|
APPLICATION_HOST=localhost:3000
|
4
|
+
PORT=3000
|
4
5
|
RACK_ENV=development
|
5
6
|
SECRET_KEY_BASE=development_secret
|
6
7
|
EXECJS_RUNTIME=Node
|
@@ -8,3 +9,4 @@ SMTP_ADDRESS=smtp.example.com
|
|
8
9
|
SMTP_DOMAIN=example.com
|
9
10
|
SMTP_PASSWORD=password
|
10
11
|
SMTP_USERNAME=username
|
12
|
+
WEB_CONCURRENCY=1
|
data/templates/errors.rb
CHANGED
@@ -15,7 +15,7 @@ HTTP_ERRORS = [
|
|
15
15
|
Net::HTTPBadResponse,
|
16
16
|
Net::HTTPHeaderSyntaxError,
|
17
17
|
Net::ProtocolError,
|
18
|
-
Timeout::Error
|
18
|
+
Timeout::Error,
|
19
19
|
]
|
20
20
|
|
21
21
|
SMTP_SERVER_ERRORS = [
|
@@ -23,12 +23,12 @@ SMTP_SERVER_ERRORS = [
|
|
23
23
|
Net::SMTPAuthenticationError,
|
24
24
|
Net::SMTPServerBusy,
|
25
25
|
Net::SMTPUnknownError,
|
26
|
-
|
26
|
+
Timeout::Error,
|
27
27
|
]
|
28
28
|
|
29
29
|
SMTP_CLIENT_ERRORS = [
|
30
30
|
Net::SMTPFatalError,
|
31
|
-
Net::SMTPSyntaxError
|
31
|
+
Net::SMTPSyntaxError,
|
32
32
|
]
|
33
33
|
|
34
34
|
SMTP_ERRORS = SMTP_SERVER_ERRORS + SMTP_CLIENT_ERRORS
|
data/templates/i18n.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: suspenders
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.35.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- thoughtbot
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bitters
|
@@ -116,19 +116,21 @@ files:
|
|
116
116
|
- templates/_flashes.html.erb
|
117
117
|
- templates/_javascript.html.erb
|
118
118
|
- templates/action_mailer.rb
|
119
|
+
- templates/app.json.erb
|
119
120
|
- templates/application.scss
|
120
121
|
- templates/bin_deploy
|
121
|
-
- templates/bin_setup
|
122
|
+
- templates/bin_setup
|
123
|
+
- templates/bin_setup_review_app.erb
|
122
124
|
- templates/browserslist
|
123
125
|
- templates/bundler_audit.rake
|
124
126
|
- templates/capybara_webkit.rb
|
125
127
|
- templates/circle.yml.erb
|
126
|
-
- templates/config_i18n_tasks.yml
|
127
128
|
- templates/config_locales_en.yml.erb
|
128
129
|
- templates/database_cleaner_rspec.rb
|
129
130
|
- templates/dev.rake
|
130
131
|
- templates/disable_xml_params.rb
|
131
132
|
- templates/dotfiles/.ctags
|
133
|
+
- templates/dotfiles/.env
|
132
134
|
- templates/errors.rb
|
133
135
|
- templates/factories.rb
|
134
136
|
- templates/factory_girl_rspec.rb
|
@@ -140,7 +142,6 @@ files:
|
|
140
142
|
- templates/postgresql_database.yml.erb
|
141
143
|
- templates/puma.rb
|
142
144
|
- templates/rails_helper.rb
|
143
|
-
- templates/sample.env
|
144
145
|
- templates/secrets.yml
|
145
146
|
- templates/shoulda_matchers_config_rspec.rb
|
146
147
|
- templates/smtp.rb
|
@@ -161,7 +162,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
161
162
|
requirements:
|
162
163
|
- - ">="
|
163
164
|
- !ruby/object:Gem::Version
|
164
|
-
version: 2.
|
165
|
+
version: 2.3.0
|
165
166
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
166
167
|
requirements:
|
167
168
|
- - ">="
|
@@ -169,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
169
170
|
version: '0'
|
170
171
|
requirements: []
|
171
172
|
rubyforge_project:
|
172
|
-
rubygems_version: 2.
|
173
|
+
rubygems_version: 2.5.1
|
173
174
|
signing_key:
|
174
175
|
specification_version: 4
|
175
176
|
summary: Generate a Rails app using thoughtbot's best practices.
|