jeweler 1.4.0 → 1.5.0.pre2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. data/.document +14 -0
  2. data/.gitignore +13 -2
  3. data/ChangeLog.markdown +8 -8
  4. data/Gemfile +21 -0
  5. data/Gemfile.lock +57 -0
  6. data/README.markdown +6 -6
  7. data/Rakefile +32 -46
  8. data/features/generator/cucumber.feature +20 -0
  9. data/features/generator/directory_layout.feature +10 -0
  10. data/features/generator/gemfile.feature +71 -0
  11. data/features/generator/git.feature +8 -0
  12. data/features/generator/license.feature +11 -2
  13. data/features/generator/rakefile.feature +25 -23
  14. data/features/generator/test.feature +6 -0
  15. data/features/generator/test_helper.feature +107 -11
  16. data/features/step_definitions/filesystem_steps.rb +5 -3
  17. data/features/step_definitions/generator_steps.rb +68 -4
  18. data/features/support/env.rb +26 -13
  19. data/jeweler.gemspec +222 -207
  20. data/lib/jeweler.rb +7 -5
  21. data/lib/jeweler/commands.rb +1 -3
  22. data/lib/jeweler/commands/check_dependencies.rb +3 -5
  23. data/lib/jeweler/commands/install_gem.rb +1 -2
  24. data/lib/jeweler/commands/release_to_git.rb +5 -3
  25. data/lib/jeweler/commands/release_to_github.rb +24 -8
  26. data/lib/jeweler/commands/{release_to_gemcutter.rb → release_to_rubygems.rb} +1 -2
  27. data/lib/jeweler/commands/version/base.rb +16 -2
  28. data/lib/jeweler/commands/write_gemspec.rb +0 -1
  29. data/lib/jeweler/errors.rb +4 -16
  30. data/lib/jeweler/gemcutter_tasks.rb +4 -32
  31. data/lib/jeweler/gemspec_helper.rb +3 -6
  32. data/lib/jeweler/generator.rb +23 -6
  33. data/lib/jeweler/generator/options.rb +17 -14
  34. data/lib/jeweler/generator/rspec_mixin.rb +1 -1
  35. data/lib/jeweler/generator/shindo_mixin.rb +44 -0
  36. data/lib/jeweler/generator/shoulda_mixin.rb +1 -1
  37. data/lib/jeweler/rubyforge_tasks.rb +5 -29
  38. data/lib/jeweler/rubygems_dot_org_tasks.rb +38 -0
  39. data/lib/jeweler/rubygems_tasks.rb +38 -0
  40. data/lib/jeweler/specification.rb +36 -12
  41. data/lib/jeweler/tasks.rb +49 -13
  42. data/lib/jeweler/templates/.document +6 -0
  43. data/lib/jeweler/templates/.gitignore +34 -16
  44. data/lib/jeweler/templates/Gemfile +12 -0
  45. data/lib/jeweler/templates/LICENSE +1 -1
  46. data/lib/jeweler/templates/Rakefile +1 -0
  47. data/lib/jeweler/templates/bacon/helper.rb +1 -0
  48. data/lib/jeweler/templates/bundler_setup.erb +10 -0
  49. data/lib/jeweler/templates/features/support/env.rb +2 -0
  50. data/lib/jeweler/templates/jeweler_tasks.erb +20 -23
  51. data/lib/jeweler/templates/micronaut/helper.rb +1 -0
  52. data/lib/jeweler/templates/minitest/helper.rb +1 -0
  53. data/lib/jeweler/templates/other_tasks.erb +27 -59
  54. data/lib/jeweler/templates/riot/helper.rb +1 -0
  55. data/lib/jeweler/templates/rspec/{spec.opts → .rspec} +0 -0
  56. data/lib/jeweler/templates/rspec/helper.rb +7 -3
  57. data/lib/jeweler/templates/shindo/flunking.rb +8 -0
  58. data/lib/jeweler/templates/shindo/helper.rb +6 -0
  59. data/lib/jeweler/templates/shoulda/helper.rb +1 -0
  60. data/lib/jeweler/templates/testunit/helper.rb +1 -0
  61. data/lib/jeweler/version.rb +10 -0
  62. data/lib/jeweler/version_helper.rb +1 -2
  63. data/test/fixtures/existing-project-with-version-constant/Rakefile +4 -2
  64. data/test/fixtures/existing-project-with-version-plaintext/Rakefile +4 -2
  65. data/test/fixtures/existing-project-with-version-yaml/Rakefile +4 -2
  66. data/test/jeweler/commands/test_install_gem.rb +2 -2
  67. data/test/jeweler/commands/test_release_to_gemcutter.rb +4 -4
  68. data/test/jeweler/commands/test_release_to_git.rb +32 -25
  69. data/test/jeweler/commands/test_release_to_github.rb +108 -25
  70. data/test/jeweler/generator/test_options.rb +16 -22
  71. data/test/jeweler/test_generator.rb +5 -0
  72. data/test/jeweler/test_specification.rb +18 -7
  73. data/test/jeweler/test_tasks.rb +1 -1
  74. data/test/test_helper.rb +12 -14
  75. data/test/test_jeweler.rb +0 -12
  76. metadata +159 -66
  77. data/VERSION.yml +0 -5
  78. data/lib/jeweler/commands/release_to_rubyforge.rb +0 -52
  79. data/lib/jeweler/commands/setup_rubyforge.rb +0 -63
  80. data/test/jeweler/commands/test_release_to_rubyforge.rb +0 -153
  81. data/test/jeweler/commands/test_setup_rubyforge.rb +0 -178
