suspenders 1.1.4 → 1.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- suspenders (1.1.4)
4
+ suspenders (1.1.5)
5
5
  bundler (>= 1.1)
6
6
  hub (~> 1.10.2)
7
7
  rails (= 3.2.8)
@@ -73,7 +73,7 @@ GEM
73
73
  rack (>= 0.4)
74
74
  rack-ssl (1.3.2)
75
75
  rack
76
- rack-test (0.6.1)
76
+ rack-test (0.6.2)
77
77
  rack (>= 1.0)
78
78
  rails (3.2.8)
79
79
  actionmailer (= 3.2.8)
@@ -108,7 +108,7 @@ GEM
108
108
  term-ansicolor (1.0.7)
109
109
  thor (0.16.0)
110
110
  tilt (1.3.3)
111
- treetop (1.4.10)
111
+ treetop (1.4.11)
112
112
  polyglot
113
113
  polyglot (>= 0.3.1)
114
114
  tzinfo (0.3.33)
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License
2
2
 
3
- Copyright (c) 2010 Mike Burns
3
+ Copyright (c) 2010-2012 Mike Burns and 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,22 @@
1
+ 1.1.5 (October 22, 2012)
2
+
3
+ * Ignore `.env`.
4
+ * Link to thoughtbot/guides in generated README.
5
+ * Remove Cucumber in favor of RSpec + Capybara.
6
+ * Deliver emails in staging environment to an overriden email or set of emails.
7
+ * Encode database as UTF8.
8
+ * Bundle with binstubs using 37signals' directory convention.
9
+ * Configure time formats using localization.
10
+ * Add Ruby version to Gemfile.
11
+ * Add fast-failing spec that tests validity of factories.
12
+ * Use SimpleCov for C0 coverage.
13
+ * Configure RSpec with `--profile` flag to find slow-running specs.
14
+
15
+ 1.1.4 (eptember 4, 2012)
16
+
17
+ * Always store UTC in the DB.
18
+ * Use Rails 3.2.8.
19
+
1
20
  1.1.3 (August 7, 2012)
2
21
 
3
22
  * Fix broken Gemfile additions where capybara stole cucumber's `require: false`
data/README.md CHANGED
@@ -22,35 +22,39 @@ Gemfile
22
22
  -------
23
23
 
24
24
  To see the latest and greatest gems, look at Suspenders'
