diesel 0.1.4 → 0.1.5

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.
@@ -0,0 +1,11 @@
1
+ appraise "3.0.9" do
2
+ gem "rails", "3.0.9"
3
+ end
4
+
5
+ appraise "3.1.0.rc4" do
6
+ gem "rails", "3.1.0.rc4"
7
+ gem 'sass'
8
+ gem 'coffee-script'
9
+ gem 'uglifier'
10
+ gem 'jquery-rails'
11
+ end
data/Gemfile CHANGED
@@ -1,9 +1,4 @@
1
1
  source "http://rubygems.org"
2
- gem "cucumber"
3
- gem "aruba"
4
- gem "rake"
5
- gem "rspec-rails", :require => false
6
- gem "rails", ">= 3.0.3", :require => false
7
- gem "thin"
8
- gem "sqlite3-ruby", :require => false
9
-
2
+ gemspec
3
+ gem "rails", "3.0.9"
4
+ gem "database_cleaner", :require => false
@@ -1,113 +1,153 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ diesel (0.1.4)
5
+ railties
6
+
1
7
  GEM
2
8
  remote: http://rubygems.org/
3
9
  specs:
4
10
  abstract (1.0.0)
5
- actionmailer (3.0.3)
6
- actionpack (= 3.0.3)
7
- mail (~> 2.2.9)
8
- actionpack (3.0.3)
9
- activemodel (= 3.0.3)
10
- activesupport (= 3.0.3)
11
+ actionmailer (3.0.9)
12
+ actionpack (= 3.0.9)
13
+ mail (~> 2.2.19)
14
+ actionpack (3.0.9)
15
+ activemodel (= 3.0.9)
16
+ activesupport (= 3.0.9)
11
17
  builder (~> 2.1.2)
12
18
  erubis (~> 2.6.6)
13
- i18n (~> 0.4)
19
+ i18n (~> 0.5.0)
14
20
  rack (~> 1.2.1)
15
- rack-mount (~> 0.6.13)
16
- rack-test (~> 0.5.6)
21
+ rack-mount (~> 0.6.14)
22
+ rack-test (~> 0.5.7)
17
23
  tzinfo (~> 0.3.23)
18
- activemodel (3.0.3)
19
- activesupport (= 3.0.3)
24
+ activemodel (3.0.9)
25
+ activesupport (= 3.0.9)
20
26
  builder (~> 2.1.2)
21
- i18n (~> 0.4)
22
- activerecord (3.0.3)
23
- activemodel (= 3.0.3)
24
- activesupport (= 3.0.3)
25
- arel (~> 2.0.2)
27
+ i18n (~> 0.5.0)
28
+ activerecord (3.0.9)
29
+ activemodel (= 3.0.9)
30
+ activesupport (= 3.0.9)
31
+ arel (~> 2.0.10)
26
32
  tzinfo (~> 0.3.23)
27
- activeresource (3.0.3)
28
- activemodel (= 3.0.3)
29
- activesupport (= 3.0.3)
30
- activesupport (3.0.3)
31
- arel (2.0.6)
32
- aruba (0.2.7)
33
- background_process
34
- cucumber (~> 0.10.0)
35
- background_process (1.2)
33
+ activeresource (3.0.9)
34
+ activemodel (= 3.0.9)
35
+ activesupport (= 3.0.9)
36
+ activesupport (3.0.9)
37
+ appraisal (0.3.5)
38
+ aruba (~> 0.3.6)
39
+ bundler
40
+ rake
41
+ arel (2.0.10)
42
+ aruba (0.3.7)
43
+ childprocess (>= 0.1.9)
44
+ cucumber (>= 0.10.5)
45
+ rspec (>= 2.6.0)
36
46
  builder (2.1.2)
37
- cucumber (0.10.0)
47
+ capybara (1.0.0.rc1)
48
+ mime-types (>= 1.16)
49
+ nokogiri (>= 1.3.3)
50
+ rack (>= 1.0.0)
51
+ rack-test (>= 0.5.4)
52
+ selenium-webdriver (~> 0.2.0)
53
+ xpath (~> 0.1.4)
54
+ childprocess (0.1.9)
55
+ ffi (~> 1.0.6)
56
+ cucumber (0.10.6)
38
57
  builder (>= 2.1.2)
39
- diff-lcs (~> 1.1.2)
40
- gherkin (~> 2.3.2)
41
- json (~> 1.4.6)
42
- term-ansicolor (~> 1.0.5)
43
- daemons (1.1.0)
58
+ diff-lcs (>= 1.1.2)
59
+ gherkin (~> 2.4.0)
60
+ json (>= 1.4.6)
61
+ term-ansicolor (>= 1.0.5)
62
+ cucumber-rails (0.5.2)
63
+ capybara (>= 1.0.0.rc1)
64
+ cucumber (>= 0.10.5)
65
+ nokogiri (>= 1.4.4)
66
+ rack-test (>= 0.5.7)
67
+ daemons (1.1.3)
68
+ database_cleaner (0.6.7)
44
69
  diff-lcs (1.1.2)
45
70
  erubis (2.6.6)
