suspenders 1.38.1 → 1.39.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f2c4cc752cce81ac6a5193f84ff570fb72c1616d
4
- data.tar.gz: f0ef48f12f20d61f0b1af283f247354860952c72
3
+ metadata.gz: 97fa9283f4c4c9b3af17953372b07bce23918a61
4
+ data.tar.gz: 44a7c216b659711cc01faf8d3db39187d8e92c25
5
5
  SHA512:
6
- metadata.gz: 80ef2155b69632554eab5fd37f68c6af7256f8cbea7927577f12cd44b86929aacc7e0751918aa4148ade88a617cb1b868d0988e9a9e434c380e98f9ac3505b5b
7
- data.tar.gz: e85a03b2e79a482870f6ffc9521d708041f238a35f121aae726fb4d04a4e91578a38f207841ffa61d32cc8274c8c8e76de1df979d706265ce2776a2196982189
6
+ metadata.gz: 81d78836d28a922cf77072c974de05fa6756ce219bfb6a4dceebd1b89431b407127e765f170ee5b50247614d30884167b33b7e0075f5349098c92807a1ed0080
7
+ data.tar.gz: d0c526b0a77295e7839f1c951f189cd759cee325b26c96ae549181fc3315b29bc0ba5d7a68c006d8bbcd17511659a42fd0628a592deeb5f6d0e2e6eb302eec79
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.3.0
1
+ 2.3.1
data/.travis.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  language: ruby
2
- rvm: 2.3.0
2
+ rvm: 2.3.1
3
3
  cache: bundler
4
4
  sudo: false
5
5
  before_install:
data/CONTRIBUTING.md CHANGED
@@ -29,6 +29,9 @@ Make the tests pass:
29
29
 
30
30
  rake
31
31
 
32
+ Mention how your changes affect the project to other developers and users in the
33
+ `NEWS.md` file.
34
+
32
35
  Write a [good commit message][commit].
33
36
  Push to your fork.
34
37
  [Submit a pull request][pr].
data/NEWS.md CHANGED
@@ -1,3 +1,17 @@
1
+ master
2
+
3
+ 1.39.0 (May 25, 2016)
4
+
5
+ * Update to Ruby 2.3.1
6
+ * Make new apps "deployable to Heroku" by default.
7
+ * Make the help text returned when running `suspenders -h` Suspenders specific
8
+ * Bugfix: Configure `static_cache_control` in production environment
9
+ * Replace NewRelic with Skylight
10
+ * Drop initializer for disabling XML parser
11
+ * Start moving suspenders features into different Rails Generators
12
+ * Set default `application_host` in Heroku
13
+ * Update the viewport meta tag
14
+
1
15
  1.38.1 (April 20, 2016)
2
16
 
3
17
  * Bugfix: add bitters as suspenders’ dependency back.
