suspenders 1.33.0 → 1.34.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/NEWS.md +14 -0
- data/README.md +0 -2
- data/RELEASING.md +19 -0
- data/bin/suspenders +3 -3
- data/lib/suspenders.rb +1 -0
- data/lib/suspenders/adapters/heroku.rb +67 -0
- data/lib/suspenders/app_builder.rb +42 -53
- data/lib/suspenders/generators/app_generator.rb +6 -3
- data/lib/suspenders/version.rb +1 -1
- data/spec/adapters/heroku_spec.rb +52 -0
- data/spec/features/heroku_spec.rb +54 -40
- data/spec/features/new_project_spec.rb +21 -1
- data/spec/spec_helper.rb +1 -1
- data/spec/support/fake_heroku.rb +5 -3
- data/spec/support/suspenders.rb +12 -3
- data/templates/Gemfile.erb +1 -1
- data/templates/README.md.erb +3 -7
- data/templates/bin_setup.erb +1 -10
- data/templates/capybara_webkit.rb +5 -0
- data/templates/circle.yml.erb +1 -1
- data/templates/rails_helper.rb +0 -4
- data/templates/sample.env +1 -1
- data/templates/suspenders_gitignore +0 -1
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b45dd44edca5abdb998e4f4125948865647cf12c
|
4
|
+
data.tar.gz: 7b3357990de3de5de40a6b9129e4c12f6dcfbbaa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2e317030fcb84a99761ddbcad59747cddc75c8c543934912001c167169269b96d4a172dd1242eb5022b2efb115b95b91eea6d16eeef72a72805f627b2894c7d
|
7
|
+
data.tar.gz: 8d64ca336c16609af68560ab0b84289a2db6d0e6af7d48a0a9f70b58fc879de4a70966a5f8d53e6708aa885bd2faea7a80f21b3a97dab6587449b4764081c6ce
|
data/LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License
|
2
2
|
|
3
|
-
Copyright (c)
|
3
|
+
Copyright (c) 2008-2015 thoughtbot, inc.
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/NEWS.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
1.34.0 (unreleased)
|
2
|
+
|
3
|
+
* Fix `block_unknown_urls` deprecation warning with capybara_webkit when running
|
4
|
+
Javascript tests
|
5
|
+
* Inherit staging's `action_mailer_host` config from production
|
6
|
+
* Suspenders command line responds to `-v` and `--version` options
|
7
|
+
* Clean up `bin/rake`
|
8
|
+
* Remove email_validator gem from generated Gemfile
|
9
|
+
* Fix Circle deploys by removing redundant remote
|
10
|
+
* Add bullet as development dependency
|
11
|
+
* Use Heroku Local (Forego) instead of Foreman
|
12
|
+
* Raise on missing Sprockets assets in test environment
|
13
|
+
|
14
|
+
|
1
15
|
1.33.0 (October 23, 2015)
|
2
16
|
|
3
17
|
* Add `quiet_assets` as development dependency
|
data/README.md
CHANGED
@@ -31,8 +31,6 @@ It includes application gems like:
|
|
31
31
|
* [Bitters](https://github.com/thoughtbot/bitters) for scaffold application styles
|
32
32
|
* [Delayed Job](https://github.com/collectiveidea/delayed_job) for background
|
33
33
|
processing
|
34
|
-
* [Email Validator](https://github.com/balexand/email_validator) for email
|
35
|
-
validation
|
36
34
|
* [Flutie](https://github.com/thoughtbot/flutie) for `page_title` and `body_class` view
|
37
35
|
helpers
|
38
36
|
* [High Voltage](https://github.com/thoughtbot/high_voltage) for static pages
|
data/RELEASING.md
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# Releasing
|
2
|
+
|
3
|
+
1. Update `lib/suspenders/version.rb` file accordingly.
|
4
|
+
2. Update `NEWS.md` to reflect the changes since last release.
|
5
|
+
3. Commit changes. There shouldn't be code changes, and thus CI doesn't need to
|
6
|
+
run, you can then add `[ci skip]` to the commit message.
|
7
|
+
4. Tag the release: `git tag vVERSION -a`. The tag message should contain the
|
8
|
+
appropriate `NEWS.md` subsection.
|
9
|
+
5. Push changes: `git push --tags`
|
10
|
+
6. Build and publish to rubygems:
|
11
|
+
```bash
|
12
|
+
gem build suspenders.gemspec
|
13
|
+
gem push suspenders-*.gem
|
14
|
+
```
|
15
|
+
|
16
|
+
7. Add a new GitHub release:
|
17
|
+
https://github.com/thoughtbot/suspenders/releases/new?tag=vVERSION
|
18
|
+
8. Announce the new release, making sure to say "thank you" to the contributors
|
19
|
+
who helped shape this version!
|
data/bin/suspenders
CHANGED
@@ -6,9 +6,9 @@ $LOAD_PATH << source_path
|
|
6
6
|
|
7
7
|
require 'suspenders'
|
8
8
|
|
9
|
-
if ['
|
10
|
-
|
11
|
-
|
9
|
+
if ['-v', '--version'].include? ARGV[0]
|
10
|
+
puts Suspenders::VERSION
|
11
|
+
exit 0
|
12
12
|
end
|
13
13
|
|
14
14
|
templates_root = File.expand_path(File.join("..", "templates"), File.dirname(__FILE__))
|
data/lib/suspenders.rb
CHANGED
@@ -0,0 +1,67 @@
|
|
1
|
+
module Suspenders
|
2
|
+
module Adapters
|
3
|
+
class Heroku
|
4
|
+
def initialize(app_builder)
|
5
|
+
@app_builder = app_builder
|
6
|
+
end
|
7
|
+
|
8
|
+
def set_heroku_remotes
|
9
|
+
remotes = <<-SHELL.strip_heredoc
|
10
|
+
|
11
|
+
# Set up the staging and production apps.
|
12
|
+
#{command_to_join_heroku_app('staging')}
|
13
|
+
#{command_to_join_heroku_app('production')}
|
14
|
+
SHELL
|
15
|
+
|
16
|
+
app_builder.append_file "bin/setup", remotes
|
17
|
+
end
|
18
|
+
|
19
|
+
def set_up_heroku_specific_gems
|
20
|
+
app_builder.inject_into_file(
|
21
|
+
"Gemfile",
|
22
|
+
%{\n\s\sgem "rails_stdout_logging"},
|
23
|
+
after: /group :staging, :production do/,
|
24
|
+
)
|
25
|
+
end
|
26
|
+
|
27
|
+
def set_heroku_rails_secrets
|
28
|
+
%w(staging production).each do |environment|
|
29
|
+
run_toolbelt_command(
|
30
|
+
"config:add SECRET_KEY_BASE=#{generate_secret}",
|
31
|
+
environment,
|
32
|
+
)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
attr_reader :app_builder
|
39
|
+
|
40
|
+
def command_to_join_heroku_app(environment)
|
41
|
+
heroku_app_name = heroku_app_name_for(environment)
|
42
|
+
<<-SHELL
|
43
|
+
if heroku join --app #{heroku_app_name} &> /dev/null; then
|
44
|
+
git remote add #{environment} git@heroku.com:#{heroku_app_name}.git || true
|
45
|
+
printf 'You are a collaborator on the "#{heroku_app_name}" Heroku app\n'
|
46
|
+
else
|
47
|
+
printf 'Ask for access to the "#{heroku_app_name}" Heroku app\n'
|
48
|
+
fi
|
49
|
+
SHELL
|
50
|
+
end
|
51
|
+
|
52
|
+
def heroku_app_name_for(environment)
|
53
|
+
"#{app_builder.app_name.dasherize}-#{environment}"
|
54
|
+
end
|
55
|
+
|
56
|
+
def generate_secret
|
57
|
+
SecureRandom.hex(64)
|
58
|
+
end
|
59
|
+
|
60
|
+
def run_toolbelt_command(command, environment)
|
61
|
+
app_builder.run(
|
62
|
+
"heroku #{command} --remote #{environment}",
|
63
|
+
)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -1,11 +1,27 @@
|
|
1
|
+
require "forwardable"
|
2
|
+
|
1
3
|
module Suspenders
|
2
4
|
class AppBuilder < Rails::AppBuilder
|
3
5
|
include Suspenders::Actions
|
6
|
+
extend Forwardable
|
7
|
+
|
8
|
+
def_delegators :heroku_adapter,
|
9
|
+
:set_heroku_remotes,
|
10
|
+
:set_up_heroku_specific_gems,
|
11
|
+
:set_heroku_rails_secrets
|
4
12
|
|
5
13
|
def readme
|
6
14
|
template 'README.md.erb', 'README.md'
|
7
15
|
end
|
8
16
|
|
17
|
+
def raise_on_missing_assets_in_test
|
18
|
+
inject_into_file(
|
19
|
+
"config/environments/test.rb",
|
20
|
+
"\n config.assets.raise_runtime_errors = true",
|
21
|
+
after: "Rails.application.configure do",
|
22
|
+
)
|
23
|
+
end
|
24
|
+
|
9
25
|
def raise_on_delivery_errors
|
10
26
|
replace_in_file 'config/environments/development.rb',
|
11
27
|
'raise_delivery_errors = false', 'raise_delivery_errors = true'
|
@@ -19,6 +35,23 @@ module Suspenders
|
|
19
35
|
)
|
20
36
|
end
|
21
37
|
|
38
|
+
def add_bullet_gem_configuration
|
39
|
+
config = <<-RUBY
|
40
|
+
config.after_initialize do
|
41
|
+
Bullet.enable = true
|
42
|
+
Bullet.bullet_logger = true
|
43
|
+
Bullet.rails_logger = true
|
44
|
+
end
|
45
|
+
|
46
|
+
RUBY
|
47
|
+
|
48
|
+
inject_into_file(
|
49
|
+
"config/environments/development.rb",
|
50
|
+
config,
|
51
|
+
after: "config.action_mailer.raise_delivery_errors = true\n",
|
52
|
+
)
|
53
|
+
end
|
54
|
+
|
22
55
|
def raise_on_unpermitted_parameters
|
23
56
|
config = <<-RUBY
|
24
57
|
config.action_controller.action_on_unpermitted_parameters = :raise
|
@@ -197,14 +230,6 @@ end
|
|
197
230
|
create_file '.ruby-version', "#{Suspenders::RUBY_VERSION}\n"
|
198
231
|
end
|
199
232
|
|
200
|
-
def setup_heroku_specific_gems
|
201
|
-
inject_into_file(
|
202
|
-
"Gemfile",
|
203
|
-
%{\n\s\sgem "rails_stdout_logging"},
|
204
|
-
after: /group :staging, :production do/
|
205
|
-
)
|
206
|
-
end
|
207
|
-
|
208
233
|
def enable_database_cleaner
|
209
234
|
copy_file 'database_cleaner_rspec.rb', 'spec/support/database_cleaner.rb'
|
210
235
|
end
|
@@ -254,6 +279,10 @@ end
|
|
254
279
|
copy_file 'action_mailer.rb', 'spec/support/action_mailer.rb'
|
255
280
|
end
|
256
281
|
|
282
|
+
def configure_capybara_webkit
|
283
|
+
copy_file "capybara_webkit.rb", "spec/support/capybara_webkit.rb"
|
284
|
+
end
|
285
|
+
|
257
286
|
def configure_time_formats
|
258
287
|
remove_file "config/locales/en.yml"
|
259
288
|
template "config_locales_en.yml.erb", "config/locales/en.yml"
|
@@ -274,7 +303,6 @@ Rack::Timeout.timeout = (ENV["RACK_TIMEOUT"] || 10).to_i
|
|
274
303
|
def configure_action_mailer
|
275
304
|
action_mailer_host "development", %{"localhost:3000"}
|
276
305
|
action_mailer_host "test", %{"www.example.com"}
|
277
|
-
action_mailer_host "staging", %{ENV.fetch("APPLICATION_HOST")}
|
278
306
|
action_mailer_host "production", %{ENV.fetch("APPLICATION_HOST")}
|
279
307
|
end
|
280
308
|
|
@@ -301,7 +329,7 @@ Rack::Timeout.timeout = (ENV["RACK_TIMEOUT"] || 10).to_i
|
|
301
329
|
copy_file "puma.rb", "config/puma.rb"
|
302
330
|
end
|
303
331
|
|
304
|
-
def
|
332
|
+
def set_up_forego
|
305
333
|
copy_file 'sample.env', '.sample.env'
|
306
334
|
copy_file 'Procfile', 'Procfile'
|
307
335
|
end
|
@@ -366,35 +394,6 @@ Rack::Timeout.timeout = (ENV["RACK_TIMEOUT"] || 10).to_i
|
|
366
394
|
create_production_heroku_app(flags)
|
367
395
|
end
|
368
396
|
|
369
|
-
def set_heroku_remotes
|
370
|
-
remotes = <<-SHELL
|
371
|
-
|
372
|
-
# Set up the staging and production apps.
|
373
|
-
#{join_heroku_app('staging')}
|
374
|
-
#{join_heroku_app('production')}
|
375
|
-
SHELL
|
376
|
-
|
377
|
-
append_file 'bin/setup', remotes
|
378
|
-
end
|
379
|
-
|
380
|
-
def join_heroku_app(environment)
|
381
|
-
heroku_app_name = heroku_app_name_for(environment)
|
382
|
-
<<-SHELL
|
383
|
-
if heroku join --app #{heroku_app_name} &> /dev/null; then
|
384
|
-
git remote add #{environment} git@heroku.com:#{heroku_app_name}.git || true
|
385
|
-
printf 'You are a collaborator on the "#{heroku_app_name}" Heroku app\n'
|
386
|
-
else
|
387
|
-
printf 'Ask for access to the "#{heroku_app_name}" Heroku app\n'
|
388
|
-
fi
|
389
|
-
SHELL
|
390
|
-
end
|
391
|
-
|
392
|
-
def set_heroku_rails_secrets
|
393
|
-
%w(staging production).each do |environment|
|
394
|
-
run_heroku "config:add SECRET_KEY_BASE=#{generate_secret}", environment
|
395
|
-
end
|
396
|
-
end
|
397
|
-
|
398
397
|
def set_heroku_serve_static_files
|
399
398
|
%w(staging production).each do |environment|
|
400
399
|
run_heroku "config:add RAILS_SERVE_STATIC_FILES=true", environment
|
@@ -426,7 +425,6 @@ you can deploy to staging and production with:
|
|
426
425
|
staging:
|
427
426
|
branch: master
|
428
427
|
commands:
|
429
|
-
- git remote add staging git@heroku.com:#{staging_remote_name}.git
|
430
428
|
- bin/deploy staging
|
431
429
|
YML
|
432
430
|
|
@@ -434,8 +432,7 @@ you can deploy to staging and production with:
|
|
434
432
|
end
|
435
433
|
|
436
434
|
def create_github_repo(repo_name)
|
437
|
-
|
438
|
-
run "#{path_addition} hub create #{repo_name}"
|
435
|
+
run "hub create #{repo_name}"
|
439
436
|
end
|
440
437
|
|
441
438
|
def setup_segment
|
@@ -527,20 +524,12 @@ end
|
|
527
524
|
uncomment_lines("config/environments/#{environment}.rb", config)
|
528
525
|
end
|
529
526
|
|
530
|
-
def override_path_for_tests
|
531
|
-
if ENV['TESTING']
|
532
|
-
support_bin = File.expand_path(File.join('..', '..', 'spec', 'fakes', 'bin'))
|
533
|
-
"PATH=#{support_bin}:$PATH"
|
534
|
-
end
|
535
|
-
end
|
536
|
-
|
537
527
|
def run_heroku(command, environment)
|
538
|
-
|
539
|
-
run "#{path_addition} heroku #{command} --remote #{environment}"
|
528
|
+
run "heroku #{command} --remote #{environment}"
|
540
529
|
end
|
541
530
|
|
542
|
-
def
|
543
|
-
|
531
|
+
def heroku_adapter
|
532
|
+
@heroku_adapter ||= Adapters::Heroku.new(self)
|
544
533
|
end
|
545
534
|
|
546
535
|
def serve_static_files_line
|
@@ -61,10 +61,11 @@ module Suspenders
|
|
61
61
|
build :set_ruby_to_version_being_used
|
62
62
|
|
63
63
|
if options[:heroku]
|
64
|
-
build :
|
64
|
+
build :set_up_heroku_specific_gems
|
65
65
|
end
|
66
66
|
|
67
67
|
bundle_command 'install'
|
68
|
+
build :configure_simple_form
|
68
69
|
end
|
69
70
|
|
70
71
|
def setup_database
|
@@ -79,8 +80,10 @@ module Suspenders
|
|
79
80
|
|
80
81
|
def setup_development_environment
|
81
82
|
say 'Setting up the development environment'
|
83
|
+
build :raise_on_missing_assets_in_test
|
82
84
|
build :raise_on_delivery_errors
|
83
85
|
build :set_test_delivery_method
|
86
|
+
build :add_bullet_gem_configuration
|
84
87
|
build :raise_on_unpermitted_parameters
|
85
88
|
build :provide_setup_script
|
86
89
|
build :provide_dev_prime_task
|
@@ -104,6 +107,7 @@ module Suspenders
|
|
104
107
|
build :configure_i18n_for_test_environment
|
105
108
|
build :configure_i18n_tasks
|
106
109
|
build :configure_action_mailer_in_specs
|
110
|
+
build :configure_capybara_webkit
|
107
111
|
end
|
108
112
|
|
109
113
|
def setup_production_environment
|
@@ -139,12 +143,11 @@ module Suspenders
|
|
139
143
|
build :configure_action_mailer
|
140
144
|
build :configure_active_job
|
141
145
|
build :configure_time_formats
|
142
|
-
build :configure_simple_form
|
143
146
|
build :disable_xml_params
|
144
147
|
build :fix_i18n_deprecation_warning
|
145
148
|
build :setup_default_rake_task
|
146
149
|
build :configure_puma
|
147
|
-
build :
|
150
|
+
build :set_up_forego
|
148
151
|
end
|
149
152
|
|
150
153
|
def setup_stylesheets
|
data/lib/suspenders/version.rb
CHANGED
@@ -0,0 +1,52 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
module Suspenders
|
4
|
+
module Adapters
|
5
|
+
RSpec.describe Heroku do
|
6
|
+
it "sets the heroku remotes" do
|
7
|
+
setup_file = "bin/setup"
|
8
|
+
app_builder = double(app_name: app_name)
|
9
|
+
allow(app_builder).to receive(:append_file)
|
10
|
+
|
11
|
+
Heroku.new(app_builder).set_heroku_remotes
|
12
|
+
|
13
|
+
expect(app_builder).to have_received(:append_file).
|
14
|
+
with(setup_file, /heroku join --app #{app_name.dasherize}-production/)
|
15
|
+
expect(app_builder).to have_received(:append_file).
|
16
|
+
with(setup_file, /heroku join --app #{app_name.dasherize}-staging/)
|
17
|
+
end
|
18
|
+
|
19
|
+
it "sets up the heroku specific gems" do
|
20
|
+
app_builder = double(app_name: app_name)
|
21
|
+
allow(app_builder).to receive(:inject_into_file)
|
22
|
+
|
23
|
+
Heroku.new(app_builder).set_up_heroku_specific_gems
|
24
|
+
|
25
|
+
expect(app_builder).to have_received(:inject_into_file).
|
26
|
+
with("Gemfile", /rails_stdout_logging/, anything)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "sets the heroku rails secrets" do
|
30
|
+
app_builder = double(app_name: app_name)
|
31
|
+
allow(app_builder).to receive(:run)
|
32
|
+
|
33
|
+
Heroku.new(app_builder).set_heroku_rails_secrets
|
34
|
+
|
35
|
+
expect(app_builder).to(
|
36
|
+
have_configured_var("staging", "SECRET_KEY_BASE"),
|
37
|
+
)
|
38
|
+
expect(app_builder).to(
|
39
|
+
have_configured_var("production", "SECRET_KEY_BASE"),
|
40
|
+
)
|
41
|
+
end
|
42
|
+
|
43
|
+
def app_name
|
44
|
+
SuspendersTestHelpers::APP_NAME
|
45
|
+
end
|
46
|
+
|
47
|
+
def have_configured_var(remote_name, var)
|
48
|
+
have_received(:run).with(/config:add #{var}=.+ --remote #{remote_name}/)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -1,58 +1,72 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
RSpec.describe "Heroku" do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
context "--heroku" do
|
5
|
+
before(:all) do
|
6
|
+
clean_up
|
7
|
+
run_suspenders("--heroku=true")
|
8
|
+
end
|
8
9
|
|
9
|
-
|
10
|
-
|
10
|
+
it "suspends a project for Heroku" do
|
11
|
+
app_name = SuspendersTestHelpers::APP_NAME.dasherize
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
13
|
+
expect(FakeHeroku).to(
|
14
|
+
have_gem_included(project_path, "rails_stdout_logging"),
|
15
|
+
)
|
16
|
+
expect(FakeHeroku).to have_created_app_for("staging")
|
17
|
+
expect(FakeHeroku).to have_created_app_for("production")
|
18
|
+
expect(FakeHeroku).to have_configured_vars("staging", "SECRET_KEY_BASE")
|
19
|
+
expect(FakeHeroku).to have_configured_vars(
|
20
|
+
"production",
|
21
|
+
"SECRET_KEY_BASE",
|
22
|
+
)
|
19
23
|
|
20
|
-
|
21
|
-
|
22
|
-
app_name = SuspendersTestHelpers::APP_NAME.dasherize
|
24
|
+
bin_setup_path = "#{project_path}/bin/setup"
|
25
|
+
bin_setup = IO.read(bin_setup_path)
|
23
26
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
+
expect(bin_setup).to include("heroku join --app #{app_name}-production")
|
28
|
+
expect(bin_setup).to include("heroku join --app #{app_name}-staging")
|
29
|
+
expect(File.stat(bin_setup_path)).to be_executable
|
27
30
|
|
28
|
-
|
29
|
-
|
31
|
+
bin_deploy_path = "#{project_path}/bin/deploy"
|
32
|
+
bin_deploy = IO.read(bin_deploy_path)
|
30
33
|
|
31
|
-
|
32
|
-
|
34
|
+
expect(bin_deploy).to include("heroku run rake db:migrate")
|
35
|
+
expect(File.stat(bin_deploy_path)).to be_executable
|
33
36
|
|
34
|
-
|
37
|
+
readme = IO.read("#{project_path}/README.md")
|
35
38
|
|
36
|
-
|
37
|
-
|
39
|
+
expect(readme).to include("./bin/deploy staging")
|
40
|
+
expect(readme).to include("./bin/deploy production")
|
38
41
|
|
39
|
-
|
40
|
-
|
42
|
+
circle_yml_path = "#{project_path}/circle.yml"
|
43
|
+
circle_yml = IO.read(circle_yml_path)
|
41
44
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
45
|
+
expect(circle_yml).to include <<-YML.strip_heredoc
|
46
|
+
deployment:
|
47
|
+
staging:
|
48
|
+
branch: master
|
49
|
+
commands:
|
50
|
+
- bin/deploy staging
|
51
|
+
YML
|
52
|
+
end
|
50
53
|
end
|
51
54
|
|
52
|
-
|
53
|
-
|
55
|
+
context "--heroku with region flag" do
|
56
|
+
before(:all) do
|
57
|
+
clean_up
|
58
|
+
run_suspenders(%{--heroku=true --heroku-flags="--region eu"})
|
59
|
+
end
|
54
60
|
|
55
|
-
|
56
|
-
|
61
|
+
it "suspends a project with extra Heroku flags" do
|
62
|
+
expect(FakeHeroku).to have_created_app_for("staging", "--region eu")
|
63
|
+
expect(FakeHeroku).to have_created_app_for("production", "--region eu")
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def clean_up
|
68
|
+
drop_dummy_database
|
69
|
+
remove_project_directory
|
70
|
+
FakeHeroku.clear!
|
57
71
|
end
|
58
72
|
end
|
@@ -43,6 +43,10 @@ RSpec.describe "Suspend a new project with default configuration" do
|
|
43
43
|
expect(File).to exist("#{project_path}/spec/support/action_mailer.rb")
|
44
44
|
end
|
45
45
|
|
46
|
+
it "configures capybara-webkit" do
|
47
|
+
expect(File).to exist("#{project_path}/spec/support/capybara_webkit.rb")
|
48
|
+
end
|
49
|
+
|
46
50
|
it "adds support file for i18n" do
|
47
51
|
expect(File).to exist("#{project_path}/spec/support/i18n.rb")
|
48
52
|
end
|
@@ -137,10 +141,26 @@ RSpec.describe "Suspend a new project with default configuration" do
|
|
137
141
|
)
|
138
142
|
end
|
139
143
|
|
144
|
+
it "configs bullet gem in development" do
|
145
|
+
test_config = IO.read("#{project_path}/config/environments/development.rb")
|
146
|
+
|
147
|
+
expect(test_config).to match /^ +Bullet.enable = true$/
|
148
|
+
expect(test_config).to match /^ +Bullet.bullet_logger = true$/
|
149
|
+
expect(test_config).to match /^ +Bullet.rails_logger = true$/
|
150
|
+
end
|
151
|
+
|
152
|
+
it "configs missing assets to raise in test" do
|
153
|
+
test_config = IO.read("#{project_path}/config/environments/test.rb")
|
154
|
+
|
155
|
+
expect(test_config).to match(
|
156
|
+
/^ +config.assets.raise_runtime_errors = true$/,
|
157
|
+
)
|
158
|
+
end
|
159
|
+
|
140
160
|
it "adds spring to binstubs" do
|
141
161
|
expect(File).to exist("#{project_path}/bin/spring")
|
142
162
|
|
143
|
-
spring_line = /^ +load File.expand_path\(
|
163
|
+
spring_line = /^ +load File.expand_path\('\.\.\/spring', __FILE__\)$/
|
144
164
|
bin_stubs = %w(rake rails rspec)
|
145
165
|
bin_stubs.each do |bin_stub|
|
146
166
|
expect(IO.read("#{project_path}/bin/#{bin_stub}")).to match(spring_line)
|
data/spec/spec_helper.rb
CHANGED
data/spec/support/fake_heroku.rb
CHANGED
@@ -36,8 +36,10 @@ class FakeHeroku
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def self.has_configured_vars?(remote_name, var)
|
39
|
-
|
40
|
-
|
41
|
-
|
39
|
+
commands_ran =~ /^config:add #{var}=.+ --remote #{remote_name}\n/
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.commands_ran
|
43
|
+
@commands_ran ||= File.read(RECORDER)
|
42
44
|
end
|
43
45
|
end
|
data/spec/support/suspenders.rb
CHANGED
@@ -12,9 +12,10 @@ module SuspendersTestHelpers
|
|
12
12
|
def run_suspenders(arguments = nil)
|
13
13
|
Dir.chdir(tmp_path) do
|
14
14
|
Bundler.with_clean_env do
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
add_fakes_to_path
|
16
|
+
`
|
17
|
+
#{suspenders_bin} #{APP_NAME} #{arguments}
|
18
|
+
`
|
18
19
|
end
|
19
20
|
end
|
20
21
|
end
|
@@ -29,6 +30,10 @@ module SuspendersTestHelpers
|
|
29
30
|
end
|
30
31
|
end
|
31
32
|
|
33
|
+
def add_fakes_to_path
|
34
|
+
ENV["PATH"] = "#{support_bin}:#{ENV['PATH']}"
|
35
|
+
end
|
36
|
+
|
32
37
|
def project_path
|
33
38
|
@project_path ||= Pathname.new("#{tmp_path}/#{APP_NAME}")
|
34
39
|
end
|
@@ -43,6 +48,10 @@ module SuspendersTestHelpers
|
|
43
48
|
File.join(root_path, 'bin', 'suspenders')
|
44
49
|
end
|
45
50
|
|
51
|
+
def support_bin
|
52
|
+
File.join(root_path, "spec", "fakes", "bin")
|
53
|
+
end
|
54
|
+
|
46
55
|
def root_path
|
47
56
|
File.expand_path('../../../', __FILE__)
|
48
57
|
end
|
data/templates/Gemfile.erb
CHANGED
@@ -7,7 +7,6 @@ gem "autoprefixer-rails"
|
|
7
7
|
gem "bourbon", "~> 4.2.0"
|
8
8
|
gem "coffee-rails", "~> 4.1.0"
|
9
9
|
gem "delayed_job_active_record"
|
10
|
-
gem "email_validator"
|
11
10
|
gem "flutie"
|
12
11
|
gem "high_voltage"
|
13
12
|
gem "jquery-rails"
|
@@ -34,6 +33,7 @@ end
|
|
34
33
|
|
35
34
|
group :development, :test do
|
36
35
|
gem "awesome_print"
|
36
|
+
gem "bullet"
|
37
37
|
gem "bundler-audit", require: false
|
38
38
|
gem "byebug"
|
39
39
|
gem "dotenv-rails"
|
data/templates/README.md.erb
CHANGED
@@ -12,15 +12,11 @@ your machine with [this script].
|
|
12
12
|
|
13
13
|
[this script]: https://github.com/thoughtbot/laptop
|
14
14
|
|
15
|
-
After setting up, you can run the application using [
|
15
|
+
After setting up, you can run the application using [Heroku Local]:
|
16
16
|
|
17
|
-
%
|
17
|
+
% heroku local
|
18
18
|
|
19
|
-
|
20
|
-
is [purposefully excluded from the project's `Gemfile`][exclude].
|
21
|
-
|
22
|
-
[foreman]: https://github.com/ddollar/foreman
|
23
|
-
[exclude]: https://github.com/ddollar/foreman/pull/437#issuecomment-41110407
|
19
|
+
[Heroku Local]: https://devcenter.heroku.com/articles/heroku-local
|
24
20
|
|
25
21
|
## Guidelines
|
26
22
|
|
data/templates/bin_setup.erb
CHANGED
@@ -16,20 +16,11 @@ if [ ! -f .env ]; then
|
|
16
16
|
fi
|
17
17
|
|
18
18
|
# Set up database and add any development seed data
|
19
|
-
|
19
|
+
bin/rake dev:prime
|
20
20
|
|
21
21
|
# Add binstubs to PATH via export PATH=".git/safe/../../bin:$PATH" in ~/.zshenv
|
22
22
|
mkdir -p .git/safe
|
23
23
|
|
24
|
-
# Pick a port for Foreman
|
25
|
-
if ! grep --quiet --no-messages --fixed-strings 'port' .foreman; then
|
26
|
-
printf 'port: 3000\n' >> .foreman
|
27
|
-
fi
|
28
|
-
|
29
|
-
if ! command -v foreman > /dev/null; then
|
30
|
-
gem install foreman
|
31
|
-
fi
|
32
|
-
|
33
24
|
# Only if this isn't CI
|
34
25
|
# if [ -z "$CI" ]; then
|
35
26
|
# fi
|
data/templates/circle.yml.erb
CHANGED
data/templates/rails_helper.rb
CHANGED
@@ -13,9 +13,6 @@ module Features
|
|
13
13
|
end
|
14
14
|
|
15
15
|
RSpec.configure do |config|
|
16
|
-
config.before(:each, js: true) do
|
17
|
-
page.driver.block_unknown_urls
|
18
|
-
end
|
19
16
|
config.include Features, type: :feature
|
20
17
|
config.infer_base_class_for_anonymous_controllers = false
|
21
18
|
config.infer_spec_type_from_file_location!
|
@@ -23,4 +20,3 @@ RSpec.configure do |config|
|
|
23
20
|
end
|
24
21
|
|
25
22
|
ActiveRecord::Migration.maintain_test_schema!
|
26
|
-
Capybara.javascript_driver = :webkit
|
data/templates/sample.env
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.34.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-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bitters
|
@@ -86,6 +86,7 @@ files:
|
|
86
86
|
- LICENSE
|
87
87
|
- NEWS.md
|
88
88
|
- README.md
|
89
|
+
- RELEASING.md
|
89
90
|
- Rakefile
|
90
91
|
- bin/rake
|
91
92
|
- bin/rspec
|
@@ -93,9 +94,11 @@ files:
|
|
93
94
|
- bin/suspenders
|
94
95
|
- lib/suspenders.rb
|
95
96
|
- lib/suspenders/actions.rb
|
97
|
+
- lib/suspenders/adapters/heroku.rb
|
96
98
|
- lib/suspenders/app_builder.rb
|
97
99
|
- lib/suspenders/generators/app_generator.rb
|
98
100
|
- lib/suspenders/version.rb
|
101
|
+
- spec/adapters/heroku_spec.rb
|
99
102
|
- spec/fakes/bin/heroku
|
100
103
|
- spec/fakes/bin/hub
|
101
104
|
- spec/features/github_spec.rb
|
@@ -118,6 +121,7 @@ files:
|
|
118
121
|
- templates/bin_setup.erb
|
119
122
|
- templates/browserslist
|
120
123
|
- templates/bundler_audit.rake
|
124
|
+
- templates/capybara_webkit.rb
|
121
125
|
- templates/circle.yml.erb
|
122
126
|
- templates/config_i18n_tasks.yml
|
123
127
|
- templates/config_locales_en.yml.erb
|
@@ -170,6 +174,7 @@ signing_key:
|
|
170
174
|
specification_version: 4
|
171
175
|
summary: Generate a Rails app using thoughtbot's best practices.
|
172
176
|
test_files:
|
177
|
+
- spec/adapters/heroku_spec.rb
|
173
178
|
- spec/fakes/bin/heroku
|
174
179
|
- spec/fakes/bin/hub
|
175
180
|
- spec/features/github_spec.rb
|