slining 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dc138d39fcfc49e24940509e4567e4b614beceb8
4
- data.tar.gz: 0158607016f6a98afd3715a0fc23665aff656695
3
+ metadata.gz: 8c8df117de827edd3c6bc4ab3dd8c3c6c5397010
4
+ data.tar.gz: daa8e46cd0c0567ddc3ef3b5d3305a714141612f
5
5
  SHA512:
6
- metadata.gz: 4350f25712e0572315d82f98298fd8daffab9af7c967098bf854210e7e2e6dd91226096ba59c2f606f7cf4723c405919405c8bde171535916017de9cee2660d7
7
- data.tar.gz: 3738f26a5bbbad076e0181b194dcede640ab8b4d3013d6d40b04543de39e8fafaa7cbb6b3739afe128f8f3fdedfea8759257a31f1e04cb45d78740d8ee8f709f
6
+ metadata.gz: 83dc0ede7093828872b27c103a8eba31e877b14175a4c6e6aa637d9fb03815113466e8d5d4a65e9478a3d6cdcf75f7240a410f795b385c386589b3fb12d78648
7
+ data.tar.gz: d33eccc0e3c047930402e4665a1bd223b0759046ae7d4e0c7ec0a25bbeb532e55a0ab7cbfa83ef7180c5cde08e5bfb1bcc66a6e87b062d9464800ed7c0ca6bf4
data/LICENSE CHANGED
@@ -1,7 +1,7 @@
1
1
  The MIT License
2
2
 
3
- Copyright (c) 2015+ vaporware, inc.
4
- Copyright (c) 2008-2015 thoughtbot, inc.
3
+ Copyright (c) 2015-2016+ vaporware, inc.
4
+ Copyright (c) 2008-2016 thoughtbot, inc.
5
5
 
6
6
  Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  of this software and associated documentation files (the "Software"), to deal
data/NEWS.md CHANGED
@@ -1,3 +1,14 @@
1
+ 1.4.0 (February 7, 2016)
2
+ * Fixed error names
3
+ * Enabled Heroku Pipeline Support [upstream-d53de08ef0b7588c5916585916b890e417741dd5]
4
+ * Switch from Airbrake to Honeybadger
5
+ * Remove i18n deprecation warning
6
+ * Simplify Rails AppBuilder methods for Gemfile and gitignore.
7
+ * Generate applications with `rack_mini_profiler` (disabled by default, enabled
8
+ by setting `RACK_MINI_PROFILER=1`)
9
+
10
+ [upstream-d53de08ef0b7588c5916585916b890e417741dd5]: https://github.com/thoughtbot/suspenders/commit/d53de08ef0b7588c5916585916b890e417741dd5
11
+
1
12
  1.3.0 (December 27, 2015)
2
13
  * Ignored `.env.local` instead of `.env` [upstream-8739344046cfbca5b74dcb4d9aba3c6e9c805463]
3
14
  * Add lang attribute to html element in layout [upstream-644dc50bed9c1f520a821f38e8555164c1140bd8]
data/README.md CHANGED
@@ -15,6 +15,12 @@ Then run:
15
15
 
16
16
  This will create a Rails app in `projectname` using the latest version of Rails.
17
17
 