data/README.md CHANGED
@@ -42,7 +42,6 @@ It includes application gems like:
42
42
  * [Honeybadger](https://honeybadger.io) for exception notification
43
43
  * [jQuery Rails](https://github.com/rails/jquery-rails) for jQuery
44
44
  * [Neat](https://github.com/thoughtbot/neat) for semantic grids
45
- * [New Relic RPM](https://github.com/newrelic/rpm) for monitoring performance
46
45
  * [Normalize](https://necolas.github.io/normalize.css/) for resetting browser styles
47
46
  * [Postgres](https://github.com/ged/ruby-pg) for access to the Postgres database
48
47
  * [Rack Canonical Host](https://github.com/tylerhunt/rack-canonical-host) to
@@ -55,6 +54,7 @@ It includes application gems like:
55
54
  and patterns based on Bourbon, Neat and Bitters
56
55
  * [Simple Form](https://github.com/plataformatec/simple_form) for form markup
57
56
  and style
57
+ * [Skylight](https://www.skylight.io/) for monitoring performance
58
58
  * [Title](https://github.com/calebthompson/title) for storing titles in
59
59
  translations
60
60
  * [Puma](https://github.com/puma/puma) to serve HTTP requests
@@ -144,7 +144,7 @@ You can optionally specify alternate Heroku flags:
144
144
 
145
145
  suspenders app \
146
146
  --heroku true \
147
- --heroku-flags "--region eu --addons newrelic,sendgrid,ssl"
147
+ --heroku-flags "--region eu --addons sendgrid,ssl"
148
148
 
149
149
  See all possible Heroku flags:
150
150
 
data/USAGE ADDED
@@ -0,0 +1,13 @@
1
+ Description:
2
+ Suspenders is a Rails template with thoughtbot standard
3
+ defaults, ready to deploy to Heroku.
4
+
5
+ For full details on the changes we've made compared to
6
+ a vanilla Rails app, check our GitHub project:
7
+ https://github.com/thoughtbot/suspenders
8
+
9
+ Example:
10
+ suspenders ~/Code/weblog
11
+
12
+ This generates a Rails installation in ~/Code/weblog configured
13
+ with our preferred defaults.
@@ -16,14 +16,6 @@ module Suspenders
16
16
  app_builder.append_file "bin/setup", remotes
17
17
  end
18
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
19
  def create_staging_heroku_app(flags)
28
20
  app_name = heroku_app_name_for("staging")
29
21
 
@@ -45,7 +37,7 @@ module Suspenders
45
37
  end
46
38
  end
47
39
 
48
- def provide_review_apps_setup_script
40
+ def create_review_apps_setup_script
49
41
  app_builder.template(
50
42
  "bin_setup_review_app.erb",
51
43
  "bin/setup_review_app",
@@ -54,7 +46,7 @@ module Suspenders
54
46
  app_builder.run "chmod a+x bin/setup_review_app"
55
47
  end
56
48
 
57
- def create_heroku_pipelines_config_file
49
+ def create_heroku_application_manifest_file
58
50
  app_builder.template "app.json.erb", "app.json"
59
51
  end
60
52
 
@@ -65,7 +57,6 @@ module Suspenders
65
57
  exit 1
66
58
  end
67
59
 
68
- heroku_app_name = app_builder.app_name.dasherize
69
60
  run_toolbelt_command(
70
61
  "pipelines:create #{heroku_app_name} \
71
62
  -a #{heroku_app_name}-staging --stage staging",
@@ -88,6 +79,15 @@ module Suspenders
88
79
  end
89
80
  end
90
81
 
82
+ def set_heroku_application_host
83
+ %w(staging production).each do |environment|
84
+ run_toolbelt_command(
85
+ "config:add APPLICATION_HOST=#{heroku_app_name}-#{environment}.herokuapp.com",
86
+ environment,
87
+ )
88
+ end
89
+ end
90
+
91
91
  private
92
92
 
93
93
  attr_reader :app_builder
@@ -105,8 +105,12 @@ fi
105
105
  SHELL
106
106
  end
107
107
 
108
+ def heroku_app_name
109
+ app_builder.app_name.dasherize
110
+ end
111
+
108
112
  def heroku_app_name_for(environment)
109
- "#{app_builder.app_name.dasherize}-#{environment}"
113
+ "#{heroku_app_name}-#{environment}"
110
114
  end
111
115
 
112
116
  def generate_secret
@@ -6,15 +6,15 @@ module Suspenders
6
6
  extend Forwardable
7
7
 
8
8
  def_delegators :heroku_adapter,
9
- :create_heroku_pipelines_config_file,
9
+ :create_heroku_application_manifest_file,
10
10
  :create_heroku_pipeline,
11
11
  :create_production_heroku_app,
12
12
  :create_staging_heroku_app,
13
- :provide_review_apps_setup_script,
13
+ :create_review_apps_setup_script,
14
14
  :set_heroku_rails_secrets,
15
15
  :set_heroku_remotes,
16
- :set_heroku_serve_static_files,
17
- :set_up_heroku_specific_gems
16
+ :set_heroku_application_host,
17
+ :set_heroku_serve_static_files
18
18
 
19
19
  def readme
20
20
  template 'README.md.erb', 'README.md'
@@ -36,11 +36,7 @@ module Suspenders
36
36
  end
37
37
 
38
38
  def raise_on_missing_assets_in_test
39
- inject_into_file(
40
- "config/environments/test.rb",
41
- "\n config.assets.raise_runtime_errors = true",
42
- after: "Rails.application.configure do",
43
- )
39
+ configure_environment "test", "config.assets.raise_runtime_errors = true"
44
40
  end
45
41
 
46
42
  def raise_on_delivery_errors
@@ -128,10 +124,6 @@ module Suspenders
128
124
  copy_file "hound.yml", ".hound.yml"
129
125
  end
130
126
 
131
- def configure_newrelic
132
- template 'newrelic.yml.erb', 'config/newrelic.yml'
133
- end
134
-
135
127
  def configure_smtp
136
128
  copy_file 'smtp.rb', 'config/smtp.rb'
137
129
 
@@ -150,34 +142,18 @@ module Suspenders
150
142
 
151
143
  def enable_rack_canonical_host
152
144
  config = <<-RUBY
153
-
154
- if ENV.fetch("HEROKU_APP_NAME", "").include?("staging-pr-")
145
+ if ENV.fetch("HEROKU_APP_NAME", "").include?("staging-pr-")
155
146
  ENV["APPLICATION_HOST"] = ENV["HEROKU_APP_NAME"] + ".herokuapp.com"
156
147
  end
157
148
 
158
- # Ensure requests are only served from one, canonical host name
159
149
  config.middleware.use Rack::CanonicalHost, ENV.fetch("APPLICATION_HOST")
160
150
  RUBY
161
151
 
162
- inject_into_file(
163
- "config/environments/production.rb",
164
- config,
165
- after: "Rails.application.configure do",
166
- )
152
+ configure_environment "production", config
167
153
  end
168
154
 
169
155
  def enable_rack_deflater
170
- config = <<-RUBY
171
-
172
- # Enable deflate / gzip compression of controller-generated responses
173
- config.middleware.use Rack::Deflater
174
- RUBY
175
-
176
- inject_into_file(
177
- "config/environments/production.rb",
178
- config,
179
- after: serve_static_files_line
180
- )
156
+ configure_environment "production", "config.middleware.use Rack::Deflater"
181
157
  end
182
158
 
183
159
  def setup_asset_host
@@ -189,10 +165,9 @@ module Suspenders
189
165
  "config.assets.version = '1.0'",
190
166
  'config.assets.version = (ENV["ASSETS_VERSION"] || "1.0")'
191
167
 
192
- inject_into_file(
193
- "config/environments/production.rb",
194
- ' config.static_cache_control = "public, max-age=#{1.year.to_i}"',
195
- after: serve_static_files_line
168
+ configure_environment(
169
+ "production",
170
+ 'config.static_cache_control = "public, max-age=31557600"',
196
171
  )
197
172
  end
198
173
 
@@ -239,6 +214,16 @@ module Suspenders
239
214
  bundle_command 'exec rake db:create db:migrate'
240
215
  end
241
216
 
217
+ def replace_gemfile(path)
218
+ template 'Gemfile.erb', 'Gemfile', force: true do |content|
219
+ if path
220
+ content.gsub(%r{gem .suspenders.}) { |s| %{#{s}, path: "#{path}"} }
221
+ else
222
+ content
223
+ end
224
+ end
225
+ end
226
+
242
227
  def set_ruby_to_version_being_used
243
228
  create_file '.ruby-version', "#{Suspenders::RUBY_VERSION}\n"
244
229
  end
@@ -375,7 +360,7 @@ Rack::Timeout.timeout = (ENV["RACK_TIMEOUT"] || 10).to_i
375
360
  create_production_heroku_app(flags)
376
361
  end
377
362
 
378
- def provide_deploy_script
363
+ def create_deploy_script
379
364
  copy_file "bin_deploy", "bin/deploy"
380
365
 
381
366
  instructions = <<-MARKDOWN
@@ -470,10 +455,6 @@ you can deploy to staging and production with:
470
455
  "Rails.application.routes.draw do\nend"
471
456
  end
472
457
 
473
- def disable_xml_params
474
- copy_file 'disable_xml_params.rb', 'config/initializers/disable_xml_params.rb'
475
- end
476
-
477
458
  def setup_default_rake_task
478
459
  append_file 'Rakefile' do
479
460
  <<-EOS
@@ -501,9 +482,5 @@ end
501
482
  def heroku_adapter
502
483
  @heroku_adapter ||= Adapters::Heroku.new(self)
503
484
  end
504
-
505
- def serve_static_files_line
506
- "config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?\n"
507
- end
508
485
  end
509
486
  end
@@ -3,6 +3,8 @@ require 'rails/generators/rails/app/app_generator'
3
3
 
4
4
  module Suspenders
5
5
  class AppGenerator < Rails::Generators::AppGenerator
6
+ hide!
7
+
6
8
  class_option :database, type: :string, aliases: "-d", default: "postgresql",
7
9
  desc: "Configure for selected database (options: #{DATABASES.join("/")})"
8
10
 
@@ -24,6 +26,15 @@ module Suspenders
24
26
  class_option :skip_bundle, type: :boolean, aliases: "-B", default: true,
25
27
  desc: "Don't run bundle install"
26
28
 
29
+ class_option :version, type: :boolean, aliases: "-v", group: :suspenders,
30
+ desc: "Show Suspenders version number and quit"
31
+
32
+ class_option :help, type: :boolean, aliases: '-h', group: :suspenders,
33
+ desc: "Show this help message and quit"
34
+
35
+ class_option :path, type: :string, default: nil,
36
+ desc: "Path to the gem"
37
+
27
38
  def finish_template
28
39
  invoke :suspenders_customization
29
40
  super
@@ -47,21 +58,19 @@ module Suspenders
47
58
  invoke :setup_dotfiles
48
59
  invoke :setup_git
49
60
  invoke :setup_database
61
+ invoke :create_local_heroku_setup
50
62
  invoke :create_heroku_apps
51
63
  invoke :create_github_repo
52
64
  invoke :setup_segment
53
65
  invoke :setup_bundler_audit
54
66
  invoke :setup_spring
67
+ invoke :generate_default
55
68
  invoke :outro
56
69
  end
57
70
 
58
71
  def customize_gemfile
72
+ build :replace_gemfile, options[:path]
59
73
  build :set_ruby_to_version_being_used
60
-
61
- if options[:heroku]
62
- build :set_up_heroku_specific_gems
63
- end
64
-
65
74
  bundle_command 'install'
66
75
  build :configure_simple_form
67
76
  end
@@ -109,7 +118,6 @@ module Suspenders
109
118
 
110
119
  def setup_production_environment
111
120
  say 'Setting up the production environment'
112
- build :configure_newrelic
113
121
  build :configure_smtp
114
122
  build :configure_rack_timeout
115
123
  build :enable_rack_canonical_host
@@ -136,7 +144,6 @@ module Suspenders
136
144
  build :configure_action_mailer
137
145
  build :configure_active_job
138
146
  build :configure_time_formats
139
- build :disable_xml_params
140
147
  build :setup_default_rake_task
141
148
  build :configure_puma
142
149
  build :set_up_forego
@@ -166,17 +173,22 @@ module Suspenders
166
173
  end
167
174
  end
168
175
 
176
+ def create_local_heroku_setup
177
+ say "Creating local Heroku setup"
178
+ build :create_review_apps_setup_script
179
+ build :create_deploy_script
180
+ build :create_heroku_application_manifest_file
181
+ end
182
+
169
183
  def create_heroku_apps
170
184
  if options[:heroku]
171
185
  say "Creating Heroku apps"
172
186
  build :create_heroku_apps, options[:heroku_flags]
173
- build :provide_review_apps_setup_script
174
187
  build :set_heroku_serve_static_files
175
188
  build :set_heroku_remotes
176
189
  build :set_heroku_rails_secrets
177
- build :create_heroku_pipelines_config_file
190
+ build :set_heroku_application_host
178
191
  build :create_heroku_pipeline
179
- build :provide_deploy_script
180
192
  build :configure_automatic_deployment
181
193
  end
182
194
  end
@@ -233,11 +245,23 @@ module Suspenders
233
245
  build :remove_routes_comment_lines
234
246
  end
235
247
 
248
+ def generate_default
249
+ run("spring stop")
250
+
251
+ generate("suspenders:static")
252
+
253
+ bundle_command "install"
254
+ end
255
+
236
256
  def outro
237
257
  say 'Congratulations! You just pulled our suspenders.'
238
258
  say honeybadger_outro
239
259
  end
240
260
 
261
+ def self.banner
262
+ "suspenders #{arguments.map(&:usage).join(' ')} [options]"
263
+ end
264
+
241
265
  protected
242
266
 
243
267
  def get_builder_class
@@ -0,0 +1,9 @@
1
+ require "rails/generators"
2
+
3
+ module Suspenders
4
+ class StaticGenerator < Rails::Generators::Base
5
+ def add_high_voltage
6
+ gem "high_voltage"
7
+ end
8
+ end
9
+ end
@@ -1,5 +1,8 @@
1
1
  module Suspenders
2
- RAILS_VERSION = "~> 4.2.0"
3
- RUBY_VERSION = IO.read("#{File.dirname(__FILE__)}/../../.ruby-version").strip
4
- VERSION = "1.38.1"
2
+ RAILS_VERSION = "~> 4.2.0".freeze
3
+ RUBY_VERSION = IO.
4
+ read("#{File.dirname(__FILE__)}/../../.ruby-version").
5
+ strip.
6
+ freeze
7
+ VERSION = "1.39.0".freeze
5
8
  end
data/lib/suspenders.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'suspenders/version'
2
2
  require 'suspenders/generators/app_generator'
3
+ require 'suspenders/generators/static_generator'
3
4
  require 'suspenders/actions'
4
5
  require "suspenders/adapters/heroku"
5
6
  require 'suspenders/app_builder'
@@ -16,27 +16,32 @@ module Suspenders
16
16
  with(setup_file, /heroku join --app #{app_name.dasherize}-staging/)
17
17
  end
18
18
 
19
- it "sets up the heroku specific gems" do
19
+ it "sets the heroku rails secrets" do
20
20
  app_builder = double(app_name: app_name)
21
- allow(app_builder).to receive(:inject_into_file)
21
+ allow(app_builder).to receive(:run)
22
22
 
23
- Heroku.new(app_builder).set_up_heroku_specific_gems
23
+ Heroku.new(app_builder).set_heroku_rails_secrets
24
24
 
25
- expect(app_builder).to have_received(:inject_into_file).
26
- with("Gemfile", /rails_stdout_logging/, anything)
25
+ expect(app_builder).to(
26
+ have_configured_var("staging", "SECRET_KEY_BASE"),
27
+ )
28
+ expect(app_builder).to(
29
+ have_configured_var("production", "SECRET_KEY_BASE"),
30
+ )
27
31
  end
28
32
 
29
- it "sets the heroku rails secrets" do
33
+ it "sets the application host" do
30
34
  app_builder = double(app_name: app_name)
31
35
  allow(app_builder).to receive(:run)
32
36
 
33
- Heroku.new(app_builder).set_heroku_rails_secrets
37
+ Heroku.new(app_builder).set_heroku_application_host
34
38
 
35
39
  expect(app_builder).to(
36
- have_configured_var("staging", "SECRET_KEY_BASE"),
40
+ have_configured_var("staging", "APPLICATION_HOST"),
37
41
  )
42
+
38
43
  expect(app_builder).to(
39
- have_configured_var("production", "SECRET_KEY_BASE"),
44
+ have_configured_var("production", "APPLICATION_HOST"),
40
45
  )
41
46
  end
42
47
 
@@ -0,0 +1,36 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe "Command line help output" do
4
+ let(:help_text) { suspenders_help_command }
5
+
6
+ it "does not contain the default rails usage statement" do
7
+ expect(help_text).not_to include("rails new APP_PATH [options]")
8
+ end
9
+
10
+ it "provides the correct usage statement for suspenders" do
11
+ expect(help_text).to include <<~EOH
12
+ Usage:
13
+ suspenders APP_PATH [options]
14
+ EOH
15
+ end
16
+
17
+ it "does not contain the default rails group" do
18
+ expect(help_text).not_to include("Rails options:")
19
+ end
20
+
21
+ it "provides help and version usage within the suspenders group" do
22
+ expect(help_text).to include <<~EOH
23
+ Suspenders options:
24
+ -h, [--help], [--no-help] # Show this help message and quit
25
+ -v, [--version], [--no-version] # Show Suspenders version number and quit
26
+ EOH
27
+ end
28
+
29
+ it "does not show the default extended rails help section" do
30
+ expect(help_text).not_to include("Create suspenders files for app generator.")
31
+ end
32
+
33
+ it "contains the usage statement from the suspenders gem" do
34
+ expect(help_text).to include IO.read(usage_file)
35
+ end
36
+ end
@@ -11,9 +11,6 @@ RSpec.describe "Heroku" do
11
11
  it "suspends a project for Heroku" do
12
12
  app_name = SuspendersTestHelpers::APP_NAME.dasherize
13
13
 
14
- expect(FakeHeroku).to(
15
- have_gem_included(project_path, "rails_stdout_logging"),
16
- )
17
14
  expect(FakeHeroku).to have_created_app_for("staging")
18
15
  expect(FakeHeroku).to have_created_app_for("production")
19
16
  expect(FakeHeroku).to have_configured_vars("staging", "SECRET_KEY_BASE")
@@ -21,6 +18,14 @@ RSpec.describe "Heroku" do
21
18
  "production",
22
19
  "SECRET_KEY_BASE",
23
20
  )
21
+ expect(FakeHeroku).to have_configured_vars(
22
+ "staging",
23
+ "APPLICATION_HOST",
24
+ )
25
+ expect(FakeHeroku).to have_configured_vars(
26
+ "production",
27
+ "APPLICATION_HOST",
28
+ )
24
29
  expect(FakeHeroku).to have_setup_pipeline_for(app_name)
25
30
 
26
31
  bin_setup_path = "#{project_path}/bin/setup"
@@ -31,20 +36,6 @@ RSpec.describe "Heroku" do
31
36
  expect(bin_setup).to include("git config heroku.remote staging")
32
37
  expect(File.stat(bin_setup_path)).to be_executable
33
38
 
34
- bin_setup_path = "#{project_path}/bin/setup_review_app"
35
- bin_setup = IO.read(bin_setup_path)
36
-
37
- expect(bin_setup).to include("heroku run rake db:migrate --exit-code --app #{app_name}-staging-pr-$1")
38
- expect(bin_setup).to include("heroku ps:scale worker=1 --app #{app_name}-staging-pr-$1")
39
- expect(bin_setup).to include("heroku restart --app #{app_name}-staging-pr-$1")
40
- expect(File.stat(bin_setup_path)).to be_executable
41
-
42
- bin_deploy_path = "#{project_path}/bin/deploy"
43
- bin_deploy = IO.read(bin_deploy_path)
44
-
45
- expect(bin_deploy).to include("heroku run rake db:migrate --exit-code")
46
- expect(File.stat(bin_deploy_path)).to be_executable
47
-
48
39
  readme = IO.read("#{project_path}/README.md")
49
40
 
50
41
  expect(readme).to include("./bin/deploy staging")
@@ -61,17 +52,6 @@ RSpec.describe "Heroku" do
61
52
  - bin/deploy staging
62
53
  YML
63
54
  end
64
-
65
- it "adds app.json file" do
66
- expect(File).to exist("#{project_path}/app.json")
67
- end
68
-
69
- it "includes application name in app.json file" do
70
- app_json_file = IO.read("#{project_path}/app.json")
71
- app_name = SuspendersTestHelpers::APP_NAME.dasherize
72
-
73
- expect(app_json_file).to match(/"name":"#{app_name}"/)
74
- end
75
55
  end
76
56
 
77
57
  context "--heroku with region flag" do
@@ -92,14 +92,6 @@ RSpec.describe "Suspend a new project with default configuration" do
92
92
  to exist("#{project_path}/config/initializers/rack_mini_profiler.rb")
93
93
  end
94
94
 
95
- it "ensures newrelic.yml reads NewRelic license from env" do
96
- newrelic_file = IO.read("#{project_path}/config/newrelic.yml")
97
-
98
- expect(newrelic_file).to match(
99
- /license_key: "<%= ENV\["NEW_RELIC_LICENSE_KEY"\] %>"/
100
- )
101
- end
102
-
103
95
  it "records pageviews through Segment if ENV variable set" do
104
96
  expect(analytics_partial).
105
97
  to include(%{<% if ENV["SEGMENT_KEY"] %>})
@@ -123,6 +115,13 @@ RSpec.describe "Suspend a new project with default configuration" do
123
115
  )
124
116
  end
125
117
 
118
+ it "configures static_cache_control in production" do
119
+ prod_env_file = IO.read("#{project_path}/config/environments/production.rb")
120
+ expect(prod_env_file).to match(
121
+ /config.static_cache_control = "public, max-age=.+"/,
122
+ )
123
+ end
124
+
126
125
  it "raises on missing translations in development and test" do
127
126
  %w[development test].each do |environment|
128
127
  environment_file =
@@ -223,10 +222,48 @@ RSpec.describe "Suspend a new project with default configuration" do
223
222
  expect(File).to exist("#{project_path}/spec/factories.rb")
224
223
  end
225
224
 
225
+ it "creates review apps setup script" do
226
+ bin_setup_path = "#{project_path}/bin/setup_review_app"
227
+ bin_setup = IO.read(bin_setup_path)
228
+
229
+ expect(bin_setup).to include("heroku run rake db:migrate --exit-code "\
230
+ "--app #{app_name.dasherize}-staging-pr-$1")
231
+ expect(bin_setup).to include("heroku ps:scale worker=1 "\
232
+ "--app #{app_name.dasherize}-staging-pr-$1")
233
+ expect(bin_setup).to include("heroku restart "\
234
+ "--app #{app_name.dasherize}-staging-pr-$1")
235
+ expect(File.stat(bin_setup_path)).to be_executable
236
+ end
237
+
238
+ it "creates deploy script" do
239
+ bin_deploy_path = "#{project_path}/bin/deploy"
240
+ bin_deploy = IO.read(bin_deploy_path)
241
+
242
+ expect(bin_deploy).to include("heroku run rake db:migrate --exit-code")
243
+ expect(File.stat(bin_deploy_path)).to be_executable
244
+ end
245
+
246
+ it "creates heroku application manifest file with application name in it" do
247
+ app_json_file = IO.read("#{project_path}/app.json")
248
+
249
+ expect(app_json_file).to match(/"name":"#{app_name.dasherize}"/)
250
+ end
251
+
252
+ it "sets up heroku specific gems" do
253
+ gemfile_file = IO.read("#{project_path}/Gemfile")
254
+
255
+ expect(gemfile_file).to include %{gem "rails_stdout_logging"}
256
+ end
257
+
226
258
  def app_name
227
259
  SuspendersTestHelpers::APP_NAME
228
260
  end
229
261
 
262
+ it "adds high_voltage" do
263
+ gemfile = IO.read("#{project_path}/Gemfile")
264
+ expect(gemfile).to match(/high_voltage/)
265
+ end
266
+
230
267
  def analytics_partial
231
268
  IO.read("#{project_path}/app/views/application/_analytics.html.erb")
232
269
  end
@@ -10,6 +10,7 @@ module SuspendersTestHelpers
10
10
  end
11
11
 
12
12
  def run_suspenders(arguments = nil)
13
+ arguments = "--path=#{root_path} #{arguments}"
13
14
  Dir.chdir(tmp_path) do
14
15
  Bundler.with_clean_env do
15
16
  add_fakes_to_path
@@ -20,6 +21,16 @@ module SuspendersTestHelpers
20
21
  end
21
22
  end
22
23
 
24
+ def suspenders_help_command
25
+ Dir.chdir(tmp_path) do
26
+ Bundler.with_clean_env do
27
+ `
28
+ #{suspenders_bin} -h
29
+ `
30
+ end
31
+ end
32
+ end
33
+
23
34
  def setup_app_dependencies
24
35
  if File.exist?(project_path)
25
36
  Dir.chdir(project_path) do
@@ -48,6 +59,10 @@ module SuspendersTestHelpers
48
59
  @project_path ||= Pathname.new("#{tmp_path}/#{APP_NAME}")
49
60
  end
50
61
 
62
+ def usage_file
63
+ @usage_path ||= File.join(root_path, "USAGE")
64
+ end
65
+
51
66
  private
52
67
 
53
68
  def tmp_path
@@ -6,11 +6,9 @@ gem "autoprefixer-rails"
6
6
  gem "bourbon", "5.0.0.beta.5"
7
7
  gem "delayed_job_active_record"
8
8
  gem "flutie"
9
- gem "high_voltage"
10
9
  gem "honeybadger"
11
10
  gem "jquery-rails"
12
11
  gem "neat", "~> 1.7.0"
13
- gem "newrelic_rpm", ">= 3.9.8"
14
12
  gem "normalize-rails", "~> 3.0.0"
15
13
  gem "pg"
16
14
  gem "puma"
@@ -19,14 +17,15 @@ gem "rails", "<%= Suspenders::RAILS_VERSION %>"
19
17
  gem "recipient_interceptor"
20
18
  gem "sass-rails", "~> 5.0"
21
19
  gem "simple_form"
20
+ gem "skylight"
22
21
  gem "sprockets", ">= 3.0.0"
23
22
  gem "sprockets-es6"
23
+ gem "suspenders"
24
24
  gem "title"
25
25
  gem "uglifier"
26
26
 
27
27
  group :development do
28
28
  gem "quiet_assets"
29
- gem "refills"
30
29
  gem "spring"
31
30
  gem "spring-commands-rspec"
32
31
  gem "web-console"
@@ -40,6 +39,7 @@ group :development, :test do
40
39
  gem "factory_girl_rails"
41
40
  gem "pry-byebug"
42
41
  gem "pry-rails"
42
+ gem "refills"
43
43
  gem "rspec-rails", "~> 3.4.0"
44
44
  end
45
45
 
@@ -60,4 +60,5 @@ end
60
60
 
61
61
  group :staging, :production do
62
62
  gem "rack-timeout"
63
+ gem "rails_stdout_logging"
63
64
  end
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset="utf-8" />
5
5
  <meta name="ROBOTS" content="NOODP" />
6
- <meta name="viewport" content="initial-scale=1" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
7
7
  <%%#
8
8
  Configure default and controller-, and view-specific titles in
9
9
  config/locales/en.yml. For more see:
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.38.1
4
+ version: 1.39.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - thoughtbot
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-20 00:00:00.000000000 Z
11
+ date: 2016-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bitters
@@ -88,6 +88,7 @@ files:
88
88
  - README.md
89
89
  - RELEASING.md
90
90
  - Rakefile
91
+ - USAGE
91
92
  - bin/rake
92
93
  - bin/rspec
93
94
  - bin/setup
@@ -97,10 +98,12 @@ files:
97
98
  - lib/suspenders/adapters/heroku.rb
98
99
  - lib/suspenders/app_builder.rb
99
100
  - lib/suspenders/generators/app_generator.rb
101
+ - lib/suspenders/generators/static_generator.rb
100
102
  - lib/suspenders/version.rb
101
103
  - spec/adapters/heroku_spec.rb
102
104
  - spec/fakes/bin/heroku
103
105
  - spec/fakes/bin/hub
106
+ - spec/features/cli_help_spec.rb
104
107
  - spec/features/github_spec.rb
105
108
  - spec/features/heroku_spec.rb
106
109
  - spec/features/new_project_spec.rb
@@ -129,7 +132,6 @@ files:
129
132
  - templates/config_locales_en.yml.erb
130
133
  - templates/database_cleaner_rspec.rb
131
134
  - templates/dev.rake
132
- - templates/disable_xml_params.rb
133
135
  - templates/dotfiles/.ctags
134
136
  - templates/dotfiles/.env
135
137
  - templates/errors.rb
@@ -139,7 +141,6 @@ files:
139
141
  - templates/hound.yml
140
142
  - templates/i18n.rb
141
143
  - templates/json_encoding.rb
142
- - templates/newrelic.yml.erb
143
144
  - templates/postgresql_database.yml.erb
144
145
  - templates/puma.rb
145
146
  - templates/rack_mini_profiler.rb
@@ -163,7 +164,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
163
164
  requirements:
164
165
  - - ">="
165
166
  - !ruby/object:Gem::Version
166
- version: 2.3.0
167
+ version: 2.3.1
167
168
  required_rubygems_version: !ruby/object:Gem::Requirement
168
169
  requirements:
169
170
  - - ">="
@@ -171,7 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
171
172
  version: '0'
172
173
  requirements: []
173
174
  rubyforge_project:
174
- rubygems_version: 2.6.2
175
+ rubygems_version: 2.5.1
175
176
  signing_key:
176
177
  specification_version: 4
177
178
  summary: Generate a Rails app using thoughtbot's best practices.
@@ -179,6 +180,7 @@ test_files:
179
180
  - spec/adapters/heroku_spec.rb
180
181
  - spec/fakes/bin/heroku
181
182
  - spec/fakes/bin/hub
183
+ - spec/features/cli_help_spec.rb
182
184
  - spec/features/github_spec.rb
183
185
  - spec/features/heroku_spec.rb
184
186
  - spec/features/new_project_spec.rb
@@ -1 +0,0 @@
1
- ActionDispatch::ParamsParser::DEFAULT_PARSERS.delete(Mime::XML)
@@ -1,34 +0,0 @@
1
- common: &default_settings
2
- app_name: "<%= app_name %>"
3
- audit_log:
4
- enabled: false
5
- browser_monitoring:
6
- auto_instrument: true
7
- capture_params: false
8
- developer_mode: false
9
- error_collector:
10
- capture_source: true
11
- enabled: true
12
- ignore_errors: "ActionController::RoutingError,Sinatra::NotFound"
13
- license_key: "<%%= ENV["NEW_RELIC_LICENSE_KEY"] %>"
14
- log_level: info
15
- monitor_mode: true
16
- transaction_tracer:
17
- enabled: true
18
- record_sql: obfuscated
19
- stack_trace_threshold: 0.500
20
- transaction_threshold: apdex_f
21
- development:
22
- <<: *default_settings
23
- monitor_mode: false
24
- developer_mode: true
25
- test:
26
- <<: *default_settings
27
- monitor_mode: false
28
- production:
29
- <<: *default_settings
30
- monitor_mode: true
31
- staging:
32
- <<: *default_settings
33
- app_name: "<%= app_name %> (Staging)"
34
- monitor_mode: true