suspenders 1.1.5 → 1.2.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.
data/Gemfile.lock CHANGED
@@ -1,39 +1,39 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- suspenders (1.1.5)
4
+ suspenders (1.2.0)
5
5
  bundler (>= 1.1)
6
6
  hub (~> 1.10.2)
7
- rails (= 3.2.8)
7
+ rails (= 3.2.12)
8
8
 
9
9
  GEM
10
10
  remote: http://rubygems.org/
11
11
  specs:
12
- actionmailer (3.2.8)
13
- actionpack (= 3.2.8)
12
+ actionmailer (3.2.12)
13
+ actionpack (= 3.2.12)
14
14
  mail (~> 2.4.4)
15
- actionpack (3.2.8)
16
- activemodel (= 3.2.8)
17
- activesupport (= 3.2.8)
15
+ actionpack (3.2.12)
16
+ activemodel (= 3.2.12)
17
+ activesupport (= 3.2.12)
18
18
  builder (~> 3.0.0)
19
19
  erubis (~> 2.7.0)
20
20
  journey (~> 1.0.4)
21
- rack (~> 1.4.0)
21
+ rack (~> 1.4.5)
22
22
  rack-cache (~> 1.2)
23
23
  rack-test (~> 0.6.1)
24
- sprockets (~> 2.1.3)
25
- activemodel (3.2.8)
26
- activesupport (= 3.2.8)
24
+ sprockets (~> 2.2.1)
25
+ activemodel (3.2.12)
26
+ activesupport (= 3.2.12)
27
27
  builder (~> 3.0.0)
28
- activerecord (3.2.8)
29
- activemodel (= 3.2.8)
30
- activesupport (= 3.2.8)
28
+ activerecord (3.2.12)
29
+ activemodel (= 3.2.12)
30
+ activesupport (= 3.2.12)
31
31
  arel (~> 3.0.2)
32
32
  tzinfo (~> 0.3.29)
33
- activeresource (3.2.8)
34
- activemodel (= 3.2.8)
35
- activesupport (= 3.2.8)
36
- activesupport (3.2.8)
33
+ activeresource (3.2.12)
34
+ activemodel (= 3.2.12)
35
+ activesupport (= 3.2.12)
36
+ activesupport (3.2.12)
37
37
  i18n (~> 0.6)
38
38
  multi_json (~> 1.0)
39
39
  arel (3.0.2)
@@ -42,9 +42,9 @@ GEM
42
42
  cucumber (>= 1.1.1)
43
43
  ffi (>= 1.0.11)
44
44
  rspec (>= 2.7.0)
45
- builder (3.0.0)
46
- childprocess (0.3.1)
47
- ffi (~> 1.0.6)
45
+ builder (3.0.4)
46
+ childprocess (0.3.6)
47
+ ffi (~> 1.0, >= 1.0.6)
48
48
  cucumber (1.1.9)
49
49
  builder (>= 2.1.2)
50
50
  diff-lcs (>= 1.1.2)
@@ -53,65 +53,66 @@ GEM
53
53
  term-ansicolor (>= 1.0.6)
54
54
  diff-lcs (1.1.3)
55
55
  erubis (2.7.0)
56
- ffi (1.0.11)
56
+ ffi (1.3.1)
57
57
  gherkin (2.9.3)
58
58
  json (>= 1.4.6)
59
59
  hike (1.2.1)
60
- hub (1.10.2)
60
+ hub (1.10.4)
61
61
  i18n (0.6.1)
62
62
  journey (1.0.4)
63
- json (1.6.6)
63
+ json (1.7.6)
64
64
  mail (2.4.4)
65
65
  i18n (>= 0.4.0)
66
66
  mime-types (~> 1.16)
67
67
  treetop (~> 1.4.8)
68
- mime-types (1.19)
69
- multi_json (1.3.6)
68
+ mime-types (1.21)
69
+ multi_json (1.6.0)
70
70
  polyglot (0.3.3)
71
- rack (1.4.1)
71
+ rack (1.4.5)
72
72
  rack-cache (1.2)
73
73
  rack (>= 0.4)
74
- rack-ssl (1.3.2)
74
+ rack-ssl (1.3.3)
75
75
  rack
76
76
  rack-test (0.6.2)
77
77
  rack (>= 1.0)
78
- rails (3.2.8)
79
- actionmailer (= 3.2.8)
80
- actionpack (= 3.2.8)
81
- activerecord (= 3.2.8)
82
- activeresource (= 3.2.8)
83
- activesupport (= 3.2.8)
78
+ rails (3.2.12)
79
+ actionmailer (= 3.2.12)
80
+ actionpack (= 3.2.12)
81
+ activerecord (= 3.2.12)
82
+ activeresource (= 3.2.12)
83
+ activesupport (= 3.2.12)
84
84
  bundler (~> 1.0)
85
- railties (= 3.2.8)
86
- railties (3.2.8)
87
- actionpack (= 3.2.8)
88
- activesupport (= 3.2.8)
85
+ railties (= 3.2.12)
86
+ railties (3.2.12)
87
+ actionpack (= 3.2.12)
88
+ activesupport (= 3.2.12)
89
89
  rack-ssl (~> 1.3.2)