@@ -92,3 +92,11 @@ Feature: git support
92
92
  Then 'features/the-perfect-gem.feature' was checked in
93
93
  And 'features/support/env.rb' was checked in
94
94
  And 'features/step_definitions/the-perfect-gem_steps.rb' was checked in
95
+
96
+ Scenario: shindo
97
+ Given a working directory
98
+ And I have configured git sanely
99
+ When I generate a shindo project named 'the-perfect-gem' that is 'zomg, so good'
100
+
101
+ Then 'tests/tests_helper.rb' was checked in
102
+ And 'tests/the-perfect-gem_tests.rb' was checked in
@@ -3,9 +3,18 @@ Feature: generated license
3
3
  A user should be able to
4
4
  generate a default license
5
5
 
6
- Scenario: copyright
6
+ Background:
7
7
  Given a working directory
8
+
9
+ Scenario: crediting user
10
+ Given I have configured git sanely
11
+ When I generate a project named 'the-perfect-gem' that is 'zomg, so good'
12
+
13
+ Then LICENSE credits 'foo'
14
+
15
+ Scenario: copyright in the current year
16
+ Given it is the year 2005
8
17
  And I have configured git sanely
9
18
  When I generate a project named 'the-perfect-gem' that is 'zomg, so good'
10
19
 
11
- Then LICENSE has the copyright as belonging to 'foo' in '2009'
20
+ Then LICENSE has a copyright in the year 2005
@@ -10,7 +10,9 @@ Feature: generated Rakefile
10
10
  Scenario: shared
11
11
  When I generate a project named 'the-perfect-gem' that is 'zomg, so good' and described as 'Descriptive'
12
12
 
13
- Then 'Rakefile' requires 'rubygems'
13
+ Then 'Rakefile' requires 'bundler'
14
+ And 'Rakefile' sets up bundler using the default and development groups
15
+ And 'Rakefile' requires 'rubygems'
14
16
  And 'Rakefile' requires 'rake'
15
17
  And 'Rakefile' requires 'rake/rdoctask'
16
18
  And Rakefile has 'the-perfect-gem' for the Jeweler::Tasks name
@@ -18,11 +20,10 @@ Feature: generated Rakefile
18
20
  And Rakefile has 'zomg, so good' for the Jeweler::Tasks summary
19
21
  And Rakefile has 'Descriptive' for the Jeweler::Tasks description
20
22
  And Rakefile has 'http://github.com/technicalpickles/the-perfect-gem' for the Jeweler::Tasks homepage
