suspenders 1.7.0 → 1.8.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 +4 -4
- data/.gitignore +2 -7
- data/.travis.yml +4 -0
- data/Gemfile.lock +25 -4
- data/NEWS.md +19 -0
- data/README.md +18 -5
- data/Rakefile +3 -3
- data/bin/rspec +16 -0
- data/bin/suspenders +5 -3
- data/lib/suspenders.rb +3 -0
- data/lib/suspenders/app_builder.rb +27 -24
- data/lib/suspenders/generators/app_generator.rb +6 -15
- data/lib/suspenders/version.rb +1 -1
- data/{features/support → spec/fakes}/bin/heroku +0 -0
- data/{features/support → spec/fakes}/bin/hub +0 -0
- data/spec/features/github_spec.rb +10 -0
- data/spec/features/heroku_spec.rb +13 -0
- data/spec/features/new_project_spec.rb +38 -0
- data/spec/spec_helper.rb +24 -0
- data/{features → spec}/support/fake_github.rb +1 -1
- data/spec/support/fake_heroku.rb +36 -0
- data/spec/support/suspenders.rb +50 -0
- data/suspenders.gemspec +2 -0
- data/templates/Gemfile_clean +5 -1
- data/templates/README.md.erb +1 -1
- data/templates/bin_setup +3 -0
- data/templates/factories_spec.rb +3 -3
- data/templates/factories_spec_rake_task.rb +7 -1
- data/templates/postgresql_database.yml.erb +1 -1
- data/templates/smtp.rb +4 -4
- data/templates/staging.rb +3 -0
- data/templates/suspenders_gitignore +9 -10
- data/templates/suspenders_layout.html.erb.erb +1 -1
- data/templates/unicorn.rb +4 -1
- metadata +64 -33
- data/features/github_repo.feature +0 -8
- data/features/heroku_true.feature +0 -11
- data/features/rake_clean.feature +0 -44
- data/features/step_definitions/suspenders_steps.rb +0 -89
- data/features/support/env.rb +0 -10
- data/features/support/fake_heroku.rb +0 -30
- data/templates/javascripts/prefilled_input.js +0 -59
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4cfc568f170e1beb62a4c80760440fabb9783a86
|
|
4
|
+
data.tar.gz: e80514b54e2488eb94ce9c816b3f768e6197b3af
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e1fa608458423954863c997253b4a84cec76cfbb32eb77b69b1e2b3128882c25c1021042d676c6063041b16370da69f22a25f054b89da225e7835bd9d0a825d4
|
|
7
|
+
data.tar.gz: d4ae9049fcc8e6ba5c908fef1f9550f78a80f76869fe09c9cd37e3381c1578f2c748c3f33ef232c2864f82dd04373ecd9b2da9a52caa3d1c11ea6966a58eb897
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
suspenders (1.
|
|
4
|
+
suspenders (1.8.0)
|
|
5
5
|
bundler (~> 1.3)
|
|
6
6
|
rails (= 4.0.0)
|
|
7
7
|
|
|
@@ -32,13 +32,19 @@ GEM
|
|
|
32
32
|
multi_json (~> 1.3)
|
|
33
33
|
thread_safe (~> 0.1)
|
|
34
34
|
tzinfo (~> 0.3.37)
|
|
35
|
-
arel (4.0.
|
|
35
|
+
arel (4.0.2)
|
|
36
36
|
aruba (0.5.3)
|
|
37
37
|
childprocess (>= 0.3.6)
|
|
38
38
|
cucumber (>= 1.1.1)
|
|
39
39
|
rspec-expectations (>= 2.7.0)
|
|
40
40
|
atomic (1.1.14)
|
|
41
41
|
builder (3.1.4)
|
|
42
|
+
capybara (2.2.0)
|
|
43
|
+
mime-types (>= 1.16)
|
|
44
|
+
nokogiri (>= 1.3.3)
|
|
45
|
+
rack (>= 1.0.0)
|
|
46
|
+
rack-test (>= 0.5.4)
|
|
47
|
+
xpath (~> 2.0)
|
|
42
48
|
childprocess (0.3.9)
|
|
43
49
|
ffi (~> 1.0, >= 1.0.11)
|
|
44
50
|
cucumber (1.3.3)
|
|
@@ -61,10 +67,15 @@ GEM
|
|
|
61
67
|
mime-types (~> 1.16)
|
|
62
68
|
treetop (~> 1.4.8)
|
|
63
69
|
mime-types (1.25.1)
|
|
70
|
+
mini_portile (0.5.2)
|
|
64
71
|
minitest (4.7.5)
|
|
65
72
|
multi_json (1.7.7)
|
|
66
73
|
multi_test (0.0.1)
|
|
67
|
-
|
|
74
|
+
nokogiri (1.6.1)
|
|
75
|
+
mini_portile (~> 0.5.0)
|
|
76
|
+
nokogiri (1.6.1-x86-mingw32)
|
|
77
|
+
mini_portile (~> 0.5.0)
|
|
78
|
+
polyglot (0.3.4)
|
|
68
79
|
rack (1.5.2)
|
|
69
80
|
rack-test (0.6.2)
|
|
70
81
|
rack (>= 1.0)
|
|
@@ -81,9 +92,15 @@ GEM
|
|
|
81
92
|
activesupport (= 4.0.0)
|
|
82
93
|
rake (>= 0.8.7)
|
|
83
94
|
thor (>= 0.18.1, < 2.0)
|
|
84
|
-
rake (10.1.
|
|
95
|
+
rake (10.1.1)
|
|
96
|
+
rspec (2.14.1)
|
|
97
|
+
rspec-core (~> 2.14.0)
|
|
98
|
+
rspec-expectations (~> 2.14.0)
|
|
99
|
+
rspec-mocks (~> 2.14.0)
|
|
100
|
+
rspec-core (2.14.7)
|
|
85
101
|
rspec-expectations (2.14.0)
|
|
86
102
|
diff-lcs (>= 1.1.3, < 2.0)
|
|
103
|
+
rspec-mocks (2.14.4)
|
|
87
104
|
sprockets (2.10.1)
|
|
88
105
|
hike (~> 1.2)
|
|
89
106
|
multi_json (~> 1.0)
|
|
@@ -101,6 +118,8 @@ GEM
|
|
|
101
118
|
polyglot
|
|
102
119
|
polyglot (>= 0.3.1)
|
|
103
120
|
tzinfo (0.3.38)
|
|
121
|
+
xpath (2.0.0)
|
|
122
|
+
nokogiri (~> 1.3)
|
|
104
123
|
|
|
105
124
|
PLATFORMS
|
|
106
125
|
ruby
|
|
@@ -108,5 +127,7 @@ PLATFORMS
|
|
|
108
127
|
|
|
109
128
|
DEPENDENCIES
|
|
110
129
|
aruba (~> 0.5.2)
|
|
130
|
+
capybara
|
|
111
131
|
cucumber (~> 1.2)
|
|
132
|
+
rspec
|
|
112
133
|
suspenders!
|
data/NEWS.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
1.8.0 (February 18, 2014)
|
|
2
|
+
|
|
3
|
+
* Make the .git/safe directory in bin/setup.
|
|
4
|
+
* Require `rails_12factor` gem only on Heroku.
|
|
5
|
+
* Require mailer config on staging and production.
|
|
6
|
+
* Add rspec binstub.
|
|
7
|
+
* Fix .ruby-version on Ruby 2.1.0.
|
|
8
|
+
* Replace Flutie's `page_title` with `title` gem.
|
|
9
|
+
* Don't run factory specs twice.
|
|
10
|
+
* Inherit staging config from production.
|
|
11
|
+
* Internal: convert tests from Cucumber to RSpec.
|
|
12
|
+
* Don't include `prefilled_input.js`.
|
|
13
|
+
* Fix Rack class name - Deflater instead of Timeout.
|
|
14
|
+
* Add Pry Rails.
|
|
15
|
+
* Add Spring.
|
|
16
|
+
* Add Dotenv to development and test environments to load environment variables
|
|
17
|
+
from the `.env` file.
|
|
18
|
+
* Reduce ActiveRecord connection pool from 5 to 2.
|
|
19
|
+
|
|
1
20
|
1.7.0 (December 6, 2013)
|
|
2
21
|
|
|
3
22
|
* Keep `db/schema.rb` under version control.
|
data/README.md
CHANGED
|
@@ -35,8 +35,8 @@ It includes application gems like:
|
|
|
35
35
|
processing
|
|
36
36
|
* [Email Validator](https://github.com/balexand/email_validator) for email
|
|
37
37
|
validation
|
|
38
|
-
* [Flutie](https://github.com/thoughtbot/flutie) for `
|
|
39
|
-
|
|
38
|
+
* [Flutie](https://github.com/thoughtbot/flutie) for and `body_class` view
|
|
39
|
+
helper
|
|
40
40
|
* [High Voltage](https://github.com/thoughtbot/high_voltage) for static pages
|
|
41
41
|
* [jQuery Rails](https://github.com/rails/jquery-rails) for jQuery
|
|
42
42
|
* [Neat](https://github.com/thoughtbot/neat) for semantic grids
|
|
@@ -48,13 +48,22 @@ It includes application gems like:
|
|
|
48
48
|
* [Simple Form](https://github.com/plataformatec/simple_form) for form markup
|
|
49
49
|
and style
|
|
50
50
|
* [Unicorn](https://github.com/defunkt/unicorn) to serve HTTP requests
|
|
51
|
+
* [Title](https://github.com/calebthompson/title) for storing titles in
|
|
52
|
+
translations
|
|
51
53
|
|
|
52
54
|
And gems only for staging and production like:
|
|
53
55
|
|
|
54
56
|
* [New Relic RPM](https://github.com/newrelic/rpm) for monitoring performance
|
|
55
|
-
* [Rails 12 Factor](https://github.com/heroku/rails_12factor) to
|
|
57
|
+
* [Rails 12 Factor](https://github.com/heroku/rails_12factor) to make running
|
|
56
58
|
Rails 4 apps easier on Heroku
|
|
57
59
|
|
|
60
|
+
And development gems like:
|
|
61
|
+
|
|
62
|
+
* [Dotenv](https://github.com/bkeepers/dotenv) for loading environment variables
|
|
63
|
+
* [Pry Rails](https://github.com/rweng/pry-rails) for debugging
|
|
64
|
+
* [Spring](https://github.com/rails/spring) for fast Rails actions via
|
|
65
|
+
pre-loading
|
|
66
|
+
|
|
58
67
|
And testing gems like:
|
|
59
68
|
|
|
60
69
|
* [Capybara](https://github.com/jnicklas/capybara) and
|
|
@@ -75,12 +84,16 @@ Suspenders also comes with:
|
|
|
75
84
|
* The [`./bin/setup`][bin] convention for new developer setup
|
|
76
85
|
* Rails' flashes set up and in application layout
|
|
77
86
|
* A few nice time formats set up for localization
|
|
78
|
-
* `Rack::
|
|
87
|
+
* `Rack::Deflater` to [compress responses with Gzip][compress]
|
|
79
88
|
* [Fast-failing factories][fast]
|
|
89
|
+
* A [low database connection pool limit][pool]
|
|
90
|
+
* [Safe binstubs][binstub]
|
|
80
91
|
|
|
81
92
|
[bin]: http://robots.thoughtbot.com/bin-setup
|
|
82
93
|
[compress]: http://robots.thoughtbot.com/content-compression-with-rack-deflater/
|
|
83
94
|
[fast]: http://robots.thoughtbot.com/testing-your-factories-first
|
|
95
|
+
[pool]: https://devcenter.heroku.com/articles/concurrency-and-database-connections
|
|
96
|
+
[binstub]: https://github.com/thoughtbot/suspenders/pull/282
|
|
84
97
|
|
|
85
98
|
Suspenders fixes several of Rails' [insecure defaults]:
|
|
86
99
|
|
|
@@ -172,5 +185,5 @@ The names and logos for thoughtbot are trademarks of thoughtbot, inc.
|
|
|
172
185
|
License
|
|
173
186
|
-------
|
|
174
187
|
|
|
175
|
-
Suspenders is Copyright © 2008-
|
|
188
|
+
Suspenders is Copyright © 2008-2014 thoughtbot. It is free software, and may be
|
|
176
189
|
redistributed under the terms specified in the LICENSE file.
|
data/Rakefile
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
require 'bundler/setup'
|
|
2
2
|
require 'bundler/gem_tasks'
|
|
3
|
-
require '
|
|
3
|
+
require 'rspec/core/rake_task'
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
RSpec::Core::RakeTask.new(:rspec)
|
|
6
6
|
|
|
7
7
|
desc 'Run the test suite'
|
|
8
|
-
task :default =>
|
|
8
|
+
task :default => :rspec
|
data/bin/rspec
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
#
|
|
3
|
+
# This file was generated by Bundler.
|
|
4
|
+
#
|
|
5
|
+
# The application 'rspec' is installed as part of a gem, and
|
|
6
|
+
# this file is here to facilitate running it.
|
|
7
|
+
#
|
|
8
|
+
|
|
9
|
+
require 'pathname'
|
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
|
11
|
+
Pathname.new(__FILE__).realpath)
|
|
12
|
+
|
|
13
|
+
require 'rubygems'
|
|
14
|
+
require 'bundler/setup'
|
|
15
|
+
|
|
16
|
+
load Gem.bin_path('rspec-core', 'rspec')
|
data/bin/suspenders
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
|
+
require 'pathname'
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
source_path = (Pathname.new(__FILE__).dirname + '../lib').expand_path
|
|
5
|
+
$LOAD_PATH << source_path
|
|
6
|
+
|
|
7
|
+
require 'suspenders'
|
|
6
8
|
|
|
7
9
|
if ['create', '--create'].include? ARGV[0]
|
|
8
10
|
ARGV.shift
|
data/lib/suspenders.rb
ADDED
|
@@ -6,14 +6,6 @@ module Suspenders
|
|
|
6
6
|
template 'README.md.erb', 'README.md'
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
def remove_public_index
|
|
10
|
-
remove_file 'public/index.html'
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def remove_rails_logo_image
|
|
14
|
-
remove_file 'app/assets/images/rails.png'
|
|
15
|
-
end
|
|
16
|
-
|
|
17
9
|
def raise_on_delivery_errors
|
|
18
10
|
replace_in_file 'config/environments/development.rb',
|
|
19
11
|
'raise_delivery_errors = false', 'raise_delivery_errors = true'
|
|
@@ -92,10 +84,17 @@ module Suspenders
|
|
|
92
84
|
end
|
|
93
85
|
|
|
94
86
|
def setup_staging_environment
|
|
95
|
-
|
|
87
|
+
staging_file = 'config/environments/staging.rb'
|
|
88
|
+
copy_file 'staging.rb', staging_file
|
|
89
|
+
|
|
90
|
+
config = <<-RUBY
|
|
96
91
|
|
|
97
|
-
|
|
98
|
-
|
|
92
|
+
#{app_name.classify}::Application.configure do
|
|
93
|
+
# ...
|
|
94
|
+
end
|
|
95
|
+
RUBY
|
|
96
|
+
|
|
97
|
+
append_file staging_file, config
|
|
99
98
|
end
|
|
100
99
|
|
|
101
100
|
def setup_secret_token
|
|
@@ -128,10 +127,6 @@ module Suspenders
|
|
|
128
127
|
''
|
|
129
128
|
end
|
|
130
129
|
|
|
131
|
-
def create_common_javascripts
|
|
132
|
-
directory 'javascripts', 'app/assets/javascripts'
|
|
133
|
-
end
|
|
134
|
-
|
|
135
130
|
def use_postgres_config_template
|
|
136
131
|
template 'postgresql_database.yml.erb', 'config/database.yml',
|
|
137
132
|
:force => true
|
|
@@ -149,7 +144,12 @@ module Suspenders
|
|
|
149
144
|
def set_ruby_to_version_being_used
|
|
150
145
|
inject_into_file 'Gemfile', "\n\nruby '#{RUBY_VERSION}'",
|
|
151
146
|
after: /source 'https:\/\/rubygems.org'/
|
|
152
|
-
create_file '.ruby-version', "#{RUBY_VERSION}
|
|
147
|
+
create_file '.ruby-version', "#{RUBY_VERSION}#{patchlevel}\n"
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
def setup_heroku_specific_gems
|
|
151
|
+
inject_into_file 'Gemfile', "\n\s\sgem 'rails_12factor'",
|
|
152
|
+
after: /group :staging, :production do/
|
|
153
153
|
end
|
|
154
154
|
|
|
155
155
|
def enable_database_cleaner
|
|
@@ -166,9 +166,8 @@ module Suspenders
|
|
|
166
166
|
copy_file 'spec_helper.rb', 'spec/spec_helper.rb'
|
|
167
167
|
end
|
|
168
168
|
|
|
169
|
-
def
|
|
170
|
-
run 'bundle binstub
|
|
171
|
-
run 'rm bin/autospec'
|
|
169
|
+
def use_spring_binstubs
|
|
170
|
+
run 'bundle exec spring binstub --all'
|
|
172
171
|
end
|
|
173
172
|
|
|
174
173
|
def configure_background_jobs_for_rspec
|
|
@@ -204,10 +203,6 @@ module Suspenders
|
|
|
204
203
|
generate 'rspec:install'
|
|
205
204
|
end
|
|
206
205
|
|
|
207
|
-
def generate_clearance
|
|
208
|
-
generate 'clearance:install'
|
|
209
|
-
end
|
|
210
|
-
|
|
211
206
|
def configure_unicorn
|
|
212
207
|
copy_file 'unicorn.rb', 'config/unicorn.rb'
|
|
213
208
|
end
|
|
@@ -309,7 +304,7 @@ git remote add production git@heroku.com:#{app_name}-production.git
|
|
|
309
304
|
|
|
310
305
|
def override_path_for_tests
|
|
311
306
|
if ENV['TESTING']
|
|
312
|
-
support_bin = File.expand_path(File.join('..', '..', '
|
|
307
|
+
support_bin = File.expand_path(File.join('..', '..', 'spec', 'fakes', 'bin'))
|
|
313
308
|
"PATH=#{support_bin}:$PATH"
|
|
314
309
|
end
|
|
315
310
|
end
|
|
@@ -321,5 +316,13 @@ git remote add production git@heroku.com:#{app_name}-production.git
|
|
|
321
316
|
def generate_secret
|
|
322
317
|
SecureRandom.hex(64)
|
|
323
318
|
end
|
|
319
|
+
|
|
320
|
+
def patchlevel
|
|
321
|
+
if RUBY_PATCHLEVEL == 0 && RUBY_VERSION >= '2.1.0'
|
|
322
|
+
''
|
|
323
|
+
else
|
|
324
|
+
"-p#{RUBY_PATCHLEVEL}"
|
|
325
|
+
end
|
|
326
|
+
end
|
|
324
327
|
end
|
|
325
328
|
end
|
|
@@ -21,7 +21,6 @@ module Suspenders
|
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def suspenders_customization
|
|
24
|
-
invoke :remove_files_we_dont_need
|
|
25
24
|
invoke :customize_gemfile
|
|
26
25
|
invoke :setup_development_environment
|
|
27
26
|
invoke :setup_test_environment
|
|
@@ -42,14 +41,14 @@ module Suspenders
|
|
|
42
41
|
invoke :outro
|
|
43
42
|
end
|
|
44
43
|
|
|
45
|
-
def remove_files_we_dont_need
|
|
46
|
-
build :remove_public_index
|
|
47
|
-
build :remove_rails_logo_image
|
|
48
|
-
end
|
|
49
|
-
|
|
50
44
|
def customize_gemfile
|
|
51
45
|
build :replace_gemfile
|
|
52
46
|
build :set_ruby_to_version_being_used
|
|
47
|
+
|
|
48
|
+
if options[:heroku]
|
|
49
|
+
build :setup_heroku_specific_gems
|
|
50
|
+
end
|
|
51
|
+
|
|
53
52
|
bundle_command 'install'
|
|
54
53
|
end
|
|
55
54
|
|
|
@@ -77,7 +76,7 @@ module Suspenders
|
|
|
77
76
|
build :test_factories_first
|
|
78
77
|
build :generate_rspec
|
|
79
78
|
build :configure_rspec
|
|
80
|
-
build :
|
|
79
|
+
build :use_spring_binstubs
|
|
81
80
|
build :configure_background_jobs_for_rspec
|
|
82
81
|
build :enable_database_cleaner
|
|
83
82
|
build :configure_spec_support_features
|
|
@@ -110,14 +109,11 @@ module Suspenders
|
|
|
110
109
|
def setup_coffeescript
|
|
111
110
|
say 'Setting up CoffeeScript defaults'
|
|
112
111
|
build :remove_turbolinks
|
|
113
|
-
build :create_common_javascripts
|
|
114
112
|
end
|
|
115
113
|
|
|
116
114
|
def configure_app
|
|
117
115
|
say 'Configuring app'
|
|
118
116
|
build :configure_action_mailer
|
|
119
|
-
build :blacklist_active_record_attributes
|
|
120
|
-
build :configure_strong_parameters
|
|
121
117
|
build :configure_time_zone
|
|
122
118
|
build :configure_time_formats
|
|
123
119
|
build :configure_rack_timeout
|
|
@@ -164,11 +160,6 @@ module Suspenders
|
|
|
164
160
|
build :init_git
|
|
165
161
|
end
|
|
166
162
|
|
|
167
|
-
def copy_libraries
|
|
168
|
-
say 'Copying libraries'
|
|
169
|
-
build :copy_libraries
|
|
170
|
-
end
|
|
171
|
-
|
|
172
163
|
def copy_miscellaneous_files
|
|
173
164
|
say 'Copying miscellaneous support files'
|
|
174
165
|
build :copy_miscellaneous_files
|
data/lib/suspenders/version.rb
CHANGED
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
feature 'Heroku' do
|
|
4
|
+
scenario 'Suspend a project with --heroku=true' do
|
|
5
|
+
run_suspenders('--heroku=true')
|
|
6
|
+
|
|
7
|
+
expect(FakeHeroku).to have_gem_included(project_path, 'rails_12factor')
|
|
8
|
+
expect(FakeHeroku).to have_created_app_for('staging')
|
|
9
|
+
expect(FakeHeroku).to have_created_app_for('production')
|
|
10
|
+
expect(FakeHeroku).to have_configured_vars('staging', 'SECRET_KEY_BASE')
|
|
11
|
+
expect(FakeHeroku).to have_configured_vars('production', 'SECRET_KEY_BASE')
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
feature 'Suspend a new project with default configuration' do
|
|
4
|
+
scenario 'specs pass' do
|
|
5
|
+
run_suspenders
|
|
6
|
+
|
|
7
|
+
Dir.chdir(project_path) do
|
|
8
|
+
Bundler.with_clean_env do
|
|
9
|
+
expect(`rake`).to include('0 failures')
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
scenario 'staging config is inherited from production' do
|
|
15
|
+
run_suspenders
|
|
16
|
+
|
|
17
|
+
staging_file = IO.read("#{project_path}/config/environments/staging.rb")
|
|
18
|
+
config_stub = "Dummy::Application.configure do"
|
|
19
|
+
expect(staging_file).to match(/^require_relative 'production'/)
|
|
20
|
+
expect(staging_file).to match(/#{config_stub}/), staging_file
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
if RUBY_PATCHLEVEL == 0 && RUBY_VERSION >= '2.1.0'
|
|
24
|
+
scenario '.ruby-version does not include patchlevel for Ruby 2.1.0' do
|
|
25
|
+
run_suspenders
|
|
26
|
+
|
|
27
|
+
ruby_version_file = IO.read("#{project_path}/.ruby-version")
|
|
28
|
+
expect(ruby_version_file).to eq "2.1.0\n"
|
|
29
|
+
end
|
|
30
|
+
else
|
|
31
|
+
scenario '.ruby-version includes patchlevel for all pre-Ruby 2.1.0 versions' do
|
|
32
|
+
run_suspenders
|
|
33
|
+
|
|
34
|
+
ruby_version_file = IO.read("#{project_path}/.ruby-version")
|
|
35
|
+
expect(ruby_version_file).to eq "#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}\n"
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require 'capybara/rspec'
|
|
2
|
+
require 'bundler/setup'
|
|
3
|
+
|
|
4
|
+
Bundler.require(:default, :test)
|
|
5
|
+
|
|
6
|
+
require (Pathname.new(__FILE__).dirname + '../lib/suspenders').expand_path
|
|
7
|
+
|
|
8
|
+
Dir['./spec/support/**/*.rb'].each { |file| require file }
|
|
9
|
+
|
|
10
|
+
RSpec.configure do |config|
|
|
11
|
+
config.include SuspendersTestHelpers
|
|
12
|
+
|
|
13
|
+
config.before(:all) do
|
|
14
|
+
create_tmp_directory
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
config.before(:each) do
|
|
18
|
+
drop_dummy_database
|
|
19
|
+
remove_project_directory
|
|
20
|
+
|
|
21
|
+
FakeHeroku.clear!
|
|
22
|
+
FakeGithub.clear!
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
class FakeHeroku
|
|
2
|
+
RECORDER = File.expand_path(File.join('..', '..', 'tmp', 'heroku_commands'), File.dirname(__FILE__))
|
|
3
|
+
|
|
4
|
+
def initialize(args)
|
|
5
|
+
@args = args
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def run!
|
|
9
|
+
File.open(RECORDER, 'a') do |file|
|
|
10
|
+
file.puts @args.join(' ')
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def self.clear!
|
|
15
|
+
FileUtils.rm_rf RECORDER
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def self.has_gem_included?(project_path, gem_name)
|
|
19
|
+
gemfile = File.open(File.join(project_path, 'Gemfile'), 'a')
|
|
20
|
+
|
|
21
|
+
File.foreach(gemfile).any?{ |line| line.match(/rails_12factor/) }
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def self.has_created_app_for?(remote_name)
|
|
25
|
+
app_name = "#{SuspendersTestHelpers::APP_NAME}-#{remote_name}"
|
|
26
|
+
expected_line = "create #{app_name} --remote=#{remote_name}\n"
|
|
27
|
+
|
|
28
|
+
File.foreach(RECORDER).any? { |line| line == expected_line }
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def self.has_configured_vars?(remote_name, var)
|
|
32
|
+
File.foreach(RECORDER).any? do |line|
|
|
33
|
+
line =~ /^config:add #{var}=.+ --remote=#{remote_name}\n$/
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
module SuspendersTestHelpers
|
|
2
|
+
APP_NAME = 'dummy'
|
|
3
|
+
|
|
4
|
+
def remove_project_directory
|
|
5
|
+
FileUtils.rm_rf(project_path)
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def create_tmp_directory
|
|
9
|
+
FileUtils.mkdir_p(tmp_path)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def run_suspenders(arguments = nil)
|
|
13
|
+
Dir.chdir(tmp_path) do
|
|
14
|
+
Bundler.with_clean_env do
|
|
15
|
+
ENV['TESTING'] = '1'
|
|
16
|
+
ENV['DISABLE_SPRING'] = '1'
|
|
17
|
+
|
|
18
|
+
%x(#{suspenders_bin} #{APP_NAME} #{arguments})
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def drop_dummy_database
|
|
24
|
+
if File.exists?(project_path)
|
|
25
|
+
Dir.chdir(project_path) do
|
|
26
|
+
Bundler.with_clean_env do
|
|
27
|
+
`rake db:drop`
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def project_path
|
|
34
|
+
@project_path ||= Pathname.new("#{tmp_path}/#{APP_NAME}")
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
private
|
|
38
|
+
|
|
39
|
+
def tmp_path
|
|
40
|
+
@tmp_path ||= Pathname.new("#{root_path}/tmp")
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def suspenders_bin
|
|
44
|
+
File.join(root_path, 'bin', 'suspenders')
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def root_path
|
|
48
|
+
File.expand_path('../../../', __FILE__)
|
|
49
|
+
end
|
|
50
|
+
end
|
data/suspenders.gemspec
CHANGED
|
@@ -30,4 +30,6 @@ rush to build something amazing; don't use it if you like missing deadlines.
|
|
|
30
30
|
s.summary = "Generate a Rails app using thoughtbot's best practices."
|
|
31
31
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
32
32
|
s.version = Suspenders::VERSION
|
|
33
|
+
s.add_development_dependency 'rspec'
|
|
34
|
+
s.add_development_dependency 'capybara'
|
|
33
35
|
end
|
data/templates/Gemfile_clean
CHANGED
|
@@ -15,6 +15,7 @@ gem 'rails', '>= 4.0.0'
|
|
|
15
15
|
gem 'recipient_interceptor'
|
|
16
16
|
gem 'sass-rails'
|
|
17
17
|
gem 'simple_form'
|
|
18
|
+
gem 'title'
|
|
18
19
|
gem 'uglifier'
|
|
19
20
|
gem 'unicorn'
|
|
20
21
|
|
|
@@ -22,10 +23,14 @@ group :development do
|
|
|
22
23
|
gem 'better_errors'
|
|
23
24
|
gem 'binding_of_caller'
|
|
24
25
|
gem 'foreman'
|
|
26
|
+
gem 'spring'
|
|
27
|
+
gem 'spring-commands-rspec'
|
|
25
28
|
end
|
|
26
29
|
|
|
27
30
|
group :development, :test do
|
|
31
|
+
gem 'dotenv-rails'
|
|
28
32
|
gem 'factory_girl_rails'
|
|
33
|
+
gem 'pry-rails'
|
|
29
34
|
gem 'rspec-rails', '>= 2.14'
|
|
30
35
|
end
|
|
31
36
|
|
|
@@ -41,5 +46,4 @@ end
|
|
|
41
46
|
|
|
42
47
|
group :staging, :production do
|
|
43
48
|
gem 'newrelic_rpm', '>= 3.6.7'
|
|
44
|
-
gem 'rails_12factor'
|
|
45
49
|
end
|
data/templates/README.md.erb
CHANGED
data/templates/bin_setup
CHANGED
|
@@ -12,6 +12,9 @@ bundle install
|
|
|
12
12
|
# Set up the database
|
|
13
13
|
bundle exec rake db:setup
|
|
14
14
|
|
|
15
|
+
# Add binstubs to PATH via export PATH=".git/safe/../../bin:$PATH" in ~/.zshenv
|
|
16
|
+
mkdir -p .git/safe
|
|
17
|
+
|
|
15
18
|
# Set up configurable environment variables
|
|
16
19
|
if [ ! -f .env ]; then
|
|
17
20
|
cp .sample.env .env
|
data/templates/factories_spec.rb
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
describe 'factories' do
|
|
4
|
+
FactoryGirl.factories.map(&:name).each do |factory_name|
|
|
5
|
+
specify "#{factory_name} factory is valid", :factory do
|
|
6
6
|
factory = build(factory_name)
|
|
7
7
|
|
|
8
8
|
if factory.respond_to?(:valid?)
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
if defined?(RSpec)
|
|
2
|
-
|
|
2
|
+
task(:spec).clear
|
|
3
|
+
|
|
4
|
+
desc 'Run all specs'
|
|
5
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
|
6
|
+
t.rspec_opts = '--tag ~factory'
|
|
7
|
+
end
|
|
3
8
|
|
|
9
|
+
desc 'Run factory specs.'
|
|
4
10
|
RSpec::Core::RakeTask.new(:factory_specs) do |t|
|
|
5
11
|
t.pattern = './spec/models/factories_spec.rb'
|
|
6
12
|
end
|
data/templates/smtp.rb
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
if Rails.env.staging? || Rails.env.production?
|
|
2
2
|
SMTP_SETTINGS = {
|
|
3
|
-
address: ENV
|
|
3
|
+
address: ENV.fetch('SMTP_ADDRESS'), # example: 'smtp.sendgrid.net'
|
|
4
4
|
authentication: :plain,
|
|
5
|
-
domain: ENV
|
|
6
|
-
password: ENV
|
|
5
|
+
domain: ENV.fetch('SMTP_DOMAIN'), # example: 'this-app.com'
|
|
6
|
+
password: ENV.fetch('SMTP_PASSWORD'),
|
|
7
7
|
port: '587',
|
|
8
|
-
user_name: ENV
|
|
8
|
+
user_name: ENV.fetch('SMTP_USERNAME')
|
|
9
9
|
}
|
|
10
10
|
end
|
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
*.DS_Store
|
|
3
3
|
*.swo
|
|
4
4
|
*.swp
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
tags
|
|
13
|
-
tmp/*
|
|
14
|
-
tmp/**/*
|
|
5
|
+
/.bundle
|
|
6
|
+
/.env
|
|
7
|
+
/.foreman
|
|
8
|
+
/coverage/*
|
|
9
|
+
/db/*.sqlite3
|
|
10
|
+
/log/*
|
|
11
|
+
/public/system
|
|
12
|
+
/tags
|
|
13
|
+
/tmp/*
|
data/templates/unicorn.rb
CHANGED
|
@@ -21,6 +21,9 @@ after_fork do |server, worker|
|
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
if defined? ActiveRecord::Base
|
|
24
|
-
|
|
24
|
+
config = Rails.application.config.database_configuration[Rails.env]
|
|
25
|
+
config['reaping_frequency'] = (ENV['DB_REAPING_FREQUENCY'] || 10).to_i
|
|
26
|
+
config['pool'] = (ENV['DB_POOL'] || 2).to_i
|
|
27
|
+
ActiveRecord::Base.establish_connection(config)
|
|
25
28
|
end
|
|
26
29
|
end
|
metadata
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: suspenders
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.8.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- thoughtbot
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2014-02-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- - ~>
|
|
17
|
+
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
19
|
version: '1.3'
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
|
-
- - ~>
|
|
24
|
+
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: '1.3'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
@@ -42,44 +42,73 @@ dependencies:
|
|
|
42
42
|
name: aruba
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
44
44
|
requirements:
|
|
45
|
-
- - ~>
|
|
45
|
+
- - "~>"
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
47
|
version: 0.5.2
|
|
48
48
|
type: :development
|
|
49
49
|
prerelease: false
|
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
51
|
requirements:
|
|
52
|
-
- - ~>
|
|
52
|
+
- - "~>"
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
54
|
version: 0.5.2
|
|
55
55
|
- !ruby/object:Gem::Dependency
|
|
56
56
|
name: cucumber
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
58
58
|
requirements:
|
|
59
|
-
- - ~>
|
|
59
|
+
- - "~>"
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
61
|
version: '1.2'
|
|
62
62
|
type: :development
|
|
63
63
|
prerelease: false
|
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
65
|
requirements:
|
|
66
|
-
- - ~>
|
|
66
|
+
- - "~>"
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
68
|
version: '1.2'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: rspec
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - ">="
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '0'
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - ">="
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '0'
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: capybara
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - ">="
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '0'
|
|
90
|
+
type: :development
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - ">="
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '0'
|
|
69
97
|
description: |
|
|
70
98
|
Suspenders is a base Rails project that you can upgrade. It is used by
|
|
71
99
|
thoughtbot to get a jump start on a working app. Use Suspenders if you're in a
|
|
72
100
|
rush to build something amazing; don't use it if you like missing deadlines.
|
|
73
101
|
email: support@thoughtbot.com
|
|
74
102
|
executables:
|
|
103
|
+
- rspec
|
|
75
104
|
- suspenders
|
|
76
105
|
extensions: []
|
|
77
106
|
extra_rdoc_files:
|
|
78
107
|
- README.md
|
|
79
108
|
- LICENSE
|
|
80
109
|
files:
|
|
81
|
-
- .gitignore
|
|
82
|
-
- .travis.yml
|
|
110
|
+
- ".gitignore"
|
|
111
|
+
- ".travis.yml"
|
|
83
112
|
- CONTRIBUTING.md
|
|
84
113
|
- Gemfile
|
|
85
114
|
- Gemfile.lock
|
|
@@ -87,20 +116,22 @@ files:
|
|
|
87
116
|
- NEWS.md
|
|
88
117
|
- README.md
|
|
89
118
|
- Rakefile
|
|
119
|
+
- bin/rspec
|
|
90
120
|
- bin/suspenders
|
|
91
|
-
-
|
|
92
|
-
- features/heroku_true.feature
|
|
93
|
-
- features/rake_clean.feature
|
|
94
|
-
- features/step_definitions/suspenders_steps.rb
|
|
95
|
-
- features/support/bin/heroku
|
|
96
|
-
- features/support/bin/hub
|
|
97
|
-
- features/support/env.rb
|
|
98
|
-
- features/support/fake_github.rb
|
|
99
|
-
- features/support/fake_heroku.rb
|
|
121
|
+
- lib/suspenders.rb
|
|
100
122
|
- lib/suspenders/actions.rb
|
|
101
123
|
- lib/suspenders/app_builder.rb
|
|
102
124
|
- lib/suspenders/generators/app_generator.rb
|
|
103
125
|
- lib/suspenders/version.rb
|
|
126
|
+
- spec/fakes/bin/heroku
|
|
127
|
+
- spec/fakes/bin/hub
|
|
128
|
+
- spec/features/github_spec.rb
|
|
129
|
+
- spec/features/heroku_spec.rb
|
|
130
|
+
- spec/features/new_project_spec.rb
|
|
131
|
+
- spec/spec_helper.rb
|
|
132
|
+
- spec/support/fake_github.rb
|
|
133
|
+
- spec/support/fake_heroku.rb
|
|
134
|
+
- spec/support/suspenders.rb
|
|
104
135
|
- suspenders.gemspec
|
|
105
136
|
- templates/Gemfile_clean
|
|
106
137
|
- templates/Procfile
|
|
@@ -117,13 +148,13 @@ files:
|
|
|
117
148
|
- templates/factories_spec.rb
|
|
118
149
|
- templates/factories_spec_rake_task.rb
|
|
119
150
|
- templates/factory_girl_syntax_rspec.rb
|
|
120
|
-
- templates/javascripts/prefilled_input.js
|
|
121
151
|
- templates/postgresql_database.yml.erb
|
|
122
152
|
- templates/rack_timeout.rb
|
|
123
153
|
- templates/sample.env
|
|
124
154
|
- templates/secret_token.rb
|
|
125
155
|
- templates/smtp.rb
|
|
126
156
|
- templates/spec_helper.rb
|
|
157
|
+
- templates/staging.rb
|
|
127
158
|
- templates/suspenders_gitignore
|
|
128
159
|
- templates/suspenders_layout.html.erb.erb
|
|
129
160
|
- templates/unicorn.rb
|
|
@@ -133,32 +164,32 @@ licenses:
|
|
|
133
164
|
metadata: {}
|
|
134
165
|
post_install_message:
|
|
135
166
|
rdoc_options:
|
|
136
|
-
- --charset=UTF-8
|
|
167
|
+
- "--charset=UTF-8"
|
|
137
168
|
require_paths:
|
|
138
169
|
- lib
|
|
139
170
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
140
171
|
requirements:
|
|
141
|
-
- -
|
|
172
|
+
- - ">="
|
|
142
173
|
- !ruby/object:Gem::Version
|
|
143
174
|
version: 1.9.2
|
|
144
175
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
176
|
requirements:
|
|
146
|
-
- -
|
|
177
|
+
- - ">="
|
|
147
178
|
- !ruby/object:Gem::Version
|
|
148
179
|
version: '0'
|
|
149
180
|
requirements: []
|
|
150
181
|
rubyforge_project:
|
|
151
|
-
rubygems_version: 2.
|
|
182
|
+
rubygems_version: 2.2.0
|
|
152
183
|
signing_key:
|
|
153
184
|
specification_version: 4
|
|
154
185
|
summary: Generate a Rails app using thoughtbot's best practices.
|
|
155
186
|
test_files:
|
|
156
|
-
-
|
|
157
|
-
-
|
|
158
|
-
- features/
|
|
159
|
-
- features/
|
|
160
|
-
- features/
|
|
161
|
-
-
|
|
162
|
-
-
|
|
163
|
-
-
|
|
164
|
-
-
|
|
187
|
+
- spec/fakes/bin/heroku
|
|
188
|
+
- spec/fakes/bin/hub
|
|
189
|
+
- spec/features/github_spec.rb
|
|
190
|
+
- spec/features/heroku_spec.rb
|
|
191
|
+
- spec/features/new_project_spec.rb
|
|
192
|
+
- spec/spec_helper.rb
|
|
193
|
+
- spec/support/fake_github.rb
|
|
194
|
+
- spec/support/fake_heroku.rb
|
|
195
|
+
- spec/support/suspenders.rb
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
@disable-bundler
|
|
2
|
-
Feature: Creating a Github repo
|
|
3
|
-
|
|
4
|
-
Scenario: --github=organization/project
|
|
5
|
-
When I suspend a project called "test_project" with:
|
|
6
|
-
| argument | value |
|
|
7
|
-
| --github | organization/project |
|
|
8
|
-
Then the "organization/project" Github repo should exist
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
@disable-bundler
|
|
2
|
-
Feature: Creating a Heroku app
|
|
3
|
-
|
|
4
|
-
Scenario: --heroku=true
|
|
5
|
-
When I suspend a project called "test_project" with:
|
|
6
|
-
| argument | value |
|
|
7
|
-
| --heroku | true |
|
|
8
|
-
Then the "test_project-staging" Heroku app should exist
|
|
9
|
-
And the "test_project-production" Heroku app should exist
|
|
10
|
-
And the "staging" Heroku remote should have "SECRET_KEY_BASE" configured
|
|
11
|
-
And the "production" Heroku remote should have "SECRET_KEY_BASE" configured
|
data/features/rake_clean.feature
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
@disable-bundler
|
|
2
|
-
Feature: Rake works in the suspended project
|
|
3
|
-
Background:
|
|
4
|
-
Given I ensure no databases exist for "test_project"
|
|
5
|
-
|
|
6
|
-
Scenario: Running rake in the suspended project
|
|
7
|
-
When I suspend a project called "test_project"
|
|
8
|
-
And I cd to the "test_project" root
|
|
9
|
-
And I obtain a fresh checkout
|
|
10
|
-
And I setup the project
|
|
11
|
-
Then I can cleanly rake the project
|
|
12
|
-
|
|
13
|
-
Scenario: Making a model spec then running rake
|
|
14
|
-
When I suspend a project called "test_project"
|
|
15
|
-
And I cd to the "test_project" root
|
|
16
|
-
And I obtain a fresh checkout
|
|
17
|
-
And I setup the project
|
|
18
|
-
And I generate "model post title:string"
|
|
19
|
-
And I run migrations
|
|
20
|
-
Then I can cleanly rake the project
|
|
21
|
-
|
|
22
|
-
Scenario: Making a feature spec then running rake
|
|
23
|
-
When I suspend a project called "test_project"
|
|
24
|
-
And I cd to the "test_project" root
|
|
25
|
-
And I obtain a fresh checkout
|
|
26
|
-
And I setup the project
|
|
27
|
-
And I write to "spec/features/example_spec.rb" with:
|
|
28
|
-
"""
|
|
29
|
-
require 'spec_helper'
|
|
30
|
-
|
|
31
|
-
feature 'Example feature spec' do
|
|
32
|
-
scenario 'using a method from the Features module' do
|
|
33
|
-
expect(example_method).to eq('Expected Value')
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
"""
|
|
37
|
-
And I write to "spec/support/features/example.rb" with:
|
|
38
|
-
"""
|
|
39
|
-
module Features
|
|
40
|
-
def example_method
|
|
41
|
-
'Expected Value'
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
"""
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
require 'aruba/cucumber'
|
|
2
|
-
|
|
3
|
-
When 'I run rake' do
|
|
4
|
-
in_current_dir do
|
|
5
|
-
run_simple 'bundle exec rake'
|
|
6
|
-
end
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
When 'I run migrations' do
|
|
10
|
-
in_current_dir do
|
|
11
|
-
run_simple 'bundle exec rake db:migrate'
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
When 'I obtain a fresh checkout' do
|
|
16
|
-
in_current_dir do
|
|
17
|
-
run_simple 'git clean --force -x -d'
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
When 'I run the rake task "$task_name"' do |task_name|
|
|
22
|
-
in_current_dir do
|
|
23
|
-
run_simple "bundle exec rake #{task_name}"
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
When 'I generate "$generator_with_args"' do |generator_with_args|
|
|
28
|
-
in_current_dir do
|
|
29
|
-
run_simple "bundle exec rails generate #{generator_with_args}"
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
When 'I ensure no databases exist for "$project_name"' do |project_name|
|
|
34
|
-
run "dropdb #{project_name}_development"
|
|
35
|
-
run "dropdb #{project_name}_test"
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
When 'I suspend a project called "$project_name"' do |project_name|
|
|
39
|
-
suspenders_bin = File.expand_path(File.join('..', '..', 'bin', 'suspenders'), File.dirname(__FILE__))
|
|
40
|
-
run_simple "#{suspenders_bin} #{project_name}"
|
|
41
|
-
cd project_name
|
|
42
|
-
run_simple 'git add -A'
|
|
43
|
-
run_simple 'git commit -m "Initial commit"'
|
|
44
|
-
cd '..'
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
When %r{I suspend a project called "([^"]*)" with:} do |project_name, arguments_table|
|
|
48
|
-
suspenders_bin = File.expand_path(File.join('..', '..', 'bin', 'suspenders'), File.dirname(__FILE__))
|
|
49
|
-
arguments = arguments_table.hashes.inject([]) do |accum, argument|
|
|
50
|
-
accum << "#{argument['argument']}=#{argument['value']}"
|
|
51
|
-
end.join
|
|
52
|
-
run_simple "#{suspenders_bin} #{project_name} #{arguments}"
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
When 'I cd to the "$test_project" root' do |dirname|
|
|
56
|
-
cd dirname
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
When 'I setup the project' do
|
|
60
|
-
run_simple 'bin/setup'
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
Then 'I can cleanly rake the project' do
|
|
64
|
-
steps %{
|
|
65
|
-
When I run rake
|
|
66
|
-
}
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
Then %r{"(.*)" should not be installed} do |gem_name|
|
|
70
|
-
in_current_dir do
|
|
71
|
-
system("bundle show #{gem_name} 2>&1 > /dev/null").should be_false
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
Then %r{"(.*)" should not be included in "(.*)"} do |content, file_path|
|
|
76
|
-
check_file_content file_path, content, false
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
Then %r{the "([^"]*)" Heroku app should exist} do |app_name|
|
|
80
|
-
FakeHeroku.should have_created_app(app_name)
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
Then %r{the "([^"]+)" Heroku remote should have "([^"]+)" configured} do |remote_name, config_name|
|
|
84
|
-
FakeHeroku.configured_vars_for(remote_name).should include(config_name)
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
Then %r{the "([^"]*)" Github repo should exist} do |repo_name|
|
|
88
|
-
FakeGithub.should have_created_repo(repo_name)
|
|
89
|
-
end
|
data/features/support/env.rb
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
class FakeHeroku
|
|
2
|
-
RECORDER = File.expand_path(File.join('..', '..', 'tmp', 'heroku_commands'), File.dirname(__FILE__))
|
|
3
|
-
|
|
4
|
-
def initialize(args)
|
|
5
|
-
@args = args
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
def run!
|
|
9
|
-
File.open(RECORDER, 'a') do |file|
|
|
10
|
-
file.puts @args.join(' ')
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def self.clear!
|
|
15
|
-
FileUtils.rm_rf RECORDER
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def self.has_created_app?(app_name)
|
|
19
|
-
File.open(RECORDER, 'r').read.include?("create #{app_name}")
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def self.configured_vars_for(remote_name)
|
|
23
|
-
File.open(RECORDER, 'r').
|
|
24
|
-
each_line.
|
|
25
|
-
grep(/^config:add .* --remote=#{remote_name}/) { |line|
|
|
26
|
-
line.scan(/([A-Z_]+)=[^ ]*/)
|
|
27
|
-
}.
|
|
28
|
-
flatten
|
|
29
|
-
end
|
|
30
|
-
end
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
// clear inputs with starter values
|
|
2
|
-
new function($) {
|
|
3
|
-
$.fn.prefilledInput = function() {
|
|
4
|
-
|
|
5
|
-
var focus = function () {
|
|
6
|
-
$(this).removeClass('prefilled');
|
|
7
|
-
if (this.value == this.prefilledValue) {
|
|
8
|
-
this.value = '';
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
var blur = function () {
|
|
13
|
-
if (this.value == '') {
|
|
14
|
-
$(this).addClass('prefilled').val(this.prefilledValue);
|
|
15
|
-
} else if (this.value != this.prefilledValue) {
|
|
16
|
-
$(this).removeClass('prefilled');
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
var extractPrefilledValue = function () {
|
|
21
|
-
if (this.title) {
|
|
22
|
-
this.prefilledValue = this.title;
|
|
23
|
-
this.title = '';
|
|
24
|
-
} else if (this.id) {
|
|
25
|
-
this.prefilledValue = $('label[for=' + this.id + ']').hide().text();
|
|
26
|
-
}
|
|
27
|
-
if (this.prefilledValue) {
|
|
28
|
-
this.prefilledValue = this.prefilledValue.replace(/\*$/, '');
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
var initialize = function (index) {
|
|
33
|
-
if (!this.prefilledValue) {
|
|
34
|
-
this.extractPrefilledValue = extractPrefilledValue;
|
|
35
|
-
this.extractPrefilledValue();
|
|
36
|
-
$(this).trigger('blur');
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
return this.filter(":input").
|
|
41
|
-
focus(focus).
|
|
42
|
-
blur(blur).
|
|
43
|
-
each(initialize);
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
var clearPrefilledInputs = function () {
|
|
47
|
-
var form = this.form || this;
|
|
48
|
-
$(form).find("input.prefilled, textarea.prefilled").val("");
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
var prefilledSetup = function () {
|
|
52
|
-
$('input.prefilled, textarea.prefilled').prefilledInput();
|
|
53
|
-
$('form').submit(clearPrefilledInputs);
|
|
54
|
-
$('input:submit, button:submit').click(clearPrefilledInputs);
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
$(document).ready(prefilledSetup);
|
|
58
|
-
$(document).ajaxComplete(prefilledSetup);
|
|
59
|
-
}(jQuery);
|