46
71
  abstract (>= 1.0.0)
47
72
  eventmachine (0.12.10)
48
- gherkin (2.3.2)
49
- json (~> 1.4.6)
50
- term-ansicolor (~> 1.0.5)
73
+ ffi (1.0.9)
74
+ gherkin (2.4.0)
75
+ json (>= 1.4.6)
51
76
  i18n (0.5.0)
52
- json (1.4.6)
53
- mail (2.2.12)
77
+ json (1.5.1)
78
+ json_pure (1.5.1)
79
+ mail (2.2.19)
54
80
  activesupport (>= 2.3.6)
55
81
  i18n (>= 0.4.0)
56
82
  mime-types (~> 1.16)
57
83
  treetop (~> 1.4.8)
58
84
  mime-types (1.16)
85
+ nokogiri (1.4.4)
59
86
  polyglot (0.3.1)
60
- rack (1.2.1)
61
- rack-mount (0.6.13)
87
+ rack (1.2.3)
88
+ rack-mount (0.6.14)
62
89
  rack (>= 1.0.0)
63
- rack-test (0.5.6)
90
+ rack-test (0.5.7)
64
91
  rack (>= 1.0)
65
- rails (3.0.3)
66
- actionmailer (= 3.0.3)
67
- actionpack (= 3.0.3)
68
- activerecord (= 3.0.3)
69
- activeresource (= 3.0.3)
70
- activesupport (= 3.0.3)
92
+ rails (3.0.9)
93
+ actionmailer (= 3.0.9)
94
+ actionpack (= 3.0.9)
95
+ activerecord (= 3.0.9)
96
+ activeresource (= 3.0.9)
97
+ activesupport (= 3.0.9)
71
98
  bundler (~> 1.0)
72
- railties (= 3.0.3)
73
- railties (3.0.3)
74
- actionpack (= 3.0.3)
75
- activesupport (= 3.0.3)
99
+ railties (= 3.0.9)
100
+ railties (3.0.9)
101
+ actionpack (= 3.0.9)
102
+ activesupport (= 3.0.9)
76
103
  rake (>= 0.8.7)
104
+ rdoc (~> 3.4)
77
105
  thor (~> 0.14.4)
78
- rake (0.8.7)
79
- rspec (2.3.0)
80
- rspec-core (~> 2.3.0)
81
- rspec-expectations (~> 2.3.0)
82
- rspec-mocks (~> 2.3.0)
83
- rspec-core (2.3.1)
84
- rspec-expectations (2.3.0)
106
+ rake (0.9.2)
107
+ rdoc (3.7)
108
+ rspec (2.6.0)
109
+ rspec-core (~> 2.6.0)
110
+ rspec-expectations (~> 2.6.0)
111
+ rspec-mocks (~> 2.6.0)
112
+ rspec-core (2.6.4)
113
+ rspec-expectations (2.6.0)
85
114
  diff-lcs (~> 1.1.2)
86
- rspec-mocks (2.3.0)
87
- rspec-rails (2.3.1)
115
+ rspec-mocks (2.6.0)
116
+ rspec-rails (2.6.1)
88
117
  actionpack (~> 3.0)
89
118
  activesupport (~> 3.0)
90
119
  railties (~> 3.0)
91
- rspec (~> 2.3.0)
92
- sqlite3-ruby (1.3.2)
120
+ rspec (~> 2.6.0)
121
+ rubyzip (0.9.4)
122
+ selenium-webdriver (0.2.1)
123
+ childprocess (>= 0.1.7)
124
+ ffi (>= 1.0.7)
125
+ json_pure
126
+ rubyzip
127
+ sqlite3 (1.3.3)
128
+ sqlite3-ruby (1.3.3)
129
+ sqlite3 (>= 1.3.3)
93
130
  term-ansicolor (1.0.5)
94
- thin (1.2.7)
131
+ thin (1.2.11)
95
132
  daemons (>= 1.0.9)
96
133
  eventmachine (>= 0.12.6)
97
134
  rack (>= 1.0.0)
98
135
  thor (0.14.6)
99
136
  treetop (1.4.9)
100
137
  polyglot (>= 0.3.1)
101
- tzinfo (0.3.23)
138
+ tzinfo (0.3.29)
139
+ xpath (0.1.4)
140
+ nokogiri (~> 1.3)
102
141
 
103
142
  PLATFORMS
104
143
  ruby
105
144
 
106
145
  DEPENDENCIES
107
- aruba
108
- cucumber
109
- rails (>= 3.0.3)
110
- rake
111
- rspec-rails
146
+ appraisal
147
+ cucumber-rails (~> 0.5.1)
148
+ database_cleaner
149
+ diesel!
150
+ rails (= 3.0.9)
151
+ rspec-rails (~> 2.6.1)
112
152
  sqlite3-ruby