23
+ And Rakefile instantiates a Jeweler::GemcutterTasks
21
24
 
22
25
  Scenario: bacon
23
26
  When I generate a bacon project named 'the-perfect-gem' that is 'zomg, so good'
24
-
25
-
26
27
  Then 'Rakefile' requires 'rcov/rcovtask'
27
28
  And Rakefile has 'spec/**/*_spec.rb' for the Rake::TestTask pattern
28
29
  And Rakefile has 'spec/**/*_spec.rb' for the Rcov::RcovTask pattern
@@ -38,11 +39,13 @@ Feature: generated Rakefile
38
39
  And Rakefile has 'test' in the Rcov::RcovTask libs
39
40
  And Rakefile has "test" as the default task
40
41
 
42
+ @rspec
41
43
  Scenario: rspec
42
44
  When I generate a rspec project named 'the-perfect-gem' that is 'zomg, so good'
43
45
 
44
- Then 'Rakefile' requires 'spec/rake/spectask'
45
- And Rakefile has 'spec/**/*_spec.rb' for the Spec::Rake::SpecTask pattern
46
+ Then 'Rakefile' requires 'rspec/core'
47
+ And 'Rakefile' requires 'rspec/core/rake_task'
48
+ And Rakefile has 'spec/**/*_spec.rb' for the RSpec::Core::RakeTask pattern
46
49
  And Rakefile has "spec" as the default task
47
50
 
48
51
  Scenario: shoulda
@@ -113,11 +116,6 @@ Feature: generated Rakefile
113
116
  When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good'
114
117
  Then Rakefile does not instantiate a Jeweler::RubyforgeTasks
115
118
 
116
- Scenario: rubyforge
117
- Given I want rubyforge setup
118
- When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good'
119
- Then Rakefile instantiates a Jeweler::RubyforgeTasks
120
-
121
119
  Scenario: yard
122
120
  Given I want to use yard instead of rdoc
123
121
  When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good'
@@ -135,17 +133,21 @@ Feature: generated Rakefile
135
133
  And Rakefile does not instantiate a YARD::Rake::YardocTask
136
134
  And Rakefile instantiates a Rake::RDocTask.new
137
135
 
138
- Scenario: rubyforge and yard
139
- Given I want to use yard instead of rdoc
140
- And I want rubyforge setup
141
- When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good'
142
- Then Rakefile instantiates a Jeweler::RubyforgeTasks
143
- And Rakefile has 'yardoc' for the Jeweler::RubyforgeTasks doc_task
136
+ Scenario: shindo
137
+ When I generate a shindo project named 'the-perfect-gem' that is 'zomg, so good'
138
+ And 'Rakefile' requires 'shindo/rake'
139
+ And Rakefile instantiates a Shindo::Rake.new
140
+ And Rakefile has "tests" as the default task
144
141
 
145
- Scenario: rubyfoge and doc
146
- Given I want to use rdoc instead of yard
147
- And I want rubyforge setup
148
- And I want rubyforge setup
149
- When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good'
150
- Then Rakefile instantiates a Jeweler::RubyforgeTasks
151
- And Rakefile has 'rdoc' for the Jeweler::RubyforgeTasks doc_task
142
+
143
+ Scenario: bundler
144
+ Given I want bundler
145
+ When I generate a project named 'the-perfect-gem' that is 'zomg, so good' and described as 'Descriptive'
146
+ Then 'Rakefile' requires 'bundler'
147
+ And 'Rakefile' sets up bundler using the default and development groups
148
+
149
+ Scenario: no bundler
150
+ Given I do not want bundler
151
+ When I generate a project named 'the-perfect-gem' that is 'zomg, so good' and described as 'Descriptive'
152
+ Then 'Rakefile' does not require 'bundler'
153
+ And 'Rakefile' does not setup bundler
@@ -46,3 +46,9 @@ Feature: generated test or spec
46
46
  When I generate a riot project named 'the-perfect-gem' that is 'zomg, so good'
47
47
  Then 'test/the-perfect-gem_test.rb' should contextualize 'the-perfect-gem'
