welaika-suspenders 2.24.0 → 2.25.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: e2f82e071962fef84f1eb7ca1deecc5c8acd3d4c
4
- data.tar.gz: 7d6b86a5f22994f77f71fe00cce6d5f5268ac3a0
3
+ metadata.gz: 35275d2042fd17e7555c3395e05fc82256ec40a5
4
+ data.tar.gz: e946e11fa1984ae6607fcd4283989c26accbae5f
5
5
  SHA512:
6
- metadata.gz: fa13059af0f52dd92a341eb1c3c2f42590fde2ea4d1637c6af67b6605474b963486d2d1e01e22e50df6d2f93e75028596dbbdb43838ad82f242b71b52671524a
7
- data.tar.gz: 8959f5757c6d5324c5fe8e797933ab92be1bed480de98577e9c8547200e3faf39377a3975221b5eda921018cbb29aac4dea1e4c04079afaf9401326e9c9577d4
6
+ metadata.gz: 28a6065760b7660c88390c0f32075c36e3c03e7573943eaa4f36634a62ebf9126e19d45a0328c10f881a000052a5893ad0186979daa1b65d874abe2ef4b47463
7
+ data.tar.gz: af6c24992c6fc71b47c5f925e053075f5f72a62951954b2384c151c0f1fb6d8af8fdb3e9ae271c16fe3a006a72fddd0e57dc5df9dab89b86246bd761afde5338
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,32 @@
1
+ master
2
+
3
+ 1.40.0 (June 25, 2016)
4
+
5
+ * Upgrade bourbon to 5.0.0.beta.6
6
+ * Update Neat to 1.8.0
7
+ * `APPLICATION_HOST` bug fix in production environment (was used before it was
8
+ defined)
9
+ * Update comment around Pipelines: it is now a Heroku core plugin
10
+ * Drop unneeded `WEB_CONCURRENCY` from `app.json` file
11
+ * Introduce a `suspenders:stylesheet_base` generator. The `application.scss`
12
+ must list the imports in a specific order. This removes the `application.css`.
13
+
14
+ 1.39.0 (May 25, 2016)
15
+
16
+ * Update to Ruby 2.3.1
17
+ * Make new apps "deployable to Heroku" by default.
18
+ * Make the help text returned when running `suspenders -h` Suspenders specific
19
+ * Bugfix: Configure `static_cache_control` in production environment
20
+ * Replace NewRelic with Skylight
21
+ * Drop initializer for disabling XML parser
22
+ * Start moving suspenders features into different Rails Generators
23
+ * Set default `application_host` in Heroku
24
+ * Update the viewport meta tag
25
+
26
+ 1.38.1 (April 20, 2016)
27
+
28
+ * Bugfix: add bitters as suspenders’ dependency back.
29
+
1
30
  1.38.0 (April 15, 2016)
2
31
 
3
32
  * Update bourbon to `v5.0.0.beta.5`
data/RELEASING.md CHANGED
@@ -4,7 +4,7 @@
4
4
  2. Update `NEWS.md` to reflect the changes since last release.
5
5
  3. Commit changes. There shouldn't be code changes, and thus CI doesn't need to
6
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
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:
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.
data/lib/suspenders.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  require 'suspenders/version'
2
2
  require 'suspenders/generators/app_generator'
3
+ require 'suspenders/generators/static_generator'
4
+ require 'suspenders/generators/stylesheet_base_generator'
3
5
  require 'suspenders/actions'
4
6
  require "suspenders/adapters/heroku"
5
7
  require 'suspenders/app_builder'
@@ -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,18 +46,17 @@ 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
 
61
53
  def create_heroku_pipeline
62
- pipelines_plugin = `heroku plugins | grep pipelines`
54
+ pipelines_plugin = `heroku help | grep pipelines`
63
55
  if pipelines_plugin.empty?
64
- puts "You need heroku pipelines plugin. Run: heroku plugins:install heroku-pipelines"
56
+ puts "You need heroku pipelines plugin. Run: brew upgrade heroku-toolbelt"
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
@@ -152,7 +148,6 @@ module Suspenders
152
148
  ENV["APPLICATION_HOST"] = ENV["HEROKU_APP_NAME"] + ".herokuapp.com"