90
90
  rake (>= 0.8.7)
91
91
  rdoc (~> 3.4)
92
92
  thor (>= 0.14.6, < 2.0)
93
- rake (0.9.2.2)
94
- rdoc (3.12)
93
+ rake (10.0.3)
94
+ rdoc (3.12.1)
95
95
  json (~> 1.4)
96
- rspec (2.9.0)
97
- rspec-core (~> 2.9.0)
98
- rspec-expectations (~> 2.9.0)
99
- rspec-mocks (~> 2.9.0)
100
- rspec-core (2.9.0)
101
- rspec-expectations (2.9.0)
96
+ rspec (2.12.0)
97
+ rspec-core (~> 2.12.0)
98
+ rspec-expectations (~> 2.12.0)
99
+ rspec-mocks (~> 2.12.0)
100
+ rspec-core (2.12.2)
101
+ rspec-expectations (2.12.1)
102
102
  diff-lcs (~> 1.1.3)
103
- rspec-mocks (2.9.0)
104
- sprockets (2.1.3)
103
+ rspec-mocks (2.12.1)
104
+ sprockets (2.2.2)
105
105
  hike (~> 1.2)
106
+ multi_json (~> 1.0)
106
107
  rack (~> 1.0)
107
108
  tilt (~> 1.1, != 1.3.0)
108
109
  term-ansicolor (1.0.7)
109
- thor (0.16.0)
110
+ thor (0.17.0)
110
111
  tilt (1.3.3)
111
- treetop (1.4.11)
112
+ treetop (1.4.12)
112
113
  polyglot
113
114
  polyglot (>= 0.3.1)
114
- tzinfo (0.3.33)
115
+ tzinfo (0.3.35)
115
116
 
116
117
  PLATFORMS
117
118
  ruby
data/NEWS.md CHANGED
@@ -1,3 +1,16 @@
1
+ 1.2.0 (February 13, 2013)
2
+
3
+ * Upgrade Rails from 3.2.8 to 3.2.12 to keep pace with security patches.
4
+ * Improve staging environment on Heroku with staging `ENV` variables and
5
+ overriding the recipient in staging email delivery.
6
+ * Remove Flutie, use Bourbon.
7
+ * Wrap all HTTP requests in a 5 second timeout.
8
+ * Don't use `attr_accessible` whitelists. Instead, configure Strong Parameters.
9
+ * Provide a `bin/setup` script.
10
+ * Force RSpec's `expect` syntax.
11
+ * Remove remaining references to Cucumber, complete RSpec + Capybara conversion.
12
+ * Improve Foreman/`.env`/`Procfile` interactions.
13
+
1
14
  1.1.5 (October 22, 2012)
2
15
 
3
16
  * Ignore `.env`.
@@ -12,7 +25,7 @@
12
25
  * Use SimpleCov for C0 coverage.
13
26
  * Configure RSpec with `--profile` flag to find slow-running specs.
14
27
 
15
- 1.1.4 (eptember 4, 2012)
28
+ 1.1.4 (September 4, 2012)
16
29
 
17
30
  * Always store UTC in the DB.
18
31
  * Use Rails 3.2.8.
data/README.md CHANGED
@@ -15,35 +15,34 @@ Then run:
15
15
 
16
16
  suspenders projectname
17
17
 
18
- This will create a Rails 3.2 app in `projectname`. This script creates a new
18
+ This will create a Rails 3.2 app in `projectname`. This script creates a
19
19
  new git repository. It is not meant to be used against an existing repo.
20
20
 
21
21
  Gemfile
22
22
  -------
23
23
 
24
24
  To see the latest and greatest gems, look at Suspenders'
