suspenders 1.31.0 → 1.32.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: bc097cf89da27e8006356a8716c702f400b76631
4
- data.tar.gz: 474d6fe3b9dd0b81dfa4be406e30fc7a2f38b991
3
+ metadata.gz: e4c2b69ad9b649ff93f1db328f9eaf6b895e4161
4
+ data.tar.gz: 4ff00b6fdb1af98288925b742469375a208ac6f9
5
5
  SHA512:
6
- metadata.gz: 48f0762028d843e9a95d3e1c8c718ed557d0cf3cf38f8f54983f7e6b89c2799947007fa5a52840e6d975a52d1a405e333b4e827d597c235324305ea54dbf5a83
7
- data.tar.gz: 9359e82fa9095de86f5c8940699f13cee98096d2c51bf80871c4609f0dd7223f8ac4e61ef35451df14e0780b98353f0efc3cab403e3d82697da098c6f5f1df0c
6
+ metadata.gz: 84e17680c1accc5fff345b16919ac7c0e3d88ccb677e828065893cbeb61a1a9cf7efde9add03be1e9a9c57f1b3154ecd4b0f343a8f0c12acc533118057b19b50
7
+ data.tar.gz: 13a16169ce1e54e6175afda0433849335fdfeac58d4c117d0ffc630e2c3265a3e93bde499336662e64d4aac6255a91e90d35f2dad4fc65ce1bf197a79c235637
data/NEWS.md CHANGED
@@ -1,3 +1,13 @@
1
+ 1.32.0 (October 9, 2015)
2
+
3
+ * Install Foreman automatically during setup script
4
+ * Port always defaults to 3000
5
+ * Provide shoulda-matchers config
6
+ * Set CI auto-deploy for Heroku suspended apps
7
+ * Configure capybara-webkit to block unknown URLs
8
+ * Add mandatory environment variables to .sample.env
9
+ * Other bugfixes
10
+
1
11
  1.31.0 (September 3, 2015)
2
12
 
3
13
  * Update to Ruby 2.2.3
@@ -28,7 +28,7 @@ module Suspenders
28
28
  end
29
29
 
30
30
  def provide_setup_script
31
- template "bin_setup.erb", "bin/setup", port_number: port, force: true
31
+ template "bin_setup.erb", "bin/setup", force: true
32
32
  run "chmod a+x bin/setup"
33
33
  end
34
34
 
@@ -86,7 +86,7 @@ module Suspenders
86
86
  config = <<-RUBY
87
87
 
88
88
  # Ensure requests are only served from one, canonical host name
89
- config.middleware.use Rack::CanonicalHost, ENV.fetch("HOST")
89
+ config.middleware.use Rack::CanonicalHost, ENV.fetch("APPLICATION_HOST")
90
90
  RUBY
91
91
 