48
48
  And 'test/the-perfect-gem_test.rb' requires 'teststrap'
49
+
50
+ Scenario: shindo
51
+ Given a working directory
52
+ And I have configured git sanely
53
+ When I generate a shindo project named 'the-perfect-gem' that is 'zomg, so good'
54
+ Then 'tests/the-perfect-gem_tests.rb' should have tests for 'ThePerfectGem'
@@ -3,54 +3,150 @@ Feature: generated test or spec
3
3
  A user should be able to
4
4
  generate a test or spec
5
5
 
6
- Scenario: bacon
6
+ Scenario: bacon w/ bundler
7
7
  Given a working directory
8
8
  And I have configured git sanely
9
+ And I want bundler
9
10
  When I generate a bacon project named 'the-perfect-gem' that is 'zomg, so good'
10
- Then 'spec/spec_helper.rb' requires 'bacon'
11
+ Then 'spec/spec_helper.rb' requires 'bundler'
12
+ And 'spec/spec_helper.rb' sets up bundler using the default and development groups
13
+ And 'spec/spec_helper.rb' requires 'bacon'
11
14
  And 'spec/spec_helper.rb' requires 'the-perfect-gem'
12
15
 
13
- Scenario: minitest
16
+ Scenario: bacon w/o bundler
14
17
  Given a working directory
15
18
  And I have configured git sanely
19
+ And I do not want bundler
20
+ When I generate a bacon project named 'the-perfect-gem' that is 'zomg, so good'
21
+ Then 'spec/spec_helper.rb' does not require 'bundler'
22
+ And 'spec/spec_helper.rb' does not setup bundler
23
+
24
+ Scenario: minitest w/ bundler
25
+ Given a working directory
26
+ And I have configured git sanely
27
+ And I want bundler
16
28
  When I generate a minitest project named 'the-perfect-gem' that is 'zomg, so good'
17
- Then 'test/helper.rb' requires 'minitest/unit'
29
+ Then 'test/helper.rb' requires 'bundler'
30
+ And 'test/helper.rb' sets up bundler using the default and development groups
31
+ And 'test/helper.rb' requires 'minitest/unit'
18
32
  And 'test/helper.rb' requires 'the-perfect-gem'
19
33
  And 'test/helper.rb' should autorun tests
20
34
 
21
- Scenario: rspec
35
+ Scenario: minitest w/o bundler
22
36
  Given a working directory
23
37
  And I have configured git sanely
38
+ And I do not want bundler
39
+ When I generate a minitest project named 'the-perfect-gem' that is 'zomg, so good'
40
+ Then 'test/helper.rb' does not require 'bundler'
41
+ And 'test/helper.rb' does not setup bundler
42
+
43
+ Scenario: rspec w/ bundler
44
+ Given a working directory
45
+ And I have configured git sanely
46
+ And I want bundler
24
47
  When I generate a rspec project named 'the-perfect-gem' that is 'zomg, so good'
25
- Then 'spec/spec_helper.rb' requires 'spec'
48
+ Then 'spec/spec_helper.rb' requires 'bundler'
49
+ And 'spec/spec_helper.rb' sets up bundler using the default and development groups
50
+ And 'spec/spec_helper.rb' requires 'rspec'
51
+ And 'spec/spec_helper.rb' requires 'rspec/autorun'
26
52
  And 'spec/spec_helper.rb' requires 'the-perfect-gem'
27
53
 
28
- Scenario: shoulda
54
+ Scenario: rspec w/o bundler
55
+ Given a working directory
56
+ And I have configured git sanely
57
+ And I do not want bundler
58
+ When I generate a rspec project named 'the-perfect-gem' that is 'zomg, so good'
59
+ Then 'spec/spec_helper.rb' does not require 'bundler'
60
+ And 'spec/spec_helper.rb' does not setup bundler
61
+
62
+ Scenario: shoulda w/ bundler
29
63
  Given a working directory
30
64
  And I have configured git sanely
65
+ And I want bundler
31
66
  When I generate a shoulda project named 'the-perfect-gem' that is 'zomg, so good'
