da-suspenders 1.0.0 → 1.0.1
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/.gitignore +4 -4
- data/CHANGELOG.md +13 -0
- data/LICENSE +21 -21
- data/README.md +62 -62
- data/Rakefile +40 -40
- data/bin/da-suspenders +0 -0
- data/da-suspenders.gemspec +26 -26
- data/features/running_cucumber.feature +17 -17
- data/features/step_definitions/shell.rb +30 -30
- data/features/support/env.rb +1 -1
- data/lib/create.rb +55 -55
- data/lib/da-suspenders/version.rb +2 -2
- data/lib/errors.rb +12 -12
- data/template/da-suspenders.rb +172 -165
- data/template/files/factory_girl_steps.rb +1 -1
- data/template/files/mysql_database.yml.erb +39 -39
- data/template/trout/Gemfile +30 -30
- data/template/trout/app/helpers/body_class_helper.rb +6 -6
- data/template/trout/app/javascripts/application.js +10 -10
- data/template/trout/app/views/layouts/application.html.erb +15 -15
- data/template/trout/app/views/shared/_flashes.html.erb +5 -5
- data/template/trout/config/initializers/errors.rb +26 -26
- data/template/trout/features/step_definitions/js_steps.rb +3 -3
- data/template/trout/lib/templates/erb/scaffold/_form.html.erb +13 -13
- data/template/trout/vendor/sprockets/jquery-ujs/src/rails.js +169 -169
- data/template/trout/vendor/sprockets/modernizr/src/modernizr.js +29 -29
- metadata +17 -5
data/.gitignore
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
*.swp
|
|
2
|
-
pkg
|
|
3
|
-
test_project
|
|
4
|
-
.rake_tasks
|
|
1
|
+
*.swp
|
|
2
|
+
pkg
|
|
3
|
+
test_project
|
|
4
|
+
.rake_tasks
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
## 1.0.1 (2011-02-16)
|
|
2
|
+
|
|
3
|
+
### New / Changed
|
|
4
|
+
* Timestamped migrations are now disabled per default.
|
|
5
|
+
* Inject code into `features/support/paths.rb` (generated by Cucumber) to enable literal paths like `/foo/bar/2` in web steps.
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
* Fixed link to the internet explorer stylesheet (generated by Sass) in `app/views/layouts/application.html.erb`.
|
|
9
|
+
* Fixed deprecation warnings because of <% %> style block helpers.
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## 1.0.0 (2011-02-14)
|
|
13
|
+
* Initial Release
|
data/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
The MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2010 Mike Burns
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
|
13
|
-
all copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
-
THE SOFTWARE.
|
|
1
|
+
The MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2010 Mike Burns
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
CHANGED
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
DA-Suspenders is a base Rails application that you can upgrade.
|
|
2
|
-
|
|
3
|
-
This is a fork of [thoughtbot's original Suspenders](https://github.com/thoughtbot/suspenders/), customized to our needs.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
## Installation
|
|
7
|
-
|
|
8
|
-
First install the da-suspenders gem:
|
|
9
|
-
|
|
10
|
-
gem install da-suspenders
|
|
11
|
-
|
|
12
|
-
Then run:
|
|
13
|
-
|
|
14
|
-
da-suspenders create projectname
|
|
15
|
-
|
|
16
|
-
This will create a Rails 3 app in `projectname'. This script creates a new git repository. It is not meant to be used against an existing repo.
|
|
17
|
-
|
|
18
|
-
Suspenders uses [Trout](https://github.com/thoughtbot/trout) to make it easier to maintain a base version of special files (like Gemfile) in Suspenders.
|
|
19
|
-
|
|
20
|
-
Whenever you want to get the latest and greatest Suspenders' Gemfile, run:
|
|
21
|
-
|
|
22
|
-
trout update Gemfile
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
## Gemfile
|
|
26
|
-
|
|
27
|
-
To see the latest and greatest gems, look at DA-Suspenders'
|
|
28
|
-
[template/trout/Gemfile](https://github.com/die-antwort/da-suspenders/blob/master/template/trout/Gemfile), which will be copied into your projectname/Gemfile.
|
|
29
|
-
|
|
30
|
-
It includes application gems like:
|
|
31
|
-
|
|
32
|
-
* [Compass](https://github.com/chriseppstein/compass), a [Sass-based](http://sass-lang.com/) CSS Meta-Framework
|
|
33
|
-
* [Formtastic](https://github.com/justinfrench/formtastic) for better forms
|
|
34
|
-
* [Hoptoad Notifier](https://github.com/thoughtbot/hoptoad_notifier) for exception notification
|
|
35
|
-
* [Paperclip](https://github.com/thoughtbot/paperclip) for file uploads
|
|
36
|
-
* [Sprockets](https://github.com/sstephenson/sprockets) for JavaScript dependency management and concatenation
|
|
37
|
-
* Our fork of [jRails](https://github.com/die-antwort/jrails), which brings you [jQuery](https://github.com/jquery/jquery) and [jQuery UI](https://github.com/jquery/jquery-ui) via Sprockets
|
|
38
|
-
* [AppConfig](https://github.com/die-antwort/app_config) for simple application configuration
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
And testing gems like:
|
|
42
|
-
|
|
43
|
-
* [Cucumber, Capybara, and Akephalos](http://robots.thoughtbot.com/post/1658763359/thoughtbot-and-the-holy-grail) for integration testing, including Javascript behavior
|
|
44
|
-
* [RSpec](https://github.com/rspec/rspec) for awesome, readable isolation testing
|
|
45
|
-
* [Factory Girl](https://github.com/thoughtbot/factory_girl) for easier creation of test data
|
|
46
|
-
* [Timecop](https://github.com/jtrupiano/timecop) for dealing with time
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
## Other goodies
|
|
50
|
-
|
|
51
|
-
DA-Suspenders also comes with:
|
|
52
|
-
|
|
53
|
-
* Additional staging environment.
|
|
54
|
-
* German localization and timezone setting.
|
|
55
|
-
* Rails' flashes set up and in application layout.
|
|
56
|
-
|
|
57
|
-
See [template/files](https://github.com/die-antwort/da-suspenders/blob/master/template/trout) to see what is installed via Trout.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
## Credits
|
|
61
|
-
|
|
62
|
-
DA-Suspenders is created by [DIE ANTWORT](http://www.die-antwort.eu), based on Suspenders created and funded by [thoughtbot, inc](http://thoughtbot.com/community).
|
|
1
|
+
DA-Suspenders is a base Rails application that you can upgrade.
|
|
2
|
+
|
|
3
|
+
This is a fork of [thoughtbot's original Suspenders](https://github.com/thoughtbot/suspenders/), customized to our needs.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
|
|
8
|
+
First install the da-suspenders gem:
|
|
9
|
+
|
|
10
|
+
gem install da-suspenders
|
|
11
|
+
|
|
12
|
+
Then run:
|
|
13
|
+
|
|
14
|
+
da-suspenders create projectname
|
|
15
|
+
|
|
16
|
+
This will create a Rails 3 app in `projectname'. This script creates a new git repository. It is not meant to be used against an existing repo.
|
|
17
|
+
|
|
18
|
+
Suspenders uses [Trout](https://github.com/thoughtbot/trout) to make it easier to maintain a base version of special files (like Gemfile) in Suspenders.
|
|
19
|
+
|
|
20
|
+
Whenever you want to get the latest and greatest Suspenders' Gemfile, run:
|
|
21
|
+
|
|
22
|
+
trout update Gemfile
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## Gemfile
|
|
26
|
+
|
|
27
|
+
To see the latest and greatest gems, look at DA-Suspenders'
|
|
28
|
+
[template/trout/Gemfile](https://github.com/die-antwort/da-suspenders/blob/master/template/trout/Gemfile), which will be copied into your projectname/Gemfile.
|
|
29
|
+
|
|
30
|
+
It includes application gems like:
|
|
31
|
+
|
|
32
|
+
* [Compass](https://github.com/chriseppstein/compass), a [Sass-based](http://sass-lang.com/) CSS Meta-Framework
|
|
33
|
+
* [Formtastic](https://github.com/justinfrench/formtastic) for better forms
|
|
34
|
+
* [Hoptoad Notifier](https://github.com/thoughtbot/hoptoad_notifier) for exception notification
|
|
35
|
+
* [Paperclip](https://github.com/thoughtbot/paperclip) for file uploads
|
|
36
|
+
* [Sprockets](https://github.com/sstephenson/sprockets) for JavaScript dependency management and concatenation
|
|
37
|
+
* Our fork of [jRails](https://github.com/die-antwort/jrails), which brings you [jQuery](https://github.com/jquery/jquery) and [jQuery UI](https://github.com/jquery/jquery-ui) via Sprockets
|
|
38
|
+
* [AppConfig](https://github.com/die-antwort/app_config) for simple application configuration
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
And testing gems like:
|
|
42
|
+
|
|
43
|
+
* [Cucumber, Capybara, and Akephalos](http://robots.thoughtbot.com/post/1658763359/thoughtbot-and-the-holy-grail) for integration testing, including Javascript behavior
|
|
44
|
+
* [RSpec](https://github.com/rspec/rspec) for awesome, readable isolation testing
|
|
45
|
+
* [Factory Girl](https://github.com/thoughtbot/factory_girl) for easier creation of test data
|
|
46
|
+
* [Timecop](https://github.com/jtrupiano/timecop) for dealing with time
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
## Other goodies
|
|
50
|
+
|
|
51
|
+
DA-Suspenders also comes with:
|
|
52
|
+
|
|
53
|
+
* Additional staging environment.
|
|
54
|
+
* German localization and timezone setting.
|
|
55
|
+
* Rails' flashes set up and in application layout.
|
|
56
|
+
|
|
57
|
+
See [template/files](https://github.com/die-antwort/da-suspenders/blob/master/template/trout) to see what is installed via Trout.
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
## Credits
|
|
61
|
+
|
|
62
|
+
DA-Suspenders is created by [DIE ANTWORT](http://www.die-antwort.eu), based on Suspenders created and funded by [thoughtbot, inc](http://thoughtbot.com/community).
|
data/Rakefile
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
require "bundler"
|
|
2
|
-
require "cucumber/rake/task"
|
|
3
|
-
|
|
4
|
-
Bundler::GemHelper.install_tasks
|
|
5
|
-
|
|
6
|
-
#############################################################################
|
|
7
|
-
#
|
|
8
|
-
# Testing functions
|
|
9
|
-
#
|
|
10
|
-
#############################################################################
|
|
11
|
-
|
|
12
|
-
Cucumber::Rake::Task.new
|
|
13
|
-
|
|
14
|
-
TEST_PROJECT = "test_project"
|
|
15
|
-
|
|
16
|
-
namespace :test do
|
|
17
|
-
desc "A full suspenders app's test suite"
|
|
18
|
-
task :full => ['test_project:generate', 'cucumber', 'test_project:destroy']
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
namespace :test_project do
|
|
22
|
-
desc 'Suspend a new project. Pass REPO=... to change the Suspenders repo.'
|
|
23
|
-
task :generate do
|
|
24
|
-
FileUtils.rm_rf(TEST_PROJECT)
|
|
25
|
-
sh 'ruby', 'bin/da-suspenders', 'create', TEST_PROJECT, ENV['REPO'].to_s
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
desc 'Remove a suspended project'
|
|
29
|
-
task :destroy do
|
|
30
|
-
FileUtils.cd TEST_PROJECT
|
|
31
|
-
sh "rake db:drop RAILS_ENV=development"
|
|
32
|
-
sh "rake db:drop RAILS_ENV=test"
|
|
33
|
-
FileUtils.cd '..'
|
|
34
|
-
FileUtils.rm_rf TEST_PROJECT
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
desc 'Run the test suite'
|
|
39
|
-
task :default => ['test:full']
|
|
40
|
-
|
|
1
|
+
require "bundler"
|
|
2
|
+
require "cucumber/rake/task"
|
|
3
|
+
|
|
4
|
+
Bundler::GemHelper.install_tasks
|
|
5
|
+
|
|
6
|
+
#############################################################################
|
|
7
|
+
#
|
|
8
|
+
# Testing functions
|
|
9
|
+
#
|
|
10
|
+
#############################################################################
|
|
11
|
+
|
|
12
|
+
Cucumber::Rake::Task.new
|
|
13
|
+
|
|
14
|
+
TEST_PROJECT = "test_project"
|
|
15
|
+
|
|
16
|
+
namespace :test do
|
|
17
|
+
desc "A full suspenders app's test suite"
|
|
18
|
+
task :full => ['test_project:generate', 'cucumber', 'test_project:destroy']
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
namespace :test_project do
|
|
22
|
+
desc 'Suspend a new project. Pass REPO=... to change the Suspenders repo.'
|
|
23
|
+
task :generate do
|
|
24
|
+
FileUtils.rm_rf(TEST_PROJECT)
|
|
25
|
+
sh 'ruby', 'bin/da-suspenders', 'create', TEST_PROJECT, ENV['REPO'].to_s
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
desc 'Remove a suspended project'
|
|
29
|
+
task :destroy do
|
|
30
|
+
FileUtils.cd TEST_PROJECT
|
|
31
|
+
sh "rake db:drop RAILS_ENV=development"
|
|
32
|
+
sh "rake db:drop RAILS_ENV=test"
|
|
33
|
+
FileUtils.cd '..'
|
|
34
|
+
FileUtils.rm_rf TEST_PROJECT
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
desc 'Run the test suite'
|
|
39
|
+
task :default => ['test:full']
|
|
40
|
+
|
data/bin/da-suspenders
CHANGED
|
File without changes
|
data/da-suspenders.gemspec
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
require File.expand_path("../lib/da-suspenders/version", __FILE__)
|
|
2
|
-
|
|
3
|
-
Gem::Specification.new do |s|
|
|
4
|
-
s.name = 'da-suspenders'
|
|
5
|
-
s.version = DaSuspenders::VERSION
|
|
6
|
-
s.platform = Gem::Platform::RUBY
|
|
7
|
-
s.authors = ["thoughtbot", "Stefan Daschek"]
|
|
8
|
-
s.email = 'stefan@die-antwort.eu'
|
|
9
|
-
s.homepage = 'http://github.com/die-antwort/da-suspenders'
|
|
10
|
-
s.summary = "Generate a Rails app using DIE ANTWORT's best practices."
|
|
11
|
-
s.description = "DIE ANTWORT's fork of thoughtbot's original Suspenders. Suspenders is an upgradeable base Rails project."
|
|
12
|
-
|
|
13
|
-
s.required_rubygems_version = ">= 1.3.6"
|
|
14
|
-
|
|
15
|
-
s.add_dependency('rails', '>= 3.0.4')
|
|
16
|
-
s.add_dependency('bundler', '>= 1.0.10')
|
|
17
|
-
s.add_dependency('trout', '>= 0.3.0')
|
|
18
|
-
|
|
19
|
-
s.files = `git ls-files`.split("\n")
|
|
20
|
-
s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
|
|
21
|
-
s.test_files = s.files.select{ |path| path =~ /^features/ }
|
|
22
|
-
s.require_path = 'lib'
|
|
23
|
-
|
|
24
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
|
25
|
-
s.extra_rdoc_files = %w[README.md LICENSE]
|
|
26
|
-
end
|
|
1
|
+
require File.expand_path("../lib/da-suspenders/version", __FILE__)
|
|
2
|
+
|
|
3
|
+
Gem::Specification.new do |s|
|
|
4
|
+
s.name = 'da-suspenders'
|
|
5
|
+
s.version = DaSuspenders::VERSION
|
|
6
|
+
s.platform = Gem::Platform::RUBY
|
|
7
|
+
s.authors = ["thoughtbot", "Stefan Daschek"]
|
|
8
|
+
s.email = 'stefan@die-antwort.eu'
|
|
9
|
+
s.homepage = 'http://github.com/die-antwort/da-suspenders'
|
|
10
|
+
s.summary = "Generate a Rails app using DIE ANTWORT's best practices."
|
|
11
|
+
s.description = "DIE ANTWORT's fork of thoughtbot's original Suspenders. Suspenders is an upgradeable base Rails project."
|
|
12
|
+
|
|
13
|
+
s.required_rubygems_version = ">= 1.3.6"
|
|
14
|
+
|
|
15
|
+
s.add_dependency('rails', '>= 3.0.4')
|
|
16
|
+
s.add_dependency('bundler', '>= 1.0.10')
|
|
17
|
+
s.add_dependency('trout', '>= 0.3.0')
|
|
18
|
+
|
|
19
|
+
s.files = `git ls-files`.split("\n")
|
|
20
|
+
s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
|
|
21
|
+
s.test_files = s.files.select{ |path| path =~ /^features/ }
|
|
22
|
+
s.require_path = 'lib'
|
|
23
|
+
|
|
24
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
|
25
|
+
s.extra_rdoc_files = %w[README.md LICENSE]
|
|
26
|
+
end
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
Feature: Running cucumber in the generated project
|
|
2
|
-
|
|
3
|
-
Scenario: jQuery and Modernizr work in the generated project
|
|
4
|
-
Given I drop and create the required databases
|
|
5
|
-
And I generate "scaffold user username:string"
|
|
6
|
-
And I run the rake task "db:migrate"
|
|
7
|
-
And I create a file named "features/js_test.feature" with:
|
|
8
|
-
"""
|
|
9
|
-
Feature: Javascript
|
|
10
|
-
@javascript
|
|
11
|
-
Scenario: Test jQuery and Modernizr
|
|
12
|
-
When I go to "the users page"
|
|
13
|
-
Then the javascript expression "$('html').hasClass('js')" should return "true"
|
|
14
|
-
And the javascript expression "$('html').hasClass('no-js')" should return "false"
|
|
15
|
-
"""
|
|
16
|
-
When I run the rake task "cucumber"
|
|
17
|
-
Then I see a successful response in the shell
|
|
1
|
+
Feature: Running cucumber in the generated project
|
|
2
|
+
|
|
3
|
+
Scenario: jQuery and Modernizr work in the generated project
|
|
4
|
+
Given I drop and create the required databases
|
|
5
|
+
And I generate "scaffold user username:string"
|
|
6
|
+
And I run the rake task "db:migrate"
|
|
7
|
+
And I create a file named "features/js_test.feature" with:
|
|
8
|
+
"""
|
|
9
|
+
Feature: Javascript
|
|
10
|
+
@javascript
|
|
11
|
+
Scenario: Test jQuery and Modernizr
|
|
12
|
+
When I go to "the users page"
|
|
13
|
+
Then the javascript expression "$('html').hasClass('js')" should return "true"
|
|
14
|
+
And the javascript expression "$('html').hasClass('no-js')" should return "false"
|
|
15
|
+
"""
|
|
16
|
+
When I run the rake task "cucumber"
|
|
17
|
+
Then I see a successful response in the shell
|
|
18
18
|
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
When 'I run the rake task "$task_name"' do |task_name|
|
|
2
|
-
Dir.chdir('test_project') do
|
|
3
|
-
system("rake #{task_name}")
|
|
4
|
-
end
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
When 'I generate "$generator_with_args"' do |generator_with_args|
|
|
8
|
-
Dir.chdir('test_project') do
|
|
9
|
-
system("rails generate #{generator_with_args}")
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
When 'I create a file named "$filename" with:' do |filename, content|
|
|
14
|
-
File.open("test_project/#{filename}", "w") do |file|
|
|
15
|
-
file.write(content)
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
Then 'I see a successful response in the shell' do
|
|
20
|
-
$?.to_i.should == 0
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
When 'I drop and create the required databases' do
|
|
24
|
-
Dir.chdir('test_project') do
|
|
25
|
-
system("rake db:drop RAILS_ENV=test")
|
|
26
|
-
system("rake db:drop")
|
|
27
|
-
system("rake db:create RAILS_ENV=test")
|
|
28
|
-
system("rake db:create")
|
|
29
|
-
end
|
|
30
|
-
end
|
|
1
|
+
When 'I run the rake task "$task_name"' do |task_name|
|
|
2
|
+
Dir.chdir('test_project') do
|
|
3
|
+
system("rake #{task_name}")
|
|
4
|
+
end
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
When 'I generate "$generator_with_args"' do |generator_with_args|
|
|
8
|
+
Dir.chdir('test_project') do
|
|
9
|
+
system("rails generate #{generator_with_args}")
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
When 'I create a file named "$filename" with:' do |filename, content|
|
|
14
|
+
File.open("test_project/#{filename}", "w") do |file|
|
|
15
|
+
file.write(content)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
Then 'I see a successful response in the shell' do
|
|
20
|
+
$?.to_i.should == 0
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
When 'I drop and create the required databases' do
|
|
24
|
+
Dir.chdir('test_project') do
|
|
25
|
+
system("rake db:drop RAILS_ENV=test")
|
|
26
|
+
system("rake db:drop")
|
|
27
|
+
system("rake db:create RAILS_ENV=test")
|
|
28
|
+
system("rake db:create")
|
|
29
|
+
end
|
|
30
|
+
end
|
data/features/support/env.rb
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
require 'spec/expectations'
|
|
1
|
+
require 'spec/expectations'
|
data/lib/create.rb
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
# Methods needed to create a project.
|
|
2
|
-
|
|
3
|
-
require 'rubygems'
|
|
4
|
-
require File.expand_path(File.dirname(__FILE__) + "/errors")
|
|
5
|
-
|
|
6
|
-
module DaSuspenders
|
|
7
|
-
class Create
|
|
8
|
-
attr_accessor :project_path
|
|
9
|
-
|
|
10
|
-
def self.run!(project_path)
|
|
11
|
-
creator = self.new(project_path)
|
|
12
|
-
creator.create_project!
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def initialize(project_path)
|
|
16
|
-
self.project_path = project_path
|
|
17
|
-
validate_project_path
|
|
18
|
-
validate_project_name
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def create_project!
|
|
22
|
-
exec(<<-COMMAND)
|
|
23
|
-
rails new #{project_path} \
|
|
24
|
-
--template="#{template}" \
|
|
25
|
-
--database=mysql \
|
|
26
|
-
--skip-test-unit \
|
|
27
|
-
--skip-prototype
|
|
28
|
-
COMMAND
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
private
|
|
32
|
-
|
|
33
|
-
def validate_project_name
|
|
34
|
-
project_name = File.basename(project_path)
|
|
35
|
-
unless project_name =~ /^[a-z0-9_]+$/
|
|
36
|
-
raise InvalidInput.new("Project name must only contain [a-z0-9_]")
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def validate_project_path
|
|
41
|
-
base_directory = Dir.pwd
|
|
42
|
-
full_path = File.join(base_directory, project_path)
|
|
43
|
-
|
|
44
|
-
# This is for the common case for the user's convenience; the race
|
|
45
|
-
# condition can still occur.
|
|
46
|
-
if File.exists?(full_path)
|
|
47
|
-
raise InvalidInput.new("Project directory (#{project_path}) already exists")
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
def template
|
|
52
|
-
File.expand_path(File.dirname(__FILE__) + "/../template/da-suspenders.rb")
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
end
|
|
1
|
+
# Methods needed to create a project.
|
|
2
|
+
|
|
3
|
+
require 'rubygems'
|
|
4
|
+
require File.expand_path(File.dirname(__FILE__) + "/errors")
|
|
5
|
+
|
|
6
|
+
module DaSuspenders
|
|
7
|
+
class Create
|
|
8
|
+
attr_accessor :project_path
|
|
9
|
+
|
|
10
|
+
def self.run!(project_path)
|
|
11
|
+
creator = self.new(project_path)
|
|
12
|
+
creator.create_project!
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def initialize(project_path)
|
|
16
|
+
self.project_path = project_path
|
|
17
|
+
validate_project_path
|
|
18
|
+
validate_project_name
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def create_project!
|
|
22
|
+
exec(<<-COMMAND)
|
|
23
|
+
rails new #{project_path} \
|
|
24
|
+
--template="#{template}" \
|
|
25
|
+
--database=mysql \
|
|
26
|
+
--skip-test-unit \
|
|
27
|
+
--skip-prototype
|
|
28
|
+
COMMAND
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
private
|
|
32
|
+
|
|
33
|
+
def validate_project_name
|
|
34
|
+
project_name = File.basename(project_path)
|
|
35
|
+
unless project_name =~ /^[a-z0-9_]+$/
|
|
36
|
+
raise InvalidInput.new("Project name must only contain [a-z0-9_]")
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def validate_project_path
|
|
41
|
+
base_directory = Dir.pwd
|
|
42
|
+
full_path = File.join(base_directory, project_path)
|
|
43
|
+
|
|
44
|
+
# This is for the common case for the user's convenience; the race
|
|
45
|
+
# condition can still occur.
|
|
46
|
+
if File.exists?(full_path)
|
|
47
|
+
raise InvalidInput.new("Project directory (#{project_path}) already exists")
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def template
|
|
52
|
+
File.expand_path(File.dirname(__FILE__) + "/../template/da-suspenders.rb")
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|