113
153
  thin
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2011 thoughtbot, inc.
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.
@@ -0,0 +1,47 @@
1
+ Diesel
2
+ ======
3
+
4
+ Diesel gives your Rails engines power.
5
+
6
+ It makes it easier to have your Engine provide generators like:
7
+
8
+ * An "install" generator like "rails g clearance:install"
9
+ * A "features" generator like "rails g clearance:features"
10
+ * A "views" generator like "rails g clearance:views"
11
+
12
+ It makes it easier to test your Engine with Cucumber stories like:
13
+
14
+ Scenario: generate a Rails app, run the generates, and run the tests
15
+ When I successfully run `bundle exec rails new testapp`
16
+ And I cd to "testapp"
17
+ And I add the "cucumber-rails" gem
18
+ And I add the "capybara" gem
19
+ And I add the "rspec-rails" gem
20
+ And I add the "database_cleaner" gem
21
+ And I add the "diesel" gem
22
+ And I add the "myengine" gem from this project
23
+ And I reset the Bundler environment variable
24
+ And I run `bundle install --local`
25
+ And I successfully run `bundle exec rails generate cucumber:install`
26
+ And I successfully run `bundle exec rails generate myengine:install`
27
+ And I successfully run `bundle exec rails generate myengine:features`
28
+ And I successfully run `bundle exec rake db:migrate --trace`
29
+ And I successfully run `bundle exec rake --trace`
30
+ Then the output should contain "1 scenario (1 passed)"
31
+ And the output should not contain "Could not find generator"
32
+
33
+ Credits
34
+ -------
35
+
36
+ ![thoughtbot](http://thoughtbot.com/images/tm/logo.png)
37
+
38
+ Diesel is maintained and funded by [thoughtbot, inc](http://thoughtbot.com/community)
39
+
40
+ Thank you to all [the contributors](https://github.com/thoughtbot/diesel/contributors)!
41
+
42
+ The names and logos for thoughtbot are trademarks of thoughtbot, inc.
43
+
44
+ License
45
+ -------
46
+
47
+ Diesel is Copyright © 2011 thoughtbot. It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.
data/Rakefile CHANGED
@@ -3,9 +3,15 @@ require 'bundler/setup'
3
3
  require 'rake'
4
4
  require 'rake/gempackagetask'
5
5
  require 'cucumber/rake/task'
6
+ require 'appraisal'
6
7
 
7
- desc 'Default: run all tests'
8
- task :default => [:cucumber]
8
+ desc 'Default: run cucumber features'
9
+ task :default => [:all]
10
+
11
+ desc 'Test the plugin under all supported Rails versions.'
12
+ task :all => ["appraisal:cleanup", "appraisal:install"] do |t|
13
+ exec('rake appraisal cucumber')
14
+ end
9
15
 
10
16
  Cucumber::Rake::Task.new(:cucumber) do |t|
11
17
  t.fork = true
@@ -1,4 +1,3 @@
1
- @disable-bundler
2
1
  Feature: test a diesel engine using the bootstrapped application
3
2
 
4
3
  Background:
@@ -6,8 +5,8 @@ Feature: test a diesel engine using the bootstrapped application
6
5
  When I cd to "testengine"
7
6
  And I write to "Gemfile" with:
8
7
  """
9
- gem "rspec-rails", "~> 2.3.0"
10
- gem "rails", "~> 3.0.3"
8
+ gem "rspec-rails", "~> 2.6.0"
9
+ gem "rails"
11
10
  gem "sqlite3-ruby"
12
11
  """
13
12
  When I add this library as a dependency
@@ -23,6 +22,8 @@ Feature: test a diesel engine using the bootstrapped application
23
22
  match "/hello", :to => 'example#hello'
24
23
  end
25
24
  """
25
+ When I reset Bundler environment variable
26
+ And I run `bundle install --local`
26
27
 
27
28
  Scenario: use root_url
28
29
  When I write to "spec/controllers/example_controller_spec.rb" with:
@@ -43,7 +44,7 @@ Feature: test a diesel engine using the bootstrapped application
43
44
  end
44
45
  end
45
46
  """
46
- When I run "bundle exec rspec --format documentation spec"
47
+ When I run `bundle exec rspec --format documentation spec`
47
48
  Then it should pass with:
48
49
  """
49
50
  0 failures
@@ -69,7 +70,7 @@ Feature: test a diesel engine using the bootstrapped application
69
70
  end
70
71
  end
71
72
  """
72
- When I run "bundle exec rspec --format documentation spec"
73
+ When I run `bundle exec rspec --format documentation spec`
73
74
  Then it should pass with:
74
75
  """
75
76
  0 failures
@@ -99,7 +100,7 @@ Feature: test a diesel engine using the bootstrapped application
99
100
  """
100
101
  hello
101
102
  """
102
- When I run "bundle exec rspec --format documentation spec"
103
+ When I run `bundle exec rspec --format documentation spec`
103
104
  Then it should pass with:
104
105
  """
105
106
  0 failures
@@ -1,26 +1,18 @@
1
- @disable-bundler
2
1
  Feature: test a diesel engine using cucumber
3
2
 
4
- Scenario: create a disel engine and test using cucumber
3
+ Background:
5
4
  Given a directory named "testengine"
6
5
  When I cd to "testengine"
7
6
  And I write to "Gemfile" with:
8
7
  """
9
- gem "cucumber-rails", "~> 0.3.2"
10
- gem "capybara", "~> 0.4.0"
11
- gem "rails", "~> 3.0.3"
12
- gem "rspec", "~> 1.3.0"
8
+ gem "cucumber-rails"
9
+ gem "rails"
10
+ gem "rspec"
13
11
  gem "sqlite3-ruby"
12
+ gem "formtastic", "~> 1.2.3"
14
13
  """
15
14
  When I add this library as a dependency
16
- When I write to "features/hello.feature" with:
17
- """
18
- Feature: say hello
19
- Scenario: go to the hello page
20
- When I go to /hello
21
- Then I should see "hello!"
22
- """
23
- When I write to "features/step_definitions/hello_steps.rb" with:
15
+ And I write to "features/step_definitions/hello_steps.rb" with:
24
16
  """
25
17
  When /^I go to (\/.+)$/ do |path|
26
18
  visit path
@@ -38,6 +30,24 @@ Feature: test a diesel engine using cucumber
38
30
  require 'capybara/cucumber'
39
31
  require 'capybara/session'
40
32
  """
33
+ When I write to "config/routes.rb" with:
34
+ """
35
+ Rails.application.routes.draw do
36
+ match "/hello", :to => 'example#hello'
37
+ end
38
+ """
39
+ When I reset Bundler environment variable
40
+ And I run `bundle install --local`
41
+
42
+ @slow
43
+ Scenario: create a diesel engine and test using cucumber
44
+ When I write to "features/hello.feature" with:
45
+ """
46
+ Feature: say hello
47
+ Scenario: go to the hello page
48
+ When I go to /hello
49
+ Then I should see "hello!"
50
+ """
41
51
  When I write to "app/controllers/example_controller.rb" with:
42
52
  """
43
53
  class ExampleController < ActionController::Base
@@ -48,17 +58,33 @@ Feature: test a diesel engine using cucumber
48
58
  """
49
59
  When I write to "app/views/example/hello.html.erb" with:
50
60
  """
61
+ <%= semantic_form_for :nothing do |form| -%>
51
62
  hello!
63
+ <% end -%>
52
64
  """
53
- When I write to "config/routes.rb" with:
65
+ When I run `bundle exec cucumber features/hello.feature`
66
+ Then it should pass with:
54
67
  """
55
- Rails.application.routes.draw do
56
- match "/hello", :to => 'example#hello'
68
+ 1 scenario (1 passed)
69
+ """
70
+
71
+ Scenario: create a diesel engine that redirects to the root url
72
+ When I write to "features/hello.feature" with:
73
+ """
74
+ Feature: say hello
75
+ Scenario: redirect from the hello page
76
+ Then I go to /hello
77
+ """
78
+ When I write to "app/controllers/example_controller.rb" with:
79
+ """
80
+ class ExampleController < ActionController::Base
81
+ def hello
82
+ redirect_to root_url
83
+ end
57
84
  end
58
85
  """
59
- When I run "bundle exec cucumber features/hello.feature"
86
+ When I run `bundle exec cucumber features/hello.feature`
60
87
  Then it should pass with:
61
88
  """
62
89
  1 scenario (1 passed)
63
90
  """
64
-
@@ -1,4 +1,3 @@
1
- @disable-bundler
2
1
  Feature: reusable features generator
3
2
 
4
3
  Background:
@@ -65,29 +64,31 @@ Feature: reusable features generator
65
64
  end
66
65
  """
67
66
  When I cd to ".."
68
- And I successfully run "rails new testapp"
67
+ And I successfully run `bundle exec rails new testapp`
69
68
  And I cd to "testapp"
70
69
  And I append to "Gemfile" with:
71
70
  """
72
- gem "cucumber-rails", "~> 0.3.2"
73
- gem "capybara", "~> 0.4.0"
74
- gem "rspec", "~> 1.3.0"
71
+ gem "cucumber-rails", ">= 0.5.1"
72
+ gem "capybara", ">= 1.0.0.beta1"
73
+ gem "rspec"
74
+ gem "database_cleaner", :group => :test
75
75
 
76
76
  """
77
77
  When I add the "testengine" as a diesel engine
78
- And I run "bundle install --local"
79
- And I successfully run "rails generate cucumber:install --trace"
80
- And I successfully run "rails generate testengine:features --trace"
78
+ And I reset Bundler environment variable
79
+ And I run `bundle install --local`
80
+ And I successfully run `bundle exec rails generate cucumber:install --trace`
81
+ And I successfully run `bundle exec rails generate testengine:features --trace`
81
82
 
82
83
  Scenario: copy features into an app from a diesel engine
83
- When I run "bundle exec cucumber -r features features/testengine/examples.feature"
84
+ When I run `bundle exec cucumber -r features features/testengine/examples.feature`
84
85
  Then it should pass with:
85
86
  """
86
87
  1 scenario (1 passed)
87
88
  """
88
89
 
89
90
  Scenario: view generator descriptions from an app with a diesel engine
90
- When I successfully run "rails generate testengine:features -h"
91
+ When I successfully run `bundle exec rails generate testengine:features -h`
91
92
  Then the output should contain:
92
93
  """
93
94
  Copy cucumber feature files for the engine into your application.
@@ -1,4 +1,4 @@
1
- @disable-bundler
1
+ @slow
2
2
  Feature: reusable install generator
3
3
 
4
4
  Background:
@@ -74,20 +74,22 @@ Feature: reusable install generator
74
74
  <% end -%>
75
75
  """
76
76
  When I cd to ".."
77
- And I successfully run "rails new testapp"
77
+ And I successfully run `bundle exec rails new testapp`
78
78
  And I cd to "testapp"
79
79
  And I append to "Gemfile" with:
80
80
  """
81
- gem "cucumber-rails", "~> 0.3.2"
82
- gem "capybara", "~> 0.4.0"
83
- gem "rspec", "~> 1.3.0"
81
+ gem "cucumber-rails"
82
+ gem "capybara"
83
+ gem "rspec"
84
+ gem "database_cleaner"
84
85
 
85
86
  """
86
87
  When I add the "testengine" as a diesel engine
87
- And I run "bundle install --local"
88
- And I successfully run "rails generate cucumber:install --trace"
89
- And I successfully run "rails generate testengine:install --trace"
90
- And I successfully run "rake db:migrate db:schema:dump db:test:prepare --trace"
88
+ And I reset Bundler environment variable
89
+ And I run `bundle install --local`
90
+ And I successfully run `bundle exec rails generate cucumber:install --trace`
91
+ And I successfully run `bundle exec rails generate testengine:install --trace`
92
+ And I successfully run `bundle exec rake db:migrate db:schema:dump db:test:prepare --trace`
91
93
 
92
94
  Scenario: test a generated app with a diesel engine
93
95
  When I write to "features/examples.feature" with:
@@ -97,16 +99,20 @@ Feature: reusable install generator
97
99
  When I go to the examples page
98
100
  Then I should see "Hello there"
99
101
  """
100
- When I run "bundle exec cucumber features/examples.feature"
102
+ When I run `bundle exec cucumber features/examples.feature`
101
103
  Then it should pass with:
102
104
  """
103
105
  1 scenario (1 passed)
104
106
  """
105
107
 
106
108
  Scenario: view generator descriptions from an app with a diesel engine
107
- When I successfully run "rails generate testengine:install -h"
109
+ When I successfully run `bundle exec rails generate testengine:install -h`
108
110
  Then the output should contain:
109
111
  """
110
112
  Generate configuration, migration, and other essential files.
111
113
  """
112
114
 
115
+ Scenario: run the install generator twice
116
+ When I successfully run `bundle exec rails generate testengine:install --trace`
117
+ Then the output should not contain "Another migration is already named"
118
+
@@ -1,6 +1,5 @@
1
- @disable-bundler
2
1
  Feature: integration testing
3
-
2
+ @slow
4
3
  Scenario: test integration of a diesel engine with a generated application
5
4
  Given a directory named "testengine"
6
5
  When I cd to "testengine"
@@ -16,9 +15,10 @@ Feature: integration testing
16
15
  """
17
16
  When I write to "Gemfile" with:
18
17
  """
18
+ gem "rails"
19
19
  gem "cucumber"
20
20
  gem "aruba"
21
- gem "rspec", "~> 1.3.0"
21
+ gem "rspec"
22
22
  """
23
23
  When I add this library as a dependency
24
24
  And I write to "db/migrate/create_examples.rb" with:
@@ -103,28 +103,33 @@ Feature: integration testing
103
103
  """
104
104
  When I write to "features/integration.feature" with:
105
105
  """
106
- @disable-bundler @puts @announce
106
+ @puts @announce
107
107
  Feature: integrate with application
108
108
  Scenario: generate a Rails app, run the generates, and run the tests
109
- When I successfully run "rails new testapp"
109
+ When I successfully run `bundle exec rails new testapp`
110
110
  And I cd to "testapp"
111
111
  And I add the "cucumber-rails" gem
112
112
  And I add the "capybara" gem
113
113
  And I add the "rspec-rails" gem
114
+ And I add the "database_cleaner" gem
114
115
  And I add the "testengine" gem from this project
115
116
  And I add the "diesel" gem from the diesel project
116
- And I run "bundle install --local"
117
- And I successfully run "rails generate cucumber:install"
118
- And I successfully run "rails generate testengine:install"
119
- And I successfully run "rails generate testengine:features"
120
- And I successfully run "rake db:migrate --trace"
121
- And I successfully run "rake --trace"
117
+ And I reset the Bundler environment variable
118
+ And I run `bundle install --local`
119
+ And I successfully run `bundle exec rails generate cucumber:install`
120
+ And I successfully run `bundle exec rails generate testengine:install`
121
+ And I successfully run `bundle exec rails generate testengine:features`
122
+ And I successfully run `bundle exec rake db:migrate --trace`
123
+ And I successfully run `bundle exec rake --trace`
122
124
  Then the output should contain "1 scenario (1 passed)"
123
125
  And the output should not contain "Could not find generator"
124
126
  """
125
127
  When I write to "features/support/env.rb" with:
126
128
  """
127
129
  require "diesel/testing/integration"
130
+ Before do
131
+ @aruba_timeout_seconds = 120
132
+ end
128
133
  """
129
134
  When I write to "features/step_definitions/dependency_steps.rb" with:
130
135
  """
@@ -132,9 +137,16 @@ Feature: integration testing
132
137
  When /^I add the "([^"]*)" gem from the diesel project$/ do |gem_name|
133
138
  append_to_file('Gemfile', %{\ngem "#{gem_name}", :path => "../../../../../.."\n})
134
139
  end
140
+
141
+ When /^I reset the Bundler environment variable$/ do
142
+ %w(RUBYOPT BUNDLE_PATH BUNDLE_BIN_PATH BUNDLE_GEMFILE).each do |key|
143
+ ENV[key] = nil
144
+ end
145
+ end
135
146
  """
136
- When I run "bundle install --local"
137
- And I run "bundle exec cucumber features/integration.feature"
147
+ When I reset Bundler environment variable
148
+ When I run `bundle install --local`
149
+ And I successfully run `bundle exec cucumber features/integration.feature`
138
150
  Then it should pass with:
139
151
  """
140
152
  1 scenario (1 passed)
@@ -1,7 +1,6 @@
1
- @disable-bundler
2
1
  Feature: use Rails rake tasks when developing a diesel application
3
2
 
4
- Scenario: create a disel engine and use Rails rake tasks
3
+ Scenario: create a diesel engine and use Rails rake tasks
5
4
  Given a directory named "testengine"
6
5
  When I cd to "testengine"
7
6
  And I write to "Gemfile" with:
@@ -11,14 +10,14 @@ Feature: use Rails rake tasks when developing a diesel application
11
10
  gem "sqlite3-ruby"
12
11
  """
13
12
  When I add this library as a dependency
14
- And I run "bundle install --local"
13
+ And I run `bundle install --local`
15
14
  And I write to "Rakefile" with:
16
15
  """
17
16
  require 'rubygems'
18
17
  require 'bundler/setup'
19
18
  require 'diesel/tasks'
20
19
  """
21
- When I successfully run "bundle exec diesel generate model post title:string"
20
+ When I successfully run `bundle exec diesel generate model post title:string`
22
21
  And I write to "spec/models/post_spec.rb" with:
23
22
  """
24
23
  ENV["RAILS_ENV"] ||= 'test'
@@ -36,8 +35,8 @@ Feature: use Rails rake tasks when developing a diesel application
36
35
  class Post < ActiveRecord::Base
37
36
  end
38
37
  """
39
- When I successfully run "rake db:create db:migrate db:schema:dump db:test:prepare"
40
- And I run "bundle exec rspec --format documentation spec"
38
+ When I successfully run `bundle exec rake db:create db:migrate db:schema:dump db:test:prepare`
39
+ And I run `bundle exec rspec --format documentation spec`
41
40
  Then it should pass with:
42
41
  """
43
42
  0 failures
@@ -1,13 +1,12 @@
1
- @disable-bundler
2
1
  Feature: test a diesel engine using rspec
3
2
 
4
- Scenario: create a disel engine and test using rspec
3
+ Scenario: create a diesel engine and test using rspec
5
4
  Given a directory named "testengine"
6
5
  When I cd to "testengine"
7
6
  And I write to "Gemfile" with:
8
7
  """
9
- gem "rspec-rails", "~> 2.3.0"
10
- gem "rails", "~> 3.0.3"
8
+ gem "rspec-rails"
9
+ gem "rails"
11
10
  gem "sqlite3-ruby"
12
11
  """
13
12
  When I add this library as a dependency
@@ -43,7 +42,7 @@ Feature: test a diesel engine using rspec
43
42
  match "/hello", :to => 'example#hello'
44
43
  end
45
44
  """
46
- When I run "bundle exec rspec --format documentation spec"
45
+ When I run `bundle exec rspec --format documentation spec`
47
46
  Then it should pass with:
48
47
  """
49
48
  0 failures
@@ -0,0 +1,18 @@
1
+ BUNDLE_ENV_VARS = %w(RUBYOPT BUNDLE_PATH BUNDLE_BIN_PATH BUNDLE_GEMFILE)
2
+ ORIGINAL_BUNDLE_VARS = Hash[ENV.select{ |key,value| BUNDLE_ENV_VARS.include?(key) }]
3
+
4
+ Before do
5
+ ENV['BUNDLE_GEMFILE'] = File.join(Dir.pwd, ENV['BUNDLE_GEMFILE'])
6
+ end
7
+
8
+ After do
9
+ ORIGINAL_BUNDLE_VARS.each_pair do |key, value|
10
+ ENV[key] = value
11
+ end
12
+ end
13
+
14
+ When /^I reset Bundler environment variable$/ do
15
+ BUNDLE_ENV_VARS.each do |key|
16
+ ENV[key] = nil
17
+ end
18
+ end
@@ -1,3 +1,11 @@
1
1
  require 'aruba/cucumber'
2
2
 
3
3
  PROJECT_ROOT = File.expand_path(File.join(File.dirname(__FILE__), "..", ".."))
4
+
5
+ Before do
6
+ @aruba_timeout_seconds = 20
7
+ end
8
+
9
+ Before('@slow') do
10
+ @aruba_timeout_seconds = 180
11
+ end
@@ -1,4 +1,3 @@
1
- @disable-bundler
2
1
  Feature: reusable views generator
3
2
 
4
3
  Background:
@@ -38,17 +37,18 @@ Feature: reusable views generator
38
37
  end
39
38
  """
40
39
  When I cd to ".."
41
- And I successfully run "rails new testapp"
40
+ And I successfully run `bundle exec rails new testapp`
42
41
  And I cd to "testapp"
43
42
  And I add the "testengine" as a diesel engine
44
- And I run "bundle install --local"
43
+ And I reset Bundler environment variable
44
+ And I run `bundle install --local`
45
45
 
46
46
  Scenario: copy views into an app from a diesel engine
47
- When I successfully run "rails generate testengine:views --trace"
47
+ When I successfully run `bundle exec rails generate testengine:views --trace`
48
48
  Then the file "app/views/examples/index.html.erb" should contain "Hello there"
49
49
 
50
50
  Scenario: view generator descriptions from an app with a diesel engine
51
- When I successfully run "rails generate testengine:views -h"
51
+ When I successfully run `bundle exec rails generate testengine:views -h`
52
52
  Then the output should contain:
53
53
  """
54
54
  Copy view files for the engine into your application.
@@ -9,8 +9,11 @@ module Diesel
9
9
  extend ActiveRecord::Generators::Migration
10
10
 
11
11
  def generate_migrations
12
- migrations.each do |migration|
13
- migration_template migration, migration.sub(%r{(db/migrate/)(?:\d+_)?}, '\1')
12
+ migrations.each do |source_file|
13
+ name = migration_name(source_file)
14
+ unless migration_exists?(name)
15
+ migration_template source_file, "db/migrate/#{name}"
16
+ end
14
17
  end
15
18
  end
16
19
 
@@ -24,6 +27,20 @@ module Diesel
24
27
  def migrations
25
28
  files_within_root(".", "db/migrate/*.rb")
26
29
  end
30
+
31
+ def migration_exists?(name)
32
+ existing_migrations.include?(name)
33
+ end
34
+
35
+ def existing_migrations
36
+ @existing_migrations ||= Dir.glob("db/migrate/*.rb").map do |file|
37
+ migration_name(file)
38
+ end
39
+ end
40
+
41
+ def migration_name(file)
42
+ file.sub(%r{^.*(db/migrate/)(?:\d+_)?}, '')
43
+ end
27
44
  end
28
45
  end
29
46
  end
@@ -1,4 +1,5 @@
1
1
  require 'diesel/testing/application'
2
2
 
3
+ Bundler.require
3
4
  Diesel::Testing::Application.initialize!
4
5
 
@@ -1,3 +1,6 @@
1
1
  class ApplicationController < ActionController::Base
2
+ def show
3
+ render :text => "", :layout => 'application'
4
+ end
2
5
  end
3
6
 
@@ -7,11 +7,19 @@ module Diesel
7
7
  class Application < Rails::Application
8
8
  config.encoding = "utf-8"
9
9
  config.action_mailer.default_url_options = { :host => 'localhost' }
10
- config.paths.config.database = "#{APP_ROOT}/config/database.yml"
11
- config.paths.config.routes << "#{APP_ROOT}/config/routes.rb"
12
- config.paths.app.controllers << "#{APP_ROOT}/app/controllers"
13
- config.paths.app.views << "#{APP_ROOT}/app/views"
14
- config.paths.log = "tmp/log"
10
+ if Rails::VERSION::MAJOR >= 3 && Rails::VERSION::MINOR >= 1
11
+ config.paths['config/database'] = "#{APP_ROOT}/config/database.yml"
12
+ config.paths['config/routes'] << "#{APP_ROOT}/config/routes.rb"
13
+ config.paths['app/controllers'] << "#{APP_ROOT}/app/controllers"
14
+ config.paths['app/views'] << "#{APP_ROOT}/app/views"
15
+ config.paths['log'] = "tmp/log/development.log"
16
+ else
17
+ config.paths.config.database = "#{APP_ROOT}/config/database.yml"
18
+ config.paths.config.routes << "#{APP_ROOT}/config/routes.rb"
19
+ config.paths.app.controllers << "#{APP_ROOT}/app/controllers"
20
+ config.paths.app.views << "#{APP_ROOT}/app/views"
21
+ config.paths.log = "tmp/log"
22
+ end
15
23
  config.cache_classes = true
16
24
  config.whiny_nils = true
17
25
  config.consider_all_requests_local = true
@@ -28,7 +36,7 @@ module Diesel
28
36
 
29
37
  def initialize!
30
38
  FileUtils.mkdir_p(Rails.root.join("db").to_s)
31
- super
39
+ super unless @initialized
32
40
  end
33
41
  end
34
42
  end
@@ -8,3 +8,6 @@ When /^I add the "([^"]*)" gem from this project$/ do |gem_name|
8
8
  append_to_file('Gemfile', %{\ngem "#{gem_name}", :path => "../../.."\n})
9
9
  end
10
10
 
11
+ When /^I add the "([^"]*)" gem from git "([^"]*)"(?: on branch "([^"]*)")?$/ do |gem_name, git, branch|
12
+ append_to_file('Gemfile', %{\ngem "#{gem_name}", :git => "#{git}"#{ %{, :branch => "#{branch}"} if branch}})
13
+ end
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: diesel
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 1
9
- - 4
10
- version: 0.1.4
4
+ prerelease:
5
+ version: 0.1.5
11
6
  platform: ruby
12
7
  authors:
13
8
  - thoughtbot, inc.
@@ -16,25 +11,74 @@ autorequire:
16
11
  bindir: bin
17
12
  cert_chain: []
18
13
 
19
- date: 2011-01-11 00:00:00 -05:00
20
- default_executable: diesel
14
+ date: 2011-07-02 00:00:00 Z
21
15
  dependencies:
22
16
  - !ruby/object:Gem::Dependency
17
+ name: railties
18
+ prerelease: false
19
+ requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: "0"
23
25
  type: :runtime
26
+ version_requirements: *id001
27
+ - !ruby/object:Gem::Dependency
28
+ name: cucumber-rails
24
29
  prerelease: false
25
- name: railties
26
- version_requirements: &id001 !ruby/object:Gem::Requirement
30
+ requirement: &id002 !ruby/object:Gem::Requirement
27
31
  none: false
28
32
  requirements:
29
33
  - - ~>
30
34
  - !ruby/object:Gem::Version
31
- hash: 1
32
- segments:
33
- - 3
34
- - 0
35
- - 3
36
- version: 3.0.3
37
- requirement: *id001
35
+ version: 0.5.1
36
+ type: :development
37
+ version_requirements: *id002
38
+ - !ruby/object:Gem::Dependency
39
+ name: appraisal
40
+ prerelease: false
41
+ requirement: &id003 !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: "0"
47
+ type: :development
48
+ version_requirements: *id003
49
+ - !ruby/object:Gem::Dependency
50
+ name: rspec-rails
51
+ prerelease: false
52
+ requirement: &id004 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ~>
56
+ - !ruby/object:Gem::Version
57
+ version: 2.6.1
58
+ type: :development
59
+ version_requirements: *id004
60
+ - !ruby/object:Gem::Dependency
61
+ name: thin
62
+ prerelease: false
63
+ requirement: &id005 !ruby/object:Gem::Requirement
64
+ none: false
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: "0"
69
+ type: :development
70
+ version_requirements: *id005
71
+ - !ruby/object:Gem::Dependency
72
+ name: sqlite3-ruby
73
+ prerelease: false
74
+ requirement: &id006 !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: "0"
80
+ type: :development
81
+ version_requirements: *id006
38
82
  description: Develop your Rails engines like you develop your Rails applications.
39
83
  email: support@thoughtbot.com
40
84
  executables:
@@ -44,9 +88,12 @@ extensions: []
44
88
  extra_rdoc_files: []
45
89
 
46
90
  files:
91
+ - Appraisals
47
92
  - Gemfile
48
93
  - Gemfile.lock
94
+ - MIT-LICENSE
49
95
  - Rakefile
96
+ - README.md
50
97
  - lib/diesel/commands.rb
51
98
  - lib/diesel/generators/base.rb
52
99
  - lib/diesel/generators/features_base.rb
@@ -68,10 +115,10 @@ files:
68
115
  - features/rails_rake_tasks_and_generators.feature
69
116
  - features/rspec_testing.feature
70
117
  - features/step_definitions/diesel_steps.rb
118
+ - features/support/appraisal.rb
71
119
  - features/support/env.rb
72
120
  - features/views_generator.feature
73
121
  - bin/diesel
74
- has_rdoc: false
75
122
  homepage: http://github.com/thoughtbot/diesel
76
123
  licenses: []
77
124
 
@@ -85,23 +132,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
85
132
  requirements:
86
133
  - - ">="
87
134
  - !ruby/object:Gem::Version
88
- hash: 3
89
- segments:
90
- - 0
91
135
  version: "0"
92
136
  required_rubygems_version: !ruby/object:Gem::Requirement
93
137
  none: false
94
138
  requirements:
95
139
  - - ">="
96
140
  - !ruby/object:Gem::Version
97
- hash: 3
98
- segments:
99
- - 0
100
141
  version: "0"
101
142
  requirements: []
102
143
 
103
144
  rubyforge_project:
104
- rubygems_version: 1.3.7
145
+ rubygems_version: 1.7.2
105
146
  signing_key:
106
147
  specification_version: 3
107
148
  summary: Diesel makes your engine go.
@@ -114,5 +155,6 @@ test_files:
114
155
  - features/rails_rake_tasks_and_generators.feature
115
156
  - features/rspec_testing.feature
116
157
  - features/step_definitions/diesel_steps.rb
158
+ - features/support/appraisal.rb
117
159
  - features/support/env.rb
118
160
  - features/views_generator.feature