32
- Then 'test/helper.rb' requires 'test/unit'
67
+ Then 'test/helper.rb' requires 'bundler'
68
+ And 'test/helper.rb' sets up bundler using the default and development groups
69
+ And 'test/helper.rb' requires 'test/unit'
33
70
  And 'test/helper.rb' requires 'shoulda'
34
71
  And 'test/helper.rb' requires 'the-perfect-gem'
35
72
 
36
- Scenario: testunit
73
+ Scenario: shoulda w/o bundler
37
74
  Given a working directory
38
75
  And I have configured git sanely
76
+ And I do not want bundler
77
+ When I generate a shoulda project named 'the-perfect-gem' that is 'zomg, so good'
78
+ And 'test/helper.rb' does not require 'bundler'
79
+ And 'test/helper.rb' does not setup bundler
80
+
81
+ Scenario: testunit w/ bundler
82
+ Given a working directory
83
+ And I have configured git sanely
84
+ And I want bundler
39
85
  When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good'
40
86
  Then 'test/helper.rb' requires 'test/unit'
41
87
  And 'test/helper.rb' requires 'the-perfect-gem'
88
+ And 'test/helper.rb' requires 'bundler'
89
+ And 'test/helper.rb' sets up bundler using the default and development groups
42
90
 
43
- Scenario: micronaut
91
+ Scenario: testunit w/o bundler
44
92
  Given a working directory
45
93
  And I have configured git sanely
94
+ And I do not want bundler
95
+ When I generate a testunit project named 'the-perfect-gem' that is 'zomg, so good'
96
+ And 'test/helper.rb' does not require 'bundler'
97
+ And 'test/helper.rb' does not setup bundler
98
+
99
+ Scenario: micronaut w/ bundler
100
+ Given a working directory
101
+ And I have configured git sanely
102
+ And I want bundler
46
103
  When I generate a micronaut project named 'the-perfect-gem' that is 'zomg, so good'
47
104
  Then 'examples/example_helper.rb' requires 'rubygems'
48
105
  Then 'examples/example_helper.rb' requires 'micronaut'
49
106
  Then 'examples/example_helper.rb' requires 'the-perfect-gem'
107
+ And 'examples/example_helper.rb' requires 'bundler'
108
+ And 'examples/example_helper.rb' sets up bundler using the default and development groups
50
109
 
51
- Scenario: riot
110
+ Scenario: micronaut w/o bundler
111
+ Given a working directory
112
+ And I have configured git sanely
113
+ And I do not want bundler
114
+ When I generate a micronaut project named 'the-perfect-gem' that is 'zomg, so good'
115
+ And 'examples/example_helper.rb' does not require 'bundler'
116
+ And 'examples/example_helper.rb' does not setup bundler
117
+
118
+ Scenario: riot w/ bundler
52
119
  Given a working directory
53
120
  And I have configured git sanely
121
+ And I want bundler
54
122
  When I generate a riot project named 'the-perfect-gem' that is 'zomg, so good'
55
123
  Then 'test/teststrap.rb' requires 'riot'
56
124
  And 'test/teststrap.rb' requires 'the-perfect-gem'
125
+ And 'test/teststrap.rb' requires 'bundler'
126
+ And 'test/teststrap.rb' sets up bundler using the default and development groups
127
+
128
+ Scenario: riot w/o bundler
129
+ Given a working directory
130
+ And I have configured git sanely
131
+ And I do not want bundler
132
+ When I generate a riot project named 'the-perfect-gem' that is 'zomg, so good'
133
+ And 'test/teststrap.rb' does not require 'bundler'
134
+ And 'test/teststrap.rb' does not setup bundler
135
+
136
+ Scenario: shindo w/ bundler
137
+ Given a working directory
138
+ And I have configured git sanely
139
+ And I want bundler
140
+ When I generate a shindo project named 'the-perfect-gem' that is 'zomg, so good'
141
+ Then 'tests/tests_helper.rb' requires 'the-perfect-gem'
142
+ Then 'tests/tests_helper.rb' requires 'shindo'
143
+ Then 'tests/tests_helper.rb' requires 'bundler'
144
+ And 'tests/tests_helper.rb' sets up bundler using the default and development groups
145
+
146
+ Scenario: shindo w/o bundler
147
+ Given a working directory
148
+ And I have configured git sanely
149
+ And I do not want bundler
150
+ When I generate a shindo project named 'the-perfect-gem' that is 'zomg, so good'
151
+ Then 'tests/tests_helper.rb' does not require 'bundler'
152
+ And 'tests/tests_helper.rb' does not setup bundler
@@ -1,7 +1,9 @@
1
1
  Given 'a working directory' do
