welaika-suspenders 2.7.1 → 2.8.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: 2ba7c8b0136a167dcc9ae6ce048ef674a079a52d
4
- data.tar.gz: 13597374a2fdab6082ac299ec8b7a4b608e02423
3
+ metadata.gz: 24e81f09eaf562a6abd0864b2d899259d726b88f
4
+ data.tar.gz: 9e121e9379e17e6950757f63a04c4620df9099c4
5
5
  SHA512:
6
- metadata.gz: aa56cc61ca09d0f4eda510c4a31173ec1567f78fac9c8f07c44c024e7f7ab966a9ba13e181ff23cd463435d2dad0dadd50b4e72453be640bca1e2852a4a31641
7
- data.tar.gz: b784d2453f86f09038e6eaec9ab675dc7251a0b9353e96db02a62cd93242648b52d119b1d0d24a40b78fdbf576583de4c48d9af74861ed10604b45a4d7f7372c
6
+ metadata.gz: 7fce84b9298cc03e57335296481cddaa24ec555f20fa1db573914b556ce29d445f80d3096a700e19d2aa78f6c79c8c10c78e8c8c44448326b6e0ffcacf7ccd41
7
+ data.tar.gz: 273c0ed7a8615b8e626e31fee2c3618871a594982578c383fd88eadc157ca7e3f22333b8c8efa6171e1172c7f5b7e1e5e18fc594773bbad0cdee983e7ce376da
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.2.0
1
+ 2.2.1
data/.travis.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.0
3
+ - 2.2.1
4
4
  before_install:
5
5
  - "echo '--colour' > ~/.rspec"
6
6
  - git config --global user.name 'Travis CI'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- welaika-suspenders (2.7.1)
4
+ welaika-suspenders (2.8.0)
5
5
  bitters (~> 0.10.0)
6
6
  bundler (~> 1.3)
7
7
  rails (= 4.2.0)
@@ -53,12 +53,19 @@ GEM
53
53
  sass (~> 3.3)
54
54
  thor
55
55
  builder (3.2.2)
56
+ byebug (3.5.1)
57
+ columnize (~> 0.8)
58
+ debugger-linecache (~> 1.2)
59
+ slop (~> 3.6)
56
60
  capybara (2.3.0)
57
61
  mime-types (>= 1.16)
58
62
  nokogiri (>= 1.3.3)
59
63
  rack (>= 1.0.0)
60
64
  rack-test (>= 0.5.4)
61
65
  xpath (~> 2.0)
66
+ coderay (1.1.0)
67
+ columnize (0.9.0)
68
+ debugger-linecache (1.2.0)
62
69
  diff-lcs (1.2.5)
63
70
  erubis (2.7.0)
64
71
  globalid (0.3.3)
@@ -70,12 +77,20 @@ GEM
70
77
  nokogiri (>= 1.5.9)
71
78
  mail (2.6.3)
72
79
  mime-types (>= 1.16, < 3)
80
+ method_source (0.8.2)
73
81
  mime-types (2.4.3)
74
82
  mini_portile (0.6.0)
75
83
  minitest (5.5.1)
76
84
  multi_json (1.10.1)
77
85
  nokogiri (1.6.2.1)
78
86
  mini_portile (= 0.6.0)
87
+ pry (0.10.1)
88
+ coderay (~> 1.1.0)
89
+ method_source (~> 0.8.1)
90
+ slop (~> 3.4)
91
+ pry-byebug (3.0.1)
92
+ byebug (~> 3.4)
93
+ pry (~> 0.10)
79
94
  rack (1.6.0)
80
95
  rack-test (0.6.2)
81
96
  rack (>= 1.0)
@@ -113,6 +128,7 @@ GEM
113
128
  diff-lcs (>= 1.1.3, < 2.0)
114
129
  rspec-mocks (2.99.0)
115
130
  sass (3.4.13)
131
+ slop (3.6.0)
116
132
  sprockets (2.12.3)
117
133
  hike (~> 1.2)
118
134
  multi_json (~> 1.0)
@@ -135,5 +151,6 @@ PLATFORMS
135
151
 
136
152
  DEPENDENCIES
137
153
  capybara (~> 2.2, >= 2.2.0)
154
+ pry-byebug
138
155
  rspec (~> 2.0)
139
156
  welaika-suspenders!
