suspenders 1.33.0 → 1.34.0

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