2
- @working_dir = File.expand_path File.join(File.dirname(__FILE__), '..', '..', 'tmp')
3
- FileUtils.rm_rf @working_dir
4
- FileUtils.mkdir_p @working_dir
2
+ @working_dir = create_construct
3
+ end
4
+
5
+ After do
6
+ @working_dir.destroy! if @working_dir
5
7
  end
6
8
 
7
9
  Given /^I use the jeweler command to generate the "([^"]+)" project in the working directory$/ do |name|
@@ -14,6 +14,15 @@ Given /^I want reek$/ do
14
14
  @use_reek = true
15
15
  end
16
16
 
17
+ Given /^I do not want bundler$/ do
18
+ @use_bundler = false
19
+ end
20
+
21
+
22
+ Given /^I want bundler$/ do
23
+ @use_bundler = true
24
+ end
25
+
17
26
  Given /^I do not want roodi$/ do
18
27
  @use_roodi = false
19
28
  end
@@ -86,9 +95,15 @@ When /^I generate a (.*)project named '((?:\w|-|_)+)' that is '([^']*)' and desc
86
95
  @use_rubyforge ? '--rubyforge' : nil,
87
96
  @use_roodi ? '--roodi' : nil,
88
97
  @use_reek ? '--reek' : nil,
98
+ case @use_bundler
99
+ when true then '--bundler'
100
+ when false then '--no-bundler'
101
+ else nil
102
+ end,
89
103
  @documentation_framework ? "--#{@documentation_framework}" : nil,
90
104
  @name].compact
91
105
 
106
+
92
107
  @stdout = OutputCatcher.catch_out do
93
108
  Jeweler::Generator::Application.run! *arguments
94
109
  end
@@ -170,16 +185,25 @@ Then /^'(.*)' mentions copyright belonging to me in the current year$/ do |file|
170
185
  end
171
186
 
172
187
 
173
- Then /^LICENSE has the copyright as belonging to '(.*)' in '(\d{4})'$/ do |copyright_holder, year|
188
+ Then /^LICENSE credits '(.*)'$/ do |copyright_holder|
174
189
  Then "a file named 'the-perfect-gem/LICENSE' is created"
175
-
176
190
  @license_content ||= File.read(File.join(@working_dir, @name, 'LICENSE'))
177
-
178
191
  assert_match copyright_holder, @license_content
192
+ end
179
193
 
194
+ Given /^it is the year (\d+)$/ do |year|
195
+ time = Time.local(year.to_i, 9, 1, 10, 5, 0)
196
+ Timecop.travel(time)
197
+ end
198
+
199
+
200
+ Then /^LICENSE has a copyright in the year (\d+)$/ do |year|
201
+ Then "a file named 'the-perfect-gem/LICENSE' is created"
202
+ @license_content ||= File.read(File.join(@working_dir, @name, 'LICENSE'))
180
203
  assert_match year, @license_content
181
204
  end
182
205
 
206
+
183
207
  Then /^'(.*)' should define '(.*)' as a subclass of '(.*)'$/ do |file, class_name, superclass_name|
184
208
  @test_content = File.read((File.join(@working_dir, @name, file)))
185
209
 
@@ -198,6 +222,12 @@ Then /^'(.*)' should contextualize '(.*)'$/ do |file, describe_name|
198
222
  assert_match %Q{context "#{describe_name}" do}, @spec_content
199
223
  end