153
149
  end
154
150
 
155
- # Ensure requests are only served from one, canonical host name
156
151
  config.middleware.use Rack::CanonicalHost, ENV.fetch("APPLICATION_HOST")
157
152
  RUBY
158
153
 
@@ -164,17 +159,7 @@ module Suspenders
164
159
  end
165
160
 
166
161
  def enable_rack_deflater
167
- config = <<-RUBY
168
-
169
- # Enable deflate / gzip compression of controller-generated responses
170
- config.middleware.use Rack::Deflater
171
- RUBY
172
-
173
- inject_into_file(
174
- "config/environments/production.rb",
175
- config,
176
- after: serve_static_files_line
177
- )
162
+ configure_environment "production", "config.middleware.use Rack::Deflater"
178
163
  end
179
164
 
180
165
  def setup_asset_host
@@ -186,10 +171,9 @@ module Suspenders
186
171
  "config.assets.version = '1.0'",
187
172
  'config.assets.version = (ENV["ASSETS_VERSION"] || "1.0")'
188
173
 
189
- inject_into_file(
190
- "config/environments/production.rb",
191
- ' config.static_cache_control = "public, max-age=#{1.year.to_i}"',
192
- after: serve_static_files_line
174
+ configure_environment(
175
+ "production",
176
+ 'config.static_cache_control = "public, max-age=31557600"',
193
177
  )
194
178
  end
195
179
 
@@ -237,6 +221,16 @@ module Suspenders
237
221
  bundle_command 'exec rake db:create db:migrate'
238
222
  end
239
223
 
224
+ def replace_gemfile(path)
225
+ template 'Gemfile.erb', 'Gemfile', force: true do |content|
226
+ if path
227
+ content.gsub(%r{gem .suspenders.}) { |s| %{#{s}, path: "#{path}"} }
228
+ else
229
+ content
230
+ end
231
+ end
232
+ end
233
+
240
234
  def set_ruby_to_version_being_used
241
235
  create_file '.ruby-version', "#{Suspenders::RUBY_VERSION}\n"
242
236
  end
@@ -300,6 +294,12 @@ module Suspenders
300
294
  replace_in_file "config/application.rb",
301
295
  "# config.time_zone = 'Central Time (US & Canada)'",
302
296
  "config.time_zone = 'Rome'"
297
+
298
+ available_locales_config = <<-RUBY
299
+ config.i18n.available_locales = [:en, :it]
300
+ RUBY
301
+
302
+ inject_into_class 'config/application.rb', 'Application', available_locales_config
303
303
  end
304
304
 
305
305
  def configure_rack_timeout
@@ -324,14 +324,6 @@ Rack::Timeout.timeout = (ENV["RACK_TIMEOUT"] || 10).to_i
324
324
  action_mailer_host "production", %{ENV.fetch("APPLICATION_HOST")}
325
325
  end
326
326
 
327
- def configure_available_locales
328
- config = <<-RUBY
329
- config.i18n.available_locales = [:en, :it]
330
- RUBY
331
-
332
- inject_into_class 'config/application.rb', 'Application', config
333
- end
334
-
335
327
  def configure_active_job
336
328
  configure_application_file(
337
329
  "config.active_job.queue_adapter = :delayed_job"
@@ -351,12 +343,6 @@ Rack::Timeout.timeout = (ENV["RACK_TIMEOUT"] || 10).to_i
351
343
  copy_file "Procfile", "Procfile"
352
344
  end
353
345
 
354
- def setup_stylesheets
355
- remove_file 'app/assets/stylesheets/application.css'
356
- copy_file 'application.sass',
357
- 'app/assets/stylesheets/application.sass'
358
- end
359
-
360
346
  def setup_default_directories
361
347
  [
362
348
  'app/forms',
@@ -393,7 +379,7 @@ Rack::Timeout.timeout = (ENV["RACK_TIMEOUT"] || 10).to_i
393
379
  create_production_heroku_app(flags)
394
380
  end
395
381
 
396
- def provide_deploy_script
382
+ def create_deploy_script
397
383
  copy_file "bin_deploy", "bin/deploy"
398
384
 
399
385
  instructions = <<-MARKDOWN
@@ -484,10 +470,6 @@ you can deploy to staging and production with:
484
470
  "Rails.application.routes.draw do\nend"
485
471
  end
486
472
 
487
- def disable_xml_params
488
- copy_file 'disable_xml_params.rb', 'config/initializers/disable_xml_params.rb'
489
- end
490
-
491
473
  def setup_default_rake_task
492
474
  append_file 'Rakefile' do
493
475
  <<-EOS
@@ -519,9 +501,5 @@ task default: "bundler:audit"
519
501
  def heroku_adapter
520
502
  @heroku_adapter ||= Adapters::Heroku.new(self)
521
503
  end
522
-
523
- def serve_static_files_line
524
- "config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?\n"
525
- end
526
504
  end
527
505
  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
@@ -45,21 +56,19 @@ module Suspenders
45
56
  invoke :setup_dotfiles
46
57
  invoke :setup_git
47
58
  invoke :setup_database
59
+ invoke :create_local_heroku_setup
48
60
  invoke :create_heroku_apps
49
61
  invoke :create_github_repo
50
62
  invoke :setup_spring
51
63
  invoke :create_binstubs
64
+ invoke :generate_default
52
65
  invoke :outro
53
66
  end
54
67
 
55
68
  def customize_gemfile
56
69
  build :create_ruby_gemset_file
70
+ build :replace_gemfile, options[:path]
57
71
  build :set_ruby_to_version_being_used
58
-
59
- if options[:heroku]
60
- build :set_up_heroku_specific_gems
61
- end
62
-
63
72
  bundle_command 'install'
64
73
  build :configure_simple_form
65
74
  end
@@ -79,7 +88,6 @@ module Suspenders
79
88
  build :raise_on_missing_assets_in_test
80
89
  build :raise_on_delivery_errors
81
90
  build :configure_letter_opener
82
- build :set_test_delivery_method
83
91
  build :add_bullet_gem_configuration
84
92
  build :raise_on_unpermitted_parameters
85
93
  build :provide_setup_script
@@ -138,8 +146,7 @@ module Suspenders
138
146
  build :configure_locales
139
147
  build :configure_active_job
140
148
  build :configure_slim
141
- build :disable_xml_params
142
- build :configure_available_locales
149
+ build :configure_time_formats
143
150
  build :setup_default_rake_task
144
151
  build :configure_puma
145
152
  build :set_up_forego
@@ -159,17 +166,23 @@ module Suspenders
159
166
  end
160
167
  end
161
168
 
169
+ def create_local_heroku_setup
170
+ say "Creating local Heroku setup"
171
+ build :create_review_apps_setup_script
172
+ build :create_deploy_script
173
+ build :create_heroku_application_manifest_file
174
+ end
175
+
162
176
  def create_heroku_apps
163
177
  if options[:heroku]
164
178
  say "Creating Heroku apps"
165
179
  build :create_heroku_apps, options[:heroku_flags]
166
- build :provide_review_apps_setup_script
167
180
  build :set_heroku_serve_static_files
168
181
  build :set_heroku_remotes
169
182
  build :set_heroku_rails_secrets
170
- build :create_heroku_pipelines_config_file
183
+ build :set_heroku_application_host
171
184
  build :create_heroku_pipeline
172
- build :provide_deploy_script
185
+ build :configure_automatic_deployment
173
186
  end
174
187
  end
175
188
 
@@ -220,11 +233,24 @@ module Suspenders
220
233
  build :remove_routes_comment_lines
221
234
  end
222
235
 
236
+ def generate_default
237
+ run("spring stop")
238
+
239
+ generate("suspenders:static")
240
+ generate("suspenders:stylesheet_base")
241
+
242
+ bundle_command "install"
243
+ end
244
+
223
245
  def outro
224
246
  say "Congratulations! You just pulled our suspenders."
225
247
  say "Read README.md and configure Errbit."
226
248
  end
227
249
 
250
+ def self.banner
251
+ "suspenders #{arguments.map(&:usage).join(' ')} [options]"
252
+ end
253
+
228
254
  protected
229
255
 
230
256
  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
@@ -0,0 +1,25 @@
1
+ require "rails/generators"
2
+
3
+ module Suspenders
4
+ class StylesheetBaseGenerator < Rails::Generators::Base
5
+ source_root File.expand_path(
6
+ File.join("..", "..", "..", "templates"),
7
+ File.dirname(__FILE__))
8
+
9
+ def add_stylesheet_gems
10
+ gem "bourbon", "5.0.0.beta.6"
11
+ end
12
+
13
+ def add_css_config
14
+ copy_file(
15
+ "application.sass",
16
+ "app/assets/stylesheets/application.sass",
17
+ force: true,
18
+ )
19
+ end
20
+
21
+ def remove_prior_config
22
+ remove_file "app/assets/stylesheets/application.css"
23
+ end
24
+ end
25
+ 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 = "2.24.0"
2
+ RAILS_VERSION = "~> 4.2.0".freeze
3
+ RUBY_VERSION = IO.
4
+ read("#{File.dirname(__FILE__)}/../../.ruby-version").
5
+ strip.
6
+ freeze
7
+ VERSION = "2.25.0".freeze
5
8
  end
@@ -0,0 +1 @@
1
+ require 'suspenders'
@@ -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", "--region eu")
18
15
  expect(FakeHeroku).to have_created_app_for("production", "--region eu")
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,36 +36,11 @@ 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")
51
42
  expect(readme).to include("./bin/deploy production")
52
43
  end
53
-
54
- it "adds app.json file" do
55
- expect(File).to exist("#{project_path}/app.json")
56
- end
57
-
58
- it "includes application name in app.json file" do
59
- app_json_file = IO.read("#{project_path}/app.json")
60
- app_name = SuspendersTestHelpers::APP_NAME.dasherize
61
-
62
- expect(app_json_file).to match(/"name":"#{app_name}"/)
63
- end
64
44
  end
65
45
 
66
46
  context "--heroku with region flag" do
@@ -129,6 +129,13 @@ RSpec.describe "Suspend a new project with default configuration" do
129
129
  )
130
130
  end
131
131
 
132
+ it "configures static_cache_control in production" do
133
+ prod_env_file = IO.read("#{project_path}/config/environments/production.rb")
134
+ expect(prod_env_file).to match(
135
+ /config.static_cache_control = "public, max-age=.+"/,
136
+ )
137
+ end
138
+
132
139
  it "raises on missing translations in development and test" do
133
140
  %w[development test].each do |environment|
134
141
  environment_file =
@@ -244,7 +251,60 @@ RSpec.describe "Suspend a new project with default configuration" do
244
251
  end
245
252
  end
246
253
 
254
+ it "creates review apps setup script" do
255
+ bin_setup_path = "#{project_path}/bin/setup_review_app"
256
+ bin_setup = IO.read(bin_setup_path)
257
+
258
+ expect(bin_setup).to include("heroku run rake db:migrate --exit-code "\
259
+ "--app #{app_name.dasherize}-staging-pr-$1")
260
+ expect(bin_setup).to include("heroku ps:scale worker=1 "\
261
+ "--app #{app_name.dasherize}-staging-pr-$1")
262
+ expect(bin_setup).to include("heroku restart "\
263
+ "--app #{app_name.dasherize}-staging-pr-$1")
264
+ expect(File.stat(bin_setup_path)).to be_executable
265
+ end
266
+
267
+ it "creates deploy script" do
268
+ bin_deploy_path = "#{project_path}/bin/deploy"
269
+ bin_deploy = IO.read(bin_deploy_path)
270
+
271
+ expect(bin_deploy).to include("heroku run rake db:migrate --exit-code")
272
+ expect(File.stat(bin_deploy_path)).to be_executable
273
+ end
274
+
275
+ it "creates heroku application manifest file with application name in it" do
276
+ app_json_file = IO.read("#{project_path}/app.json")
277
+
278
+ expect(app_json_file).to match(/"name":"#{app_name.dasherize}"/)
279
+ end
280
+
281
+ it "sets up heroku specific gems" do
282
+ gemfile_file = IO.read("#{project_path}/Gemfile")
283
+
284
+ expect(gemfile_file).to include %{gem "rails_stdout_logging"}
285
+ end
286
+
247
287
  def app_name
248
288
  SuspendersTestHelpers::APP_NAME
249
289
  end
290
+
291
+ it "adds high_voltage" do
292
+ gemfile = IO.read("#{project_path}/Gemfile")
293
+ expect(gemfile).to match(/high_voltage/)
294
+ end
295
+
296
+ it "adds bourbon" do
297
+ gemfile = read_project_file("Gemfile")
298
+
299
+ expect(gemfile).to match(/bourbon/)
300
+ end
301
+
302
+ it "configures bourbon" do
303
+ app_css = read_project_file(%w(app assets stylesheets application.sass))
304
+ expect(app_css).to match(/normalize-rails.*bourbon/m)
305
+ end
306
+
307
+ def read_project_file(path)
308
+ IO.read(File.join(project_path, *path))
309
+ end
250
310
  end
data/spec/spec_helper.rb CHANGED
@@ -18,4 +18,7 @@ RSpec.configure do |config|
18
18
  config.before(:each) do
19
19
  FakeGithub.clear!
20
20
  end
21
+
22
+ config.example_status_persistence_file_path = "tmp/rspec_examples.txt"
23
+ config.order = :random
21
24
  end
@@ -6,8 +6,8 @@ class FakeHeroku
6
6
  end
7
7
 
8
8
  def run!
9
- if @args.first == "plugins"
10
- puts "heroku-pipelines@0.29.0"
9
+ if @args.first == "help"
10
+ puts "pipelines # manage collections of apps in pipelines"
11
11
  end
12
12
  File.open(RECORDER, 'a') do |file|
13
13
  file.puts @args.join(' ')
@@ -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
data/suspenders.gemspec CHANGED
@@ -25,13 +25,9 @@ weLaika's fork of the famous thoughbot suspenders gem.
25
25
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
26
26
  s.version = Suspenders::VERSION
27
27
 
28
- s.add_dependency 'bundler', '>= 1.8.4'
28
+ s.add_dependency 'bundler', '~> 1.3'
29
29
  s.add_dependency 'rails', Suspenders::RAILS_VERSION
30
30
 
31
31
  s.add_development_dependency 'rspec', '~> 3.4'
32
- s.add_development_dependency 'simple_form', '~> 3.2'
33
- s.add_development_dependency 'title', '~> 0.0'
34
- s.add_development_dependency 'quiet_assets', '~> 1.1'
35
- s.add_development_dependency 'capybara-webkit', '~> 1.8'
36
32
  s.add_development_dependency 'pry-byebug'
37
33
  end
@@ -4,15 +4,12 @@ ruby "<%= Suspenders::RUBY_VERSION %>"
4
4
 
5
5
  gem "airbrake"
6
6
  gem "autoprefixer-rails"
7
- gem "bourbon", "5.0.0.beta.5"
8
7
  gem "coffee-rails", "~> 4.1.0"
9
8
  gem "delayed_job_active_record"
10
9
  gem "draper"
11
10
  gem "email_validator"
12
11
  gem "flutie"
13
- gem "high_voltage"
14
12
  gem "jquery-rails"
15
- gem "neat", "~> 1.7.0"
16
13
  gem "normalize-rails", "~> 3.0.0"
17
14
  gem "pg"
18
15
  gem "puma"
@@ -22,12 +19,15 @@ gem "rails-i18n"
22
19
  gem "recipient_interceptor"
23
20
  gem "sass-rails", "~> 5.0"
24
21
  gem "simple_form"
22
+ gem "skylight"
25
23
  gem "slim-rails"
24
+ gem "welaika-suspenders", ">= <%= Suspenders::VERSION %>"
26
25
  gem "title"
27
26
  gem "uglifier"
28
27
 
29
28
  group :development do
30
29
  gem "letter_opener"
30
+ gem "quiet_assets"
31
31
  gem "spring"
32
32
  gem "spring-commands-rspec"
33
33
  gem "web-console"
@@ -44,7 +44,6 @@ group :development, :test do
44
44
  gem "priscilla"
45
45
  gem "pry-byebug"
46
46
  gem "pry-rails"
47
- gem "quiet_assets"
48
47
  gem "rspec-rails", "~> 3.4.0"
49
48
  gem "rubocop", require: false
50
49
  end
@@ -67,4 +66,5 @@ end
67
66
 
68
67
  group :staging, :production do
69
68
  gem "rack-timeout"
69
+ gem "rails_stdout_logging"
70
70
  end
@@ -31,9 +31,6 @@
31
31
  },
32
32
  "SMTP_USERNAME":{
33
33
  "required":true
34
- },
35
- "WEB_CONCURRENCY":{
36
- "required":true
37
34
  }
38
35
  },
39
36
  "addons":[
@@ -2,4 +2,3 @@
2
2
 
3
3
  @import "normalize-rails"
4
4
  @import "bourbon"
5
- @import "neat"
@@ -8,22 +8,26 @@ AllCops:
8
8
  - "config/**/*"
9
9
  - "bin/*"
10
10
 
11
+ Lint/Debugger:
12
+ Exclude:
13
+ - "spec/support/capybara_webkit.rb"
14
+
15
+ Metrics/AbcSize:
16
+ Max: 18
17
+
11
18
  Metrics/LineLength:
12
19
  Max: 100
13
20
 
14
- Style/StringLiterals:
15
- Enabled: false
16
- EnforcedStyle: double_quotes
17
-
18
21
  Style/Documentation:
19
22
  Enabled: false
20
23
 
21
24
  Style/FrozenStringLiteralComment:
22
25
  Enabled: false
23
26
 
24
- Metrics/AbcSize:
25
- Max: 18
27
+ Style/StringLiterals:
28
+ Enabled: false
29
+ EnforcedStyle: double_quotes
26
30
 
27
- Lint/Debugger:
31
+ Style/TrailingBlankLines:
28
32
  Exclude:
29
- - "spec/support/capybara_webkit.rb"
33
+ - "Gemfile"
@@ -4,7 +4,7 @@ html lang="it"
4
4
  meta charset="utf-8"
5
5
  meta http-equiv="X-UA-Compatible" content="IE=edge"
6
6
  meta name="ROBOTS" content="NOODP"
7
- meta name="viewport" content="width=device-width, initial-scale=1"
7
+ meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"
8
8
 
9
9
  / Configure default and controller-, and view-specific titles in
10
10
  config/locales/en.yml. For more see:
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: welaika-suspenders
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.24.0
4
+ version: 2.25.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - thoughtbot
@@ -9,22 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-04-19 00:00:00.000000000 Z
12
+ date: 2016-06-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ">="
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: 1.8.4
20
+ version: '1.3'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ">="
25
+ - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: 1.8.4
27
+ version: '1.3'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rails
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -53,62 +53,6 @@ dependencies:
53
53
  - - "~>"
54
54
  - !ruby/object:Gem::Version
55
55
  version: '3.4'
56
- - !ruby/object:Gem::Dependency
57
- name: simple_form
58
- requirement: !ruby/object:Gem::Requirement
59
- requirements:
60
- - - "~>"
61
- - !ruby/object:Gem::Version
62
- version: '3.2'
63
- type: :development
64
- prerelease: false
65
- version_requirements: !ruby/object:Gem::Requirement
66
- requirements:
67
- - - "~>"
68
- - !ruby/object:Gem::Version
69
- version: '3.2'
70
- - !ruby/object:Gem::Dependency
71
- name: title
72
- requirement: !ruby/object:Gem::Requirement
73
- requirements:
74
- - - "~>"
75
- - !ruby/object:Gem::Version
76
- version: '0.0'
77
- type: :development
78
- prerelease: false
79
- version_requirements: !ruby/object:Gem::Requirement
80
- requirements:
81
- - - "~>"
82
- - !ruby/object:Gem::Version
83
- version: '0.0'
84
- - !ruby/object:Gem::Dependency
85
- name: quiet_assets
86
- requirement: !ruby/object:Gem::Requirement
87
- requirements:
88
- - - "~>"
89
- - !ruby/object:Gem::Version
90
- version: '1.1'
91
- type: :development
92
- prerelease: false
93
- version_requirements: !ruby/object:Gem::Requirement
94
- requirements:
95
- - - "~>"
96
- - !ruby/object:Gem::Version
97
- version: '1.1'
98
- - !ruby/object:Gem::Dependency
99
- name: capybara-webkit
100
- requirement: !ruby/object:Gem::Requirement
101
- requirements:
102
- - - "~>"
103
- - !ruby/object:Gem::Version
104
- version: '1.8'
105
- type: :development
106
- prerelease: false
107
- version_requirements: !ruby/object:Gem::Requirement
108
- requirements:
109
- - - "~>"
110
- - !ruby/object:Gem::Version
111
- version: '1.8'
112
56
  - !ruby/object:Gem::Dependency
113
57
  name: pry-byebug
114
58
  requirement: !ruby/object:Gem::Requirement
@@ -146,6 +90,7 @@ files:
146
90
  - README.md
147
91
  - RELEASING.md
148
92
  - Rakefile
93
+ - USAGE
149
94
  - bin/rake
150
95
  - bin/rspec
151
96
  - bin/setup
@@ -155,10 +100,14 @@ files:
155
100
  - lib/suspenders/adapters/heroku.rb
156
101
  - lib/suspenders/app_builder.rb
157
102
  - lib/suspenders/generators/app_generator.rb
103
+ - lib/suspenders/generators/static_generator.rb
104
+ - lib/suspenders/generators/stylesheet_base_generator.rb
158
105
  - lib/suspenders/version.rb
106
+ - lib/welaika-suspenders.rb
159
107
  - spec/adapters/heroku_spec.rb
160
108
  - spec/fakes/bin/heroku
161
109
  - spec/fakes/bin/hub
110
+ - spec/features/cli_help_spec.rb
162
111
  - spec/features/github_spec.rb
163
112
  - spec/features/heroku_spec.rb
164
113
  - spec/features/new_project_spec.rb
@@ -186,7 +135,6 @@ files:
186
135
  - templates/config_locales_it.yml.erb
187
136
  - templates/database_cleaner_rspec.rb
188
137
  - templates/dev.rake
189
- - templates/disable_xml_params.rb
190
138
  - templates/dotfiles/.ctags
191
139
  - templates/dotfiles/.env
192
140
  - templates/errors.rb
@@ -224,7 +172,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
224
172
  requirements:
225
173
  - - ">="
226
174
  - !ruby/object:Gem::Version
227
- version: 2.3.0
175
+ version: 2.3.1
228
176
  required_rubygems_version: !ruby/object:Gem::Requirement
229
177
  requirements:
230
178
  - - ">="
@@ -232,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
232
180
  version: '0'
233
181
  requirements: []
234
182
  rubyforge_project:
235
- rubygems_version: 2.6.1
183
+ rubygems_version: 2.6.4
236
184
  signing_key:
237
185
  specification_version: 4
238
186
  summary: Generate a Rails app using thoughtbot's best practices.
@@ -240,6 +188,7 @@ test_files:
240
188
  - spec/adapters/heroku_spec.rb
241
189
  - spec/fakes/bin/heroku
242
190
  - spec/fakes/bin/hub
191
+ - spec/features/cli_help_spec.rb
243
192
  - spec/features/github_spec.rb
244
193
  - spec/features/heroku_spec.rb
245
194
  - spec/features/new_project_spec.rb
@@ -1 +0,0 @@
1
- ActionDispatch::ParamsParser::DEFAULT_PARSERS.delete(Mime::XML)