data/NEWS.md CHANGED
@@ -1,3 +1,16 @@
1
+ 1.25.0 (March 7, 2015)
2
+
3
+ * Configure Active Job queue adapter for test env
4
+ * Use Ruby 2.2.1
5
+ * Dasherize heroku app names
6
+ * Update Bourbon to 4.2.0
7
+ * Add ASSET_HOST to sample.env (defaults to HOST)
8
+ * Set bin/deploy script as executable
9
+ * Set email deliver method to :test for development
10
+ * Include missing word in the Flutie description in README.
11
+ * Remove unused dev gems: aruba & cucumber
12
+ * Use skip_bundle class_option (rather than defining an empty run_bundle method)
13
+
1
14
  1.24.0 (February 3, 2015)
2
15
 
3
16
  * Remove things in Suspenders that Rails does for us now.
data/README.md CHANGED
@@ -14,6 +14,10 @@ If you are using RVM, please create a new gemset named like `projectname`:
14
14
  rvm gemset create projectname
15
15
  rvm gemset use projectname
16
16
 
17
+ If you want to use heroku, please install the [heroku toolbelt](https://toolbelt.heroku.com/) and run
18
+
19
+ heroku login
20
+
17
21
  Then run:
18
22
 
19
23
  welaika-suspenders projectname
@@ -67,3 +71,6 @@ List of changes we made since [this is commit](https://github.com/thoughtbot/sus
67
71
  - add `quiet_assets` gem
68
72
  - add `brakeman` gem
69
73
  - change `i18n_tasks` configuration: set `it` as base locale
74
+ - set `Rome` as `time_zone`
75
+ - set `:it` as `default_locale`
76
+ - add [simplecov](https://github.com/colszowka/simplecov)
@@ -14,6 +14,14 @@ module Suspenders
14
14
  configure_environment(rails_env, config)
15
15
  end
16
16
 
17
+ def configure_application_file(config)
18
+ inject_into_file(
19
+ "config/application.rb",
20
+ "\n\n #{config}",
21
+ before: "\n end"
22
+ )
23
+ end
24
+
17
25
  def configure_environment(rails_env, config)
18
26
  inject_into_file(
19
27
  "config/environments/#{rails_env}.rb",
@@ -214,7 +214,6 @@ end
214
214
  end
215
215
 
216
216
  def configure_background_jobs_for_rspec
217
- copy_file 'background_jobs_rspec.rb', 'spec/support/background_jobs.rb'
218
217
  run 'rails g delayed_job:active_record'
219
218
  end
220
219
 
@@ -222,9 +221,30 @@ end
222
221
  copy_file 'action_mailer.rb', 'spec/support/action_mailer.rb'
223
222
  end
224
223
 
224
+ def configure_simplecov
225
+ simplecov_configuration = <<-RUBY
226
+ require "simplecov"
227
+ SimpleCov.start "rails" do
228
+ add_group "Queries", "app/queries"
229
+ add_group "Services", "app/services"
230
+ add_group "Validators", "app/validators"
231
+ add_group "Presenter", "app/presenters"
232
+ end
233
+ RUBY
234
+ prepend_to_file "spec/spec_helper.rb", simplecov_configuration
235
+ end
236
+
225
237
  def configure_locales
226
238
  remove_file "config/locales/en.yml"
227
239
  template "config_locales_it.yml.erb", "config/locales/it.yml"
240
+
241
+ replace_in_file "config/application.rb",
242
+ "# config.time_zone = 'Central Time (US & Canada)'",
243
+ "config.time_zone = 'Rome'"
244
+
245
+ replace_in_file "config/application.rb",
246
+ "# config.i18n.default_locale = :de",
247
+ "config.i18n.default_locale = :it"
228
248
  end
229
249
 
230
250
  def configure_rack_timeout
@@ -254,6 +274,13 @@ end
254
274
  inject_into_class 'config/application.rb', 'Application', config
255
275
  end
256
276
 
277
+ def configure_active_job
278
+ configure_application_file(
279
+ "config.active_job.queue_adapter = :delayed_job"
280
+ )
281
+ configure_environment "test", "config.active_job.queue_adapter = :inline"
282
+ end
283
+
257
284
  def fix_i18n_deprecation_warning
258
285
  config = <<-RUBY
259
286
  config.i18n.enforce_available_locales = true
@@ -314,14 +341,23 @@ end
314
341
  run 'git init'
315
342
  end
316
343
 
317
- def create_heroku_apps(flags)
344
+ def create_staging_heroku_app(flags)
318
345
  rack_env = "RACK_ENV=staging RAILS_ENV=staging"
319
- rails_serve_static_files = "RAILS_SERVE_STATIC_FILES=true"
320
- staging_config = "#{rack_env} #{rails_serve_static_files}"
321
- run_heroku "create #{app_name}-production #{flags}", "production"
322
- run_heroku "create #{app_name}-staging #{flags}", "staging"
323
- run_heroku "config:add #{staging_config}", "staging"
324
- run_heroku "config:add #{rails_serve_static_files}", "production"
346
+ app_name = heroku_app_name_for("staging")
347
+
348
+ run_heroku "create #{app_name} #{flags}", "staging"
349
+ run_heroku "config:add #{rack_env}", "staging"
350
+ end
351
+
352
+ def create_production_heroku_app(flags)
353
+ app_name = heroku_app_name_for("production")
354
+
355
+ run_heroku "create #{app_name} #{flags}", "production"
356
+ end
357
+
358
+ def create_heroku_apps(flags)
359
+ create_staging_heroku_app(flags)
360
+ create_production_heroku_app(flags)
325
361
  end
326
362
 
327
363
  def set_heroku_remotes
@@ -336,7 +372,7 @@ end
336
372
  end
337
373
 
338
374
  def join_heroku_app(environment)
339
- heroku_app_name = "#{app_name}-#{environment}"
375
+ heroku_app_name = heroku_app_name_for(environment)
340
376
  <<-SHELL
341
377
  if heroku join --app #{heroku_app_name} &> /dev/null; then
342
378
  git remote add #{environment} git@heroku.com:#{heroku_app_name}.git || true
@@ -353,12 +389,18 @@ fi
353
389
  end
354
390
  end
355
391
 
356
- def set_memory_management_variable
392
+ def set_heroku_memory_management_variable
357
393
  %w(staging production).each do |environment|
358
394
  run_heroku "config:add NEW_RELIC_AGGRESSIVE_KEEPALIVE=1", environment
359
395
  end
360
396
  end
361
397
 
398
+ def set_heroku_serve_static_files
399
+ %w(staging production).each do |environment|
400
+ run_heroku "config:add RAILS_SERVE_STATIC_FILES=true", environment
401
+ end
402
+ end
403
+
362
404
  def provide_deploy_script
363
405
  copy_file "bin_deploy", "bin/deploy"
364
406
 
@@ -462,5 +504,9 @@ end
462
504
  def serve_static_files_line
463
505
  "config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?\n"
464
506
  end
507
+
508
+ def heroku_app_name_for(environment)
509
+ "#{app_name.dasherize}-#{environment}"
510
+ end
465
511
  end
466
512
  end
@@ -96,6 +96,7 @@ module Suspenders
96
96
  build :configure_i18n_for_test_environment
97
97
  build :configure_i18n_tasks
98
98
  build :configure_action_mailer_in_specs
99
+ build :configure_simplecov
99
100
  end
100
101
 
101
102
  def setup_production_environment
@@ -128,6 +129,7 @@ module Suspenders
128
129
  say 'Configuring app'
129
130
  build :configure_action_mailer
130
131
  build :configure_locales
132
+ build :configure_active_job
131
133
  build :configure_rack_timeout
132
134
  build :configure_simple_form
133
135
  build :configure_slim
@@ -161,9 +163,10 @@ module Suspenders
161
163
  if options[:heroku]
162
164
  say "Creating Heroku apps"
163
165
  build :create_heroku_apps, options[:heroku_flags]
166
+ build :set_heroku_serve_static_files
164
167
  build :set_heroku_remotes
165
168
  build :set_heroku_rails_secrets
166
- build :set_memory_management_variable
169
+ build :set_heroku_memory_management_variable
167
170
  build :provide_deploy_script
168
171
  end
169
172
  end
@@ -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 = "2.7.1"
4
+ VERSION = "2.8.0"
5
5
  end
@@ -4,8 +4,7 @@ feature "Heroku" do
4
4
  scenario "Suspend a project for Heroku" do
5
5
  run_suspenders("--heroku=true")
6
6
 
7
- expect(FakeHeroku).
8
- to have_gem_included(project_path, "rails_stdout_logging")
7
+ expect(FakeHeroku).to have_gem_included(project_path, "rails_stdout_logging")
9
8
  expect(FakeHeroku).to have_created_app_for("staging", "--region eu")
10
9
  expect(FakeHeroku).to have_created_app_for("production", "--region eu")
11
10
  expect(FakeHeroku).to have_configured_vars("staging", "SECRET_KEY_BASE")
@@ -13,10 +12,10 @@ feature "Heroku" do
13
12
 
14
13
  bin_setup_path = "#{project_path}/bin/setup"
15
14
  bin_setup = IO.read(bin_setup_path)
16
- app_name = SuspendersTestHelpers::APP_NAME
15
+ app_name = SuspendersTestHelpers::APP_NAME.dasherize
17
16
 
18
- expect(bin_setup).to include("heroku join --app #{app_name}-staging")
19
17
  expect(bin_setup).to include("heroku join --app #{app_name}-production")
18
+ expect(bin_setup).to include("heroku join --app #{app_name}-staging")
20
19
  expect(File.stat(bin_setup_path)).to be_executable
21
20
 
22
21
  bin_deploy_path = "#{project_path}/bin/deploy"
@@ -67,14 +67,16 @@ feature 'Suspend a new project with default configuration' do
67
67
  )
68
68
  end
69
69
 
70
- scenario "set up available locales" do
70
+ scenario "set up locale and timezone" do
71
71
  run_suspenders
72
72
 
73
73
  result = IO.read("#{project_path}/config/application.rb")
74
74
 
75
- expect(result).to match(
76
- /^ +config.i18n.available_locales = \[:en, :it\]$/
77
- )
75
+ expect(result).to match(/^ +config.i18n.enforce_available_locales = true$/)
76
+ expect(result).to match(/^ +config.i18n.available_locales = \[:en, :it\]$/)
77
+ expect(result).to match(/^ +config.i18n.default_locale = :it$/)
78
+
79
+ expect(result).to match(/^ +config.time_zone = 'Rome'$/)
78
80
  end
79
81
 
80
82
  scenario "raises on unpermitted parameters in all environments" do
@@ -136,6 +138,28 @@ feature 'Suspend a new project with default configuration' do
136
138
  to match(/^ +config.action_mailer.delivery_method = :letter_opener$/)
137
139
  end
138
140
 
141
+ scenario "set up simplecov" do
142
+ run_suspenders
143
+
144
+ spec_helper_file = IO.read("#{project_path}/spec/spec_helper.rb")
145
+ expect(spec_helper_file).to match(/^require "simplecov"$/)
146
+ expect(spec_helper_file).to match(/^SimpleCov.start "rails" do$/)
147
+ end
148
+
149
+ scenario "config active job queue adapter" do
150
+ run_suspenders
151
+
152
+ application_config = IO.read("#{project_path}/config/application.rb")
153
+ test_config = IO.read("#{project_path}/config/environments/test.rb")
154
+
155
+ expect(application_config).to match(
156
+ /^ +config.active_job.queue_adapter = :delayed_job$/
157
+ )
158
+ expect(test_config).to match(
159
+ /^ +config.active_job.queue_adapter = :inline$/
160
+ )
161
+ end
162
+
139
163
  def analytics_partial
140
164
  IO.read("#{project_path}/app/views/application/_analytics.html.erb")
141
165
  end
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,6 @@
1
- require 'capybara/rspec'
2
- require 'bundler/setup'
1
+ require "capybara/rspec"
2
+ require "bundler/setup"
3
+ require "pry-byebug"
3
4
 
4
5
  Bundler.require(:default, :test)
5
6
 
@@ -23,16 +23,16 @@ class FakeHeroku
23
23
  end
24
24
  end
25
25
 
26
- def self.has_created_app_for?(remote_name, flags = nil)
27
- app_name = "#{SuspendersTestHelpers::APP_NAME}-#{remote_name}"
26
+ def self.has_created_app_for?(environment, flags = nil)
27
+ app_name = "#{SuspendersTestHelpers::APP_NAME.dasherize}-#{environment}"
28
28
 
29
- expected_line = if flags
30
- "create #{app_name} #{flags} --remote #{remote_name}\n"
31
- else
32
- "create #{app_name} --remote #{remote_name}\n"
33
- end
29
+ command = if flags
30
+ "create #{app_name} #{flags} --remote #{environment}\n"
31
+ else
32
+ "create #{app_name} --remote #{environment}\n"
33
+ end
34
34
 
35
- File.foreach(RECORDER).any? { |line| line == expected_line }
35
+ File.foreach(RECORDER).any? { |line| line == command }
36
36
  end
37
37
 
38
38
  def self.has_configured_vars?(remote_name, var)
@@ -1,5 +1,5 @@
1
1
  module SuspendersTestHelpers
2
- APP_NAME = 'dummy'
2
+ APP_NAME = "dummy_app"
3
3
 
4
4
  def remove_project_directory
5
5
  FileUtils.rm_rf(project_path)
data/suspenders.gemspec CHANGED
@@ -31,4 +31,5 @@ weLaika's fork of the famous thoughbot suspenders gem.
31
31
 
32
32
  s.add_development_dependency 'rspec', '~> 2.0'
33
33
  s.add_development_dependency 'capybara', '~> 2.2', '>= 2.2.0'
34
+ s.add_development_dependency 'pry-byebug'
34
35
  end
@@ -3,7 +3,7 @@ source "https://rubygems.org"
3
3
  ruby "<%= Suspenders::RUBY_VERSION %>"
4
4
 
5
5
  gem "airbrake"
6
- gem "bourbon", "~> 4.1.0"
6
+ gem "bourbon", "~> 4.2.0"
7
7
  gem "coffee-rails", "~> 4.1.0"
8
8
  gem "delayed_job_active_record"
9
9
  gem "email_validator"
@@ -54,6 +54,7 @@ group :test do
54
54
  gem "formulaic"
55
55
  gem "launchy"
56
56
  gem "shoulda-matchers", require: false
57
+ gem "simplecov", require: false
57
58
  gem "timecop"
58
59
  gem "webmock"
59
60
  end
@@ -7,7 +7,7 @@ RSpec.configure do |config|
7
7
  DatabaseCleaner.strategy = :transaction
8
8
  end
9
9
 
10
- config.before(:each, :js => true) do
10
+ config.before(:each, js: true) do
11
11
  DatabaseCleaner.strategy = :deletion
12
12
  end
13
13
 
@@ -8,6 +8,7 @@ RSpec.configure do |config|
8
8
 
9
9
  config.mock_with :rspec do |mocks|
10
10
  mocks.syntax = :expect
11
+ mocks.verify_partial_doubles = true
11
12
  end
12
13
 
13
14
  config.order = :random
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.7.1
4
+ version: 2.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - thoughtbot
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-02-28 00:00:00.000000000 Z
12
+ date: 2015-03-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bitters
@@ -87,6 +87,20 @@ dependencies:
87
87
  - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: 2.2.0
90
+ - !ruby/object:Gem::Dependency
91
+ name: pry-byebug
92
+ requirement: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ type: :development
98
+ prerelease: false
99
+ version_requirements: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
90
104
  description: |
91
105
  weLaika's fork of the famous thoughbot suspenders gem.
92
106
  email: info@welaika.com
@@ -133,7 +147,6 @@ files:
133
147
  - templates/_javascript.html.slim
134
148
  - templates/action_mailer.rb
135
149
  - templates/application.css.sass
136
- - templates/background_jobs_rspec.rb
137
150
  - templates/bin_deploy
138
151
  - templates/bin_setup.erb
139
152
  - templates/bundler_audit.rake
@@ -173,7 +186,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
173
186
  requirements:
174
187
  - - ">="
175
188
  - !ruby/object:Gem::Version
176
- version: 2.2.0
189
+ version: 2.2.1
177
190
  required_rubygems_version: !ruby/object:Gem::Requirement
178
191
  requirements:
179
192
  - - ">="
@@ -181,7 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
181
194
  version: '0'
182
195
  requirements: []
183
196
  rubyforge_project:
184
- rubygems_version: 2.4.5
197
+ rubygems_version: 2.4.6
185
198
  signing_key:
186
199
  specification_version: 4
187
200
  summary: Generate a Rails app using thoughtbot's best practices.
@@ -1,19 +0,0 @@
1
- module BackgroundJobs
2
- def run_background_jobs_immediately
3
- delay_jobs = Delayed::Worker.delay_jobs
4
- Delayed::Worker.delay_jobs = false
5
- yield
6
- ensure
7
- Delayed::Worker.delay_jobs = delay_jobs
8
- end
9
- end
10
-
11
- RSpec.configure do |config|
12
- config.around(:each, type: :feature) do |example|
13
- run_background_jobs_immediately do
14
- example.run
15
- end
16
- end
17
-
18
- config.include BackgroundJobs
19
- end