25
- [template/Gemfile_additions](/thoughtbot/suspenders/blob/master/templates/Gemfile_additions),
25
+ [templates/Gemfile_clean](templates/Gemfile_clean),
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](/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
30
+ * [Airbrake](https://github.com/airbrake/airbrake) for exception notification
31
+ * [Bourbon](https://github.com/thoughtbot/bourbon) for Sass mixins
32
+ * [Simple Form](https://github.com/plataformatec/simple_form) for form markup and style
36
33
 
37
34
  And testing gems like:
38
35
 
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
36
+ * [Bourne](https://github.com/thoughtbot/bourne) and
37
+ [Mocha](https://github.com/freerange/mocha) for stubbing and spying
38
+ * [Capybara](https://github.com/jnicklas/capybara) and
39
+ [Capybara Webkit](https://github.com/thoughtbot/capybara-webkit) for
40
+ integration testing
41
+ * [Factory Girl](https://github.com/thoughtbot/factory_girl) for test data
44
42
  * [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
43
+ * [Shoulda Matchers](https://github.com/thoughtbot/shoulda-matchers) for common
44
+ RSpec matchers
45
+ * [Timecop](https://github.com/jtrupiano/timecop-console) for testing time
47
46
 
48
47
  Other goodies
49
48
  -------------
@@ -79,43 +78,30 @@ This has the same effect as running:
79
78
 
80
79
  hub create organization/project
81
80
 
82
- Clearance
83
- ---------
84
-
85
- You can optionally not include Clearance:
86
-
87
- suspenders app --clearance false
88
-
89
- Capybara Webkit
90
- ---------------
91
-
92
- You can optionally not include Capybara Webkit (which depends on QT being
93
- installed on your machine):
94
-
95
- suspenders app --webkit false
96
-
97
81
  Dependencies
98
82
  ------------
99
83
 
100
- Some gems included in Suspenders have native extensions. You should have GCC installed on your
101
- machine before generating an app with Suspenders.
84
+ Some gems included in Suspenders have native extensions. You should have GCC
85
+ installed on your machine before generating an app with Suspenders.
102
86
 
103
- Use [OS X GCC Installer](/kennethreitz/osx-gcc-installer/) for Snow Leopard
104
- (OS X 10.6).
87
+ Use [OS X GCC Installer](https://github.com/kennethreitz/osx-gcc-installer/) for
88
+ Snow Leopard (OS X 10.6).
105
89
 
106
90
  Use [Command Line Tools for XCode](https://developer.apple.com/downloads/index.action)
107
91
  for Lion (OS X 10.7) or Mountain Lion (OS X 10.8).
108
92
 
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).
93
+ We use [Capybara Webkit](https://github.com/thoughtbot/capybara-webkit) for
94
+ full-stack Javascript integration testing. It requires QT. Instructions for
95
+ installing QT are
96
+ [here](https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit).
112
97
 
113
98
  PostgreSQL needs to be installed and running for the `db:create` rake task.
114
99
 
115
100
  Issues
116
101
  ------
117
102
 
118
- If you have problems, please create a [Github Issue](/thoughtbot/suspenders/issues).
103
+ If you have problems, please create a
104
+ [Github Issue](https://github.com/thoughtbot/suspenders/issues).
119
105
 
120
106
  Contributing
121
107
  ------------
@@ -127,12 +113,13 @@ Credits
127
113
 
128
114
  ![thoughtbot](http://thoughtbot.com/images/tm/logo.png)
129
115
 
130
- Suspenders is maintained and funded by [thoughtbot, inc](http://thoughtbot.com/community)
116
+ Suspenders is maintained and funded by
117
+ [thoughtbot, inc](http://thoughtbot.com/community).
131
118
 
132
119
  The names and logos for thoughtbot are trademarks of thoughtbot, inc.
133
120
 
134
121
  License
135
122
  -------
136
123
 
137
- Suspenders is Copyright © 2008-2012 thoughtbot. It is free software, and may be
124
+ Suspenders is Copyright © 2008-2013 thoughtbot. It is free software, and may be
138
125
  redistributed under the terms specified in the LICENSE file.
@@ -1,21 +1,15 @@
1
1
  @disable-bundler
2
2
  Feature: Rake works in the suspended project
3
+ Background:
4
+ Given I ensure no databases exist for "test_project"
3
5
 
4
6
  Scenario: Running rake in the suspended project
5
7
  When I suspend a project called "test_project"
6
8
  And I cd to the "test_project" root
7
- When I drop and create the required databases
8
- And I run the rake task "db:create"
9
- And I run the rake task "db:migrate"
10
- And I run the rake task "db:test:prepare"
11
- And I run rake
12
- Then I see a successful response in the shell
9
+ Then I can cleanly rake the project
13
10
 
14
11
  Scenario: Making a spec then running rake
15
- When I drop and create the required databases
16
- And I suspend a project called "test_project"
12
+ When I suspend a project called "test_project"
13
+ And I cd to the "test_project" root
17
14
  And I generate "model post title:string"
18
- And I run the rake task "db:migrate"
19
- And I run the rake task "db:test:prepare"
20
- And I run the rake task "spec"
21
- Then I see a successful response in the shell
15
+ Then I can cleanly rake the project
@@ -2,39 +2,30 @@ require 'aruba/cucumber'
2
2
 
3
3
  When 'I run rake' do
4
4
  in_current_dir do
5
- run 'bundle exec rake'
5
+ run_simple 'bundle exec rake'
6
6
  end
7
7
  end
8
8
 
9
9
  When 'I run the rake task "$task_name"' do |task_name|
10
10
  in_current_dir do
11
- run "bundle exec rake #{task_name}"
11
+ run_simple "bundle exec rake #{task_name}"
12
12
  end
13
13
  end
14
14
 
15
15
  When 'I generate "$generator_with_args"' do |generator_with_args|
16
16
  in_current_dir do
17
- run "bundle exec rails generate #{generator_with_args}"
17
+ run_simple "bundle exec rails generate #{generator_with_args}"
18
18
  end
19
19
  end
20
20
 
21
- Then 'I see a successful response in the shell' do
22
- assert_exit_status(0)
23
- end
24
-
25
- When 'I drop and create the required databases' do
26
- in_current_dir do
27
- run 'bundle exec rake db:drop RAILS_ENV=test'
28
- run 'bundle exec rake db:drop'
29
- run 'bundle exec rake db:create RAILS_ENV=test'
30
- run 'bundle exec rake db:create'
31
- end
21
+ When 'I ensure no databases exist for "$project_name"' do |project_name|
22
+ run "dropdb #{project_name}_development"
23
+ run "dropdb #{project_name}_test"
32
24
  end
33
25
 
34
26
  When 'I suspend a project called "$project_name"' do |project_name|
35
27
  suspenders_bin = File.expand_path(File.join('..', '..', 'bin', 'suspenders'), File.dirname(__FILE__))
36
- run "#{suspenders_bin} #{project_name}"
37
- assert_exit_status(0)
28
+ run_simple "#{suspenders_bin} #{project_name}"
38
29
  end
39
30
 
40
31
  When /^I suspend a project called "([^"]*)" with:$/ do |project_name, arguments_table|
@@ -42,8 +33,7 @@ When /^I suspend a project called "([^"]*)" with:$/ do |project_name, arguments_
42
33
  arguments = arguments_table.hashes.inject([]) do |accum, argument|
43
34
  accum << "#{argument['argument']}=#{argument['value']}"
44
35
  end.join
45
- run "#{suspenders_bin} #{project_name} #{arguments}"
46
- assert_exit_status(0)
36
+ run_simple "#{suspenders_bin} #{project_name} #{arguments}"
47
37
  end
48
38
 
49
39
  When 'I cd to the "$test_project" root' do |dirname|
@@ -55,8 +45,7 @@ Then 'I can cleanly rake the project' do
55
45
  And I run the rake task "db:create"
56
46
  And I run the rake task "db:migrate"
57
47
  And I run the rake task "db:test:prepare"
58
- And I run the rake task "cucumber"
59
- Then I see a successful response in the shell
48
+ And I run rake
60
49
  }
61
50
  end
62
51
 
@@ -19,6 +19,11 @@ module Suspenders
19
19
  'raise_delivery_errors = false', 'raise_delivery_errors = true'
20
20
  end
21
21
 
22
+ def provide_setup_script
23
+ copy_file 'bin_setup', 'bin/setup'
24
+ run 'chmod a+x bin/setup'
25
+ end
26
+
22
27
  def enable_factory_girl_syntax
23
28
  copy_file 'factory_girl_syntax_rspec.rb', 'spec/support/factory_girl.rb'
24
29
  end
@@ -77,37 +82,41 @@ module Suspenders
77
82
  bundle_command 'exec rake db:create'
78
83
  end
79
84
 
80
- def set_ruby_to_version_being_used
81
- inject_into_file 'Gemfile', "\n\nruby '#{RUBY_VERSION}'",
82
- :after => /source 'https:\/\/rubygems.org'/
85
+ def replace_gemfile
86
+ remove_file 'Gemfile'
87
+ copy_file 'Gemfile_clean', 'Gemfile'
83
88
  end
84
89
 
85
- def add_custom_gems
86
- additions_path = find_in_source_paths('Gemfile_additions')
87
- new_gems = File.open(additions_path).read
88
- inject_into_file 'Gemfile', "\n#{new_gems}",
89
- :after => /gem 'jquery-rails'/
90
+ def set_ruby_to_version_being_used
91
+ inject_into_file 'Gemfile', "\n\nruby '#{RUBY_VERSION}'",
92
+ after: /source 'https:\/\/rubygems.org'/
90
93
  end
91
94
 
92
- def add_clearance_gem
93
- inject_into_file 'Gemfile', "\ngem 'clearance'",
94
- :after => /gem 'jquery-rails'/
95
- end
95
+ def enable_database_cleaner
96
+ replace_in_file 'spec/spec_helper.rb',
97
+ 'config.use_transactional_fixtures = true',
98
+ 'config.use_transactional_fixtures = false'
96
99
 
97
- def add_capybara_webkit_gem
98
- inject_into_file 'Gemfile', "\n gem 'capybara-webkit'",
99
- :after => /gem 'capybara'/
100
+ copy_file 'database_cleaner_rspec.rb', 'spec/support/database_cleaner.rb'
100
101
  end
101
102
 
102
103
  def configure_rspec
103
104
  remove_file '.rspec'
104
105
  copy_file 'rspec', '.rspec'
105
106
  prepend_file 'spec/spec_helper.rb', simplecov_init
107
+
106
108
  replace_in_file 'spec/spec_helper.rb',
107
109
  '# config.mock_with :mocha',
108
110
  'config.mock_with :mocha'
109
111
 
110
- generators_config = <<-RUBY
112
+ rspec_expect_syntax = <<-RUBY
113
+
114
+ config.expect_with :rspec do |c|
115
+ c.syntax = :expect
116
+ end
117
+ RUBY
118
+
119
+ config = <<-RUBY
111
120
  config.generators do |generate|
112
121
  generate.test_framework :rspec
113
122
  generate.helper false
@@ -115,16 +124,32 @@ module Suspenders
115
124
  generate.javascript_engine false
116
125
  generate.view_specs false
117
126
  end
127
+
118
128
  RUBY
119
129
 
120
- inject_into_class 'config/application.rb', 'Application', generators_config
130
+ inject_into_file 'spec/spec_helper.rb', rspec_expect_syntax,
131
+ :after => 'RSpec.configure do |config|'
132
+ inject_into_class 'config/application.rb', 'Application', config
133
+ end
134
+
135
+ def blacklist_active_record_attributes
136
+ config = <<-RUBY
137
+ config.active_record.whitelist_attributes = false
138
+
139
+ RUBY
140
+ inject_into_class 'config/application.rb', 'Application', config
141
+ end
142
+
143
+ def configure_strong_parameters
144
+ copy_file 'strong_parameters.rb', 'config/initializers/strong_parameters.rb'
121
145
  end
122
146
 
123
147
  def configure_time_zone
124
- time_zone_config = <<-RUBY
125
- config.active_record.default_timezone = :utc
148
+ config = <<-RUBY
149
+ config.active_record.default_timezone = :utc
150
+
126
151
  RUBY
127
- inject_into_class "config/application.rb", "Application", time_zone_config
152
+ inject_into_class 'config/application.rb', 'Application', config
128
153
  end
129
154
 
130
155
  def configure_time_formats
@@ -132,6 +157,10 @@ module Suspenders
132
157
  copy_file 'config_locales_en.yml', 'config/locales/en.yml'
133
158
  end
134
159
 
160
+ def configure_rack_timeout
161
+ copy_file 'rack_timeout.rb', 'config/initializers/rack_timeout.rb'
162
+ end
163
+
135
164
  def configure_action_mailer
136
165
  action_mailer_host 'development', "#{app_name}.local"
137
166
  action_mailer_host 'test', 'www.example.com'
@@ -145,24 +174,7 @@ module Suspenders
145
174
 
146
175
  def configure_capybara_webkit
147
176
  append_file 'spec/spec_helper.rb' do
148
- "\n Capybara.javascript_driver = :webkit"
149
- end
150
- end
151
-
152
- def generate_cucumber(options = {})
153
- generate 'cucumber:install', '--rspec', '--capybara'
154
- inject_into_file 'config/cucumber.yml',
155
- ' -drb -r features',
156
- :after => %{default: <%= std_opts %> features}
157
- copy_file 'features_support_env.rb',
158
- 'features/support/env.rb',
159
- :force => true
160
- prepend_file 'features/support/env.rb', simplecov_init
161
-
162
- if options[:webkit]
163
- inject_into_file 'features/support/env.rb',
164
- "\n Capybara.javascript_driver = :webkit",
165
- :after => /Capybara.default_selector = :css/
177
+ "\nCapybara.javascript_driver = :webkit"
166
178
  end
167
179
  end
168
180
 
@@ -170,8 +182,9 @@ module Suspenders
170
182
  copy_file 'Guardfile', 'Guardfile'
171
183
  end
172
184
 
173
- def generate_clearance
174
- generate 'clearance:install'
185
+ def setup_foreman
186
+ copy_file 'sample.env', '.sample.env'
187
+ copy_file 'Procfile', 'Procfile'
175
188
  end
176
189
 
177
190
  def setup_stylesheets
@@ -212,6 +225,7 @@ module Suspenders
212
225
  path_addition = override_path_for_tests
213
226
  run "#{path_addition} heroku create #{app_name}-production --remote=production"
214
227
  run "#{path_addition} heroku create #{app_name}-staging --remote=staging"
228
+ run "#{path_addition} heroku config:add RACK_ENV=staging RAILS_ENV=staging --remote=staging"
215
229
  end
216
230
 
217
231
  def create_github_repo(repo_name)
@@ -219,9 +233,12 @@ module Suspenders
219
233
  run "#{path_addition} hub create #{repo_name}"
220
234
  end
221
235
 
236
+ def copy_libraries
237
+ copy_file 'override_recipient_smtp.rb', 'lib/override_recipient_smtp.rb'
238
+ end
239
+
222
240
  def copy_miscellaneous_files
223
241
  copy_file 'errors.rb', 'config/initializers/errors.rb'
224
- copy_file 'Procfile'
225
242
  end
226
243
 
227
244
  def customize_error_pages
@@ -232,6 +249,7 @@ module Suspenders
232
249
  style_tags =<<-EOS
233
250
  <link href='/assets/application.css' media='all' rel='stylesheet' type='text/css' />
234
251
  EOS
252
+
235
253
  %w(500 404 422).each do |page|
236
254
  inject_into_file "public/#{page}.html", meta_tags, :after => "<head>\n"
237
255
  replace_in_file "public/#{page}.html", /<style.+>.+<\/style>/mi, style_tags.strip
@@ -239,28 +257,18 @@ module Suspenders
239
257
  end
240
258
  end
241
259
 
242
- def setup_root_route
243
- route "root :to => 'Clearance::Sessions#new'"
244
- end
245
-
246
260
  def remove_routes_comment_lines
247
261
  replace_in_file 'config/routes.rb',
248
262
  /Application\.routes\.draw do.*end/m,
249
263
  "Application.routes.draw do\nend"
250
264
  end
251
265
 
252
- def set_attr_accessibles_on_user
253
- inject_into_file 'app/models/user.rb',
254
- " attr_accessible :email, :password\n",
255
- :after => /include Clearance::User\n/
256
- end
257
-
258
266
  def add_email_validator
259
267
  copy_file 'email_validator.rb', 'app/validators/email_validator.rb'
260
268
  end
261
269
 
262
- def include_clearance_matchers
263
- create_file 'spec/support/clearance.rb', "require 'clearance/testing'"
270
+ def disable_xml_params
271
+ copy_file 'disable_xml_params.rb', 'config/initializers/disable_xml_params.rb'
264
272
  end
265
273
 
266
274
  def setup_default_rake_task
@@ -3,9 +3,6 @@ require 'rails/generators/rails/app/app_generator'
3
3
 
4
4
  module Suspenders
5
5
  class AppGenerator < Rails::Generators::AppGenerator
6
- class_option :clearance, :type => :boolean, :aliases => '-C', :default => true,
7
- :desc => 'Add the Clearance Rails authentication library'
8
-
9
6
  class_option :database, :type => :string, :aliases => '-d', :default => 'postgresql',
10
7
  :desc => "Preconfigure for selected database (options: #{DATABASES.join('/')})"
11
8
 
@@ -18,9 +15,6 @@ module Suspenders
18
15
  class_option :skip_test_unit, :type => :boolean, :aliases => '-T', :default => true,
19
16
  :desc => 'Skip Test::Unit files'
20
17
 
21
- class_option :webkit, :type => :boolean, :aliases => '-W', :default => true,
22
- :desc => 'Add the Capybara Webkit Javascript integration testing library'
23
-
24
18
  def finish_template
25
19
  invoke :suspenders_customization
26
20
  super
@@ -38,10 +32,10 @@ module Suspenders
38
32
  invoke :setup_database
39
33
  invoke :configure_app
40
34
  invoke :setup_stylesheets
35
+ invoke :copy_libraries
41
36
  invoke :copy_miscellaneous_files
42
37
  invoke :customize_error_pages
43
38
  invoke :remove_routes_comment_lines
44
- invoke :setup_root_route
45
39
  invoke :setup_git
46
40
  invoke :create_heroku_apps
47
41
  invoke :create_github_repo
@@ -56,6 +50,7 @@ module Suspenders
56
50
  def setup_development_environment
57
51
  say 'Setting up the development environment'
58
52
  build :raise_delivery_errors
53
+ build :provide_setup_script
59
54
  end
60
55
 
61
56
  def setup_test_environment
@@ -64,11 +59,8 @@ module Suspenders
64
59
  build :test_factories_first
65
60
  build :generate_rspec
66
61
  build :configure_rspec
67
-
68
- if options[:webkit]
69
- build :configure_capybara_webkit
70
- end
71
-
62
+ build :enable_database_cleaner
63
+ build :configure_capybara_webkit
72
64
  build :setup_guard_spork
73
65
  end
74
66
 
@@ -97,17 +89,8 @@ module Suspenders
97
89
  end
98
90
 
99
91
  def customize_gemfile
92
+ build :replace_gemfile
100
93
  build :set_ruby_to_version_being_used
101
- build :add_custom_gems
102
-
103
- if options[:clearance]
104
- build :add_clearance_gem
105
- end
106
-
107
- if options[:webkit]
108
- build :add_capybara_webkit_gem
109
- end
110
-
111
94
  bundle_command 'install --binstubs=bin/stubs'
112
95
  end
113
96
 
@@ -124,23 +107,15 @@ module Suspenders
124
107
  def configure_app
125
108
  say 'Configuring app'
126
109
  build :configure_action_mailer
110
+ build :blacklist_active_record_attributes
111
+ build :configure_strong_parameters
127
112
  build :configure_time_zone
128
113
  build :configure_time_formats
129
-
114
+ build :configure_rack_timeout
115
+ build :disable_xml_params
130
116
  build :add_email_validator
131
117
  build :setup_default_rake_task
132
- build :setup_clearance
133
- end
134
-
135
- def setup_clearance
136
- if options[:clearance]
137
- build :generate_clearance
138
- build :include_clearance_matchers
139
-
140
- if using_active_record?
141
- build :set_attr_accessibles_on_user
142
- end
143
- end
118
+ build :setup_foreman
144
119
  end
145
120
 
146
121
  def setup_stylesheets
@@ -176,6 +151,11 @@ module Suspenders
176
151
  build :init_git
177
152
  end
178
153
 
154
+ def copy_libraries
155
+ say 'Copying libraries'
156
+ build :copy_libraries
157
+ end
158
+
179
159
  def copy_miscellaneous_files
180
160
  say 'Copying miscellaneous support files'
181
161
  build :copy_miscellaneous_files
@@ -190,13 +170,6 @@ module Suspenders
190
170
  build :remove_routes_comment_lines
191
171
  end
192
172
 
193
- def setup_root_route
194
- if options[:clearance]
195
- say 'Setting up a root route'
196
- build :setup_root_route
197
- end
198
- end
199
-
200
173
  def outro
201
174
  say 'Congratulations! You just pulled our suspenders.'
202
175
  say "Remember to run 'rails generate airbrake' with your API key."
@@ -1,3 +1,3 @@
1
1
  module Suspenders
2
- VERSION = '1.1.5'
2
+ VERSION = '1.2.0'
3
3
  end
data/suspenders.gemspec CHANGED
@@ -27,7 +27,7 @@ rush to build something amazing; don't use it if you like missing deadlines.
27
27
  s.rdoc_options = ["--charset=UTF-8"]
28
28
  s.extra_rdoc_files = %w[README.md LICENSE]
29
29
 
30
- s.add_dependency 'rails', '3.2.8'
30
+ s.add_dependency 'rails', '3.2.12'
31
31
  s.add_dependency 'bundler', '>= 1.1'
32
32
  s.add_dependency 'hub', '~> 1.10.2'
33
33
 
@@ -1,10 +1,22 @@
1
- gem 'thin'
2
- gem 'high_voltage'
3
- gem 'paperclip'
4
- gem 'formtastic'
5
- gem 'flutie'
6
- gem 'bourbon'
1
+ source 'https://rubygems.org'
2
+
7
3
  gem 'airbrake'
4
+ gem 'bourbon'
5
+ gem 'high_voltage'
6
+ gem 'jquery-rails'
7
+ gem 'pg'
8
+ gem 'psych'
9
+ gem 'rack-timeout'
10
+ gem 'rails', '>= 3.2.11'
11
+ gem 'simple_form'
12
+ gem 'strong_parameters'
13
+ gem 'thin'
14
+
15
+ group :assets do
16
+ gem 'sass-rails'
17
+ gem 'coffee-rails'
18
+ gem 'uglifier'
19
+ end
8
20
 
9
21
  group :development do
10
22
  gem 'foreman'
@@ -18,14 +30,14 @@ group :development, :test do
18
30
  end
19
31
 
20
32
  group :test do
21
- gem 'capybara'
22
- gem 'factory_girl_rails'
23
- gem 'bourne'
33
+ gem 'bourne', require: false
34
+ gem 'capybara-webkit', '>= 0.14.1'
24
35
  gem 'database_cleaner'
25
- gem 'timecop'
26
- gem 'shoulda-matchers'
36
+ gem 'factory_girl_rails'
27
37
  gem 'launchy'
38
+ gem 'shoulda-matchers'
28
39
  gem 'simplecov', require: false
40
+ gem 'timecop'
29
41
  end
30
42
 
31
43
  group :staging, :production do
data/templates/Procfile CHANGED
@@ -1 +1 @@
1
- web: bundle exec rails server thin -p $PORT
1
+ web: bundle exec rails server thin -p $PORT -e $RACK_ENV
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env sh
2
+
3
+ # Set up Rails app. Run this script immediately after cloning the codebase.
4
+ # https://github.com/thoughtbot/guides/tree/master/protocol
5
+
6
+ bundle install --binstubs=bin/stubs
7
+ bundle exec rake db:setup
8
+
9
+ if [ ! -f .env ]; then
10
+ cp .sample.env .env
11
+ fi
@@ -0,0 +1,21 @@
1
+ RSpec.configure do |config|
2
+ config.before(:suite) do
3
+ DatabaseCleaner.clean_with(:deletion)
4
+ end
5
+
6
+ config.before(:each) do
7
+ DatabaseCleaner.strategy = :transaction
8
+ end
9
+
10
+ config.before(:each, :js => true) do
11
+ DatabaseCleaner.strategy = :deletion
12
+ end
13
+
14
+ config.before(:each) do
15
+ DatabaseCleaner.start
16
+ end
17
+
18
+ config.after(:each) do
19
+ DatabaseCleaner.clean
20
+ end
21
+ end
@@ -0,0 +1,3 @@
1
+ # Protect against injection attacks
2
+ # http://www.kb.cert.org/vuls/id/380039
3
+ ActionDispatch::ParamsParser::DEFAULT_PARSERS.delete(Mime::XML)
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  FactoryGirl.factories.map(&:name).each do |factory_name|
4
4
  describe "the #{factory_name} factory" do
5
5
  it 'is valid' do
6
- build(factory_name).should be_valid
6
+ expect(build(factory_name)).to be_valid
7
7
  end
8
8
  end
9
9
  end
@@ -1,4 +1,3 @@
1
1
 
2
2
 
3
- @import 'flutie';
4
- @import 'bourbon';
3
+ @import 'bourbon';
@@ -0,0 +1 @@
1
+ Rack::Timeout.timeout = (ENV['TIMEOUT_IN_SECONDS'] || 5).to_i
@@ -0,0 +1,2 @@
1
+ # http://ddollar.github.com/foreman/
2
+ RACK_ENV=development
@@ -0,0 +1 @@
1
+ ActiveRecord::Base.send :include, ActiveModel::ForbiddenAttributesProtection
@@ -8,13 +8,6 @@
8
8
  <%%= csrf_meta_tags %>
9
9
  </head>
10
10
  <body class="<%%= body_class %>">
11
- <header>
12
- <%% if signed_in? -%>
13
- <%%= link_to "Sign out", sign_out_path, :method => :delete %>
14
- <%% else -%>
15
- <%%= link_to "Sign in", sign_in_path %>
16
- <%% end -%>
17
- </header>
18
11
  <%%= render 'flashes' -%>
19
12
  <%%= yield %>
20
13
  <%%= render 'javascript' %>
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.5
4
+ version: 1.2.0
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-10-22 00:00:00.000000000 Z
12
+ date: 2013-02-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 3.2.8
21
+ version: 3.2.12
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - '='
28
28
  - !ruby/object:Gem::Version
29
- version: 3.2.8
29
+ version: 3.2.12
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: bundler
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -115,7 +115,6 @@ files:
115
115
  - README.md
116
116
  - Rakefile
117
117
  - bin/suspenders
118
- - features/clearance_false.feature
119
118
  - features/github_repo.feature
120
119
  - features/heroku_true.feature
121
120
  - features/rake_clean.feature
@@ -125,19 +124,21 @@ files:
125
124
  - features/support/env.rb
126
125
  - features/support/fake_github.rb
127
126
  - features/support/fake_heroku.rb
128
- - features/webkit_false.feature
129
127
  - lib/suspenders/actions.rb
130
128
  - lib/suspenders/app_builder.rb
131
129
  - lib/suspenders/generators/app_generator.rb
132
130
  - lib/suspenders/version.rb
133
131
  - suspenders.gemspec
134
- - templates/Gemfile_additions
132
+ - templates/Gemfile_clean
135
133
  - templates/Guardfile
136
134
  - templates/Procfile
137
135
  - templates/README.md.erb
138
136
  - templates/_flashes.html.erb
139
137
  - templates/_javascript.html.erb
138
+ - templates/bin_setup
140
139
  - templates/config_locales_en.yml
140
+ - templates/database_cleaner_rspec.rb
141
+ - templates/disable_xml_params.rb
141
142
  - templates/email_validator.rb
142
143
  - templates/errors.rb
143
144
  - templates/factories_spec.rb
@@ -147,8 +148,11 @@ files:
147
148
  - templates/javascripts/prefilled_input.js
148
149
  - templates/override_recipient_smtp.rb
149
150
  - templates/postgresql_database.yml.erb
151
+ - templates/rack_timeout.rb
150
152
  - templates/rspec
153
+ - templates/sample.env
151
154
  - templates/simplecov_init.rb
155
+ - templates/strong_parameters.rb
152
156
  - templates/suspenders_gitignore
153
157
  - templates/suspenders_layout.html.erb.erb
154
158
  homepage: http://github.com/thoughtbot/suspenders
@@ -164,26 +168,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
164
168
  - - ! '>='
165
169
  - !ruby/object:Gem::Version
166
170
  version: '0'
167
- segments:
168
- - 0
169
- hash: -3447770025967369151
170
171
  required_rubygems_version: !ruby/object:Gem::Requirement
171
172
  none: false
172
173
  requirements:
173
174
  - - ! '>='
174
175
  - !ruby/object:Gem::Version
175
176
  version: '0'
176
- segments:
177
- - 0
178
- hash: -3447770025967369151
179
177
  requirements: []
180
178
  rubyforge_project:
181
- rubygems_version: 1.8.24
179
+ rubygems_version: 1.8.23
182
180
  signing_key:
183
181
  specification_version: 3
184
182
  summary: Generate a Rails app using thoughtbot's best practices.
185
183
  test_files:
186
- - features/clearance_false.feature
187
184
  - features/github_repo.feature
188
185
  - features/heroku_true.feature
189
186
  - features/rake_clean.feature
@@ -193,4 +190,3 @@ test_files:
193
190
  - features/support/env.rb
194
191
  - features/support/fake_github.rb
195
192
  - features/support/fake_heroku.rb
196
- - features/webkit_false.feature
@@ -1,10 +0,0 @@
1
- @disable-bundler
2
- Feature: Skipping Clearance
3
-
4
- Scenario: --clearance=false
5
- When I suspend a project called "test_project" with:
6
- | argument | value |
7
- | --clearance | false |
8
- And I cd to the "test_project" root
9
- Then "clearance" should not be installed
10
- And I can cleanly rake the project
@@ -1,11 +0,0 @@
1
- @disable-bundler
2
- Feature: Skipping Capybara Webkit
3
-
4
- Scenario: --webkit=false
5
- When I suspend a project called "test_project" with:
6
- | argument | value |
7
- | --webkit | false |
8
- And I cd to the "test_project" root
9
- Then "capybara-webkit" should not be installed
10
- And "webkit" should not be included in "spec/spec_helper.rb"
11
- And I can cleanly rake the project