25
- [template/Gemfile_additions](https://github.com/thoughtbot/suspenders/blob/master/templates/Gemfile_additions),
25
+ [template/Gemfile_additions](/thoughtbot/suspenders/blob/master/templates/Gemfile_additions),
26
26
  which will be appended to the default generated projectname/Gemfile.
27
27
 
28
28
  It includes application gems like:
29
29
 
30
- * [Airbrake](https://github.com/airbrake/airbrake) for exception notification
31
- * [Bourbon](https://github.com/thoughtbot/bourbon) for classy sass mixins
32
- * [Clearance](https://github.com/thoughtbot/clearance) for authentication
33
- * [Flutie](https://github.com/thoughtbot/flutie) for default CSS styles
34
- * [Formtastic](https://github.com/justinfrench/formtastic) for better forms
35
- * [Paperclip](https://github.com/thoughtbot/paperclip) for file uploads
30
+ * [Airbrake](/airbrake/airbrake) for exception notification
31
+ * [Bourbon](/thoughtbot/bourbon) for Sass mixins
32
+ * [Clearance](/thoughtbot/clearance) for authentication
33
+ * [Flutie](/thoughtbot/flutie) for default CSS styles
34
+ * [Formtastic](/justinfrench/formtastic) for form markup and style
35
+ * [Paperclip](/thoughtbot/paperclip) for file uploads
36
36
 
37
37
  And testing gems like:
38
38
 
39
- * [Bourne](https://github.com/thoughtbot/bourne) and Mocha for stubbing and spying
40
- * [Cucumber, Capybara, and Capybara Webkit](http://robots.thoughtbot.com/post/4583605733/capybara-webkit) for integration testing, including Javascript behavior
41
- * [Factory Girl](https://github.com/thoughtbot/factory_girl) for easier creation of test data
42
- * [RSpec](https://github.com/rspec/rspec) for awesome, readable isolation testing
43
- * [Shoulda Matchers](http://github.com/thoughtbot/shoulda-matchers) for frequently needed Rails and RSpec matchers
44
- * [Timecop](https://github.com/jtrupiano/timecop) for dealing with time
39
+ * [Bourne](/thoughtbot/bourne) and [Mocha](/freerange/mocha) for stubbing and
40
+ spying
41
+ * [Capybara](/jnicklas/capybara) and
42
+ [Capybara Webkit](/thoughtbot/capybara-webkit) for integration testing
43
+ * [Factory Girl](/thoughtbot/factory_girl) for test data
44
+ * [RSpec](https://github.com/rspec/rspec) for unit testing
45
+ * [Shoulda Matchers](/thoughtbot/shoulda-matchers) for common RSpec matchers
46
+ * [Timecop](/jtrupiano/timecop) for testing time
45
47
 
46
48
  Other goodies
47
49
  -------------
48
50
 
49
51
  Suspenders also comes with:
50
52
 
53
+ * Override recipient emails in staging environment.
51
54
  * Rails' flashes set up and in application layout.
52
- * A few nice time formats.
53
- * [Heroku-compliant asset pipeline settings](https://devcenter.heroku.com/articles/rails3x-asset-pipeline-cedar/).
55
+ * A few nice time formats set up for localization.
56
+ * [Heroku-recommended asset pipeline
57
+ settings](https://devcenter.heroku.com/articles/rails3x-asset-pipeline-cedar/).
54
58
 
55
59
  Heroku
56
60
  ------
@@ -96,19 +100,22 @@ Dependencies
96
100
  Some gems included in Suspenders have native extensions. You should have GCC installed on your
97
101
  machine before generating an app with Suspenders.
98
102
 
99
- If you're running OS X, we recommend the [GCC OSX installer](https://github.com/kennethreitz/osx-gcc-installer).
103
+ Use [OS X GCC Installer](/kennethreitz/osx-gcc-installer/) for Snow Leopard
104
+ (OS X 10.6).
100
105
 
101
- We use [Capybara Webkit](https://github.com/thoughtbot/capybara-webkit) for full-stack Javascript integration testing.
102
- It requires you have QT installed on your machine before running Suspenders.
106
+ Use [Command Line Tools for XCode](https://developer.apple.com/downloads/index.action)
107
+ for Lion (OS X 10.7) or Mountain Lion (OS X 10.8).
103
108
 
104
- Instructions for installing QT on most systems are [available here](https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit).
109
+ We use [Capybara Webkit](/thoughtbot/capybara-webkit) for full-stack Javascript
110
+ integration testing. It requires QT. Instructions for installing QT are
111
+ [here](/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit).
105
112
 
106
113
  PostgreSQL needs to be installed and running for the `db:create` rake task.
107
114
 
108
115
  Issues
109
116
  ------
110
117
 
111
- If you have problems, please create a [Github issue](https://github.com/thoughtbot/suspenders/issues).
118
+ If you have problems, please create a [Github Issue](/thoughtbot/suspenders/issues).
112
119
 
113
120
  Contributing
114
121
  ------------
@@ -127,4 +134,5 @@ The names and logos for thoughtbot are trademarks of thoughtbot, inc.
127
134
  License
128
135
  -------
129
136
 
130
- Suspenders is Copyright © 2008-2011 thoughtbot. It is free software, and may be redistributed under the terms specified in the LICENSE file.
137
+ Suspenders is Copyright © 2008-2012 thoughtbot. It is free software, and may be
138
+ redistributed under the terms specified in the LICENSE file.
@@ -8,7 +8,7 @@ Feature: Rake works in the suspended project
8
8
  And I run the rake task "db:create"
9
9
  And I run the rake task "db:migrate"
10
10
  And I run the rake task "db:test:prepare"
11
- And I run the rake task "cucumber"
11
+ And I run rake
12
12
  Then I see a successful response in the shell
13
13
 
14
14
  Scenario: Making a spec then running rake
@@ -1,5 +1,11 @@
1
1
  require 'aruba/cucumber'
2
2
 
3
+ When 'I run rake' do
4
+ in_current_dir do
5
+ run 'bundle exec rake'
6
+ end
7
+ end
8
+
3
9
  When 'I run the rake task "$task_name"' do |task_name|
4
10
  in_current_dir do
5
11
  run "bundle exec rake #{task_name}"
@@ -7,5 +7,5 @@ Feature: Skipping Capybara Webkit
7
7
  | --webkit | false |
8
8
  And I cd to the "test_project" root
9
9
  Then "capybara-webkit" should not be installed
10
- And "webkit" should not be included in "features/support/env.rb"
10
+ And "webkit" should not be included in "spec/spec_helper.rb"
11
11
  And I can cleanly rake the project
@@ -23,8 +23,16 @@ module Suspenders
23
23
  copy_file 'factory_girl_syntax_rspec.rb', 'spec/support/factory_girl.rb'
24
24
  end
25
25
 
26
+ def test_factories_first
27
+ copy_file 'factories_spec.rb', 'spec/models/factories_spec.rb'
28
+ append_file 'Rakefile', factories_spec_rake_task
29
+ end
30
+
26
31
  def setup_staging_environment
27
32
  run 'cp config/environments/production.rb config/environments/staging.rb'
33
+ inject_into_file 'config/environments/staging.rb',
34
+ "\n config.action_mailer.delivery_method = :override_recipient_smtp, to: 'staging@example.com'",
35
+ :after => 'config.action_mailer.raise_delivery_errors = false'
28
36
  end
29
37
 
30
38
  def initialize_on_precompile
@@ -69,8 +77,13 @@ module Suspenders
69
77
  bundle_command 'exec rake db:create'
70
78
  end
71
79
 
80
+ def set_ruby_to_version_being_used
81
+ inject_into_file 'Gemfile', "\n\nruby '#{RUBY_VERSION}'",
82
+ :after => /source 'https:\/\/rubygems.org'/
83
+ end
84
+
72
85
  def add_custom_gems
73
- additions_path = find_in_source_paths 'Gemfile_additions'
86
+ additions_path = find_in_source_paths('Gemfile_additions')
74
87
  new_gems = File.open(additions_path).read
75
88
  inject_into_file 'Gemfile', "\n#{new_gems}",
76
89
  :after => /gem 'jquery-rails'/
@@ -82,11 +95,18 @@ module Suspenders
82
95
  end
83
96
 
84
97
  def add_capybara_webkit_gem
85
- inject_into_file 'Gemfile', "\n gem 'capybara-webkit', '~> 0.11.0'",
86
- :after => /gem 'cucumber-rails', '1.3.0', :require => false/
98
+ inject_into_file 'Gemfile', "\n gem 'capybara-webkit'",
99
+ :after => /gem 'capybara'/
87
100
  end
88
101
 
89
102
  def configure_rspec
103
+ remove_file '.rspec'
104
+ copy_file 'rspec', '.rspec'
105
+ prepend_file 'spec/spec_helper.rb', simplecov_init
106
+ replace_in_file 'spec/spec_helper.rb',
107
+ '# config.mock_with :mocha',
108
+ 'config.mock_with :mocha'
109
+
90
110
  generators_config = <<-RUBY
91
111
  config.generators do |generate|
92
112
  generate.test_framework :rspec
@@ -96,6 +116,7 @@ module Suspenders
96
116
  generate.view_specs false
97
117
  end
98
118
  RUBY
119
+
99
120
  inject_into_class 'config/application.rb', 'Application', generators_config
100
121
  end
101
122
 
@@ -106,26 +127,37 @@ module Suspenders
106
127
  inject_into_class "config/application.rb", "Application", time_zone_config
107
128
  end
108
129
 
130
+ def configure_time_formats
131
+ remove_file 'config/locales/en.yml'
132
+ copy_file 'config_locales_en.yml', 'config/locales/en.yml'
133
+ end
134
+
109
135
  def configure_action_mailer
110
136
  action_mailer_host 'development', "#{app_name}.local"
111
- action_mailer_host 'test', 'example.com'
137
+ action_mailer_host 'test', 'www.example.com'
112
138
  action_mailer_host 'staging', "staging.#{app_name}.com"
113
139
  action_mailer_host 'production', "#{app_name}.com"
114
140
  end
115
141
 
116
142
  def generate_rspec
117
143
  generate 'rspec:install'
118
- inject_into_file '.rspec', " --drb", :after => '--color'
119
- replace_in_file 'spec/spec_helper.rb',
120
- '# config.mock_with :mocha', 'config.mock_with :mocha'
144
+ end
145
+
146
+ def configure_capybara_webkit
147
+ append_file 'spec/spec_helper.rb' do
148
+ "\n Capybara.javascript_driver = :webkit"
149
+ end
121
150
  end
122
151
 
123
152
  def generate_cucumber(options = {})
124
153
  generate 'cucumber:install', '--rspec', '--capybara'
125
154
  inject_into_file 'config/cucumber.yml',
126
- ' -drb -r features', :after => %{default: <%= std_opts %> features}
127
- copy_file 'features_support_env.rb', 'features/support/env.rb',
155
+ ' -drb -r features',
156
+ :after => %{default: <%= std_opts %> features}
157
+ copy_file 'features_support_env.rb',
158
+ 'features/support/env.rb',
128
159
  :force => true
160
+ prepend_file 'features/support/env.rb', simplecov_init
129
161
 
130
162
  if options[:webkit]
131
163
  inject_into_file 'features/support/env.rb',
@@ -140,11 +172,11 @@ module Suspenders
140
172
 
141
173
  def generate_clearance
142
174
  generate 'clearance:install'
143
- generate 'clearance:features'
144
175
  end
145
176
 
146
177
  def setup_stylesheets
147
- copy_file 'app/assets/stylesheets/application.css', 'app/assets/stylesheets/application.css.scss'
178
+ copy_file 'app/assets/stylesheets/application.css',
179
+ 'app/assets/stylesheets/application.css.scss'
148
180
  remove_file 'app/assets/stylesheets/application.css'
149
181
  concat_file 'import_scss_styles', 'app/assets/stylesheets/application.css.scss'
150
182
  create_file 'app/assets/stylesheets/_screen.scss'
@@ -152,7 +184,8 @@ module Suspenders
152
184
 
153
185
  def gitignore_files
154
186
  concat_file 'suspenders_gitignore', '.gitignore'
155
- ['app/models',
187
+ [
188
+ 'app/models',
156
189
  'app/assets/images',
157
190
  'app/views/pages',
158
191
  'db/migrate',
@@ -165,7 +198,8 @@ module Suspenders
165
198
  'spec/helpers',
166
199
  'spec/support/matchers',
167
200
  'spec/support/mixins',
168
- 'spec/support/shared_examples'].each do |dir|
201
+ 'spec/support/shared_examples'
202
+ ].each do |dir|
169
203
  empty_directory_with_gitkeep dir
170
204
  end
171
205
  end
@@ -177,7 +211,7 @@ module Suspenders
177
211
  def create_heroku_apps
178
212
  path_addition = override_path_for_tests
179
213
  run "#{path_addition} heroku create #{app_name}-production --remote=production"
180
- run "#{path_addition} heroku create #{app_name}-staging --remote=staging"
214
+ run "#{path_addition} heroku create #{app_name}-staging --remote=staging"
181
215
  end
182
216
 
183
217
  def create_github_repo(repo_name)
@@ -187,7 +221,6 @@ module Suspenders
187
221
 
188
222
  def copy_miscellaneous_files
189
223
  copy_file 'errors.rb', 'config/initializers/errors.rb'
190
- copy_file 'time_formats.rb', 'config/initializers/time_formats.rb'
191
224
  copy_file 'Procfile'
192
225
  end
193
226
 
@@ -211,7 +244,9 @@ module Suspenders
211
244
  end
212
245
 
213
246
  def remove_routes_comment_lines
214
- replace_in_file 'config/routes.rb', /Application\.routes\.draw do.*end/m, "Application.routes.draw do\nend"
247
+ replace_in_file 'config/routes.rb',
248
+ /Application\.routes\.draw do.*end/m,
249
+ "Application.routes.draw do\nend"
215
250
  end
216
251
 
217
252
  def set_attr_accessibles_on_user
@@ -230,7 +265,7 @@ module Suspenders
230
265
 
231
266
  def setup_default_rake_task
232
267
  append_file 'Rakefile' do
233
- "task(:default).clear\ntask :default => [:spec, :cucumber]"
268
+ "task(:default).clear\ntask :default => [:spec]"
234
269
  end
235
270
  end
236
271
 
@@ -242,5 +277,13 @@ module Suspenders
242
277
  "PATH=#{support_bin}:$PATH"
243
278
  end
244
279
  end
280
+
281
+ def factories_spec_rake_task
282
+ IO.read find_in_source_paths('factories_spec_rake_task.rb')
283
+ end
284
+
285
+ def simplecov_init
286
+ IO.read find_in_source_paths('simplecov_init.rb')
287
+ end
245
288
  end
246
289
  end
@@ -28,12 +28,13 @@ module Suspenders
28
28
 
29
29
  def suspenders_customization
30
30
  invoke :remove_files_we_dont_need
31
+ invoke :customize_gemfile
31
32
  invoke :setup_development_environment
33
+ invoke :setup_test_environment
32
34
  invoke :setup_staging_environment
33
35
  invoke :create_suspenders_views
34
36
  invoke :create_common_javascripts
35
37
  invoke :add_jquery_ui
36
- invoke :customize_gemfile
37
38
  invoke :setup_database
38
39
  invoke :configure_app
39
40
  invoke :setup_stylesheets
@@ -55,7 +56,20 @@ module Suspenders
55
56
  def setup_development_environment
56
57
  say 'Setting up the development environment'
57
58
  build :raise_delivery_errors
59
+ end
60
+
61
+ def setup_test_environment
62
+ say 'Setting up the test environment'
58
63
  build :enable_factory_girl_syntax
64
+ build :test_factories_first
65
+ build :generate_rspec
66
+ build :configure_rspec
67
+
68
+ if options[:webkit]
69
+ build :configure_capybara_webkit
70
+ end
71
+
72
+ build :setup_guard_spork
59
73
  end
60
74
 
61
75
  def setup_staging_environment
@@ -83,6 +97,7 @@ module Suspenders
83
97
  end
84
98
 
85
99
  def customize_gemfile
100
+ build :set_ruby_to_version_being_used
86
101
  build :add_custom_gems
87
102
 
88
103
  if options[:clearance]
@@ -93,7 +108,7 @@ module Suspenders
93
108
  build :add_capybara_webkit_gem
94
109
  end
95
110
 
96
- bundle_command 'install'
111
+ bundle_command 'install --binstubs=bin/stubs'
97
112
  end
98
113
 
99
114
  def setup_database
@@ -108,12 +123,10 @@ module Suspenders
108
123
 
109
124
  def configure_app
110
125
  say 'Configuring app'
111
- build :configure_rspec
112
126
  build :configure_action_mailer
113
- build :generate_rspec
114
127
  build :configure_time_zone
115
- build :generate_cucumber, :webkit => options[:webkit]
116
- build :setup_guard_spork
128
+ build :configure_time_formats
129
+
117
130
  build :add_email_validator
118
131
  build :setup_default_rake_task
119
132
  build :setup_clearance
@@ -1,3 +1,3 @@
1
1
  module Suspenders
2
- VERSION = '1.1.4'
2
+ VERSION = '1.1.5'
3
3
  end
@@ -13,18 +13,19 @@ end
13
13
  group :development, :test do
14
14
  gem 'guard'
15
15
  gem 'guard-spork'
16
- gem 'rspec-rails', '~> 2.9.0'
16
+ gem 'rspec-rails'
17
17
  gem 'sham_rack'
18
18
  end
19
19
 
20
20
  group :test do
21
- gem 'cucumber-rails', '1.3.0', :require => false
21
+ gem 'capybara'
22
22
  gem 'factory_girl_rails'
23
23
  gem 'bourne'
24
24
  gem 'database_cleaner'
25
25
  gem 'timecop'
26
26
  gem 'shoulda-matchers'
27
27
  gem 'launchy'
28
+ gem 'simplecov', require: false
28
29
  end
29
30
 
30
31
  group :staging, :production do
data/templates/Procfile CHANGED
@@ -1 +1 @@
1
- web: bundle exec thin start -p $PORT
1
+ web: bundle exec rails server thin -p $PORT
@@ -1,404 +1,9 @@
1
- Style Guide
2
- ===========
1
+ You look great in Suspenders
2
+ ============================
3
3
 
4
- A guide for programming in style.
4
+ Use the following guides for getting things done, programming well, and
5
+ programming in style.
5
6
 
6
- Laptop setup
7
- ------------
8
-
9
- Set up your laptop with [this script](https://github.com/thoughtbot/laptop)
10
- and [these dotfiles](https://github.com/thoughtbot/dotfiles).
11
-
12
- Project setup
13
- -------------
14
-
15
- Get the code.
16
-
17
- git clone git@github.com:organization/project.git
18
-
19
- Set up the project's dependencies.
20
-
21
- cd project
22
- bundle --binstubs
23
- rake db:create
24
- rake db:schema:load
25
- rake db:seed
26
-
27
- Add Heroku remotes for staging and production environments.
28
-
29
- git remote add staging git@heroku.com:<app>-staging.git
30
- git remote add production git@heroku.com:<app>-production.git
31
-
32
- Use [Heroku config](https://github.com/ddollar/heroku-config) to get `ENV`
33
- variables.
34
-
35
- heroku config:pull --app <app>-staging
36
-
37
- Delete extra lines in `.env`, leaving only those needed for app to function
38
- properly.
39
-
40
- BRAINTREE_MERCHANT_ID
41
- BRAINTREE_PRIVATE_KEY
42
- BRAINTREE_PUBLIC_KEY
43
- S3_KEY
44
- S3_SECRET
45
-
46
- Use [Foreman](http://goo.gl/oy4uw) to run the app locally.
47
-
48
- foreman start
49
-
50
- It uses your `.env` file and `Procfile` to run processes just like Heroku's
51
- [Cedar](https://devcenter.heroku.com/articles/cedar/) stack.
52
-
53
- Development
54
- -----------
55
-
56
- Create a local feature branch based off master.
57
-
58
- git checkout master
59
- git pull --rebase
60
- git checkout -b feature-xyz
61
-
62
- Rebase frequently to incorporate upstream changes.
63
-
64
- git fetch origin
65
- git rebase origin/master
66
- <resolve conflicts>
67
-
68
- When feature is complete and tests pass, commit the changes.
69
-
70
- rake
71
- git add -A
72
- git status
73
- git commit -v
74
-
75
- Write a [good commit message](http://goo.gl/w11us).
76
-
77
- Present-tense summary under 50 characters
78
-
79
- * More information about commit (under 72 characters).
80
- * More information about commit (under 72 characters).
81
-
82
- Share your branch.
83
-
84
- git push origin [branch]
85
-
86
- Submit a [Github pull request](http://goo.gl/Kmdee).
87
-
88
- Ask for a code review in [Campfire](http://campfirenow.com).
89
-
90
- Code review
91
- -----------
92
-
93
- A team member other than the author reviews the pull request.
94
-
95
- They make comments and ask questions directly on lines of code in the Github
96
- web interface or in Campfire.
97
-
98
- For changes which they can make themselves, they check out the branch.
99
-
100
- git checkout <branch>
101
- rake db:migrate
102
- rake
103
- git diff staging..HEAD
104
-
105
- They make small changes right in the branch, test the feature in browser,
106
- run tests, commit, and push.
107
-
108
- When satisfied, they comment on the pull request `Ready to squash and merge.`
109
-
110
- Deploy
111
- ------
112
-
113
- If there are multiple commits in the branch, squash them.
114
-
115
- git rebase -i staging/master
116
- rake
117
-
118
- View a list of new commits. View changed files. Merge branch into staging.
119
-
120
- git checkout staging
121
- git fetch staging
122
- git reset --hard staging/master
123
- git log staging..[branch]
124
- git diff --stat [branch]
125
- git merge [branch] --ff-only
126
-
127
- Deploy to [Heroku](https://devcenter.heroku.com/articles/quickstart).
128
-
129
- git push staging
130
-
131
- Run migrations (if necessary).
132
-
133
- heroku run rake db:migrate --app <app>
134
-
135
- Restart the dynos if migrations were run.
136
-
137
- heroku restart --app <app>
138
-
139
- [Introspect](http://goo.gl/tTgVF) to make sure everything's ok.
140
-
141
- watch heroku ps --app <app>
142
-
143
- Test the feature in browser.
144
-
145
- Delete your remote feature branch.
146
-
147
- git push origin :[branch]
148
-
149
- Delete your local feature branch.
150
-
151
- git branch -d [branch]
152
-
153
- Close pull request and comment `Merged.`
154
-
155
- Deploy to production.
156
-
157
- git checkout production
158
- git fetch production
159
- git reset --hard production/master
160
- git log production..staging
161
- git diff --stat staging/master
162
- git merge staging --ff-only
163
- git push production
164
- heroku run rake db:migrate --app <app>
165
- heroku restart --app <app>
166
- watch heroku ps --app <app>
167
-
168
- Watch logs and metrics dashboards. If the feature is working, merge into master.
169
-
170
- git checkout master
171
- git fetch origin
172
- git log production..master
173
- git merge production --ff-only
174
- git push origin master
175
-
176
- Use scripts from [thoughtbot/dotfiles](http://github.com/thoughtbot/dotfiles)
177
- to quickly access the Heroku console, backup the production database, and
178
- transfer production data to staging.
179
-
180
- Formatting
181
- ----------
182
-
183
- * Delete trailing whitespace.
184
- * Don't include spaces after `(`, `[` or before `]`, `)`.
185
- * Don't vertically align tokens on consecutive lines.
186
- * Include spaces around infix method invocations like `+` and `-`.
187
- * Indent continued lines two spaces.
188
- * Indent private methods equal to public methods.
189
- * Limit lines to a maximum of 80 characters.
190
- * Use 2 space indentation (no tabs) unless otherwise noted.
191
- * Use an empty line between methods, blocks and conditionals.
192
- * Use spaces around operators, after commas, colons and semicolons, around `{`
193
- and before `}`.
194
-
195
- Naming
196
- ------
197
-
198
- * Avoid abbreviations.
199
- * Avoid Hungarian notiation (`szName`).
200
- * Avoid types in names (`user_array`).
201
- * Name background jobs with a `Job` suffix.
202
- * Name the enumeration parameter the singular of the collection.
203
- * Name variables, methods, and classes to reveal intent.
204
- * Treat acronyms as words in names (`XmlHttpRequest` not `XMLHTTPRequest`),
205
- even if the acronym is the entire name (`class Html` not `class HTML`).
206
-
207
- Design
208
- ------
209
-
210
- * Aggressively remove duplication during development.
211
- * Avoid comments.
212
- * Avoid global variables.
213
- * Avoid long parameter lists.
214
- * Be consistent.
215
- * Don't duplicate the functionality of a built-in library.
216
- * Don't swallow exceptions or "fail silently."
217
- * Don't write code that guesses at future functionality.
218
- * [Exceptions should be exceptional](http://rdd.me/yichhgvu).
219
- * [Keep the code simple](http://rdd.me/ko2aqda2).
220
- * Limit the number of collaborators of an object.
221
- * Prefer composition over inheritance.
222
- * Prefer small methods. One line is best.
223
- * Prefer small objects with a single, well-defined responsibility.
224
- * [Tell, don't ask](http://goo.gl/Ztawt).
225
-
226
- Javascript
227
- ----------
228
-
229
- * Define functions that operate on `window` or DOM in scope of `window`.
230
- * Initialize arrays using `[]`.
231
- * Initialize empty objects and hashes using `{}`.
232
- * Use `CamelCase` for prototypes, `mixedCase` for variables and functions,
233
- `SCREAMING_SNAKE_CASE` for constants, `_single_leading_underscore` for
234
- private variables and functions.
235
- * Use `data-` attributes to bind event handlers.
236
- * Use the [module pattern](http://goo.gl/JDtHN) to control method visibility.
237
-
238
- Ruby
239
- ----
240
-
241
- * Avoid conditional modifiers (lines that end with conditionals).
242
- * Avoid hashes as optional parameters. Does the method do too much?
243
- * Avoid including code and gems in source control that are specific to your
244
- development machine or process. Examples: `.rvmrc`, `.swp`
245
- * Avoid meta-programming.
246
- * Avoid monkey-patching core classes.
247
- * Avoid ternary operators (`boolean ? true : false`). Use multi-line `if`
248
- instead to emphasize code branches.
249
- * Define the project's [Ruby version in the
250
- Gemfile](http://gembundler.com/man/gemfile.5.html#RUBY-ruby-).
251
- * Prefer classes to modules when designing functionality that is shared by
252
- multiple models.
253
- * Prefer `detect`, not `find`, and `select`, not `find_all`, to avoid confusion
254
- with ActiveRecord and keep `select`/`reject` symmetry.
255
- * Prefer `map`, not `collect`, and `reduce`, not `inject`, due to symmetry and
256
- familarity with mapping and reducing in other technologies.
257
- * Use `_` for unused block parameters: `hash.map { |_, v| v + 1 }`
258
- * Use `%{}` for single-line strings needing interpolation and double-quotes.
259
- * Use `%w()`, not `['', '']`, for an array of words.
260
- * Use `&&` and `||` for boolean expressions.
261
- * Use `||=` freely.
262
- * Use `{...}`, not `do..end`, for single-line blocks.
263
- * Use `!` suffix for dangerous methods (modifies `self`).
264
- * Use `?` suffix for predicate methods (return a boolean).
265
- * Use `CamelCase` for classes and modules, `snake_case` for variables and
266
- methods, `SCREAMING_SNAKE_CASE` for constants.
267
- * Use `def` with parentheses when there are arguments.
268
- * Use `do..end`, not `{...}`, for multi-line blocks.
269
- * Use `each`, not `for`, for iteration.
270
- * Use heredocs for multi-line strings.
271
- * Use `/(?:first|second)/`, not `/(first|second)/`, when you don't need the
272
- captured group.
273
- * Use `private`, not `protected`, to indicate scope.
274
- * Use `def self.method`, not `def Class.method` or `class << self`.
275
- * Use `Set`, not `Array`, for arrays with unique elements. The lookup is faster.
276
- * Use single-quotes for strings unless interpolating.
277
-
278
- Rails
279
- -----
280
-
281
- * Avoid the `:except` option in routes.
282
- * Avoid `member` and `collection` routes.
283
- * Avoid Single Table Inheritance.
284
- * Don't change a migration after it has been committed unless it cannot be
285
- solved with another migration.
286
- * Don't invoke a model's class directly from a view.
287
- * Don't use SQL or SQL fragments (`where('inviter_id is not null')`) outside of
288
- models.
289
- * Keep the `db/schema.rb` under version control.
290
- * Limit the number of instance variables shared between controller and view.
291
- * Name initializers for their gem name. Example: `paperclip.rb`
292
- * Order controller contents: filters, public methods, private methods.
293
- * Order model contents: constants, attributes, associations, nested attributes,
294
- named scopes, validations, callbacks, public methods, private methods.
295
- * Prefer [decorators](http://goo.gl/yeF3X), not view helpers.
296
- * Put all copy text in models, views, controllers, and mailers in
297
- `config/locales`.
298
- * Set `config.assets.initialize_on_precompile = false` in
299
- `config/application.rb`.
300
- * Set default values in the database.
301
- * Use `_path`, not `_url`, for named routes everywhere except mailer views.
302
- * Use `def self.method`, not the `named_scope :method` DSL.
303
- * Use `I18n.t 'dot.separated.key'`, not `I18n.t :key,
304
- :scope => [:dot, :separated]`.
305
- * Use `has_and_belongs_to_many` if all you need is a join table. Do not include
306
- an `id` or timestamps.
307
- * Use namespaced locale lookup in views by prefixing a period: `t '.title'`.
308
- * Use nested routes to express `belongs_to` relationships between resources.
309
- * Use SQL, not `ActiveRecord` models, in migrations.
310
- * Use the default `render 'partial'` syntax over `render partial: 'partial'`.
311
- * Use the `:only` option to explicitly state exposed routes.
312
-
313
- Database
314
- --------
315
-
316
- * Avoid multicolumn indexes in Postgres. It [combines multiple
317
- indexes](http://goo.gl/pY3Po) efficiently.
318
- * Create [indexes concurrently](https://gist.github.com/3186117) to avoid table
319
- locks and [reduced performance](http://goo.gl/fi5ER) during deploys.
320
- * Consider a [partial index](http://goo.gl/YC8Jt) for queries on booleans.
321
- * Constrain most columns as [`NOT NULL`](http://goo.gl/0GeBr).
322
- * Create a read-only [Heroku Follower](http://goo.gl/xWDMx) for your
323
- production database. If a Heroku database outage occurs, Heroku can use the
324
- follower to get your app back up and running faster.
325
- * Index all foreign keys.
326
- * Use a Heroku Follower database for analytics to limit reads on the primary
327
- database.
328
-
329
- Background Jobs
330
- ---------------
331
-
332
- * Define a `PRIORITY` constant at the top of the class.
333
- * Define two public methods: `self.enqueue` and `perform`.
334
- * Enqueue the job in `self.enqueue` [like this](http://goo.gl/C7e54).
335
- * Put background jobs in `app/jobs`.
336
- * Store IDs, not `ActiveRecord` objects for cleaner serialization, then re-find
337
- the `ActiveRecord` object in the `perform` method.
338
- * Subclass the job from `Struct.new(:something_id)`.
339
- * Use [`Delayed::Job`](http://goo.gl/sRYju) for background jobs.
340
-
341
- Email
342
- -----
343
-
344
- * Set `config.action_mailer.raise_delivery_errors = true` in the development
345
- environment.
346
- * Set `config.action_mailer.delivery_method = :test` in the test environment.
347
- * Use one `ActionMailer` for the app. Name it `Mailer`.
348
- * Use [SendGrid](http://goo.gl/Kxu9W) or [Amazon SES](http://goo.gl/A5jAA) to
349
- deliver email in staging and production environments.
350
- * Use [single recipient SMTP](http://goo.gl/FWdhG) in staging environment.
351
- * Use the user's name in the `From` header and email in the `Reply-To` when
352
- [delivering email on behalf of the app's users](http://goo.gl/5w1ck).
353
-
354
- Gems
355
- ----
356
-
357
- * Use [AssetSync](http://goo.gl/m58tF) to serve assets from S3.
358
- * Use [Bourbon](http://goo.gl/wpyee) for Sass mixins.
359
- * Use [Bourne](http://goo.gl/lE7zH) for stubs and spies.
360
- * Use [Braintree](http://goo.gl/mpWTp) for credit card processing.
361
- * Use [Clearance](http://goo.gl/svPGo) for authentication.
362
- * Use [Factory Girl](http://goo.gl/AB8bI) to set up test data.
363
- * Use [Geocoder](http://goo.gl/CKnYF) for geocoding.
364
- * Use [Haml](http://haml.info) for view templates.
365
- * Use [Money](http://goo.gl/2CNfc) for money objects.
366
- * Use [New Relic](http://goo.gl/F7Q56) for performance monitoring.
367
- * Use [Paperclip](http://goo.gl/eSESD) for file uploads.
368
- * Use [Thin](http://goo.gl/5Hlr) for serving web requests.
369
- * Use [WebMock](http://goo.gl/BC1Ac) to disable real HTTP requests.
370
-
371
- Testing
372
- -------
373
-
374
- * Avoid `its`, `let`, `let!`, `specify`, `subject`, and other DSLs. Prefer
375
- explicitness and consistency.
376
- * Disable real HTTP requests to external services with
377
- `WebMock.disable_net_connect!`.
378
- * Don't prefix `it` blocks with 'should'.
379
- * Name outer `describe` blocks after the method under test. Use `.method`
380
- for class methods and `#method` for instance methods.
381
- * Order factories.rb: sequences, traits, factory definitions.
382
- * Order factory definitions alphabetically by factory name.
383
- * Order factory attributes: implicit attributes, newline, explicit attributes,
384
- child factory definitions. Each section's attributes are alphabetical.
385
- * Prefix `context` blocks names with 'given' when receiving input. Prefix with
386
- 'when' in most other cases.
387
- * Run specs with `--format documentation`.
388
- * Test background jobs with a [`Delayed::Job` matcher](http://goo.gl/bzBlN).
389
- * Use a `context` block for each execution path through the method.
390
- * Use a [Fake](http://goo.gl/YR7Hh) to stub requests to external services.
391
- * Use a `before` block to define phases of [Four Phase
392
- Test](http://goo.gl/J9FiJ).
393
- * Use integration tests to execute the entire app.
394
- * Use non-[SUT](http://goo.gl/r5Ti2) methods in expectations when possible.
395
- * Use one expectation per `it` block.
396
- * Use [stubs and spies](http://goo.gl/EciDJ) (not mocks) in isolated tests.
397
-
398
- Browsers
399
- --------
400
-
401
- * Don't support clients without Javascript.
402
- * Don't support IE6.
403
-
404
- [Always be learning](http://learn.thoughtbot.com).
7
+ * [Protocol](http://github.com/thoughtbot/guides/blob/master/protocol)
8
+ * [Best Practices](http://github.com/thoughtbot/guides/blob/master/best-practices)
9
+ * [Style](http://github.com/thoughtbot/guides/blob/master/style)
@@ -0,0 +1,11 @@
1
+ en:
2
+ date:
3
+ formats:
4
+ default: '%m/%d/%Y'
5
+ with_weekday: '%a %m/%d/%y'
6
+
7
+ time:
8
+ formats:
9
+ default: '%a, %b %-d, %Y at %r'
10
+ date: '%b %-d, %Y'
11
+ short: '%B %d'
@@ -0,0 +1,9 @@
1
+ require 'spec_helper'
2
+
3
+ FactoryGirl.factories.map(&:name).each do |factory_name|
4
+ describe "the #{factory_name} factory" do
5
+ it 'is valid' do
6
+ build(factory_name).should be_valid
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+
2
+ if defined?(RSpec)
3
+ desc 'Run factory specs.'
4
+ RSpec::Core::RakeTask.new(:factory_specs) do |t|
5
+ t.pattern = './spec/models/factories_spec.rb'
6
+ end
7
+
8
+ task spec: :factory_specs
9
+ end
@@ -0,0 +1,38 @@
1
+ module Mail
2
+ # == Sending Email with Override Recipient SMTP
3
+ #
4
+ # Use the OverrideRecipientSMTP delivery method when you don't want your app
5
+ # to accidentally send emails to addresses other than the overridden recipient
6
+ # which you configure.
7
+ #
8
+ # An typical use case is in your app's staging environment, your development
9
+ # team will receive all staging emails without accidentally emailing users with
10
+ # active email addresses in the database.
11
+ #
12
+ # === Sending via OverrideRecipientSMTP
13
+ #
14
+ # config.action_mailer.delivery_method = :override_recipient_smtp,
15
+ # to: 'staging@example.com'
16
+ #
17
+ # === Sending to multiple email addresses
18
+ #
19
+ # config.action_mailer.delivery_method = :override_recipient_smtp,
20
+ # to: ['dan@example.com', 'harlow@example.com']
21
+ class OverrideRecipientSMTP < Mail::SMTP
22
+ def initialize(values)
23
+ unless values[:to]
24
+ raise ArgumentError.new('A :to option is required when using :override_recipient_smtp')
25
+ end
26
+
27
+ super(values)
28
+ end
29
+
30
+ def deliver!(mail)
31
+ mail.to = settings[:to]
32
+ mail.cc = nil
33
+ mail.bcc = nil
34
+
35
+ super(mail)
36
+ end
37
+ end
38
+ end
@@ -1,10 +1,11 @@
1
1
  development: &default
2
2
  adapter: postgresql
3
3
  database: <%= app_name %>_development
4
+ encoding: utf8
5
+ min_messages: warning
4
6
  pool: 5
5
7
  timeout: 5000
6
8
 
7
- test: &TEST
9
+ test:
8
10
  <<: *default
9
11
  database: <%= app_name %>_test
10
- min_messages: warning
data/templates/rspec ADDED
@@ -0,0 +1,3 @@
1
+ --colour
2
+ --drb
3
+ --profile
@@ -0,0 +1,3 @@
1
+ require 'simplecov'
2
+ SimpleCov.start 'rails'
3
+
@@ -1,8 +1,10 @@
1
- public/system
1
+ !.keep
2
2
  *.DS_Store
3
- coverage/*
4
3
  *.swp
4
+ .env
5
+ bin/stubs
6
+ coverage/*
7
+ public/system
5
8
  rerun.txt
6
9
  tags
7
- !.keep
8
10
  vendor/bundler_gems
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: suspenders
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.1.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-04 00:00:00.000000000 Z
12
+ date: 2012-10-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -137,16 +137,20 @@ files:
137
137
  - templates/README.md.erb
138
138
  - templates/_flashes.html.erb
139
139
  - templates/_javascript.html.erb
140
+ - templates/config_locales_en.yml
140
141
  - templates/email_validator.rb
141
142
  - templates/errors.rb
143
+ - templates/factories_spec.rb
144
+ - templates/factories_spec_rake_task.rb
142
145
  - templates/factory_girl_syntax_rspec.rb
143
- - templates/features_support_env.rb
144
146
  - templates/import_scss_styles
145
147
  - templates/javascripts/prefilled_input.js
148
+ - templates/override_recipient_smtp.rb
146
149
  - templates/postgresql_database.yml.erb
150
+ - templates/rspec
151
+ - templates/simplecov_init.rb
147
152
  - templates/suspenders_gitignore
148
153
  - templates/suspenders_layout.html.erb.erb
149
- - templates/time_formats.rb
150
154
  homepage: http://github.com/thoughtbot/suspenders
151
155
  licenses: []
152
156
  post_install_message:
@@ -160,12 +164,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
160
164
  - - ! '>='
161
165
  - !ruby/object:Gem::Version
162
166
  version: '0'
167
+ segments:
168
+ - 0
169
+ hash: -3447770025967369151
163
170
  required_rubygems_version: !ruby/object:Gem::Requirement
164
171
  none: false
165
172
  requirements:
166
173
  - - ! '>='
167
174
  - !ruby/object:Gem::Version
168
175
  version: '0'
176
+ segments:
177
+ - 0
178
+ hash: -3447770025967369151
169
179
  requirements: []
170
180
  rubyforge_project:
171
181
  rubygems_version: 1.8.24
@@ -1,16 +0,0 @@
1
- require 'spork'
2
-
3
- Spork.prefork do
4
- ENV['RAILS_ENV'] ||= 'test'
5
- require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
6
- require 'cucumber/rails'
7
-
8
- Capybara.default_selector = :css
9
- DatabaseCleaner.strategy = :truncation
10
- end
11
-
12
- Spork.each_run do
13
- After do
14
- DatabaseCleaner.clean
15
- end
16
- end
@@ -1,6 +0,0 @@
1
- # {
2
- # :short_date => "%x", # 04/13/10
3
- # :long_date => "%a, %b %d, %Y" # Tue, Apr 13, 2010
4
- # }.each do |format_name, format_string|
5
- # Time::DATE_FORMATS[format_name] = format_string
6
- # end