suspenders 0.3 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CONTRIBUTING.md +2 -5
- data/Gemfile +3 -0
- data/Gemfile.lock +126 -0
- data/README.md +6 -16
- data/Rakefile +2 -25
- data/features/rake_clean.feature +4 -0
- data/features/step_definitions/shell.rb +30 -10
- data/lib/suspenders/app_builder.rb +19 -2
- data/lib/suspenders/generators/app_generator.rb +20 -4
- data/suspenders.gemspec +6 -3
- metadata +22 -9
data/CONTRIBUTING.md
CHANGED
@@ -3,10 +3,7 @@ We love pull requests. Here's a quick guide:
|
|
3
3
|
1. Fork the repo.
|
4
4
|
|
5
5
|
2. Run the tests. We only take pull requests with passing tests, and it's great
|
6
|
-
to know that you have a clean slate: `
|
7
|
-
|
8
|
-
Note that you must include the `REPO` environment variable pointing at your local
|
9
|
-
`.git` repository in order to generate the test application required by tests.
|
6
|
+
to know that you have a clean slate: `bundle && rake`
|
10
7
|
|
11
8
|
3. Add a test for your change. Only refactoring and documentation changes
|
12
9
|
require no new tests. If you are adding functionality or fixing a bug, we need
|
@@ -38,4 +35,4 @@ Syntax:
|
|
38
35
|
* a = b and not a=b.
|
39
36
|
* Follow the conventions you see used in the source already.
|
40
37
|
|
41
|
-
And in case we didn't emphasize it enough: we love tests!
|
38
|
+
And in case we didn't emphasize it enough: we love tests!
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,126 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
suspenders (0.3)
|
5
|
+
bundler (>= 1.0.7)
|
6
|
+
rails (= 3.1.1)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: http://rubygems.org/
|
10
|
+
specs:
|
11
|
+
actionmailer (3.1.1)
|
12
|
+
actionpack (= 3.1.1)
|
13
|
+
mail (~> 2.3.0)
|
14
|
+
actionpack (3.1.1)
|
15
|
+
activemodel (= 3.1.1)
|
16
|
+
activesupport (= 3.1.1)
|
17
|
+
builder (~> 3.0.0)
|
18
|
+
erubis (~> 2.7.0)
|
19
|
+
i18n (~> 0.6)
|
20
|
+
rack (~> 1.3.2)
|
21
|
+
rack-cache (~> 1.1)
|
22
|
+
rack-mount (~> 0.8.2)
|
23
|
+
rack-test (~> 0.6.1)
|
24
|
+
sprockets (~> 2.0.2)
|
25
|
+
activemodel (3.1.1)
|
26
|
+
activesupport (= 3.1.1)
|
27
|
+
builder (~> 3.0.0)
|
28
|
+
i18n (~> 0.6)
|
29
|
+
activerecord (3.1.1)
|
30
|
+
activemodel (= 3.1.1)
|
31
|
+
activesupport (= 3.1.1)
|
32
|
+
arel (~> 2.2.1)
|
33
|
+
tzinfo (~> 0.3.29)
|
34
|
+
activeresource (3.1.1)
|
35
|
+
activemodel (= 3.1.1)
|
36
|
+
activesupport (= 3.1.1)
|
37
|
+
activesupport (3.1.1)
|
38
|
+
multi_json (~> 1.0)
|
39
|
+
arel (2.2.1)
|
40
|
+
aruba (0.4.6)
|
41
|
+
bcat (>= 0.6.1)
|
42
|
+
childprocess (>= 0.2.0)
|
43
|
+
cucumber (>= 1.0.2)
|
44
|
+
rdiscount (>= 1.6.8)
|
45
|
+
rspec (>= 2.6.0)
|
46
|
+
bcat (0.6.2)
|
47
|
+
rack (~> 1.0)
|
48
|
+
builder (3.0.0)
|
49
|
+
childprocess (0.2.2)
|
50
|
+
ffi (~> 1.0.6)
|
51
|
+
cucumber (1.1.0)
|
52
|
+
builder (>= 2.1.2)
|
53
|
+
diff-lcs (>= 1.1.2)
|
54
|
+
gherkin (~> 2.5.0)
|
55
|
+
json (>= 1.4.6)
|
56
|
+
term-ansicolor (>= 1.0.6)
|
57
|
+
diff-lcs (1.1.3)
|
58
|
+
erubis (2.7.0)
|
59
|
+
ffi (1.0.9)
|
60
|
+
gherkin (2.5.4)
|
61
|
+
json (>= 1.4.6)
|
62
|
+
hike (1.2.1)
|
63
|
+
i18n (0.6.0)
|
64
|
+
json (1.6.1)
|
65
|
+
mail (2.3.0)
|
66
|
+
i18n (>= 0.4.0)
|
67
|
+
mime-types (~> 1.16)
|
68
|
+
treetop (~> 1.4.8)
|
69
|
+
mime-types (1.16)
|
70
|
+
multi_json (1.0.3)
|
71
|
+
polyglot (0.3.2)
|
72
|
+
rack (1.3.5)
|
73
|
+
rack-cache (1.1)
|
74
|
+
rack (>= 0.4)
|
75
|
+
rack-mount (0.8.3)
|
76
|
+
rack (>= 1.0.0)
|
77
|
+
rack-ssl (1.3.2)
|
78
|
+
rack
|
79
|
+
rack-test (0.6.1)
|
80
|
+
rack (>= 1.0)
|
81
|
+
rails (3.1.1)
|
82
|
+
actionmailer (= 3.1.1)
|
83
|
+
actionpack (= 3.1.1)
|
84
|
+
activerecord (= 3.1.1)
|
85
|
+
activeresource (= 3.1.1)
|
86
|
+
activesupport (= 3.1.1)
|
87
|
+
bundler (~> 1.0)
|
88
|
+
railties (= 3.1.1)
|
89
|
+
railties (3.1.1)
|
90
|
+
actionpack (= 3.1.1)
|
91
|
+
activesupport (= 3.1.1)
|
92
|
+
rack-ssl (~> 1.3.2)
|
93
|
+
rake (>= 0.8.7)
|
94
|
+
rdoc (~> 3.4)
|
95
|
+
thor (~> 0.14.6)
|
96
|
+
rake (0.9.2)
|
97
|
+
rdiscount (1.6.8)
|
98
|
+
rdoc (3.11)
|
99
|
+
json (~> 1.4)
|
100
|
+
rspec (2.7.0)
|
101
|
+
rspec-core (~> 2.7.0)
|
102
|
+
rspec-expectations (~> 2.7.0)
|
103
|
+
rspec-mocks (~> 2.7.0)
|
104
|
+
rspec-core (2.7.1)
|
105
|
+
rspec-expectations (2.7.0)
|
106
|
+
diff-lcs (~> 1.1.2)
|
107
|
+
rspec-mocks (2.7.0)
|
108
|
+
sprockets (2.0.3)
|
109
|
+
hike (~> 1.2)
|
110
|
+
rack (~> 1.0)
|
111
|
+
tilt (!= 1.3.0, ~> 1.1)
|
112
|
+
term-ansicolor (1.0.7)
|
113
|
+
thor (0.14.6)
|
114
|
+
tilt (1.3.3)
|
115
|
+
treetop (1.4.10)
|
116
|
+
polyglot
|
117
|
+
polyglot (>= 0.3.1)
|
118
|
+
tzinfo (0.3.30)
|
119
|
+
|
120
|
+
PLATFORMS
|
121
|
+
ruby
|
122
|
+
|
123
|
+
DEPENDENCIES
|
124
|
+
aruba (~> 0.4.6)
|
125
|
+
cucumber (~> 1.1.0)
|
126
|
+
suspenders!
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Suspenders is
|
1
|
+
Suspenders is the base Rails application used at [thoughtbot](http://thoughtbot.com/community).
|
2
2
|
|
3
3
|
![Suspenders boy](http://media.tumblr.com/1TEAMALpseh5xzf0Jt6bcwSMo1_400.png)
|
4
4
|
|
@@ -11,25 +11,17 @@ First install the suspenders gem:
|
|
11
11
|
|
12
12
|
Then run:
|
13
13
|
|
14
|
-
suspenders
|
14
|
+
suspenders projectname
|
15
15
|
|
16
16
|
This will create a Rails 3.1 app in `projectname'. This script creates a new
|
17
17
|
new git repository. It is not meant to be used against an existing repo.
|
18
18
|
|
19
|
-
Suspenders uses [Trout](https://github.com/thoughtbot/trout) to make it
|
20
|
-
easier to maintain a base version of special files like Gemfile and Procfile
|
21
|
-
in Suspenders.
|
22
|
-
|
23
|
-
Whenever you want to get the latest and greatest Suspenders' Gemfile, run:
|
24
|
-
|
25
|
-
trout update Gemfile
|
26
|
-
|
27
19
|
Gemfile
|
28
20
|
-------
|
29
21
|
|
30
22
|
To see the latest and greatest gems, look at Suspenders'
|
31
|
-
[template/
|
32
|
-
which will be
|
23
|
+
[template/Gemfile_additions](https://github.com/thoughtbot/suspenders/blob/master/templates/Gemfile_additions),
|
24
|
+
which will be appended to the default generated projectname/Gemfile.
|
33
25
|
|
34
26
|
It includes application gems like:
|
35
27
|
|
@@ -48,6 +40,7 @@ And testing gems like:
|
|
48
40
|
* [Shoulda Matchers](http://github.com/thoughtbot/shoulda-matchers) for frequently needed Rails and RSpec matchers
|
49
41
|
* [Timecop](https://github.com/jtrupiano/timecop) for dealing with time
|
50
42
|
* [Bourne](https://github.com/thoughtbot/bourne) and Mocha for stubbing and spying
|
43
|
+
* [email_spec](https://github.com/bmabey/email-spec) for testing emails.
|
51
44
|
|
52
45
|
Other goodies
|
53
46
|
-------------
|
@@ -58,14 +51,11 @@ Suspenders also comes with:
|
|
58
51
|
* Rails' flashes set up and in application layout.
|
59
52
|
* A few nice time formats.
|
60
53
|
|
61
|
-
See [template/files](https://github.com/thoughtbot/suspenders/blob/master/template/files) to
|
62
|
-
see what is generated one-time.
|
63
|
-
|
64
54
|
Dependencies
|
65
55
|
------------
|
66
56
|
|
67
57
|
Some gems included in Suspenders have native extensions. You should have GCC installed on your
|
68
|
-
machine before
|
58
|
+
machine before generating an app with Suspenders.
|
69
59
|
|
70
60
|
If you're running OS X, we recommend the [GCC OSX installer](https://github.com/kennethreitz/osx-gcc-installer).
|
71
61
|
|
data/Rakefile
CHANGED
@@ -4,7 +4,7 @@ require 'cucumber/rake/task'
|
|
4
4
|
require 'date'
|
5
5
|
|
6
6
|
TEST_PROJECT = 'test_project'
|
7
|
-
SUSPENDERS_GEM_VERSION = '0.
|
7
|
+
SUSPENDERS_GEM_VERSION = '0.3.1'
|
8
8
|
|
9
9
|
#############################################################################
|
10
10
|
#
|
@@ -14,31 +14,8 @@ SUSPENDERS_GEM_VERSION = '0.2.6'
|
|
14
14
|
|
15
15
|
Cucumber::Rake::Task.new
|
16
16
|
|
17
|
-
namespace :test do
|
18
|
-
desc "A full suspenders app's test suite"
|
19
|
-
task :full => ['test_project:generate', 'cucumber', 'test_project:destroy']
|
20
|
-
end
|
21
|
-
|
22
|
-
namespace :test_project do
|
23
|
-
desc 'Suspend a new project. Pass REPO=... to change the Suspenders repo (defaults to dir with Rakefile).'
|
24
|
-
task :generate do
|
25
|
-
FileUtils.rm_rf(TEST_PROJECT)
|
26
|
-
repo = (ENV['REPO'].to_s || "file://#{Dir.pwd}").to_s
|
27
|
-
sh "./bin/suspenders", 'create', TEST_PROJECT, repo
|
28
|
-
end
|
29
|
-
|
30
|
-
desc 'Remove a suspended project'
|
31
|
-
task :destroy do
|
32
|
-
FileUtils.cd TEST_PROJECT
|
33
|
-
sh "rake db:drop RAILS_ENV=development"
|
34
|
-
sh "rake db:drop RAILS_ENV=test"
|
35
|
-
FileUtils.cd '..'
|
36
|
-
FileUtils.rm_rf TEST_PROJECT
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
17
|
desc 'Run the test suite'
|
41
|
-
task :default => ['
|
18
|
+
task :default => ['cucumber']
|
42
19
|
|
43
20
|
#############################################################################
|
44
21
|
#
|
data/features/rake_clean.feature
CHANGED
@@ -1,6 +1,9 @@
|
|
1
|
+
@disable-bundler
|
1
2
|
Feature: Rake works in the suspended project
|
2
3
|
|
3
4
|
Scenario: Running rake in the suspended project
|
5
|
+
When I suspend a project called "test_project"
|
6
|
+
And I cd to the "test_project" root
|
4
7
|
When I drop and create the required databases
|
5
8
|
And I run the rake task "db:create"
|
6
9
|
And I run the rake task "db:migrate"
|
@@ -10,6 +13,7 @@ Feature: Rake works in the suspended project
|
|
10
13
|
|
11
14
|
Scenario: Making a spec then running rake
|
12
15
|
When I drop and create the required databases
|
16
|
+
And I suspend a project called "test_project"
|
13
17
|
And I generate "model post title:string"
|
14
18
|
And I run the rake task "db:migrate"
|
15
19
|
And I run the rake task "db:test:prepare"
|
@@ -1,24 +1,44 @@
|
|
1
|
+
require 'aruba/cucumber'
|
2
|
+
|
3
|
+
Before do
|
4
|
+
@aruba_timeout_seconds = 60
|
5
|
+
end
|
6
|
+
|
7
|
+
After do
|
8
|
+
FileUtils.rm_rf('test_project')
|
9
|
+
end
|
10
|
+
|
1
11
|
When 'I run the rake task "$task_name"' do |task_name|
|
2
|
-
|
3
|
-
|
12
|
+
in_current_dir do
|
13
|
+
run "bundle exec rake #{task_name}"
|
4
14
|
end
|
5
15
|
end
|
6
16
|
|
7
17
|
When 'I generate "$generator_with_args"' do |generator_with_args|
|
8
|
-
|
9
|
-
|
18
|
+
in_current_dir do
|
19
|
+
run "bundle exec rails generate #{generator_with_args}"
|
10
20
|
end
|
11
21
|
end
|
12
22
|
|
13
23
|
Then 'I see a successful response in the shell' do
|
14
|
-
|
24
|
+
assert_exit_status(0)
|
15
25
|
end
|
16
26
|
|
17
27
|
When 'I drop and create the required databases' do
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
28
|
+
in_current_dir do
|
29
|
+
run 'bundle exec rake db:drop RAILS_ENV=test'
|
30
|
+
run 'bundle exec rake db:drop'
|
31
|
+
run 'bundle exec rake db:create RAILS_ENV=test'
|
32
|
+
run 'bundle exec rake db:create'
|
23
33
|
end
|
24
34
|
end
|
35
|
+
|
36
|
+
When 'I suspend a project called "$project_name"' do |project_name|
|
37
|
+
suspenders_bin = File.expand_path(File.join('..', '..', 'bin', 'suspenders'), File.dirname(__FILE__))
|
38
|
+
run "#{suspenders_bin} #{project_name}"
|
39
|
+
assert_exit_status(0)
|
40
|
+
end
|
41
|
+
|
42
|
+
When 'I cd to the "$test_project" root' do |dirname|
|
43
|
+
cd dirname
|
44
|
+
end
|
@@ -133,8 +133,25 @@ module Suspenders
|
|
133
133
|
route "root :to => 'Clearance::Sessions#new'"
|
134
134
|
end
|
135
135
|
|
136
|
-
def
|
137
|
-
|
136
|
+
def set_active_record_whitelist_attributes
|
137
|
+
inject_into_class "config/application.rb", "Application", " config.active_record.whitelist_attributes = true\n"
|
138
|
+
end
|
139
|
+
|
140
|
+
def set_attr_accessibles_on_user
|
141
|
+
inject_into_file "app/models/user.rb",
|
142
|
+
" attr_accessible :email, :password\n",
|
143
|
+
:after => /include Clearance::User\n/
|
144
|
+
end
|
145
|
+
|
146
|
+
def include_clearance_matchers
|
147
|
+
create_file "spec/support/clearance.rb", "require 'clearance/testing'"
|
148
|
+
end
|
149
|
+
|
150
|
+
def setup_default_rake_task
|
151
|
+
append_file "Rakefile" do
|
152
|
+
"task(:default).clear\ntask :default => [:spec, :cucumber]"
|
153
|
+
end
|
154
|
+
|
138
155
|
end
|
139
156
|
end
|
140
157
|
end
|
@@ -28,7 +28,8 @@ module Suspenders
|
|
28
28
|
invoke :setup_gitignore
|
29
29
|
invoke :copy_miscellaneous_files
|
30
30
|
invoke :setup_root_route
|
31
|
-
invoke :
|
31
|
+
invoke :set_active_record_whitelist_attributes
|
32
|
+
invoke :set_attr_accessibles_on_user
|
32
33
|
invoke :outro
|
33
34
|
end
|
34
35
|
|
@@ -80,6 +81,8 @@ module Suspenders
|
|
80
81
|
build(:generate_cucumber)
|
81
82
|
build(:generate_clearance)
|
82
83
|
build(:install_factory_girl_steps)
|
84
|
+
build(:include_clearance_matchers)
|
85
|
+
build(:setup_default_rake_task)
|
83
86
|
end
|
84
87
|
|
85
88
|
def setup_stylesheets
|
@@ -102,9 +105,18 @@ module Suspenders
|
|
102
105
|
build(:setup_root_route)
|
103
106
|
end
|
104
107
|
|
105
|
-
def
|
106
|
-
|
107
|
-
|
108
|
+
def set_active_record_whitelist_attributes
|
109
|
+
if using_active_record?
|
110
|
+
say "Setting up active_record.whitelist_attributes"
|
111
|
+
build(:set_active_record_whitelist_attributes)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
def set_attr_accessibles_on_user
|
116
|
+
if using_active_record?
|
117
|
+
say "Setting up writable attributes on user"
|
118
|
+
build(:set_attr_accessibles_on_user)
|
119
|
+
end
|
108
120
|
end
|
109
121
|
|
110
122
|
def outro
|
@@ -117,6 +129,10 @@ module Suspenders
|
|
117
129
|
Suspenders::AppBuilder
|
118
130
|
end
|
119
131
|
|
132
|
+
def using_active_record?
|
133
|
+
!options[:skip_active_record]
|
134
|
+
end
|
135
|
+
|
120
136
|
end
|
121
137
|
end
|
122
138
|
|
data/suspenders.gemspec
CHANGED
@@ -4,8 +4,8 @@ Gem::Specification.new do |s|
|
|
4
4
|
s.rubygems_version = '1.3.5'
|
5
5
|
|
6
6
|
s.name = 'suspenders'
|
7
|
-
s.version = '0.3'
|
8
|
-
s.date = '2011-10-
|
7
|
+
s.version = '0.3.1'
|
8
|
+
s.date = '2011-10-28'
|
9
9
|
|
10
10
|
s.summary = "Generate a Rails app using thoughtbot's best practices."
|
11
11
|
s.description = <<-HERE
|
@@ -26,11 +26,14 @@ rush to build something amazing; don't use it if you like missing deadlines.
|
|
26
26
|
|
27
27
|
s.add_dependency('rails', '3.1.1')
|
28
28
|
s.add_dependency('bundler', '>= 1.0.7')
|
29
|
-
s.add_development_dependency('cucumber', '~> 1.0
|
29
|
+
s.add_development_dependency('cucumber', '~> 1.1.0')
|
30
|
+
s.add_development_dependency('aruba', '~> 0.4.6')
|
30
31
|
|
31
32
|
# = MANIFEST =
|
32
33
|
s.files = %w[
|
33
34
|
CONTRIBUTING.md
|
35
|
+
Gemfile
|
36
|
+
Gemfile.lock
|
34
37
|
LICENSE
|
35
38
|
README.md
|
36
39
|
Rakefile
|
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:
|
4
|
+
version: 0.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-10-
|
12
|
+
date: 2011-10-28 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &2161798380 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - =
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 3.1.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2161798380
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: bundler
|
27
|
-
requirement: &
|
27
|
+
requirement: &2161797800 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,18 +32,29 @@ dependencies:
|
|
32
32
|
version: 1.0.7
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2161797800
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: cucumber
|
38
|
-
requirement: &
|
38
|
+
requirement: &2161797320 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: 1.0
|
43
|
+
version: 1.1.0
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2161797320
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: aruba
|
49
|
+
requirement: &2161796760 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.4.6
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *2161796760
|
47
58
|
description: ! 'Suspenders is a base Rails project that you can upgrade. It is used
|
48
59
|
by
|
49
60
|
|
@@ -61,6 +72,8 @@ extra_rdoc_files:
|
|
61
72
|
- LICENSE
|
62
73
|
files:
|
63
74
|
- CONTRIBUTING.md
|
75
|
+
- Gemfile
|
76
|
+
- Gemfile.lock
|
64
77
|
- LICENSE
|
65
78
|
- README.md
|
66
79
|
- Rakefile
|