200
224
 
225
+ Then /^'(.*)' should have tests for '(.*)'$/ do |file, describe_name|
226
+ @tests_content ||= File.read((File.join(@working_dir, @name, file)))
227
+
228
+ assert_match %Q{Shindo.tests("#{describe_name}") do}, @tests_content
229
+ end
230
+
201
231
  Then /^'(.*)' requires '(.*)'$/ do |file, lib|
202
232
  content = File.read(File.join(@working_dir, @name, file))
203
233
 
@@ -287,5 +317,39 @@ end
287
317
 
288
318
  After do
289
319
  ENV['JEWELER_OPTS'] = nil
290
- FileUtils.rm_rf @working_dir if @working_dir
291
320
  end
321
+
322
+ Then /^'Gemfile' has a (\w+) dependency on '(.*)'$/ do |group, name|
323
+ @gemfile_content ||= File.read(File.join(@working_dir, @name, 'Gemfile'))
324
+
325
+ group_block = yank_group_info(@gemfile_content, group)
326
+
327
+ assert_match name, group_block
328
+ end
329
+
330
+ Then /^'Gemfile' has a development dependency on the current version of jeweler$/ do
331
+ @gemfile_content ||= File.read(File.join(@working_dir, @name, 'Gemfile'))
332
+ group_block = yank_group_info(@gemfile_content, 'development')
333
+
334
+ assert_match %Q{gem "jeweler", "~> #{Jeweler::Version::STRING}"}, group_block
335
+ end
336
+
337
+
338
+ Then /^'(.*)' sets up bundler using the default and development groups$/ do |file|
339
+ content = File.read(File.join(@working_dir, @name, file))
340
+
341
+ assert_match "Bundler.setup(:default, :development)", content
342
+ end
343
+
344
+ Then /^'(.*)' does not setup bundler$/ do |file|
345
+ content = File.read(File.join(@working_dir, @name, file))
346
+
347
+ assert_no_match /Bundler\.setup/, content
348
+ end
349
+
350
+ Then /^'Gemfile' uses the (.*) source$/ do |source|
351
+ content = File.read(File.join(@working_dir, @name, 'Gemfile'))
352
+
353
+ assert_match "source :#{source}", content
354
+ end
355
+
@@ -1,29 +1,42 @@
1
- $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
2
- require 'jeweler'
3
-
1
+ require 'bundler'
4
2
  begin
5
- require 'mocha'
6
- require 'output_catcher'
7
- rescue LoadError => e
8
- puts "*" * 80
9
- puts "Some dependencies needed to run tests were missing. Run the following command to find them:"
10
- puts
11
- puts "\trake check_dependencies:development"
12
- puts "*" * 80
13
- exit 1
3
+ Bundler.setup(:default, :development)
4
+ rescue Bundler::BundlerError => e
5
+ $stderr.puts e.message
6
+ $stderr.puts "Run `bundle install` to install missing gems"
7
+ exit e.status_code
14
8
  end
15
9
 
10
+ $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
11
+ require 'jeweler'
12
+ require 'mocha'
13
+ require 'output_catcher'
14
+ require 'timecop'
15
+ require 'ruby-debug'
16
+ require 'active_support'
16
17
 
17
18
  require 'test/unit/assertions'
18
-
19
19
  World(Test::Unit::Assertions)
20
20
 
21
+ require 'construct'
22
+ World(Construct::Helpers)
23
+
21
24
  def yank_task_info(content, task)
22
25
  if content =~ /#{Regexp.escape(task)}.new(\(.*\))? do \|(.*?)\|(.*?)end/m
23
26
  [$2, $3]
24
27
  end
25
28
  end
26
29
 
30
+ def yank_group_info(content, group)
31
+ if content =~ /group :#{group} do(.*?)end/m
32
+ $1
33
+ end
34
+ end
35
+
27
36
  def fixture_dir
28
37
  File.expand_path File.join(File.dirname(__FILE__), '..', '..', 'test', 'fixtures')
29
38
  end
39
+
40
+ After do
41
+ Timecop.return
42
+ end