suspenders 1.24.0 → 1.25.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/Gemfile.lock +0 -18
- data/NEWS.md +13 -0
- data/README.md +3 -3
- data/lib/suspenders/actions.rb +8 -0
- data/lib/suspenders/app_builder.rb +45 -11
- data/lib/suspenders/generators/app_generator.rb +7 -5
- data/lib/suspenders/version.rb +1 -1
- data/spec/features/heroku_spec.rb +11 -6
- data/spec/features/new_project_spec.rb +22 -0
- data/spec/support/fake_heroku.rb +8 -8
- data/spec/support/suspenders.rb +1 -1
- data/suspenders.gemspec +0 -2
- data/templates/Gemfile.erb +1 -1
- data/templates/database_cleaner_rspec.rb +1 -1
- data/templates/sample.env +2 -0
- metadata +3 -31
- data/templates/background_jobs_rspec.rb +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e5b7ff219c02602303e763a6176f1b748402de9
|
4
|
+
data.tar.gz: fea4f4b9ebf8e9b6f7d4e8846603f36a702f9b09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37c7031f7dd62ca4edbf952da97f7be0cdf1a2e6842c729b0f02be89062096ef76e37edac4f2aa01f1d84a05f9c9269e0ded299e1090dff433292a29d75bc960
|
7
|
+
data.tar.gz: 038163505d91aa1b58fc258c5f77740b6f9f0eb04b3a5c647d6b052989e14e26c8089d0b114fe624dc354b5850241b9239c11d43a5e7c99f1b9a94f0cb47babb
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -45,10 +45,6 @@ GEM
|
|
45
45
|
thread_safe (~> 0.3, >= 0.3.4)
|
46
46
|
tzinfo (~> 1.1)
|
47
47
|
arel (6.0.0)
|
48
|
-
aruba (0.5.4)
|
49
|
-
childprocess (>= 0.3.6)
|
50
|
-
cucumber (>= 1.1.1)
|
51
|
-
rspec-expectations (>= 2.7.0)
|
52
48
|
bitters (0.10.1)
|
53
49
|
bourbon (>= 3.2)
|
54
50
|
sass (>= 3.2)
|
@@ -63,19 +59,8 @@ GEM
|
|
63
59
|
rack (>= 1.0.0)
|
64
60
|
rack-test (>= 0.5.4)
|
65
61
|
xpath (~> 2.0)
|
66
|
-
childprocess (0.5.3)
|
67
|
-
ffi (~> 1.0, >= 1.0.11)
|
68
|
-
cucumber (1.3.15)
|
69
|
-
builder (>= 2.1.2)
|
70
|
-
diff-lcs (>= 1.1.3)
|
71
|
-
gherkin (~> 2.12)
|
72
|
-
multi_json (>= 1.7.5, < 2.0)
|
73
|
-
multi_test (>= 0.1.1)
|
74
62
|
diff-lcs (1.2.5)
|
75
63
|
erubis (2.7.0)
|
76
|
-
ffi (1.9.3)
|
77
|
-
gherkin (2.12.2)
|
78
|
-
multi_json (~> 1.3)
|
79
64
|
globalid (0.3.0)
|
80
65
|
activesupport (>= 4.1.0)
|
81
66
|
hike (1.2.3)
|
@@ -89,7 +74,6 @@ GEM
|
|
89
74
|
mini_portile (0.6.0)
|
90
75
|
minitest (5.5.1)
|
91
76
|
multi_json (1.10.1)
|
92
|
-
multi_test (0.1.1)
|
93
77
|
nokogiri (1.6.2.1)
|
94
78
|
mini_portile (= 0.6.0)
|
95
79
|
rack (1.6.0)
|
@@ -150,8 +134,6 @@ PLATFORMS
|
|
150
134
|
ruby
|
151
135
|
|
152
136
|
DEPENDENCIES
|
153
|
-
aruba (~> 0.5)
|
154
137
|
capybara (~> 2.2, >= 2.2.0)
|
155
|
-
cucumber (~> 1.2)
|
156
138
|
rspec (~> 2.0)
|
157
139
|
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
@@ -1,4 +1,4 @@
|
|
1
|
-
# Suspenders [![Build Status](https://secure.travis-ci.org/thoughtbot/suspenders.
|
1
|
+
# Suspenders [![Build Status](https://secure.travis-ci.org/thoughtbot/suspenders.svg?branch=master)](http://travis-ci.org/thoughtbot/suspenders)
|
2
2
|
|
3
3
|
Suspenders is the base Rails application used at
|
4
4
|
[thoughtbot](http://thoughtbot.com).
|
@@ -32,8 +32,8 @@ It includes application gems like:
|
|
32
32
|
processing
|
33
33
|
* [Email Validator](https://github.com/balexand/email_validator) for email
|
34
34
|
validation
|
35
|
-
* [Flutie](https://github.com/thoughtbot/flutie) for and `body_class` view
|
36
|
-
|
35
|
+
* [Flutie](https://github.com/thoughtbot/flutie) for `page_title` and `body_class` view
|
36
|
+
helpers
|
37
37
|
* [High Voltage](https://github.com/thoughtbot/high_voltage) for static pages
|
38
38
|
* [jQuery Rails](https://github.com/rails/jquery-rails) for jQuery
|
39
39
|
* [Neat](https://github.com/thoughtbot/neat) for semantic grids
|
data/lib/suspenders/actions.rb
CHANGED
@@ -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",
|
@@ -11,6 +11,14 @@ module Suspenders
|
|
11
11
|
'raise_delivery_errors = false', 'raise_delivery_errors = true'
|
12
12
|
end
|
13
13
|
|
14
|
+
def set_test_delivery_method
|
15
|
+
inject_into_file(
|
16
|
+
"config/environments/development.rb",
|
17
|
+
"\n config.action_mailer.delivery_method = :test",
|
18
|
+
after: "config.action_mailer.raise_delivery_errors = true",
|
19
|
+
)
|
20
|
+
end
|
21
|
+
|
14
22
|
def raise_on_unpermitted_parameters
|
15
23
|
config = <<-RUBY
|
16
24
|
config.action_controller.action_on_unpermitted_parameters = :raise
|
@@ -87,7 +95,7 @@ module Suspenders
|
|
87
95
|
def setup_asset_host
|
88
96
|
replace_in_file 'config/environments/production.rb',
|
89
97
|
"# config.action_controller.asset_host = 'http://assets.example.com'",
|
90
|
-
'config.action_controller.asset_host = ENV.fetch("ASSET_HOST")'
|
98
|
+
'config.action_controller.asset_host = ENV.fetch("ASSET_HOST", ENV.fetch("HOST"))'
|
91
99
|
|
92
100
|
replace_in_file 'config/initializers/assets.rb',
|
93
101
|
"config.assets.version = '1.0'",
|
@@ -201,7 +209,6 @@ end
|
|
201
209
|
end
|
202
210
|
|
203
211
|
def configure_background_jobs_for_rspec
|
204
|
-
copy_file 'background_jobs_rspec.rb', 'spec/support/background_jobs.rb'
|
205
212
|
run 'rails g delayed_job:active_record'
|
206
213
|
end
|
207
214
|
|
@@ -229,6 +236,13 @@ end
|
|
229
236
|
action_mailer_host "production", %{ENV.fetch("HOST")}
|
230
237
|
end
|
231
238
|
|
239
|
+
def configure_active_job
|
240
|
+
configure_application_file(
|
241
|
+
"config.active_job.queue_adapter = :delayed_job"
|
242
|
+
)
|
243
|
+
configure_environment "test", "config.active_job.queue_adapter = :inline"
|
244
|
+
end
|
245
|
+
|
232
246
|
def fix_i18n_deprecation_warning
|
233
247
|
config = <<-RUBY
|
234
248
|
config.i18n.enforce_available_locales = true
|
@@ -285,14 +299,23 @@ end
|
|
285
299
|
run 'git init'
|
286
300
|
end
|
287
301
|
|
288
|
-
def
|
302
|
+
def create_staging_heroku_app(flags)
|
289
303
|
rack_env = "RACK_ENV=staging RAILS_ENV=staging"
|
290
|
-
|
291
|
-
|
292
|
-
run_heroku "create #{app_name}
|
293
|
-
run_heroku "
|
294
|
-
|
295
|
-
|
304
|
+
app_name = heroku_app_name_for("staging")
|
305
|
+
|
306
|
+
run_heroku "create #{app_name} #{flags}", "staging"
|
307
|
+
run_heroku "config:add #{rack_env}", "staging"
|
308
|
+
end
|
309
|
+
|
310
|
+
def create_production_heroku_app(flags)
|
311
|
+
app_name = heroku_app_name_for("production")
|
312
|
+
|
313
|
+
run_heroku "create #{app_name} #{flags}", "production"
|
314
|
+
end
|
315
|
+
|
316
|
+
def create_heroku_apps(flags)
|
317
|
+
create_staging_heroku_app(flags)
|
318
|
+
create_production_heroku_app(flags)
|
296
319
|
end
|
297
320
|
|
298
321
|
def set_heroku_remotes
|
@@ -307,7 +330,7 @@ end
|
|
307
330
|
end
|
308
331
|
|
309
332
|
def join_heroku_app(environment)
|
310
|
-
heroku_app_name =
|
333
|
+
heroku_app_name = heroku_app_name_for(environment)
|
311
334
|
<<-SHELL
|
312
335
|
if heroku join --app #{heroku_app_name} &> /dev/null; then
|
313
336
|
git remote add #{environment} git@heroku.com:#{heroku_app_name}.git || true
|
@@ -324,12 +347,18 @@ fi
|
|
324
347
|
end
|
325
348
|
end
|
326
349
|
|
327
|
-
def
|
350
|
+
def set_heroku_memory_management_variable
|
328
351
|
%w(staging production).each do |environment|
|
329
352
|
run_heroku "config:add NEW_RELIC_AGGRESSIVE_KEEPALIVE=1", environment
|
330
353
|
end
|
331
354
|
end
|
332
355
|
|
356
|
+
def set_heroku_serve_static_files
|
357
|
+
%w(staging production).each do |environment|
|
358
|
+
run_heroku "config:add RAILS_SERVE_STATIC_FILES=true", environment
|
359
|
+
end
|
360
|
+
end
|
361
|
+
|
333
362
|
def provide_deploy_script
|
334
363
|
copy_file "bin_deploy", "bin/deploy"
|
335
364
|
|
@@ -345,6 +374,7 @@ you can deploy to staging and production with:
|
|
345
374
|
MARKDOWN
|
346
375
|
|
347
376
|
append_file "README.md", instructions
|
377
|
+
run "chmod a+x bin/deploy"
|
348
378
|
end
|
349
379
|
|
350
380
|
def create_github_repo(repo_name)
|
@@ -437,5 +467,9 @@ end
|
|
437
467
|
def serve_static_files_line
|
438
468
|
"config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?\n"
|
439
469
|
end
|
470
|
+
|
471
|
+
def heroku_app_name_for(environment)
|
472
|
+
"#{app_name.dasherize}-#{environment}"
|
473
|
+
end
|
440
474
|
end
|
441
475
|
end
|
@@ -21,6 +21,9 @@ module Suspenders
|
|
21
21
|
class_option :skip_turbolinks, type: :boolean, default: true,
|
22
22
|
desc: "Skip turbolinks gem"
|
23
23
|
|
24
|
+
class_option :skip_bundle, type: :boolean, aliases: "-B", default: true,
|
25
|
+
desc: "Don't run bundle install"
|
26
|
+
|
24
27
|
def finish_template
|
25
28
|
invoke :suspenders_customization
|
26
29
|
super
|
@@ -74,6 +77,7 @@ module Suspenders
|
|
74
77
|
def setup_development_environment
|
75
78
|
say 'Setting up the development environment'
|
76
79
|
build :raise_on_delivery_errors
|
80
|
+
build :set_test_delivery_method
|
77
81
|
build :raise_on_unpermitted_parameters
|
78
82
|
build :provide_setup_script
|
79
83
|
build :provide_dev_prime_task
|
@@ -124,6 +128,7 @@ module Suspenders
|
|
124
128
|
def configure_app
|
125
129
|
say 'Configuring app'
|
126
130
|
build :configure_action_mailer
|
131
|
+
build :configure_active_job
|
127
132
|
build :configure_time_formats
|
128
133
|
build :configure_rack_timeout
|
129
134
|
build :configure_simple_form
|
@@ -161,9 +166,10 @@ module Suspenders
|
|
161
166
|
if options[:heroku]
|
162
167
|
say "Creating Heroku apps"
|
163
168
|
build :create_heroku_apps, options[:heroku_flags]
|
169
|
+
build :set_heroku_serve_static_files
|
164
170
|
build :set_heroku_remotes
|
165
171
|
build :set_heroku_rails_secrets
|
166
|
-
build :
|
172
|
+
build :set_heroku_memory_management_variable
|
167
173
|
build :provide_deploy_script
|
168
174
|
end
|
169
175
|
end
|
@@ -212,10 +218,6 @@ module Suspenders
|
|
212
218
|
say "Remember to run 'rails generate airbrake' with your API key."
|
213
219
|
end
|
214
220
|
|
215
|
-
def run_bundle
|
216
|
-
# Let's not: We'll bundle manually at the right spot
|
217
|
-
end
|
218
|
-
|
219
221
|
protected
|
220
222
|
|
221
223
|
def get_builder_class
|
data/lib/suspenders/version.rb
CHANGED
@@ -4,22 +4,27 @@ feature "Heroku" do
|
|
4
4
|
scenario "Suspend a project for Heroku" do
|
5
5
|
run_suspenders("--heroku=true")
|
6
6
|
|
7
|
-
expect(FakeHeroku).
|
8
|
-
|
7
|
+
expect(FakeHeroku).to(
|
8
|
+
have_gem_included(project_path, "rails_stdout_logging")
|
9
|
+
)
|
9
10
|
expect(FakeHeroku).to have_created_app_for("staging")
|
10
11
|
expect(FakeHeroku).to have_created_app_for("production")
|
11
12
|
expect(FakeHeroku).to have_configured_vars("staging", "SECRET_KEY_BASE")
|
12
13
|
expect(FakeHeroku).to have_configured_vars("production", "SECRET_KEY_BASE")
|
13
14
|
|
14
|
-
|
15
|
-
|
15
|
+
bin_setup_path = "#{project_path}/bin/setup"
|
16
|
+
bin_setup = IO.read(bin_setup_path)
|
17
|
+
app_name = SuspendersTestHelpers::APP_NAME.dasherize
|
16
18
|
|
17
|
-
expect(bin_setup).to include("heroku join --app #{app_name}-staging")
|
18
19
|
expect(bin_setup).to include("heroku join --app #{app_name}-production")
|
20
|
+
expect(bin_setup).to include("heroku join --app #{app_name}-staging")
|
21
|
+
expect(File.stat(bin_setup_path)).to be_executable
|
19
22
|
|
20
|
-
|
23
|
+
bin_deploy_path = "#{project_path}/bin/deploy"
|
24
|
+
bin_deploy = IO.read(bin_deploy_path)
|
21
25
|
|
22
26
|
expect(bin_deploy).to include("heroku run rake db:migrate")
|
27
|
+
expect(File.stat(bin_deploy_path)).to be_executable
|
23
28
|
|
24
29
|
readme = IO.read("#{project_path}/README.md")
|
25
30
|
|
@@ -117,6 +117,28 @@ feature 'Suspend a new project with default configuration' do
|
|
117
117
|
expect(File).to exist("#{project_path}/config/initializers/simple_form.rb")
|
118
118
|
end
|
119
119
|
|
120
|
+
scenario "config :test email delivery method for development" do
|
121
|
+
run_suspenders
|
122
|
+
|
123
|
+
dev_env_file = IO.read("#{project_path}/config/environments/development.rb")
|
124
|
+
expect(dev_env_file).
|
125
|
+
to match(/^ +config.action_mailer.delivery_method = :test$/)
|
126
|
+
end
|
127
|
+
|
128
|
+
scenario "config active job queue adapter" do
|
129
|
+
run_suspenders
|
130
|
+
|
131
|
+
application_config = IO.read("#{project_path}/config/application.rb")
|
132
|
+
test_config = IO.read("#{project_path}/config/environments/test.rb")
|
133
|
+
|
134
|
+
expect(application_config).to match(
|
135
|
+
/^ +config.active_job.queue_adapter = :delayed_job$/
|
136
|
+
)
|
137
|
+
expect(test_config).to match(
|
138
|
+
/^ +config.active_job.queue_adapter = :inline$/
|
139
|
+
)
|
140
|
+
end
|
141
|
+
|
120
142
|
def analytics_partial
|
121
143
|
IO.read("#{project_path}/app/views/application/_analytics.html.erb")
|
122
144
|
end
|
data/spec/support/fake_heroku.rb
CHANGED
@@ -23,16 +23,16 @@ class FakeHeroku
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
def self.has_created_app_for?(
|
27
|
-
app_name = "#{SuspendersTestHelpers::APP_NAME}-#{
|
26
|
+
def self.has_created_app_for?(environment, flags = nil)
|
27
|
+
app_name = "#{SuspendersTestHelpers::APP_NAME.dasherize}-#{environment}"
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
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 ==
|
35
|
+
File.foreach(RECORDER).any? { |line| line == command }
|
36
36
|
end
|
37
37
|
|
38
38
|
def self.has_configured_vars?(remote_name, var)
|
data/spec/support/suspenders.rb
CHANGED
data/suspenders.gemspec
CHANGED
@@ -31,8 +31,6 @@ rush to build something amazing; don't use it if you like missing deadlines.
|
|
31
31
|
s.add_dependency 'bundler', '~> 1.3'
|
32
32
|
s.add_dependency 'rails', Suspenders::RAILS_VERSION
|
33
33
|
|
34
|
-
s.add_development_dependency 'aruba', '~> 0.5'
|
35
|
-
s.add_development_dependency 'cucumber', '~> 1.2'
|
36
34
|
s.add_development_dependency 'rspec', '~> 2.0'
|
37
35
|
s.add_development_dependency 'capybara', '~> 2.2', '>= 2.2.0'
|
38
36
|
end
|
data/templates/Gemfile.erb
CHANGED
data/templates/sample.env
CHANGED
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.
|
4
|
+
version: 1.25.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-
|
11
|
+
date: 2015-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bitters
|
@@ -52,34 +52,6 @@ dependencies:
|
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 4.2.0
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: aruba
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0.5'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0.5'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: cucumber
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '1.2'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '1.2'
|
83
55
|
- !ruby/object:Gem::Dependency
|
84
56
|
name: rspec
|
85
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -163,7 +135,6 @@ files:
|
|
163
135
|
- templates/_javascript.html.erb
|
164
136
|
- templates/action_mailer.rb
|
165
137
|
- templates/application.css.scss
|
166
|
-
- templates/background_jobs_rspec.rb
|
167
138
|
- templates/bin_deploy
|
168
139
|
- templates/bin_setup.erb
|
169
140
|
- templates/bundler_audit.rake
|
@@ -224,3 +195,4 @@ test_files:
|
|
224
195
|
- spec/support/fake_github.rb
|
225
196
|
- spec/support/fake_heroku.rb
|
226
197
|
- spec/support/suspenders.rb
|
198
|
+
has_rdoc:
|
@@ -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
|