jeweler 0.11.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +7 -0
- data/README.markdown +6 -4
- data/ROADMAP +12 -0
- data/Rakefile +15 -3
- data/VERSION.yml +3 -3
- data/features/generator/cucumber.feature +83 -0
- data/features/generator/directory_layout.feature +76 -0
- data/features/generator/dotdocument.feature +14 -0
- data/features/generator/env_options.feature +9 -0
- data/features/generator/git.feature +94 -0
- data/features/generator/license.feature +11 -0
- data/features/generator/rakefile.feature +110 -0
- data/features/generator/readme.feature +12 -0
- data/features/generator/test.feature +41 -0
- data/features/generator/test_helper.feature +49 -0
- data/features/placeholder.feature +5 -0
- data/features/step_definitions/debug_steps.rb +6 -0
- data/features/step_definitions/filesystem_steps.rb +65 -0
- data/features/step_definitions/generator_steps.rb +251 -0
- data/features/step_definitions/task_steps.rb +6 -0
- data/features/support/env.rb +19 -0
- data/features/tasks/build_gem.feature +9 -0
- data/features/tasks/version.feature +24 -0
- data/features/tasks/version_bumping.feature +33 -0
- data/jeweler.gemspec +204 -0
- data/lib/jeweler/commands/release.rb +35 -11
- data/lib/jeweler/commands/version/base.rb +1 -1
- data/lib/jeweler/gemspec_helper.rb +4 -6
- data/lib/jeweler/generator.rb +12 -6
- data/lib/jeweler/rubyforge_tasks.rb +46 -0
- data/lib/jeweler/specification.rb +3 -2
- data/lib/jeweler/tasks.rb +32 -26
- data/lib/jeweler/templates/Rakefile +4 -27
- data/lib/jeweler/templates/rspec/flunking.rb +1 -1
- data/lib/jeweler/version_helper.rb +78 -33
- data/lib/jeweler.rb +5 -0
- data/test/fixtures/existing-project-with-version-plaintext/.document +5 -0
- data/test/fixtures/existing-project-with-version-plaintext/.gitignore +5 -0
- data/test/fixtures/{existing-project-with-version → existing-project-with-version-plaintext}/LICENSE +0 -0
- data/test/fixtures/{existing-project-with-version → existing-project-with-version-plaintext}/README.rdoc +0 -0
- data/test/fixtures/{existing-project-with-version → existing-project-with-version-plaintext}/Rakefile +0 -0
- data/test/fixtures/existing-project-with-version-plaintext/VERSION +1 -0
- data/test/fixtures/{existing-project-with-version → existing-project-with-version-plaintext}/existing-project-with-version.gemspec +0 -0
- data/test/fixtures/{existing-project-with-version → existing-project-with-version-plaintext}/lib/existing_project_with_version.rb +0 -0
- data/test/fixtures/{existing-project-with-version → existing-project-with-version-plaintext}/test/existing_project_with_version_test.rb +0 -0
- data/test/fixtures/{existing-project-with-version → existing-project-with-version-plaintext}/test/test_helper.rb +0 -0
- data/test/fixtures/existing-project-with-version-yaml/.document +5 -0
- data/test/fixtures/existing-project-with-version-yaml/.gitignore +5 -0
- data/test/fixtures/existing-project-with-version-yaml/LICENSE +20 -0
- data/test/fixtures/existing-project-with-version-yaml/README.rdoc +7 -0
- data/test/fixtures/existing-project-with-version-yaml/Rakefile +82 -0
- data/test/fixtures/{existing-project-with-version → existing-project-with-version-yaml}/VERSION.yml +0 -0
- data/test/fixtures/existing-project-with-version-yaml/existing-project-with-version.gemspec +29 -0
- data/test/fixtures/existing-project-with-version-yaml/lib/existing_project_with_version.rb +0 -0
- data/test/fixtures/existing-project-with-version-yaml/test/existing_project_with_version_test.rb +7 -0
- data/test/fixtures/existing-project-with-version-yaml/test/test_helper.rb +10 -0
- data/test/jeweler/commands/test_release.rb +304 -79
- data/test/test_generator.rb +11 -7
- data/test/test_generator_initialization.rb +2 -2
- data/test/test_helper.rb +2 -0
- data/test/test_specification.rb +6 -2
- data/test/test_version_helper.rb +47 -9
- metadata +52 -15
- data/test/version_tmp/VERSION.yml +0 -4
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "existing-project-with-version"
|
8
|
+
gem.summary = %Q{TODO}
|
9
|
+
gem.email = "josh@technicalpickles.com"
|
10
|
+
gem.homepage = "http://github.com/technicalpickles/existing-project-with-version"
|
11
|
+
gem.authors = ["Josh Nichols"]
|
12
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
13
|
+
end
|
14
|
+
rescue LoadError
|
15
|
+
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
16
|
+
end
|
17
|
+
|
18
|
+
require 'rake/testtask'
|
19
|
+
Rake::TestTask.new(:test) do |test|
|
20
|
+
test.libs << 'lib' << 'test'
|
21
|
+
test.pattern = 'test/**/*_test.rb'
|
22
|
+
test.verbose = false
|
23
|
+
end
|
24
|
+
|
25
|
+
begin
|
26
|
+
require 'rcov/rcovtask'
|
27
|
+
Rcov::RcovTask.new do |test|
|
28
|
+
test.libs << 'test'
|
29
|
+
test.pattern = 'test/**/*_test.rb'
|
30
|
+
test.verbose = true
|
31
|
+
end
|
32
|
+
rescue LoadError
|
33
|
+
task :rcov do
|
34
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
task :default => :test
|
40
|
+
|
41
|
+
require 'rake/rdoctask'
|
42
|
+
Rake::RDocTask.new do |rdoc|
|
43
|
+
if File.exist?('VERSION.yml')
|
44
|
+
config = YAML.load(File.read('VERSION.yml'))
|
45
|
+
version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
|
46
|
+
else
|
47
|
+
version = ""
|
48
|
+
end
|
49
|
+
|
50
|
+
rdoc.rdoc_dir = 'rdoc'
|
51
|
+
rdoc.title = "existing-project-with-version #{version}"
|
52
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
53
|
+
rdoc.rdoc_files.include('README*')
|
54
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
55
|
+
end
|
56
|
+
|
57
|
+
# Rubyforge documentation task
|
58
|
+
begin
|
59
|
+
require 'rake/contrib/sshpublisher'
|
60
|
+
namespace :rubyforge do
|
61
|
+
|
62
|
+
desc "Release gem and RDoc documentation to RubyForge"
|
63
|
+
task :release => ["rubyforge:release:gem", "rubyforge:release:docs"]
|
64
|
+
|
65
|
+
namespace :release do
|
66
|
+
desc "Publish RDoc to RubyForge."
|
67
|
+
task :docs => [:rdoc] do
|
68
|
+
config = YAML.load(
|
69
|
+
File.read(File.expand_path('~/.rubyforge/user-config.yml'))
|
70
|
+
)
|
71
|
+
|
72
|
+
host = "#{config['username']}@rubyforge.org"
|
73
|
+
remote_dir = "/var/www/gforge-projects/existing-project-with-version/"
|
74
|
+
local_dir = 'rdoc'
|
75
|
+
|
76
|
+
Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
rescue LoadError
|
81
|
+
puts "Rake SshDirPublisher is unavailable or your rubyforge environment is not configured."
|
82
|
+
end
|
data/test/fixtures/{existing-project-with-version → existing-project-with-version-yaml}/VERSION.yml
RENAMED
File without changes
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{existing-project-with-version}
|
5
|
+
s.version = "1.5.3"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Josh Nichols"]
|
9
|
+
s.date = %q{2009-03-13}
|
10
|
+
s.email = %q{josh@technicalpickles.com}
|
11
|
+
s.extra_rdoc_files = ["README.rdoc", "LICENSE"]
|
12
|
+
s.files = ["README.rdoc", "VERSION.yml", "lib/existing_project_with_version.rb", "test/existing_project_with_version_test.rb", "test/test_helper.rb", "LICENSE"]
|
13
|
+
s.has_rdoc = true
|
14
|
+
s.homepage = %q{http://github.com/technicalpickles/existing-project-with-version}
|
15
|
+
s.rdoc_options = ["--inline-source", "--charset=UTF-8"]
|
16
|
+
s.require_paths = ["lib"]
|
17
|
+
s.rubygems_version = %q{1.3.1}
|
18
|
+
s.summary = %q{TODO}
|
19
|
+
|
20
|
+
if s.respond_to? :specification_version then
|
21
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
22
|
+
s.specification_version = 2
|
23
|
+
|
24
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
25
|
+
else
|
26
|
+
end
|
27
|
+
else
|
28
|
+
end
|
29
|
+
end
|
File without changes
|
@@ -4,15 +4,10 @@ class Jeweler
|
|
4
4
|
module Commands
|
5
5
|
class TestRelease < Test::Unit::TestCase
|
6
6
|
|
7
|
-
context "with
|
7
|
+
context "with pending changes" do
|
8
8
|
setup do
|
9
9
|
@repo = Object.new
|
10
10
|
stub(@repo).checkout(anything)
|
11
|
-
|
12
|
-
status = Object.new
|
13
|
-
stub(status).added { ['README'] }
|
14
|
-
stub(status).deleted { [] }
|
15
|
-
stub(status).changed { [] }
|
16
11
|
stub(@repo).status { status }
|
17
12
|
|
18
13
|
@command = Jeweler::Commands::Release.new
|
@@ -20,6 +15,8 @@ class Jeweler
|
|
20
15
|
@command.repo = @repo
|
21
16
|
@command.gemspec_helper = @gemspec_helper
|
22
17
|
@command.version = '1.2.3'
|
18
|
+
|
19
|
+
stub(@command).any_pending_changes? { true }
|
23
20
|
end
|
24
21
|
|
25
22
|
should 'raise error' do
|
@@ -29,85 +26,86 @@ class Jeweler
|
|
29
26
|
end
|
30
27
|
end
|
31
28
|
|
32
|
-
context "
|
29
|
+
context "run without pending changes, and gemspec changed, and tagged not created already" do
|
33
30
|
setup do
|
34
31
|
@repo = Object.new
|
35
|
-
stub(@repo)
|
32
|
+
stub(@repo) do
|
33
|
+
checkout(anything)
|
34
|
+
add(anything)
|
35
|
+
commit(anything)
|
36
|
+
push
|
37
|
+
end
|
36
38
|
|
37
|
-
|
38
|
-
stub(
|
39
|
-
|
40
|
-
|
41
|
-
|
39
|
+
@gemspec_helper = Object.new
|
40
|
+
stub(@gemspec_helper) do
|
41
|
+
write
|
42
|
+
path {'zomg.gemspec'}
|
43
|
+
update_version('1.2.3')
|
44
|
+
end
|
42
45
|
|
43
|
-
@
|
44
|
-
@command.output = @output
|
45
|
-
@command.repo = @repo
|
46
|
-
@command.gemspec_helper = @gemspec_helper
|
47
|
-
@command.version = '1.2.3'
|
48
|
-
@command.base_dir = '.'
|
49
|
-
end
|
46
|
+
@output = StringIO.new
|
50
47
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
48
|
+
@command = Jeweler::Commands::Release.new :output => @output,
|
49
|
+
:repo => @repo,
|
50
|
+
:gemspec_helper => @gemspec_helper,
|
51
|
+
:version => '1.2.3'
|
52
|
+
|
53
|
+
stub(@command).tag_release!
|
54
|
+
stub(@command).gemspec_changed? { true }
|
55
|
+
stub(@command).any_pending_changes? { false }
|
56
|
+
stub(@command).regenerate_gemspec!
|
57
|
+
stub(@command).commit_gemspec!
|
58
|
+
stub(@command).release_tagged? { false }
|
59
|
+
|
60
|
+
@command.run
|
55
61
|
end
|
56
|
-
end
|
57
62
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
stub(@repo).checkout(anything)
|
63
|
+
should "checkout master" do
|
64
|
+
assert_received(@repo) {|repo| repo.checkout('master') }
|
65
|
+
end
|
62
66
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
stub(status).changed { ['README'] }
|
67
|
-
stub(@repo).status { status }
|
67
|
+
should "regenerate gemspec" do
|
68
|
+
assert_received(@command) {|command| command.regenerate_gemspec! }
|
69
|
+
end
|
68
70
|
|
69
|
-
|
70
|
-
@command.
|
71
|
-
@command.repo = @repo
|
72
|
-
@command.gemspec_helper = @gemspec_helper
|
73
|
-
@command.version = '1.2.3'
|
71
|
+
should "commit gemspec" do
|
72
|
+
assert_received(@command) {|command| command.commit_gemspec! }
|
74
73
|
end
|
75
74
|
|
76
|
-
should
|
77
|
-
|
78
|
-
@command.run
|
79
|
-
end
|
75
|
+
should "tag release" do
|
76
|
+
assert_received(@command) {|command| command.tag_release! }
|
80
77
|
end
|
81
78
|
end
|
82
79
|
|
83
|
-
context "
|
80
|
+
context "run without pending changes, and gemspec didn't change, and tagged not created already" do
|
84
81
|
setup do
|
85
82
|
@repo = Object.new
|
86
|
-
stub(@repo)
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
83
|
+
stub(@repo) do
|
84
|
+
checkout(anything)
|
85
|
+
add(anything)
|
86
|
+
commit(anything)
|
87
|
+
push
|
88
|
+
end
|
92
89
|
|
93
90
|
@gemspec_helper = Object.new
|
94
|
-
stub(@gemspec_helper)
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
stub(status).added { [] }
|
100
|
-
stub(status).deleted { [] }
|
101
|
-
stub(status).changed { [] }
|
102
|
-
stub(@repo).status { status }
|
91
|
+
stub(@gemspec_helper) do
|
92
|
+
write
|
93
|
+
path {'zomg.gemspec'}
|
94
|
+
update_version('1.2.3')
|
95
|
+
end
|
103
96
|
|
104
97
|
@output = StringIO.new
|
105
98
|
|
106
|
-
@command = Jeweler::Commands::Release.new
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
99
|
+
@command = Jeweler::Commands::Release.new :output => @output,
|
100
|
+
:repo => @repo,
|
101
|
+
:gemspec_helper => @gemspec_helper,
|
102
|
+
:version => '1.2.3'
|
103
|
+
|
104
|
+
stub(@command).tag_release!
|
105
|
+
stub(@command).any_pending_changes? { false }
|
106
|
+
stub(@command).gemspec_changed? { false }
|
107
|
+
stub(@command).regenerate_gemspec!
|
108
|
+
stub(@command).release_tagged? { false }
|
111
109
|
|
112
110
|
@command.run
|
113
111
|
end
|
@@ -116,33 +114,62 @@ class Jeweler
|
|
116
114
|
assert_received(@repo) {|repo| repo.checkout('master') }
|
117
115
|
end
|
118
116
|
|
119
|
-
should "
|
120
|
-
assert_received(@
|
117
|
+
should "regenerate gemspec" do
|
118
|
+
assert_received(@command) {|command| command.regenerate_gemspec! }
|
121
119
|
end
|
122
120
|
|
123
|
-
|
124
|
-
|
125
|
-
|
121
|
+
should_eventually "not commit gemspec" do
|
122
|
+
# need a way to assert it wasn't received short of not stubbing it
|
123
|
+
#assert_received(@command) {|command| command.commit_gemspec! }
|
126
124
|
end
|
127
125
|
|
128
|
-
should "
|
129
|
-
assert_received(@
|
126
|
+
should "tag release" do
|
127
|
+
assert_received(@command) {|command| command.tag_release! }
|
130
128
|
end
|
129
|
+
end
|
131
130
|
|
132
|
-
|
133
|
-
|
131
|
+
context "run without pending changes and tagged already" do
|
132
|
+
setup do
|
133
|
+
@repo = Object.new
|
134
|
+
stub(@repo) do
|
135
|
+
checkout(anything)
|
136
|
+
add(anything)
|
137
|
+
commit(anything)
|
138
|
+
push
|
139
|
+
end
|
140
|
+
|
141
|
+
@gemspec_helper = Object.new
|
142
|
+
stub(@gemspec_helper) do
|
143
|
+
write
|
144
|
+
path {'zomg.gemspec'}
|
145
|
+
update_version('1.2.3')
|
146
|
+
end
|
147
|
+
|
148
|
+
@output = StringIO.new
|
149
|
+
|
150
|
+
@command = Jeweler::Commands::Release.new :output => @output,
|
151
|
+
:repo => @repo,
|
152
|
+
:gemspec_helper => @gemspec_helper,
|
153
|
+
:version => '1.2.3'
|
154
|
+
|
155
|
+
#stub(@command).tag_release!
|
156
|
+
stub(@command).any_pending_changes? { false }
|
157
|
+
stub(@command).regenerate_gemspec!
|
158
|
+
stub(@command).release_tagged? { true }
|
159
|
+
|
160
|
+
@command.run
|
134
161
|
end
|
135
162
|
|
136
|
-
should "
|
137
|
-
assert_received(@repo) {|repo| repo.
|
163
|
+
should "checkout master" do
|
164
|
+
assert_received(@repo) {|repo| repo.checkout('master') }
|
138
165
|
end
|
139
166
|
|
140
|
-
should "
|
141
|
-
assert_received(@
|
167
|
+
should "regenerate gemspec" do
|
168
|
+
assert_received(@command) {|command| command.regenerate_gemspec! }
|
142
169
|
end
|
143
170
|
|
144
|
-
|
145
|
-
|
171
|
+
should_eventually "not tag release" do
|
172
|
+
# need to have a way to verify tag_release! not being called, short of not stubbing it
|
146
173
|
end
|
147
174
|
end
|
148
175
|
|
@@ -175,6 +202,204 @@ class Jeweler
|
|
175
202
|
assert_same @base_dir, @command.base_dir
|
176
203
|
end
|
177
204
|
end
|
205
|
+
|
206
|
+
context "any_pending_changes?" do
|
207
|
+
|
208
|
+
should "be true if there added files" do
|
209
|
+
repo = build_repo :added => %w(README)
|
210
|
+
|
211
|
+
command = Jeweler::Commands::Release.new :repo => repo
|
212
|
+
|
213
|
+
assert command.any_pending_changes?
|
214
|
+
end
|
215
|
+
|
216
|
+
should "be true if there are changed files" do
|
217
|
+
repo = build_repo :changed => %w(README)
|
218
|
+
|
219
|
+
command = Jeweler::Commands::Release.new
|
220
|
+
command.repo = repo
|
221
|
+
|
222
|
+
assert command.any_pending_changes?
|
223
|
+
end
|
224
|
+
|
225
|
+
should "be true if there are deleted files" do
|
226
|
+
repo = build_repo :deleted => %w(README)
|
227
|
+
|
228
|
+
command = Jeweler::Commands::Release.new
|
229
|
+
command.repo = repo
|
230
|
+
|
231
|
+
assert command.any_pending_changes?
|
232
|
+
end
|
233
|
+
|
234
|
+
should "be false if nothing added, changed, or deleted" do
|
235
|
+
repo = build_repo
|
236
|
+
|
237
|
+
command = Jeweler::Commands::Release.new
|
238
|
+
command.repo = repo
|
239
|
+
|
240
|
+
assert ! command.any_pending_changes?
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
context "tag_release!" do
|
245
|
+
setup do
|
246
|
+
@repo = Object.new
|
247
|
+
stub(@repo) do
|
248
|
+
add_tag(anything)
|
249
|
+
push(anything, anything)
|
250
|
+
end
|
251
|
+
|
252
|
+
@output = StringIO.new
|
253
|
+
|
254
|
+
@command = Jeweler::Commands::Release.new
|
255
|
+
@command.output = @output
|
256
|
+
@command.repo = @repo
|
257
|
+
@command.gemspec_helper = @gemspec_helper
|
258
|
+
@command.version = '1.2.3'
|
259
|
+
|
260
|
+
@command.tag_release!
|
261
|
+
end
|
262
|
+
|
263
|
+
should "tag release" do
|
264
|
+
assert_received(@repo) {|repo| repo.add_tag("v1.2.3")}
|
265
|
+
end
|
266
|
+
|
267
|
+
should "push tag to repository" do
|
268
|
+
assert_received(@repo) {|repo| repo.push('origin', 'v1.2.3')}
|
269
|
+
end
|
270
|
+
end
|
271
|
+
|
272
|
+
context "regenerate_gemspec!" do
|
273
|
+
setup do
|
274
|
+
@repo = Object.new
|
275
|
+
stub(@repo) do
|
276
|
+
add(anything)
|
277
|
+
commit(anything)
|
278
|
+
end
|
279
|
+
|
280
|
+
@gemspec_helper = Object.new
|
281
|
+
stub(@gemspec_helper) do
|
282
|
+
write
|
283
|
+
path {'zomg.gemspec'}
|
284
|
+
update_version('1.2.3')
|
285
|
+
end
|
286
|
+
|
287
|
+
@output = StringIO.new
|
288
|
+
|
289
|
+
@command = Jeweler::Commands::Release.new :output => @output,
|
290
|
+
:repo => @repo,
|
291
|
+
:gemspec_helper => @gemspec_helper,
|
292
|
+
:version => '1.2.3'
|
293
|
+
|
294
|
+
@command.regenerate_gemspec!
|
295
|
+
end
|
296
|
+
|
297
|
+
should "refresh gemspec version" do
|
298
|
+
assert_received(@gemspec_helper) {|gemspec_helper| gemspec_helper.update_version('1.2.3') }
|
299
|
+
end
|
300
|
+
|
301
|
+
should "write gemspec" do
|
302
|
+
assert_received(@gemspec_helper) {|gemspec_helper| gemspec_helper.write }
|
303
|
+
end
|
304
|
+
end
|
305
|
+
|
306
|
+
context "commit_gemspec!" do
|
307
|
+
setup do
|
308
|
+
@repo = Object.new
|
309
|
+
stub(@repo) do
|
310
|
+
add(anything)
|
311
|
+
commit(anything)
|
312
|
+
end
|
313
|
+
|
314
|
+
@gemspec_helper = Object.new
|
315
|
+
stub(@gemspec_helper) do
|
316
|
+
path {'zomg.gemspec'}
|
317
|
+
update_version('1.2.3')
|
318
|
+
end
|
319
|
+
|
320
|
+
@output = StringIO.new
|
321
|
+
|
322
|
+
@command = Jeweler::Commands::Release.new :output => @output,
|
323
|
+
:repo => @repo,
|
324
|
+
:gemspec_helper => @gemspec_helper,
|
325
|
+
:version => '1.2.3'
|
326
|
+
|
327
|
+
@command.commit_gemspec!
|
328
|
+
end
|
329
|
+
|
330
|
+
should "add gemspec to repository" do
|
331
|
+
assert_received(@repo) {|repo| repo.add('zomg.gemspec') }
|
332
|
+
end
|
333
|
+
|
334
|
+
should "commit with commit message including version" do
|
335
|
+
assert_received(@repo) {|repo| repo.commit("Regenerated gemspec for version 1.2.3") }
|
336
|
+
end
|
337
|
+
|
338
|
+
end
|
339
|
+
|
340
|
+
context "release_tagged? when no tag exists" do
|
341
|
+
setup do
|
342
|
+
@repo = Object.new
|
343
|
+
stub(@repo).tag('v1.2.3') {raise Git::GitTagNameDoesNotExist, tag}
|
344
|
+
#stub(@repo) do
|
345
|
+
#tag('v1.2.3') do |tag|
|
346
|
+
#raise Git::GitTagNameDoesNotExist, tag
|
347
|
+
#end
|
348
|
+
#end
|
349
|
+
|
350
|
+
@output = StringIO.new
|
351
|
+
|
352
|
+
@command = Jeweler::Commands::Release.new
|
353
|
+
@command.output = @output
|
354
|
+
@command.repo = @repo
|
355
|
+
@command.version = '1.2.3'
|
356
|
+
end
|
357
|
+
|
358
|
+
should_eventually "be false" do
|
359
|
+
assert ! @command.release_tagged?
|
360
|
+
end
|
361
|
+
|
362
|
+
end
|
363
|
+
|
364
|
+
context "release_tagged? when tag exists" do
|
365
|
+
setup do
|
366
|
+
@repo = Object.new
|
367
|
+
stub(@repo) do
|
368
|
+
tag('v1.2.3') { Object.new }
|
369
|
+
end
|
370
|
+
|
371
|
+
@output = StringIO.new
|
372
|
+
|
373
|
+
@command = Jeweler::Commands::Release.new
|
374
|
+
@command.output = @output
|
375
|
+
@command.repo = @repo
|
376
|
+
@command.version = '1.2.3'
|
377
|
+
end
|
378
|
+
|
379
|
+
should_eventually "be true" do
|
380
|
+
assert @command.release_tagged?
|
381
|
+
end
|
382
|
+
|
383
|
+
end
|
384
|
+
|
385
|
+
def build_repo(options = {})
|
386
|
+
status = build_status options
|
387
|
+
repo = Object.new
|
388
|
+
stub(repo).status { status }
|
389
|
+
repo
|
390
|
+
end
|
391
|
+
|
392
|
+
def build_status(options = {})
|
393
|
+
options = {:added => [], :deleted => [], :changed => []}.merge(options)
|
394
|
+
|
395
|
+
status = Object.new
|
396
|
+
stub(status) do
|
397
|
+
added { options[:added] }
|
398
|
+
deleted { options[:deleted] }
|
399
|
+
changed { options[:changed] }
|
400
|
+
end
|
401
|
+
|
402
|
+
end
|
178
403
|
end
|
179
404
|
end
|
180
405
|
end
|
data/test/test_generator.rb
CHANGED
@@ -67,7 +67,11 @@ class TestGenerator < Test::Unit::TestCase
|
|
67
67
|
end
|
68
68
|
|
69
69
|
should "have the correct require name" do
|
70
|
-
assert_equal "
|
70
|
+
assert_equal "the-perfect-gem", build_generator.require_name
|
71
|
+
end
|
72
|
+
|
73
|
+
should "have the correct lib file name" do
|
74
|
+
assert_equal "the-perfect-gem.rb", build_generator.lib_filename
|
71
75
|
end
|
72
76
|
|
73
77
|
def self.should_have_generator_attribute(attribute, value)
|
@@ -84,7 +88,7 @@ class TestGenerator < Test::Unit::TestCase
|
|
84
88
|
should_have_generator_attribute :feature_support_require, 'test/unit/assertions'
|
85
89
|
should_have_generator_attribute :feature_support_extend, 'Test::Unit::Assertions'
|
86
90
|
should_have_generator_attribute :test_pattern, 'test/**/*_test.rb'
|
87
|
-
should_have_generator_attribute :test_filename, '
|
91
|
+
should_have_generator_attribute :test_filename, 'the-perfect-gem_test.rb'
|
88
92
|
should_have_generator_attribute :test_helper_filename, 'test_helper.rb'
|
89
93
|
end
|
90
94
|
|
@@ -96,7 +100,7 @@ class TestGenerator < Test::Unit::TestCase
|
|
96
100
|
should_have_generator_attribute :feature_support_require, 'test/unit/assertions'
|
97
101
|
should_have_generator_attribute :feature_support_extend, 'Test::Unit::Assertions'
|
98
102
|
should_have_generator_attribute :test_pattern, 'test/**/*_test.rb'
|
99
|
-
should_have_generator_attribute :test_filename, '
|
103
|
+
should_have_generator_attribute :test_filename, 'the-perfect-gem_test.rb'
|
100
104
|
should_have_generator_attribute :test_helper_filename, 'test_helper.rb'
|
101
105
|
end
|
102
106
|
|
@@ -108,7 +112,7 @@ class TestGenerator < Test::Unit::TestCase
|
|
108
112
|
should_have_generator_attribute :feature_support_require, 'mini/test'
|
109
113
|
should_have_generator_attribute :feature_support_extend, 'Mini::Test::Assertions'
|
110
114
|
should_have_generator_attribute :test_pattern, 'test/**/*_test.rb'
|
111
|
-
should_have_generator_attribute :test_filename, '
|
115
|
+
should_have_generator_attribute :test_filename, 'the-perfect-gem_test.rb'
|
112
116
|
should_have_generator_attribute :test_helper_filename, 'test_helper.rb'
|
113
117
|
end
|
114
118
|
|
@@ -120,7 +124,7 @@ class TestGenerator < Test::Unit::TestCase
|
|
120
124
|
should_have_generator_attribute :feature_support_require, 'test/unit/assertions'
|
121
125
|
should_have_generator_attribute :feature_support_extend, 'Test::Unit::Assertions'
|
122
126
|
should_have_generator_attribute :test_pattern, 'spec/**/*_spec.rb'
|
123
|
-
should_have_generator_attribute :test_filename, '
|
127
|
+
should_have_generator_attribute :test_filename, 'the-perfect-gem_spec.rb'
|
124
128
|
should_have_generator_attribute :test_helper_filename, 'spec_helper.rb'
|
125
129
|
end
|
126
130
|
|
@@ -132,7 +136,7 @@ class TestGenerator < Test::Unit::TestCase
|
|
132
136
|
should_have_generator_attribute :feature_support_require, 'spec/expectations'
|
133
137
|
should_have_generator_attribute :feature_support_extend, nil
|
134
138
|
should_have_generator_attribute :test_pattern, 'spec/**/*_spec.rb'
|
135
|
-
should_have_generator_attribute :test_filename, '
|
139
|
+
should_have_generator_attribute :test_filename, 'the-perfect-gem_spec.rb'
|
136
140
|
should_have_generator_attribute :test_helper_filename, 'spec_helper.rb'
|
137
141
|
end
|
138
142
|
|
@@ -144,7 +148,7 @@ class TestGenerator < Test::Unit::TestCase
|
|
144
148
|
should_have_generator_attribute :feature_support_require, 'micronaut/expectations'
|
145
149
|
should_have_generator_attribute :feature_support_extend, 'Micronaut::Matchers'
|
146
150
|
should_have_generator_attribute :test_pattern, 'examples/**/*_example.rb'
|
147
|
-
should_have_generator_attribute :test_filename, '
|
151
|
+
should_have_generator_attribute :test_filename, 'the-perfect-gem_example.rb'
|
148
152
|
should_have_generator_attribute :test_helper_filename, 'example_helper.rb'
|
149
153
|
end
|
150
154
|
end
|
@@ -68,9 +68,9 @@ class TestGeneratorInitialization < Test::Unit::TestCase
|
|
68
68
|
stub_git_config 'user.name' => @git_name, 'user.email' => @git_email, 'github.user' => @github_user
|
69
69
|
end
|
70
70
|
|
71
|
-
should 'raise NoGitHubToken' do
|
71
|
+
should 'raise NoGitHubToken if creating repo' do
|
72
72
|
assert_raise Jeweler::NoGitHubToken do
|
73
|
-
Jeweler::Generator.new(@project_name)
|
73
|
+
Jeweler::Generator.new(@project_name, :create_repo => true)
|
74
74
|
end
|
75
75
|
end
|
76
76
|
end
|