18
+ ### Associated services
19
+
20
+ * Enable [Circle CI](https://circleci.com/) Continuous Integration
21
+ * Enable [GitHub auto deploys to Heroku staging and review
22
+ apps](https://dashboard.heroku.com/apps/app-name-staging/deploy/github).
23
+
18
24
  ## Gemfile
19
25
 
20
26
  To see the latest and greatest gems, look at Slining's
@@ -23,7 +29,6 @@ generated projectname/Gemfile.
23
29
 
24
30
  It includes application gems like:
25
31
 
26
- * [Airbrake](https://github.com/airbrake/airbrake) for exception notification
27
32
  * [Autoprefixer Rails](https://github.com/ai/autoprefixer-rails) for CSS vendor prefixes
28
33
  * [Bootstrap](getbootstrap.com) for fast frontend prototyping
29
34
  * [Delayed Job](https://github.com/collectiveidea/delayed_job) for background
@@ -34,6 +39,7 @@ It includes application gems like:
34
39
  helpers
35
40
  * [HAML](http://haml.info/) for cleaner view code
36
41
  * [High Voltage](https://github.com/thoughtbot/high_voltage) for static pages
42
+ * [Honeybadger](https://honeybadger.io) for exception notification
37
43
  * [jQuery Rails](https://github.com/rails/jquery-rails) for jQuery
38
44
  * [New Relic RPM](https://github.com/newrelic/rpm) for monitoring performance
39
45
  * [Normalize](https://necolas.github.io/normalize.css/) for resetting browser styles
@@ -125,9 +131,11 @@ This:
125
131
  * Adds the [Rails Stdout Logging][logging-gem] gem
126
132
  to configure the app to log to standard out,
127
133
  which is how [Heroku's logging][heroku-logging] works.
134
+ * Creates a [Heroku Pipeline] for review apps
128
135
 
129
136
  [logging-gem]: https://github.com/heroku/rails_stdout_logging
130
137
  [heroku-logging]: https://devcenter.heroku.com/articles/logging#writing-to-your-log
138
+ [Heroku Pipeline]: https://devcenter.heroku.com/articles/pipelines
131
139
 
132
140
  You can optionally specify alternate Heroku flags:
133
141
 
@@ -205,7 +213,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md).
205
213
  Thank you, [contributors]!
206
214
 
207
215
  ## License
208
- Slining is Copyright © 2015+ vaporware. MIT Licensed, see [LICENSE] for details.
216
+ Slining is Copyright © 2015-2016+ vaporware. MIT Licensed, see [LICENSE] for details.
209
217
 
210
218
  [gem]: https://rubygems.org/gems/slining
211
219
  [circleci]: https://circleci.com/gh/vaporware/slining
data/bin/setup CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env sh
1
+ #!/bin/sh
2
2
 
3
3
  # Run this script immediately after cloning the codebase.
4
4
 
@@ -7,8 +7,6 @@ module Slining
7
7
 
8
8
  def set_heroku_remotes
9
9
  remotes = <<-SHELL.strip_heredoc
10
-
11
- # Set up the staging and production apps.
12
10
  #{command_to_join_heroku_app('staging')}
13
11
  #{command_to_join_heroku_app('production')}
14
12
  git config heroku.remote staging
@@ -25,6 +23,20 @@ module Slining
25
23
  )
26
24
  end
27
25
 
26
+ def create_staging_heroku_app(flags)
27
+ rack_env = "RACK_ENV=staging RAILS_ENV=staging"
28
+ app_name = heroku_app_name_for("staging")
29
+
30
+ run_toolbelt_command "create #{app_name} #{flags}", "staging"
31
+ run_toolbelt_command "config:add #{rack_env}", "staging"
32
+ end
33
+
34
+ def create_production_heroku_app(flags)
35
+ app_name = heroku_app_name_for("production")
36
+
37
+ run_toolbelt_command "create #{app_name} #{flags}", "production"
38
+ end
39
+
28
40
  def set_heroku_rails_secrets
29
41
  %w(staging production).each do |environment|
30
42
  run_toolbelt_command(
@@ -34,6 +46,49 @@ module Slining
34
46
  end
35
47
  end
36
48
 
49
+ def provide_review_apps_setup_script
50
+ app_builder.template(
51
+ "bin_setup_review_app.erb",
52
+ "bin/setup_review_app",
53
+ force: true,
54
+ )
55
+ app_builder.run "chmod a+x bin/setup_review_app"
56
+ end
57
+
58
+ def create_heroku_pipelines_config_file
59
+ app_builder.template "app.json.erb", "app.json"
60
+ end
61
+
62
+ def create_heroku_pipeline
63
+ pipelines_plugin = `heroku plugins | grep pipelines`
64
+ if pipelines_plugin.empty?
65
+ puts "You need heroku pipelines plugin. Run: heroku plugins:install heroku-pipelines"
66
+ exit 1
67
+ end
68
+
69
+ heroku_app_name = app_builder.app_name.dasherize
70
+ run_toolbelt_command(
71
+ "pipelines:create #{heroku_app_name} \
72
+ -a #{heroku_app_name}-staging --stage staging",
73
+ "staging",
74
+ )
75
+
76
+ run_toolbelt_command(
77
+ "pipelines:add #{heroku_app_name} \
78
+ -a #{heroku_app_name}-production --stage production",
79
+ "production",
80
+ )
81
+ end
82
+
83
+ def set_heroku_serve_static_files
84
+ %w(staging production).each do |environment|
85
+ run_toolbelt_command(
86
+ "config:add RAILS_SERVE_STATIC_FILES=true",
87
+ environment,
88
+ )
89
+ end
90
+ end
91
+
37
92
  private
38
93
 
39
94
  attr_reader :app_builder
@@ -41,6 +96,7 @@ module Slining
41
96
  def command_to_join_heroku_app(environment)
42
97
  heroku_app_name = heroku_app_name_for(environment)
43
98
  <<-SHELL
99
+
44
100
  if heroku join --app #{heroku_app_name} &> /dev/null; then
45
101
  git remote add #{environment} git@heroku.com:#{heroku_app_name}.git || true
46
102
  printf 'You are a collaborator on the "#{heroku_app_name}" Heroku app\n'
@@ -6,14 +6,35 @@ module Slining
6
6
  extend Forwardable
7
7
 
8
8
  def_delegators :heroku_adapter,
9
+ :create_heroku_pipelines_config_file,
10
+ :create_heroku_pipeline,
11
+ :create_production_heroku_app,
12
+ :create_staging_heroku_app,
13
+ :provide_review_apps_setup_script,
14
+ :set_heroku_rails_secrets,
9
15
  :set_heroku_remotes,
10
- :set_up_heroku_specific_gems,
11
- :set_heroku_rails_secrets
16
+ :set_heroku_serve_static_files,
17
+ :set_up_heroku_specific_gems
12
18
 
13
19
  def readme
14
20
  template 'README.md.erb', 'README.md'
15
21
  end
16
22
 
23
+ def gitignore
24
+ copy_file "slining_gitignore", ".gitignore"
25
+ end
26
+
27
+ def gemfile
28
+ template "Gemfile.erb", "Gemfile"
29
+ end
30
+
31
+ def setup_rack_mini_profiler
32
+ copy_file(
33
+ "rack_mini_profiler.rb",
34
+ "config/initializers/rack_mini_profiler.rb",
35
+ )
36
+ end
37
+
17
38
  def raise_on_missing_assets_in_test
18
39
  inject_into_file(
19
40
  "config/environments/test.rb",
@@ -69,7 +90,7 @@ module Slining
69
90
  end
70
91
 
71
92
  def provide_setup_script
72
- template "bin_setup.erb", "bin/setup", force: true
93
+ template "bin_setup", "bin/setup", force: true
73
94
  run "chmod a+x bin/setup"
74
95
  end
75
96
 
@@ -130,6 +151,10 @@ module Slining
130
151
  def enable_rack_canonical_host
131
152
  config = <<-RUBY
132
153
 
154
+ if ENV.fetch("HEROKU_APP_NAME", "").include?("staging-pr-")
155
+ ENV["APPLICATION_HOST"] = ENV["HEROKU_APP_NAME"] ".herokuapp.com"
156
+ end
157
+
133
158
  # Ensure requests are only served from one, canonical host name
134
159
  config.middleware.use Rack::CanonicalHost, ENV.fetch("APPLICATION_HOST")
135
160
  RUBY
@@ -137,7 +162,7 @@ module Slining
137
162
  inject_into_file(
138
163
  "config/environments/production.rb",
139
164
  config,
140
- after: serve_static_files_line
165
+ after: "Rails.application.configure do",
141
166
  )
142
167
  end
143
168
 
@@ -221,11 +246,6 @@ end
221
246
  bundle_command 'exec rake db:create db:migrate'
222
247
  end
223
248
 
224
- def replace_gemfile
225
- remove_file 'Gemfile'
226
- template 'Gemfile.erb', 'Gemfile'
227
- end
228
-
229
249
  def set_ruby_to_version_being_used
230
250
  create_file '.ruby-version', "#{Slining::RUBY_VERSION}\n"
231
251
  end
@@ -305,14 +325,6 @@ Rack::Timeout.timeout = (ENV["RACK_TIMEOUT"] || 10).to_i
305
325
  configure_environment "test", "config.active_job.queue_adapter = :inline"
306
326
  end
307
327
 
308
- def fix_i18n_deprecation_warning
309
- config = <<-RUBY
310
- config.i18n.enforce_available_locales = true
311
- RUBY
312
-
313
- inject_into_class 'config/application.rb', 'Application', config
314
- end
315
-
316
328
  def generate_rspec
317
329
  generate 'rspec:install'
318
330
  end
@@ -331,9 +343,7 @@ Rack::Timeout.timeout = (ENV["RACK_TIMEOUT"] || 10).to_i
331
343
  "app/assets/stylesheets/application.scss"
332
344
  end
333
345
 
334
- def gitignore_files
335
- remove_file '.gitignore'
336
- copy_file 'slining_gitignore', '.gitignore'
346
+ def setup_default_directories
337
347
  [
338
348
  'app/views/pages',
339
349
  'spec/lib',
@@ -343,8 +353,7 @@ Rack::Timeout.timeout = (ENV["RACK_TIMEOUT"] || 10).to_i
343
353
  'spec/support/mixins',
344
354
  'spec/support/shared_examples'
345
355
  ].each do |dir|
346
- run "mkdir #{dir}"
347
- run "touch #{dir}/.keep"
356
+ empty_directory_with_keep_file dir
348
357
  end
349
358
  end
350
359
 
@@ -356,32 +365,11 @@ Rack::Timeout.timeout = (ENV["RACK_TIMEOUT"] || 10).to_i
356
365
  run 'git init'
357
366
  end
358
367
 
359
- def create_staging_heroku_app(flags)
360
- rack_env = "RACK_ENV=staging RAILS_ENV=staging"
361
- app_name = heroku_app_name_for("staging")
362
-
363
- run_heroku "create #{app_name} #{flags}", "staging"
364
- run_heroku "config:add #{rack_env}", "staging"
365
- end
366
-
367
- def create_production_heroku_app(flags)
368
- app_name = heroku_app_name_for("production")
369
-
370
- run_heroku "create #{app_name} #{flags}", "production"
371
- end
372
-
373
368
  def create_heroku_apps(flags)
374
369
  create_staging_heroku_app(flags)
375
370
  create_production_heroku_app(flags)
376
371
  end
377
372
 
378
-
379
- def set_heroku_serve_static_files
380
- %w(staging production).each do |environment|
381
- run_heroku "config:add RAILS_SERVE_STATIC_FILES=true", environment
382
- end
383
- end
384
-
385
373
  def provide_deploy_script
386
374
  copy_file "bin_deploy", "bin/deploy"
387
375
 
@@ -401,7 +389,6 @@ you can deploy to staging and production with:
401
389
  end
402
390
 
403
391
  def configure_automatic_deployment
404
- staging_remote_name = heroku_app_name_for("staging")
405
392
  deploy_command = <<-YML.strip_heredoc
406
393
  deployment:
407
394
  staging:
@@ -506,10 +493,6 @@ end
506
493
  uncomment_lines("config/environments/#{environment}.rb", config)
507
494
  end
508
495
 
509
- def run_heroku(command, environment)
510
- run "heroku #{command} --remote #{environment}"
511
- end
512
-
513
496
  def heroku_adapter
514
497
  @heroku_adapter ||= Adapters::Heroku.new(self)
515
498
  end
@@ -517,9 +500,5 @@ end
517
500
  def serve_static_files_line
518
501
  "config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?\n"
519
502
  end
520
-
521
- def heroku_app_name_for(environment)
522
- "#{app_name.dasherize}-#{environment}"
523
- end
524
503
  end
525
504
  end
@@ -55,7 +55,6 @@ module Slining
55
55
  end
56
56
 
57
57
  def customize_gemfile
58
- build :replace_gemfile
59
58
  build :set_ruby_to_version_being_used
60
59
 
61
60
  if options[:heroku]
@@ -141,10 +140,10 @@ module Slining
141
140
  build :configure_active_job
142
141
  build :configure_time_formats
143
142
  build :disable_xml_params
144
- build :fix_i18n_deprecation_warning
145
143
  build :setup_default_rake_task
146
144
  build :configure_puma
147
145
  build :set_up_forego
146
+ build :setup_rack_mini_profiler
148
147
  end
149
148
 
150
149
  def setup_stylesheets
@@ -154,8 +153,8 @@ module Slining
154
153
 
155
154
  def setup_git
156
155
  if !options[:skip_git]
157
- say 'Initializing git'
158
- invoke :setup_gitignore
156
+ say "Initializing git"
157
+ invoke :setup_default_directories
159
158
  invoke :init_git
160
159
  end
161
160
  end
@@ -164,9 +163,12 @@ module Slining
164
163
  if options[:heroku]
165
164
  say "Creating Heroku apps"
166
165
  build :create_heroku_apps, options[:heroku_flags]
166
+ build :provide_review_apps_setup_script
167
167
  build :set_heroku_serve_static_files
168
168
  build :set_heroku_remotes
169
169
  build :set_heroku_rails_secrets
170
+ build :create_heroku_pipelines_config_file
171
+ build :create_heroku_pipeline
170
172
  build :provide_deploy_script
171
173
  build :configure_automatic_deployment
172
174
  end
@@ -188,8 +190,8 @@ module Slining
188
190
  build :copy_dotfiles
189
191
  end
190
192
 
191
- def setup_gitignore
192
- build :gitignore_files
193
+ def setup_default_directories
194
+ build :setup_default_directories
193
195
  end
194
196
 
195
197
  def setup_bundler_audit
@@ -226,7 +228,7 @@ module Slining
226
228
 
227
229
  def outro
228
230
  say 'Congratulations! You just found the silver lining.'
229
- say "Remember to run 'rails generate airbrake' with your API key."
231
+ say honeybadger_outro
230
232
  end
231
233
 
232
234
  protected
@@ -238,5 +240,17 @@ module Slining
238
240
  def using_active_record?
239
241
  !options[:skip_active_record]
240
242
  end
243
+
244
+ private
245
+
246
+ def honeybadger_outro
247
+ "Run 'bundle exec honeybadger heroku install' with your API key#{honeybadger_message_suffix}."
248
+ end
249
+
250
+ def honeybadger_message_suffix
251
+ if options[:heroku]
252
+ " unless you're using the Heroku Honeybadger add-on"
253
+ end
254
+ end
241
255
  end
242
256
  end
@@ -1,5 +1,5 @@
1
1
  module Slining
2
2
  RAILS_VERSION = "~> 4.2.0"
3
3
  RUBY_VERSION = IO.read("#{File.dirname(__FILE__)}/../../.ruby-version").strip
4
- VERSION = "1.3.0"
4
+ VERSION = "1.4.0"
5
5
  end
@@ -20,6 +20,7 @@ RSpec.describe "Heroku" do
20
20
  "production",
21
21
  "SECRET_KEY_BASE",
22
22
  )
23
+ expect(FakeHeroku).to have_setup_pipeline_for(app_name)
23
24
 
24
25
  bin_setup_path = "#{project_path}/bin/setup"
25
26
  bin_setup = IO.read(bin_setup_path)
@@ -28,6 +29,13 @@ RSpec.describe "Heroku" do
28
29
  expect(bin_setup).to include("heroku join --app #{app_name}-staging")
29
30
  expect(bin_setup).to include("git config heroku.remote staging")
30
31
  expect(File.stat(bin_setup_path)).to be_executable
32
+ bin_setup_path = "#{project_path}/bin/setup_review_app"
33
+ bin_setup = IO.read(bin_setup_path)
34
+
35
+ expect(bin_setup).to include("heroku run rake db:migrate --app #{app_name}-staging-pr-$1")
36
+ expect(bin_setup).to include("heroku ps:scale worker=1 --app #{app_name}-staging-pr-$1")
37
+ expect(bin_setup).to include("heroku restart --app #{app_name}-staging-pr-$1")
38
+ expect(File.stat(bin_setup_path)).to be_executable
31
39
 
32
40
  bin_deploy_path = "#{project_path}/bin/deploy"
33
41
  bin_deploy = IO.read(bin_deploy_path)
@@ -51,6 +59,17 @@ RSpec.describe "Heroku" do
51
59
  - bin/deploy staging
52
60
  YML
53
61
  end
62
+
63
+ it "adds app.json file" do
64
+ expect(File).to exist("#{project_path}/app.json")
65
+ end
66
+
67
+ it "includes application name in app.json file" do
68
+ app_json_file = IO.read("#{project_path}/app.json")
69
+ app_name = SliningTestHelpers::APP_NAME.dasherize
70
+
71
+ expect(app_json_file).to match(/"name":"#{app_name}"/)
72
+ end
54
73
  end
55
74
 
56
75
  context "--heroku with region flag" do
@@ -7,6 +7,19 @@ RSpec.describe "Slining a new project with default configuration" do
7
7
  run_slining
8
8
  end
9
9
 
10
+ it "uses custom Gemfile" do
11
+ gemfile_file = IO.read("#{project_path}/Gemfile")
12
+ expect(gemfile_file).to match(
13
+ /^ruby "#{Slining::RUBY_VERSION}"$/,
14
+ )
15
+ expect(gemfile_file).to match(
16
+ /^gem "autoprefixer-rails"$/,
17
+ )
18
+ expect(gemfile_file).to match(
19
+ /^gem "rails", "#{Slining::RAILS_VERSION}"$/,
20
+ )
21
+ end
22
+
10
23
  it "ensures project specs pass" do
11
24
  Dir.chdir(project_path) do
12
25
  Bundler.with_clean_env do
@@ -41,6 +54,16 @@ RSpec.describe "Slining a new project with default configuration" do
41
54
  expect(secrets_file).to match(/secret_key_base: <%= ENV\["SECRET_KEY_BASE"\] %>/)
42
55
  end
43
56
 
57
+ it "adds bin/setup file" do
58
+ expect(File).to exist("#{project_path}/bin/setup")
59
+ end
60
+
61
+ it "makes bin/setup executable" do
62
+ bin_setup_path = "#{project_path}/bin/setup"
63
+
64
+ expect(File.stat(bin_setup_path)).to be_executable
65
+ end
66
+
44
67
  it "adds support file for action mailer" do
45
68
  expect(File).to exist("#{project_path}/spec/support/action_mailer.rb")
46
69
  end
@@ -59,6 +82,23 @@ RSpec.describe "Slining a new project with default configuration" do
59
82
  expect(hound_config_file).to include "enabled: true"
60
83
  end
61
84
 
85
+ it "ensures Gemfile contains `rack-mini-profiler`" do
86
+ gemfile = IO.read("#{project_path}/Gemfile")
87
+
88
+ expect(gemfile).to include %{gem "rack-mini-profiler", require: false}
89
+ end
90
+
91
+ it "ensures .sample.env defaults to RACK_MINI_PROFILER=0" do
92
+ env = IO.read("#{project_path}/.env")
93
+
94
+ expect(env).to include "RACK_MINI_PROFILER=0"
95
+ end
96
+
97
+ it "creates a rack-mini-profiler initializer" do
98
+ expect(File).
99
+ to exist("#{project_path}/config/initializers/rack_mini_profiler.rb")
100
+ end
101
+
62
102
  it "ensures newrelic.yml reads NewRelic license from env" do
63
103
  newrelic_file = IO.read("#{project_path}/config/newrelic.yml")
64
104
 
@@ -182,6 +222,10 @@ RSpec.describe "Slining a new project with default configuration" do
182
222
  expect(File).to exist("#{project_path}/spec/factories.rb")
183
223
  end
184
224
 
225
+ def app_name
226
+ SliningTestHelpers::APP_NAME
227
+ end
228
+
185
229
  def analytics_partial
186
230
  IO.read("#{project_path}/app/views/application/_analytics.html.erb")
187
231
  end
@@ -6,6 +6,9 @@ class FakeHeroku
6
6
  end
7
7
 
8
8
  def run!
9
+ if @args.first == "plugins"
10
+ puts "heroku-pipelines@0.29.0"
11
+ end
9
12
  File.open(RECORDER, 'a') do |file|
10
13
  file.puts @args.join(' ')
11
14
  end
@@ -39,6 +42,11 @@ class FakeHeroku
39
42
  commands_ran =~ /^config:add #{var}=.+ --remote #{remote_name}\n/
40
43
  end
41
44
 
45
+ def self.has_setup_pipeline_for?(app_name)
46
+ commands_ran =~ /^pipelines:create #{app_name} -a #{app_name}-staging --stage staging/ &&
47
+ commands_ran =~ /^pipelines:add #{app_name} -a #{app_name}-production --stage production/
48
+ end
49
+
42
50
  def self.commands_ran
43
51
  @commands_ran ||= File.read(RECORDER)
44
52
  end
@@ -2,7 +2,6 @@ source "https://rubygems.org"
2
2
 
3
3
  ruby "<%= Slining::RUBY_VERSION %>"
4
4
 
5
- gem "airbrake"
6
5
  gem "autoprefixer-rails"
7
6
  gem "bootstrap-sass", "~> 3.3.5"
8
7
  gem "coffee-rails", "~> 4.1.0"
@@ -11,6 +10,7 @@ gem "email_validator"
11
10
  gem "flutie"
12
11
  gem "haml-rails", "~> 0.9"
13
12
  gem "high_voltage"
13
+ gem "honeybadger"
14
14
  gem "jquery-rails"
15
15
  gem "newrelic_rpm", ">= 3.9.8"
16
16
  gem "normalize-rails", "~> 3.0.0"
@@ -42,6 +42,10 @@ group :development, :test do
42
42
  gem "rspec-rails", "~> 3.4.0"
43
43
  end
44
44
 
45
+ group :development, :staging do
46
+ gem "rack-mini-profiler", require: false
47
+ end
48
+
45
49
  group :test do
46
50
  gem "capybara-webkit", ">= 1.2.0"
47
51
  gem "database_cleaner"
@@ -0,0 +1,39 @@
1
+ {
2
+ "name":"<%= app_name.dasherize %>",
3
+ "scripts":{},
4
+ "env":{
5
+ "AIRBRAKE_API_KEY":{
6
+ "required":true
7
+ },
8
+ "EMAIL_RECIPIENTS":{
9
+ "required":true
10
+ },
11
+ "RACK_ENV":{
12
+ "required":true
13
+ },
14
+ "RAILS_ENV":{
15
+ "required":true
16
+ },
17
+ "SECRET_KEY_BASE":{
18
+ "generator":"secret"
19
+ },
20
+ "SMTP_ADDRESS":{
21
+ "required":true
22
+ },
23
+ "SMTP_DOMAIN":{
24
+ "required":true
25
+ },
26
+ "SMTP_PASSWORD":{
27
+ "required":true
28
+ },
29
+ "SMTP_USERNAME":{
30
+ "required":true
31
+ },
32
+ "WEB_CONCURRENCY":{
33
+ "required":true
34
+ }
35
+ },
36
+ "addons":[
37
+ "heroku-postgresql"
38
+ ]
39
+ }
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env sh
1
+ #!/bin/sh
2
2
 
3
3
  # Set up Rails app. Run this script immediately after cloning the codebase.
4
4
  # https://github.com/thoughtbot/guides/tree/master/protocol
@@ -0,0 +1,19 @@
1
+ #!/bin/sh
2
+
3
+ # Run this script to set up a review app's database and worker dyno
4
+
5
+ set -e
6
+
7
+ if [ -z "$1" ]; then
8
+ printf "You must provide a review app (same as the pull request) id.\n"
9
+ exit 64
10
+ fi
11
+
12
+ heroku pg:backups restore \
13
+ `heroku pg:backups public-url -a <%= app_name.dasherize %>-staging` \
14
+ DATABASE_URL \
15
+ --confirm <%= app_name.dasherize %>-staging-pr-$1 \
16
+ --app <%= app_name.dasherize %>-staging-pr-$1
17
+ heroku run rake db:migrate --app <%= app_name.dasherize %>-staging-pr-$1
18
+ heroku ps:scale worker=1 --app <%= app_name.dasherize %>-staging-pr-$1
19
+ heroku restart --app <%= app_name.dasherize %>-staging-pr-$1
@@ -3,6 +3,7 @@ APPLICATION_HOST=localhost:3000
3
3
  ASSET_HOST=localhost:3000
4
4
  EXECJS_RUNTIME=Node
5
5
  RACK_ENV=development
6
+ RACK_MINI_PROFILER=0
6
7
  SECRET_KEY_BASE=development_secret
7
8
  SMTP_ADDRESS=smtp.example.com
8
9
  SMTP_DOMAIN=example.com
data/templates/errors.rb CHANGED
@@ -15,7 +15,7 @@ HTTP_ERRORS = [
15
15
  Net::HTTPBadResponse,
16
16
  Net::HTTPHeaderSyntaxError,
17
17
  Net::ProtocolError,
18
- Timeout::Error
18
+ Timeout::Error,
19
19
  ]
20
20
 
21
21
  SMTP_SERVER_ERRORS = [
@@ -23,12 +23,12 @@ SMTP_SERVER_ERRORS = [
23
23
  Net::SMTPAuthenticationError,
24
24
  Net::SMTPServerBusy,
25
25
  Net::SMTPUnknownError,
26
- TimeoutError
26
+ Timeout::Error,
27
27
  ]
28
28
 
29
29
  SMTP_CLIENT_ERRORS = [
30
30
  Net::SMTPFatalError,
31
- Net::SMTPSyntaxError
31
+ Net::SMTPSyntaxError,
32
32
  ]
33
33
 
34
34
  SMTP_ERRORS = SMTP_SERVER_ERRORS + SMTP_CLIENT_ERRORS
@@ -0,0 +1,5 @@
1
+ if ENV["RACK_MINI_PROFILER"].to_i > 0
2
+ require "rack-mini-profiler"
3
+
4
+ Rack::MiniProfilerRails.initialize!(Rails.application)
5
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slining
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - vaporware
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-27 00:00:00.000000000 Z
11
+ date: 2016-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -115,9 +115,11 @@ files:
115
115
  - templates/_flashes.html.erb
116
116
  - templates/_javascript.html.erb
117
117
  - templates/action_mailer.rb
118
+ - templates/app.json.erb
118
119
  - templates/application.scss
119
120
  - templates/bin_deploy
120
- - templates/bin_setup.erb
121
+ - templates/bin_setup
122
+ - templates/bin_setup_review_app.erb
121
123
  - templates/browserslist
122
124
  - templates/bundler_audit.rake
123
125
  - templates/capybara_webkit.rb
@@ -138,6 +140,7 @@ files:
138
140
  - templates/newrelic.yml.erb
139
141
  - templates/postgresql_database.yml.erb
140
142
  - templates/puma.rb
143
+ - templates/rack_mini_profiler.rb
141
144
  - templates/rails_helper.rb
142
145
  - templates/secrets.yml
143
146
  - templates/shoulda_matchers_config_rspec.rb
@@ -171,14 +174,4 @@ rubygems_version: 2.5.1
171
174
  signing_key:
172
175
  specification_version: 4
173
176
  summary: Generate a Rails app using vaporware's best practices.
174
- test_files:
175
- - spec/adapters/heroku_spec.rb
176
- - spec/fakes/bin/heroku
177
- - spec/fakes/bin/hub
178
- - spec/features/github_spec.rb
179
- - spec/features/heroku_spec.rb
180
- - spec/features/new_project_spec.rb
181
- - spec/spec_helper.rb
182
- - spec/support/fake_github.rb
183
- - spec/support/fake_heroku.rb
184
- - spec/support/slining.rb
177
+ test_files: []