suspenders 1.46.0 → 1.47.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 +2 -1
- data/NEWS.md +12 -0
- data/README.md +1 -3
- data/RELEASING.md +6 -7
- data/lib/suspenders.rb +3 -1
- data/lib/suspenders/app_builder.rb +13 -28
- data/lib/suspenders/generators/app_generator.rb +7 -5
- data/lib/suspenders/generators/db_optimizations_generator.rb +1 -0
- data/lib/suspenders/generators/factories_generator.rb +1 -0
- data/lib/suspenders/generators/jobs_generator.rb +1 -0
- data/lib/suspenders/generators/js_driver_generator.rb +1 -0
- data/lib/suspenders/generators/production/email_generator.rb +30 -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/stylesheet_base_generator.rb +0 -6
- data/lib/suspenders/version.rb +2 -2
- data/spec/features/api_spec.rb +18 -0
- data/spec/features/new_project_spec.rb +9 -11
- data/spec/features/production/email_spec.rb +15 -0
- data/spec/support/match_contents_matcher.rb +6 -0
- data/spec/support/suspenders.rb +91 -30
- data/templates/Gemfile.erb +2 -4
- data/templates/application.scss +1 -2
- data/templates/email.rb +3 -0
- data/templates/smtp.rb +0 -4
- metadata +14 -19
- data/lib/suspenders/generators/enforce_ssl_generator.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e585c8f3e53dfd7aa542261c004856ddd5e6372373d5a09fb23ad4adcafbfde1
|
4
|
+
data.tar.gz: ec2ff003f5d6ba7870fef1d617f3c60580a0b0dad6837bcdc5fcaf1600e62539
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ec04e0b9b8e16290547280ad3e76ebaf74f7cc427840eb13f4bef533eff595dc4d3b6829470b715b46104246b8465dd356ecb71b86da025a20356e1b1cf2efb
|
7
|
+
data.tar.gz: c95149425b13ea6b3ebedbe86207cafc3bf616293c2afab63eaffeb156b7e11ca459fb6bc89a30e882640b72dceea0e65de0ab7c86713e5d152d737234ace46c
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.5.
|
1
|
+
2.5.1
|
data/.travis.yml
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
language: ruby
|
2
|
-
rvm: 2.5.
|
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
|
9
10
|
- gem update --system
|
10
11
|
install: bundle install
|
11
12
|
notifications:
|
data/NEWS.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
1.47.0 (May 25, 2018)
|
2
|
+
|
3
|
+
* Bug fix: normalize.css Sass import is concatenated with other styles now
|
4
|
+
* Bug fix: the suspenders gem itself is not needed in production
|
5
|
+
* Bug fix: bundle install after adding a gem
|
6
|
+
* Breaking: remove Refills
|
7
|
+
* Breaking: rename suspenders:enforce_ssl to suspenders:production:force_tls
|
8
|
+
* Upgrade: update to Ruby 2.5.1
|
9
|
+
* Upgrade: update to Rails 5.2.0
|
10
|
+
* New generator: production email
|
11
|
+
* New generator: production timeouts
|
12
|
+
|
1
13
|
1.46.0 (January 26, 2018)
|
2
14
|
|
3
15
|
* Bug fix: Fix for action mailer asset_host
|
data/README.md
CHANGED
@@ -50,8 +50,6 @@ It includes application gems like:
|
|
50
50
|
taking too long
|
51
51
|
* [Recipient Interceptor](https://github.com/croaky/recipient_interceptor) to
|
52
52
|
avoid accidentally sending emails to real people from staging
|
53
|
-
* [Refills](https://github.com/thoughtbot/refills) for “copy-paste” components
|
54
|
-
and patterns based on Bourbon, Neat and Bitters
|
55
53
|
* [Simple Form](https://github.com/plataformatec/simple_form) for form markup
|
56
54
|
and style
|
57
55
|
* [Skylight](https://www.skylight.io/) for monitoring performance
|
@@ -156,7 +154,7 @@ bypass this with the `--skip-git` option:
|
|
156
154
|
You can optionally create a GitHub repository for the suspended Rails app. It
|
157
155
|
requires that you have [Hub](https://github.com/github/hub) on your system:
|
158
156
|
|
159
|
-
curl
|
157
|
+
curl https://hub.github.com/standalone -sLo ~/bin/hub && chmod +x ~/bin/hub
|
160
158
|
suspenders app --github organization/project
|
161
159
|
|
162
160
|
This has the same effect as running:
|
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/lib/suspenders.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require "suspenders/version"
|
2
2
|
require "suspenders/generators/app_generator"
|
3
|
-
require "suspenders/generators/enforce_ssl_generator"
|
4
3
|
require "suspenders/generators/static_generator"
|
5
4
|
require "suspenders/generators/stylesheet_base_generator"
|
6
5
|
require "suspenders/generators/forms_generator"
|
@@ -13,6 +12,9 @@ require "suspenders/generators/analytics_generator"
|
|
13
12
|
require "suspenders/generators/views_generator"
|
14
13
|
require "suspenders/generators/js_driver_generator"
|
15
14
|
require "suspenders/generators/testing_generator"
|
15
|
+
require "suspenders/generators/production/force_tls_generator"
|
16
|
+
require "suspenders/generators/production/email_generator"
|
17
|
+
require "suspenders/generators/production/timeout_generator"
|
16
18
|
require "suspenders/actions"
|
17
19
|
require "suspenders/adapters/heroku"
|
18
20
|
require "suspenders/app_builder"
|
@@ -94,20 +94,8 @@ module Suspenders
|
|
94
94
|
inject_into_class 'config/application.rb', 'Application', config
|
95
95
|
end
|
96
96
|
|
97
|
-
def
|
98
|
-
copy_file
|
99
|
-
|
100
|
-
prepend_file 'config/environments/production.rb',
|
101
|
-
%{require Rails.root.join("config/smtp")\n}
|
102
|
-
|
103
|
-
config = <<-RUBY
|
104
|
-
|
105
|
-
config.action_mailer.delivery_method = :smtp
|
106
|
-
config.action_mailer.smtp_settings = SMTP_SETTINGS
|
107
|
-
RUBY
|
108
|
-
|
109
|
-
inject_into_file 'config/environments/production.rb', config,
|
110
|
-
after: "config.action_mailer.raise_delivery_errors = false"
|
97
|
+
def configure_local_mail
|
98
|
+
copy_file "email.rb", "config/initializers/email.rb"
|
111
99
|
end
|
112
100
|
|
113
101
|
def enable_rack_canonical_host
|
@@ -132,9 +120,11 @@ module Suspenders
|
|
132
120
|
"# config.action_controller.asset_host = 'http://assets.example.com'",
|
133
121
|
'config.action_controller.asset_host = ENV.fetch("ASSET_HOST", ENV.fetch("APPLICATION_HOST"))'
|
134
122
|
|
135
|
-
|
136
|
-
|
137
|
-
|
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
|
138
128
|
|
139
129
|
config = <<-EOD
|
140
130
|
config.public_file_server.headers = {
|
@@ -172,7 +162,7 @@ config.public_file_server.headers = {
|
|
172
162
|
end
|
173
163
|
end
|
174
164
|
|
175
|
-
def
|
165
|
+
def ruby_version
|
176
166
|
create_file '.ruby-version', "#{Suspenders::RUBY_VERSION}\n"
|
177
167
|
end
|
178
168
|
|
@@ -190,14 +180,6 @@ config.public_file_server.headers = {
|
|
190
180
|
template "config_locales_en.yml.erb", "config/locales/en.yml"
|
191
181
|
end
|
192
182
|
|
193
|
-
def configure_rack_timeout
|
194
|
-
rack_timeout_config = <<-RUBY
|
195
|
-
Rack::Timeout.timeout = (ENV["RACK_TIMEOUT"] || 10).to_i
|
196
|
-
RUBY
|
197
|
-
|
198
|
-
append_file "config/environments/production.rb", rack_timeout_config
|
199
|
-
end
|
200
|
-
|
201
183
|
def configure_action_mailer
|
202
184
|
action_mailer_host "development", %{"localhost:3000"}
|
203
185
|
action_mailer_asset_host "development", %{"http://localhost:3000"}
|
@@ -298,8 +280,11 @@ you can deploy to staging and production with:
|
|
298
280
|
EOS
|
299
281
|
|
300
282
|
%w(500 404 422).each do |page|
|
301
|
-
|
302
|
-
|
283
|
+
path = "public/#{page}.html"
|
284
|
+
if File.exist?(path)
|
285
|
+
inject_into_file path, meta_tags, after: "<head>\n"
|
286
|
+
replace_in_file path, /<!--.+-->\n/, ''
|
287
|
+
end
|
303
288
|
end
|
304
289
|
end
|
305
290
|
|
@@ -64,7 +64,6 @@ module Suspenders
|
|
64
64
|
|
65
65
|
def customize_gemfile
|
66
66
|
build :replace_gemfile, options[:path]
|
67
|
-
build :set_ruby_to_version_being_used
|
68
67
|
bundle_command 'install'
|
69
68
|
end
|
70
69
|
|
@@ -80,6 +79,7 @@ module Suspenders
|
|
80
79
|
|
81
80
|
def setup_development_environment
|
82
81
|
say 'Setting up the development environment'
|
82
|
+
build :configure_local_mail
|
83
83
|
build :raise_on_missing_assets_in_test
|
84
84
|
build :raise_on_delivery_errors
|
85
85
|
build :set_test_delivery_method
|
@@ -92,8 +92,6 @@ module Suspenders
|
|
92
92
|
|
93
93
|
def setup_production_environment
|
94
94
|
say 'Setting up the production environment'
|
95
|
-
build :configure_smtp
|
96
|
-
build :configure_rack_timeout
|
97
95
|
build :enable_rack_canonical_host
|
98
96
|
build :enable_rack_deflater
|
99
97
|
build :setup_asset_host
|
@@ -180,19 +178,23 @@ module Suspenders
|
|
180
178
|
|
181
179
|
def generate_default
|
182
180
|
run("spring stop")
|
183
|
-
generate("suspenders:enforce_ssl")
|
184
181
|
generate("suspenders:static")
|
185
182
|
generate("suspenders:stylesheet_base")
|
186
183
|
generate("suspenders:testing")
|
187
184
|
generate("suspenders:ci")
|
188
185
|
generate("suspenders:js_driver")
|
189
|
-
|
186
|
+
unless options[:api]
|
187
|
+
generate("suspenders:forms")
|
188
|
+
end
|
190
189
|
generate("suspenders:db_optimizations")
|
191
190
|
generate("suspenders:factories")
|
192
191
|
generate("suspenders:lint")
|
193
192
|
generate("suspenders:jobs")
|
194
193
|
generate("suspenders:analytics")
|
195
194
|
generate("suspenders:views")
|
195
|
+
generate("suspenders:production:force_tls")
|
196
|
+
generate("suspenders:production:email")
|
197
|
+
generate("suspenders:production:timeout")
|
196
198
|
end
|
197
199
|
|
198
200
|
def outro
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require "rails/generators"
|
2
|
+
|
3
|
+
module Suspenders
|
4
|
+
module Production
|
5
|
+
class EmailGenerator < Rails::Generators::Base
|
6
|
+
source_root File.expand_path(
|
7
|
+
File.join("..", "..", "..", "..", "templates"),
|
8
|
+
File.dirname(__FILE__),
|
9
|
+
)
|
10
|
+
|
11
|
+
def smtp_configuration
|
12
|
+
copy_file "smtp.rb", "config/smtp.rb"
|
13
|
+
|
14
|
+
prepend_file "config/environments/production.rb",
|
15
|
+
%{require Rails.root.join("config/smtp")\n}
|
16
|
+
end
|
17
|
+
|
18
|
+
def use_smtp
|
19
|
+
config = <<-RUBY
|
20
|
+
|
21
|
+
config.action_mailer.delivery_method = :smtp
|
22
|
+
config.action_mailer.smtp_settings = SMTP_SETTINGS
|
23
|
+
RUBY
|
24
|
+
|
25
|
+
inject_into_file "config/environments/production.rb", config,
|
26
|
+
after: "config.action_mailer.raise_delivery_errors = false"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require "rails/generators"
|
2
|
+
require_relative "../../actions"
|
3
|
+
|
4
|
+
module Suspenders
|
5
|
+
module Production
|
6
|
+
class ForceTlsGenerator < Rails::Generators::Base
|
7
|
+
include Suspenders::Actions
|
8
|
+
|
9
|
+
def config_enforce_ssl
|
10
|
+
configure_environment "production", "config.force_ssl = true"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require "rails/generators"
|
2
|
+
|
3
|
+
module Suspenders
|
4
|
+
module Production
|
5
|
+
class TimeoutGenerator < Rails::Generators::Base
|
6
|
+
def add_gem
|
7
|
+
gem "rack-timeout", group: :production
|
8
|
+
end
|
9
|
+
|
10
|
+
def configure_rack_timeout
|
11
|
+
append_file "config/environments/production.rb", rack_timeout_config
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def rack_timeout_config
|
17
|
+
%{Rack::Timeout.timeout = ENV.fetch("RACK_TIMEOUT", 10).to_i}
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -9,7 +9,6 @@ module Suspenders
|
|
9
9
|
def add_stylesheet_gems
|
10
10
|
gem "bourbon", "~> 5.0"
|
11
11
|
gem "neat", "~> 2.1"
|
12
|
-
gem "refills", group: [:development, :test]
|
13
12
|
Bundler.with_clean_env { run "bundle install" }
|
14
13
|
end
|
15
14
|
|
@@ -25,11 +24,6 @@ module Suspenders
|
|
25
24
|
remove_file "app/assets/stylesheets/application.css"
|
26
25
|
end
|
27
26
|
|
28
|
-
def install_refills
|
29
|
-
generate "refills:import", "flashes"
|
30
|
-
remove_dir "app/views/refills"
|
31
|
-
end
|
32
|
-
|
33
27
|
def install_bitters
|
34
28
|
run "bitters install --path app/assets/stylesheets"
|
35
29
|
end
|
data/lib/suspenders/version.rb
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe "Suspend a new project with --api flag" do
|
4
|
+
before(:all) do
|
5
|
+
drop_dummy_database
|
6
|
+
remove_project_directory
|
7
|
+
end
|
8
|
+
|
9
|
+
it "ensures project specs pass" do
|
10
|
+
run_suspenders("--api")
|
11
|
+
|
12
|
+
Dir.chdir(project_path) do
|
13
|
+
Bundler.with_clean_env do
|
14
|
+
expect(`rake`).to include("0 failures")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -178,10 +178,12 @@ RSpec.describe "Suspend a new project with default configuration" do
|
|
178
178
|
expect(production_config).not_to match(/"HOST"/)
|
179
179
|
end
|
180
180
|
|
181
|
-
it "configures email interceptor
|
182
|
-
|
183
|
-
|
184
|
-
|
181
|
+
it "configures email interceptor" do
|
182
|
+
email_file = File.join(project_path, "config", "initializers", "email.rb")
|
183
|
+
email_config = IO.read(email_file)
|
184
|
+
|
185
|
+
expect(email_config).
|
186
|
+
to include(%{RecipientInterceptor.new(ENV["EMAIL_RECIPIENTS"])})
|
185
187
|
end
|
186
188
|
|
187
189
|
it "configures language in html element" do
|
@@ -286,21 +288,17 @@ RSpec.describe "Suspend a new project with default configuration" do
|
|
286
288
|
expect(gemfile).to match(/high_voltage/)
|
287
289
|
end
|
288
290
|
|
289
|
-
it "adds and configures bourbon
|
291
|
+
it "adds and configures bourbon and neat" do
|
290
292
|
gemfile = read_project_file("Gemfile")
|
291
293
|
|
292
294
|
expect(gemfile).to match(/bourbon/)
|
293
295
|
expect(gemfile).to match(/neat/)
|
294
|
-
expect(gemfile).to match(/refills/)
|
295
296
|
end
|
296
297
|
|
297
|
-
it "configures bourbon, neat, and
|
298
|
-
flashes_path = %w(app assets stylesheets refills _flashes.scss)
|
299
|
-
expect(read_project_file(flashes_path)).to match(/\$flashes/m)
|
300
|
-
|
298
|
+
it "configures bourbon, neat, and bitters" do
|
301
299
|
app_css = read_project_file(%w(app assets stylesheets application.scss))
|
302
300
|
expect(app_css).to match(
|
303
|
-
/normalize\.css\/normalize
|
301
|
+
/normalize\.css\/normalize.*bourbon.*neat.*base/m,
|
304
302
|
)
|
305
303
|
end
|
306
304
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe "suspenders:production:email" do
|
4
|
+
it "generates the configuration for a production email deployment" do
|
5
|
+
with_app { generate("suspenders:production:email") }
|
6
|
+
|
7
|
+
expect("config/smtp.rb").to match_contents(%r{SMTP_SETTINGS\s*=})
|
8
|
+
expect("config/environments/production.rb").to \
|
9
|
+
match_contents(%r{require.+config/smtp})
|
10
|
+
expect("config/environments/production.rb").to \
|
11
|
+
match_contents(%r{action_mailer.delivery_method\s*=\s*:smtp})
|
12
|
+
expect("config/environments/production.rb").to \
|
13
|
+
match_contents(%r{action_mailer.smtp_settings\s*=\s*SMTP_SETTINGS})
|
14
|
+
end
|
15
|
+
end
|
data/spec/support/suspenders.rb
CHANGED
@@ -11,52 +11,81 @@ module SuspendersTestHelpers
|
|
11
11
|
|
12
12
|
def run_suspenders(arguments = nil)
|
13
13
|
arguments = "--path=#{root_path} #{arguments}"
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
14
|
+
run_in_tmp do
|
15
|
+
add_fakes_to_path
|
16
|
+
|
17
|
+
with_revision_for_honeybadger do
|
18
|
+
debug `#{suspenders_bin} #{APP_NAME} #{arguments}`
|
19
|
+
end
|
20
|
+
|
21
|
+
Dir.chdir(APP_NAME) do
|
22
|
+
with_env("HOME", tmp_path) do
|
23
|
+
debug `git add .`
|
24
|
+
debug `git commit -m 'Initial commit'`
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def with_app
|
31
|
+
drop_dummy_database
|
32
|
+
remove_project_directory
|
33
|
+
rails_new
|
34
|
+
setup_app_dependencies
|
35
|
+
|
36
|
+
yield
|
37
|
+
end
|
38
|
+
|
39
|
+
def rails_new
|
40
|
+
run_in_tmp do
|
41
|
+
add_fakes_to_path
|
42
|
+
|
43
|
+
with_revision_for_honeybadger do
|
44
|
+
debug `#{system_rails_bin} new #{APP_NAME}`
|
45
|
+
end
|
46
|
+
|
47
|
+
Dir.chdir(APP_NAME) do
|
48
|
+
File.open("Gemfile", "a") do |file|
|
49
|
+
file.puts %{gem "suspenders", path: #{root_path.inspect}}
|
21
50
|
end
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
end
|
51
|
+
|
52
|
+
with_env("HOME", tmp_path) do
|
53
|
+
debug `git add .`
|
54
|
+
debug `git commit -m 'Initial commit'`
|
27
55
|
end
|
28
56
|
end
|
29
57
|
end
|
30
58
|
end
|
31
59
|
|
32
|
-
def
|
33
|
-
|
34
|
-
|
35
|
-
`
|
36
|
-
|
37
|
-
`
|
60
|
+
def generate(generator)
|
61
|
+
run_in_project do
|
62
|
+
with_revision_for_honeybadger do
|
63
|
+
debug `bin/spring stop`
|
64
|
+
debug `#{project_rails_bin} generate #{generator}`
|
38
65
|
end
|
39
66
|
end
|
40
67
|
end
|
41
68
|
|
69
|
+
def suspenders_help_command
|
70
|
+
run_in_tmp do
|
71
|
+
debug `#{suspenders_bin} -h`
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
42
75
|
def setup_app_dependencies
|
43
|
-
|
44
|
-
|
45
|
-
Bundler.with_clean_env do
|
46
|
-
`bundle check || bundle install`
|
47
|
-
end
|
48
|
-
end
|
76
|
+
run_in_project do
|
77
|
+
debug `bundle check || bundle install`
|
49
78
|
end
|
79
|
+
rescue Errno::ENOENT
|
80
|
+
# The project_path might not exist, in which case we can skip this.
|
50
81
|
end
|
51
82
|
|
52
83
|
def drop_dummy_database
|
53
|
-
|
54
|
-
|
55
|
-
Bundler.with_clean_env do
|
56
|
-
`rails db:drop`
|
57
|
-
end
|
58
|
-
end
|
84
|
+
run_in_project do
|
85
|
+
debug `#{project_rails_bin} db:drop 2>&1`
|
59
86
|
end
|
87
|
+
rescue Errno::ENOENT
|
88
|
+
# The project_path might not exist, in which case we can skip this.
|
60
89
|
end
|
61
90
|
|
62
91
|
def add_fakes_to_path
|
@@ -81,6 +110,14 @@ module SuspendersTestHelpers
|
|
81
110
|
File.join(root_path, 'bin', 'suspenders')
|
82
111
|
end
|
83
112
|
|
113
|
+
def system_rails_bin
|
114
|
+
"rails"
|
115
|
+
end
|
116
|
+
|
117
|
+
def project_rails_bin
|
118
|
+
"bin/rails"
|
119
|
+
end
|
120
|
+
|
84
121
|
def support_bin
|
85
122
|
File.join(root_path, "spec", "fakes", "bin")
|
86
123
|
end
|
@@ -109,4 +146,28 @@ module SuspendersTestHelpers
|
|
109
146
|
yield
|
110
147
|
end
|
111
148
|
end
|
149
|
+
|
150
|
+
def run_in_tmp
|
151
|
+
Dir.chdir(tmp_path) do
|
152
|
+
Bundler.with_clean_env do
|
153
|
+
yield
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
def run_in_project
|
159
|
+
Dir.chdir(project_path) do
|
160
|
+
Bundler.with_clean_env do
|
161
|
+
yield
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
def debug(output)
|
167
|
+
if ENV["DEBUG"]
|
168
|
+
warn output
|
169
|
+
end
|
170
|
+
|
171
|
+
output
|
172
|
+
end
|
112
173
|
end
|
data/templates/Gemfile.erb
CHANGED
@@ -19,9 +19,9 @@ gem "recipient_interceptor"
|
|
19
19
|
gem "sass-rails", "~> 5.0"
|
20
20
|
gem "skylight"
|
21
21
|
gem "sprockets", ">= 3.0.0"
|
22
|
-
gem "suspenders"
|
23
22
|
gem "title"
|
24
23
|
gem "uglifier"
|
24
|
+
gem "bootsnap", require: false
|
25
25
|
<% if options[:webpack] %>
|
26
26
|
gem "webpacker"
|
27
27
|
<% end %>
|
@@ -49,6 +49,4 @@ group :test do
|
|
49
49
|
gem "webmock"
|
50
50
|
end
|
51
51
|
|
52
|
-
group :
|
53
|
-
gem "rack-timeout"
|
54
|
-
end
|
52
|
+
gem "suspenders", group: [:development, :test]
|
data/templates/application.scss
CHANGED
data/templates/email.rb
ADDED
data/templates/smtp.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.47.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- thoughtbot
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bitters
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 5.
|
33
|
+
version: 5.2.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 5.
|
40
|
+
version: 5.2.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -87,12 +87,14 @@ files:
|
|
87
87
|
- lib/suspenders/generators/app_generator.rb
|
88
88
|
- lib/suspenders/generators/ci_generator.rb
|
89
89
|
- lib/suspenders/generators/db_optimizations_generator.rb
|
90
|
-
- lib/suspenders/generators/enforce_ssl_generator.rb
|
91
90
|
- lib/suspenders/generators/factories_generator.rb
|
92
91
|
- lib/suspenders/generators/forms_generator.rb
|
93
92
|
- lib/suspenders/generators/jobs_generator.rb
|
94
93
|
- lib/suspenders/generators/js_driver_generator.rb
|
95
94
|
- lib/suspenders/generators/lint_generator.rb
|
95
|
+
- lib/suspenders/generators/production/email_generator.rb
|
96
|
+
- lib/suspenders/generators/production/force_tls_generator.rb
|
97
|
+
- lib/suspenders/generators/production/timeout_generator.rb
|
96
98
|
- lib/suspenders/generators/static_generator.rb
|
97
99
|
- lib/suspenders/generators/stylesheet_base_generator.rb
|
98
100
|
- lib/suspenders/generators/testing_generator.rb
|
@@ -101,13 +103,16 @@ files:
|
|
101
103
|
- spec/adapters/heroku_spec.rb
|
102
104
|
- spec/fakes/bin/heroku
|
103
105
|
- spec/fakes/bin/hub
|
106
|
+
- spec/features/api_spec.rb
|
104
107
|
- spec/features/cli_help_spec.rb
|
105
108
|
- spec/features/github_spec.rb
|
106
109
|
- spec/features/heroku_spec.rb
|
107
110
|
- spec/features/new_project_spec.rb
|
111
|
+
- spec/features/production/email_spec.rb
|
108
112
|
- spec/spec_helper.rb
|
109
113
|
- spec/support/fake_github.rb
|
110
114
|
- spec/support/fake_heroku.rb
|
115
|
+
- spec/support/match_contents_matcher.rb
|
111
116
|
- spec/support/suspenders.rb
|
112
117
|
- suspenders.gemspec
|
113
118
|
- templates/Gemfile.erb
|
@@ -132,6 +137,7 @@ files:
|
|
132
137
|
- templates/dev.rake
|
133
138
|
- templates/dotfiles/.ctags
|
134
139
|
- templates/dotfiles/.env
|
140
|
+
- templates/email.rb
|
135
141
|
- templates/errors.rb
|
136
142
|
- templates/factories.rb
|
137
143
|
- templates/factory_bot_rspec.rb
|
@@ -162,7 +168,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
162
168
|
requirements:
|
163
169
|
- - ">="
|
164
170
|
- !ruby/object:Gem::Version
|
165
|
-
version: 2.5.
|
171
|
+
version: 2.5.1
|
166
172
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
167
173
|
requirements:
|
168
174
|
- - ">="
|
@@ -170,19 +176,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
170
176
|
version: 2.7.4
|
171
177
|
requirements: []
|
172
178
|
rubyforge_project:
|
173
|
-
rubygems_version: 2.7.
|
179
|
+
rubygems_version: 2.7.6
|
174
180
|
signing_key:
|
175
181
|
specification_version: 4
|
176
182
|
summary: Generate a Rails app using thoughtbot's best practices.
|
177
|
-
test_files:
|
178
|
-
- spec/adapters/heroku_spec.rb
|
179
|
-
- spec/fakes/bin/heroku
|
180
|
-
- spec/fakes/bin/hub
|
181
|
-
- spec/features/cli_help_spec.rb
|
182
|
-
- spec/features/github_spec.rb
|
183
|
-
- spec/features/heroku_spec.rb
|
184
|
-
- spec/features/new_project_spec.rb
|
185
|
-
- spec/spec_helper.rb
|
186
|
-
- spec/support/fake_github.rb
|
187
|
-
- spec/support/fake_heroku.rb
|
188
|
-
- spec/support/suspenders.rb
|
183
|
+
test_files: []
|
@@ -1,12 +0,0 @@
|
|
1
|
-
require "rails/generators"
|
2
|
-
require_relative "../actions"
|
3
|
-
|
4
|
-
module Suspenders
|
5
|
-
class EnforceSslGenerator < Rails::Generators::Base
|
6
|
-
include Suspenders::Actions
|
7
|
-
|
8
|
-
def enforce_ssl
|
9
|
-
configure_environment "production", "config.force_ssl = true"
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|