92
92
  inject_into_file(
@@ -197,6 +197,13 @@ end
197
197
  copy_file 'database_cleaner_rspec.rb', 'spec/support/database_cleaner.rb'
198
198
  end
199
199
 
200
+ def provide_shoulda_matchers_config
201
+ copy_file(
202
+ "shoulda_matchers_config_rspec.rb",
203
+ "spec/support/shoulda_matchers_config.rb"
204
+ )
205
+ end
206
+
200
207
  def configure_spec_support_features
201
208
  empty_directory_with_keep_file 'spec/features'
202
209
  empty_directory_with_keep_file 'spec/support/features'
@@ -253,10 +260,10 @@ Rack::Timeout.timeout = (ENV["RACK_TIMEOUT"] || 10).to_i
253
260
  end
254
261
 
255
262
  def configure_action_mailer
256
- action_mailer_host "development", %{"localhost:#{port}"}
263
+ action_mailer_host "development", %{"localhost:3000"}
257
264
  action_mailer_host "test", %{"www.example.com"}
258
- action_mailer_host "staging", %{ENV.fetch("HOST")}
259
- action_mailer_host "production", %{ENV.fetch("HOST")}
265
+ action_mailer_host "staging", %{ENV.fetch("APPLICATION_HOST")}
266
+ action_mailer_host "production", %{ENV.fetch("APPLICATION_HOST")}
260
267
  end
261
268
 
262
269
  def configure_active_job
@@ -400,6 +407,20 @@ you can deploy to staging and production with:
400
407
  run "chmod a+x bin/deploy"
401
408
  end
402
409
 
410
+ def configure_automatic_deployment
411
+ staging_remote_name = heroku_app_name_for("staging")
412
+ deploy_command = <<-YML.strip_heredoc
413
+ deployment:
414
+ staging:
415
+ branch: master
416
+ commands:
417
+ - git remote add staging git@heroku.com:#{staging_remote_name}.git
418
+ - bin/deploy staging
419
+ YML
420
+
421
+ append_file "circle.yml", deploy_command
422
+ end
423
+
403
424
  def create_github_repo(repo_name)
404
425
  path_addition = override_path_for_tests
405
426
  run "#{path_addition} hub create #{repo_name}"
@@ -510,10 +531,6 @@ end
510
531
  SecureRandom.hex(64)
511
532
  end
512
533
 
513
- def port
514
- @port ||= [3000, 4000, 5000, 7000, 8000, 9000].sample
515
- end
516
-
517
534
  def serve_static_files_line
518
535
  "config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?\n"
519
536
  end
@@ -96,6 +96,7 @@ module Suspenders
96
96
  build :configure_rspec
97
97
  build :configure_background_jobs_for_rspec
98
98
  build :enable_database_cleaner
99
+ build :provide_shoulda_matchers_config
99
100
  build :configure_spec_support_features
100
101
  build :configure_ci
101
102
  build :configure_i18n_for_test_environment
@@ -175,6 +176,7 @@ module Suspenders
175
176
  build :set_heroku_remotes
176
177
  build :set_heroku_rails_secrets
177
178
  build :provide_deploy_script
179
+ build :configure_automatic_deployment
178
180
  end
179
181
  end
180
182
 
@@ -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.31.0"
4
+ VERSION = "1.32.0"
5
5
  end
@@ -35,6 +35,18 @@ RSpec.describe "Heroku" do
35
35
 
36
36
  expect(readme).to include("./bin/deploy staging")
37
37
  expect(readme).to include("./bin/deploy production")
38
+
39
+ circle_yml_path = "#{project_path}/circle.yml"
40
+ circle_yml = IO.read(circle_yml_path)
41
+
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
38
50
  end
39
51
 
40
52
  it "suspends a project with extra Heroku flags" do
@@ -111,6 +111,12 @@ RSpec.describe "Suspend a new project with default configuration" do
111
111
  to match(/^ +config.action_mailer.delivery_method = :test$/)
112
112
  end
113
113
 
114
+ it "uses APPLICATION_HOST, not HOST in the production config" do
115
+ prod_env_file = IO.read("#{project_path}/config/environments/production.rb")
116
+ expect(prod_env_file).to match(/"APPLICATION_HOST"/)
117
+ expect(prod_env_file).not_to match(/"HOST"/)
118
+ end
119
+
114
120
  it "configs active job queue adapter" do
115
121
  application_config = IO.read("#{project_path}/config/application.rb")
116
122
  test_config = IO.read("#{project_path}/config/environments/test.rb")
@@ -43,11 +43,11 @@ group :development, :test do
43
43
  end
44
44
 
45
45
  group :test do
46
- gem "capybara-webkit", ">= 1.2.0"
46
+ gem "capybara-webkit"
47
47
  gem "database_cleaner"
48
48
  gem "formulaic"
49
49
  gem "launchy"
50
- gem "shoulda-matchers", require: false
50
+ gem "shoulda-matchers"
51
51
  gem "simplecov", require: false
52
52
  gem "timecop"
53
53
  gem "webmock"
@@ -23,12 +23,11 @@ mkdir -p .git/safe
23
23
 
24
24
  # Pick a port for Foreman
25
25
  if ! grep --quiet --no-messages --fixed-strings 'port' .foreman; then
26
- printf 'port: <%= config[:port_number] %>\n' >> .foreman
26
+ printf 'port: 3000\n' >> .foreman
27
27
  fi
28
28
 
29
29
  if ! command -v foreman > /dev/null; then
30
- printf 'Foreman is not installed.\n'
31
- printf 'See https://github.com/ddollar/foreman for install instructions.\n'
30
+ gem install foreman
32
31
  fi
33
32
 
34
33
  # Only if this isn't CI
@@ -4,8 +4,8 @@ development: &default
4
4
  encoding: utf8
5
5
  host: localhost
6
6
  min_messages: warning
7
- pool: <%%= ENV.fetch("DB_POOL", 5) %>
8
- reaping_frequency: <%%= ENV.fetch("DB_REAPING_FREQUENCY", 10) %>
7
+ pool: <%%= Integer(ENV.fetch("DB_POOL", 5)) %>
8
+ reaping_frequency: <%%= Integer(ENV.fetch("DB_REAPING_FREQUENCY", 10)) %>
9
9
  timeout: 5000
10
10
 
11
11
  test:
@@ -15,7 +15,7 @@ test:
15
15
  production: &deploy
16
16
  encoding: utf8
17
17
  min_messages: warning
18
- pool: <%%= [ENV.fetch("MAX_THREADS", 5), ENV.fetch("DB_POOL", 5)].max %>
18
+ pool: <%%= [Integer(ENV.fetch("MAX_THREADS", 5)), Integer(ENV.fetch("DB_POOL", 5))].max %>
19
19
  timeout: 5000
20
20
  url: <%%= ENV.fetch("DATABASE_URL", "") %>
21
21
 
@@ -4,7 +4,6 @@ require File.expand_path("../../config/environment", __FILE__)
4
4
  abort("DATABASE_URL environment variable is set") if ENV["DATABASE_URL"]
5
5
 
6
6
  require "rspec/rails"
7
- require "shoulda/matchers"
8
7
 
9
8
  Dir[Rails.root.join("spec/support/**/*.rb")].sort.each { |file| require file }
10
9
 
@@ -14,6 +13,9 @@ module Features
14
13
  end
15
14
 
16
15
  RSpec.configure do |config|
16
+ config.before(:each, js: true) do
17
+ page.driver.block_unknown_urls
18
+ end
17
19
  config.include Features, type: :feature
18
20
  config.infer_base_class_for_anonymous_controllers = false
19
21
  config.infer_spec_type_from_file_location!
data/templates/sample.env CHANGED
@@ -4,3 +4,7 @@ APPLICATION_HOST=localhost:3000
4
4
  RACK_ENV=development
5
5
  SECRET_KEY_BASE=development_secret
6
6
  EXECJS_RUNTIME=Node
7
+ SMTP_ADDRESS=smtp.example.com
8
+ SMTP_DOMAIN=example.com
9
+ SMTP_PASSWORD=password
10
+ SMTP_USERNAME=username
@@ -0,0 +1,6 @@
1
+ Shoulda::Matchers.configure do |config|
2
+ config.integrate do |with|
3
+ with.test_framework :rspec
4
+ with.library :rails
5
+ end
6
+ end
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.31.0
4
+ version: 1.32.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-09-03 00:00:00.000000000 Z
11
+ date: 2015-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bitters
@@ -137,6 +137,7 @@ files:
137
137
  - templates/rails_helper.rb
138
138
  - templates/sample.env
139
139
  - templates/secrets.yml
140
+ - templates/shoulda_matchers_config_rspec.rb
140
141
  - templates/smtp.rb
141
142
  - templates/spec_helper.rb
142
143
  - templates/staging.rb