technicalpickles-jeweler 1.0.2 → 1.1.0
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 +1 -0
- data/Rakefile +53 -7
- data/VERSION.yml +2 -2
- data/features/generator/rakefile.feature +42 -36
- data/features/step_definitions/filesystem_steps.rb +3 -0
- data/features/step_definitions/generator_steps.rb +9 -0
- data/features/support/env.rb +12 -2
- data/jeweler.gemspec +24 -6
- data/lib/jeweler/commands/install_gem.rb +16 -2
- data/lib/jeweler/commands/release.rb +10 -7
- data/lib/jeweler/commands/setup_rubyforge.rb +19 -0
- data/lib/jeweler/gemspec_helper.rb +3 -0
- data/lib/jeweler/generator/options.rb +10 -1
- data/lib/jeweler/generator.rb +15 -6
- data/lib/jeweler/rubyforge_tasks.rb +57 -5
- data/lib/jeweler/specification.rb +2 -2
- data/lib/jeweler/tasks.rb +22 -28
- data/lib/jeweler/templates/Rakefile +17 -5
- data/test/jeweler/commands/test_install_gem.rb +53 -0
- data/test/jeweler/commands/test_release.rb +101 -144
- data/test/jeweler/commands/test_setup_rubyforge.rb +102 -8
- data/test/test_application.rb +2 -2
- data/test/test_generator.rb +1 -1
- data/test/test_generator_initialization.rb +69 -26
- data/test/test_helper.rb +18 -12
- data/test/test_options.rb +15 -0
- data/test/test_tasks.rb +4 -20
- metadata +53 -3
@@ -31,12 +31,12 @@ class Jeweler
|
|
31
31
|
self.files = repo.ls_files.keys - repo.lib.ignored_files
|
32
32
|
end
|
33
33
|
|
34
|
-
if blank?(test_files)
|
34
|
+
if blank?(test_files) && File.directory?(File.join(base_dir, '.git'))
|
35
35
|
repo = Git.open(base_dir)
|
36
36
|
self.test_files = FileList['{spec,test,examples}/**/*.rb'] - repo.lib.ignored_files
|
37
37
|
end
|
38
38
|
|
39
|
-
if blank?(
|
39
|
+
if blank?(executables)
|
40
40
|
self.executables = Dir["bin/*"].map { |f| File.basename(f) }
|
41
41
|
end
|
42
42
|
|
data/lib/jeweler/tasks.rb
CHANGED
@@ -6,6 +6,28 @@ class Rake::Application
|
|
6
6
|
end
|
7
7
|
|
8
8
|
class Jeweler
|
9
|
+
# Rake tasks for managing your gem.
|
10
|
+
#
|
11
|
+
# Here's a basic example of using it:
|
12
|
+
#
|
13
|
+
# Jeweler::Tasks.new do |gem|
|
14
|
+
# gem.name = "jeweler"
|
15
|
+
# gem.summary = "Simple and opinionated helper for creating Rubygem projects on GitHub"
|
16
|
+
# gem.email = "josh@technicalpickles.com"
|
17
|
+
# gem.homepage = "http://github.com/technicalpickles/jeweler"
|
18
|
+
# gem.description = "Simple and opinionated helper for creating Rubygem projects on GitHub"
|
19
|
+
# gem.authors = ["Josh Nichols"]
|
20
|
+
# end
|
21
|
+
#
|
22
|
+
# The block variable gem is actually a Gem::Specification, so you can do anything you would normally do with a Gem::Specification. For more details, see the official gemspec reference: http://docs.rubygems.org/read/chapter/20
|
23
|
+
#
|
24
|
+
# Jeweler fills in a few reasonable defaults for you:
|
25
|
+
#
|
26
|
+
# [gem.files] a Rake::FileList of anything that is in git and not gitignored. You can include/exclude this default set, or override it entirely
|
27
|
+
# [gem.test_files] Similar to gem.files, except it's only things under the spec, test, or examples directory.
|
28
|
+
# [gem.extra_rdoc_files] a Rake::FileList including files like README*, ChangeLog*, and LICENSE*
|
29
|
+
# [gem.executables] uses anything found in the bin/ directory. You can override this.
|
30
|
+
#
|
9
31
|
class Tasks < ::Rake::TaskLib
|
10
32
|
attr_accessor :gemspec, :jeweler
|
11
33
|
|
@@ -90,34 +112,6 @@ class Jeweler
|
|
90
112
|
jeweler.release
|
91
113
|
end
|
92
114
|
|
93
|
-
namespace :rubyforge do
|
94
|
-
namespace :release do
|
95
|
-
desc "Release the current gem version to RubyForge."
|
96
|
-
task :gem => [:gemspec, :build] do
|
97
|
-
begin
|
98
|
-
jeweler.release_gem_to_rubyforge
|
99
|
-
rescue NoRubyForgeProjectInGemspecError => e
|
100
|
-
abort "Setting up RubyForge requires that you specify a 'rubyforge_project' in your Jeweler::Tasks declaration"
|
101
|
-
rescue MissingRubyForgePackageError => e
|
102
|
-
abort "Rubyforge reported that the #{e.message} package isn't setup. Run rake rubyforge:setup to do so."
|
103
|
-
rescue RubyForgeProjectNotConfiguredError => e
|
104
|
-
abort "RubyForge reported that #{e.message} wasn't configured. This means you need to run 'rubyforge setup', 'rubyforge login', and 'rubyforge configure', or maybe the project doesn't exist on RubyForge"
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
desc "Setup a rubyforge project for this gem"
|
110
|
-
task :setup do
|
111
|
-
begin
|
112
|
-
jeweler.setup_rubyforge
|
113
|
-
rescue NoRubyForgeProjectInGemspecError => e
|
114
|
-
abort "Setting up RubyForge requires that you specify a 'rubyforge_project' in your Jeweler::Tasks declaration"
|
115
|
-
rescue RubyForgeProjectNotConfiguredError => e
|
116
|
-
abort "The RubyForge reported that #{e.message} wasn't configured. This means you need to run 'rubyforge setup', 'rubyforge login', and 'rubyforge configure', or maybe the project doesn't exist on RubyForge"
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
end
|
121
115
|
end
|
122
116
|
end
|
123
117
|
end
|
@@ -17,7 +17,9 @@ begin
|
|
17
17
|
end
|
18
18
|
|
19
19
|
<% if should_setup_rubyforge %>
|
20
|
-
Jeweler::RubyforgeTasks.new
|
20
|
+
Jeweler::RubyforgeTasks.new do |rubyforge|
|
21
|
+
rubyforge.doc_task = "<%= doc_task %>"
|
22
|
+
end
|
21
23
|
<% end %>
|
22
24
|
rescue LoadError
|
23
25
|
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
@@ -115,11 +117,12 @@ end
|
|
115
117
|
|
116
118
|
task :default => :<%= default_task %>
|
117
119
|
|
120
|
+
<% case documentation_framework %>
|
121
|
+
<% when :rdoc %>
|
118
122
|
require 'rake/rdoctask'
|
119
123
|
Rake::RDocTask.new do |rdoc|
|
120
|
-
if File.exist?('VERSION
|
121
|
-
|
122
|
-
version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
|
124
|
+
if File.exist?('VERSION')
|
125
|
+
version = File.read('VERSION')
|
123
126
|
else
|
124
127
|
version = ""
|
125
128
|
end
|
@@ -129,4 +132,13 @@ Rake::RDocTask.new do |rdoc|
|
|
129
132
|
rdoc.rdoc_files.include('README*')
|
130
133
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
131
134
|
end
|
132
|
-
|
135
|
+
<% when :yard %>
|
136
|
+
begin
|
137
|
+
require 'yard'
|
138
|
+
YARD::Rake::YardocTask.new
|
139
|
+
rescue LoadError
|
140
|
+
task :yardoc do
|
141
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
142
|
+
end
|
143
|
+
end
|
144
|
+
<% end %>
|
@@ -3,6 +3,59 @@ require 'test_helper'
|
|
3
3
|
class Jeweler
|
4
4
|
module Commands
|
5
5
|
class TestInstallGem < Test::Unit::TestCase
|
6
|
+
rubyforge_command_context "running" do
|
7
|
+
setup do
|
8
|
+
stub(@gemspec_helper).gem_path { 'pkg/zomg-1.1.1.gem' }
|
9
|
+
stub(@command).sudo_wrapper { 'sudo gem install pkg/zomg-1.1.1.gem' }
|
10
|
+
stub(@command).sh
|
11
|
+
|
12
|
+
@command.run
|
13
|
+
end
|
14
|
+
|
15
|
+
should "call sudo wrapper with gem install" do
|
16
|
+
assert_received(@command) {|command| command.sudo_wrapper('gem install pkg/zomg-1.1.1.gem') }
|
17
|
+
end
|
18
|
+
|
19
|
+
should "call sh with output of sudo wrapper" do
|
20
|
+
assert_received(@command) {|command| command.sh 'sudo gem install pkg/zomg-1.1.1.gem' }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
rubyforge_command_context "use_sudo?" do
|
25
|
+
should "be false on mswin" do
|
26
|
+
stub(@command).host_os { "i386-mswin32" }
|
27
|
+
assert ! @command.use_sudo?
|
28
|
+
end
|
29
|
+
|
30
|
+
should "be false on windows" do
|
31
|
+
stub(@command).host_os { "windows" }
|
32
|
+
assert ! @command.use_sudo?
|
33
|
+
end
|
34
|
+
|
35
|
+
should "be false on cygwin" do
|
36
|
+
stub(@command).host_os { "cygwin" }
|
37
|
+
assert ! @command.use_sudo?
|
38
|
+
end
|
39
|
+
|
40
|
+
should "be true on basically anything else" do
|
41
|
+
stub(@command).host_os { "darwin9" }
|
42
|
+
assert @command.use_sudo?
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
rubyforge_command_context "sudo_wrapper" do
|
47
|
+
should "prefix sudo if needed" do
|
48
|
+
stub(@command).use_sudo? { true }
|
49
|
+
assert_equal "sudo blarg", @command.sudo_wrapper("blarg")
|
50
|
+
end
|
51
|
+
|
52
|
+
should "not prefix with sudo if unneeded" do
|
53
|
+
stub(@command).use_sudo? { false }
|
54
|
+
assert_equal "blarg", @command.sudo_wrapper("blarg")
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
|
6
59
|
build_command_context "build for jeweler" do
|
7
60
|
setup do
|
8
61
|
@command = Jeweler::Commands::InstallGem.build_for(@jeweler)
|
@@ -4,175 +4,137 @@ class Jeweler
|
|
4
4
|
module Commands
|
5
5
|
class TestRelease < Test::Unit::TestCase
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
stub(@repo).status { status }
|
7
|
+
rubyforge_command_context "running" do
|
8
|
+
context "happily" do
|
9
|
+
setup do
|
10
|
+
stub(@command).clean_staging_area? { true }
|
12
11
|
|
13
|
-
|
14
|
-
@command.output = @output
|
15
|
-
@command.repo = @repo
|
16
|
-
@command.gemspec_helper = @gemspec_helper
|
17
|
-
@command.version = '1.2.3'
|
12
|
+
stub(@repo).checkout(anything)
|
18
13
|
|
19
|
-
|
20
|
-
|
14
|
+
stub(@command).regenerate_gemspec!
|
15
|
+
|
16
|
+
stub(@command).gemspec_changed? { true }
|
17
|
+
stub(@command).commit_gemspec! { true }
|
18
|
+
|
19
|
+
stub(@repo).push
|
20
|
+
|
21
|
+
stub(@command).release_not_tagged? { true }
|
22
|
+
stub(@command).tag_release!
|
21
23
|
|
22
|
-
should 'raise error' do
|
23
|
-
assert_raises RuntimeError, /try commiting/i do
|
24
24
|
@command.run
|
25
25
|
end
|
26
|
-
end
|
27
|
-
end
|
28
26
|
|
29
|
-
|
30
|
-
|
31
|
-
@repo = Object.new
|
32
|
-
stub(@repo) do
|
33
|
-
checkout(anything)
|
34
|
-
add(anything)
|
35
|
-
commit(anything)
|
36
|
-
push
|
27
|
+
should "checkout master" do
|
28
|
+
assert_received(@repo) {|repo| repo.checkout('master') }
|
37
29
|
end
|
38
30
|
|
39
|
-
|
40
|
-
|
41
|
-
write
|
42
|
-
path {'zomg.gemspec'}
|
43
|
-
update_version('1.2.3')
|
31
|
+
should "regenerate gemspec" do
|
32
|
+
assert_received(@command) {|command| command.regenerate_gemspec! }
|
44
33
|
end
|
45
34
|
|
46
|
-
|
35
|
+
should "commit gemspec" do
|
36
|
+
assert_received(@command) {|command| command.commit_gemspec! }
|
37
|
+
end
|
47
38
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
:version => '1.2.3'
|
39
|
+
should "push" do
|
40
|
+
assert_received(@repo) {|repo| repo.push }
|
41
|
+
end
|
52
42
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
stub(@command).regenerate_gemspec!
|
57
|
-
stub(@command).commit_gemspec!
|
58
|
-
stub(@command).release_tagged? { false }
|
43
|
+
should "tag release" do
|
44
|
+
assert_received(@command) {|command| command.tag_release! }
|
45
|
+
end
|
59
46
|
|
60
|
-
@command.run
|
61
47
|
end
|
62
48
|
|
63
|
-
|
64
|
-
|
65
|
-
|
49
|
+
context "with an unclean staging area" do
|
50
|
+
setup do
|
51
|
+
stub(@command).clean_staging_area? { false }
|
52
|
+
end
|
66
53
|
|
67
|
-
|
68
|
-
|
54
|
+
should 'raise error' do
|
55
|
+
assert_raises RuntimeError, /try commiting/i do
|
56
|
+
@command.run
|
57
|
+
end
|
58
|
+
end
|
69
59
|
end
|
70
60
|
|
71
|
-
|
72
|
-
|
73
|
-
|
61
|
+
context "with an unchanged gemspec" do
|
62
|
+
setup do
|
63
|
+
stub(@command).clean_staging_area? { true }
|
74
64
|
|
75
|
-
|
76
|
-
assert_received(@command) {|command| command.tag_release! }
|
77
|
-
end
|
78
|
-
end
|
65
|
+
stub(@repo).checkout(anything)
|
79
66
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
67
|
+
stub(@command).regenerate_gemspec!
|
68
|
+
|
69
|
+
stub(@command).gemspec_changed? { false }
|
70
|
+
dont_allow(@command).commit_gemspec! { true }
|
71
|
+
|
72
|
+
stub(@repo).push
|
73
|
+
|
74
|
+
stub(@command).release_not_tagged? { true }
|
75
|
+
stub(@command).tag_release!
|
76
|
+
|
77
|
+
@command.run
|
88
78
|
end
|
89
79
|
|
90
|
-
|
91
|
-
|
92
|
-
write
|
93
|
-
path {'zomg.gemspec'}
|
94
|
-
update_version('1.2.3')
|
80
|
+
should "checkout master" do
|
81
|
+
assert_received(@repo) {|repo| repo.checkout('master') }
|
95
82
|
end
|
96
83
|
|
97
|
-
|
84
|
+
should "regenerate gemspec" do
|
85
|
+
assert_received(@command) {|command| command.regenerate_gemspec! }
|
86
|
+
end
|
98
87
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
:version => '1.2.3'
|
88
|
+
should "push" do
|
89
|
+
assert_received(@repo) {|repo| repo.push }
|
90
|
+
end
|
103
91
|
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
stub(@command).regenerate_gemspec!
|
108
|
-
stub(@command).release_tagged? { false }
|
92
|
+
should "tag release" do
|
93
|
+
assert_received(@command) {|command| command.tag_release! }
|
94
|
+
end
|
109
95
|
|
110
|
-
@command.run
|
111
96
|
end
|
112
97
|
|
113
|
-
|
114
|
-
|
115
|
-
|
98
|
+
context "with a release already tagged" do
|
99
|
+
setup do
|
100
|
+
stub(@command).clean_staging_area? { true }
|
116
101
|
|
117
|
-
|
118
|
-
assert_received(@command) {|command| command.regenerate_gemspec! }
|
119
|
-
end
|
102
|
+
stub(@repo).checkout(anything)
|
120
103
|
|
121
|
-
|
122
|
-
# need a way to assert it wasn't received short of not stubbing it
|
123
|
-
#assert_received(@command) {|command| command.commit_gemspec! }
|
124
|
-
end
|
104
|
+
stub(@command).regenerate_gemspec!
|
125
105
|
|
126
|
-
|
127
|
-
|
128
|
-
end
|
129
|
-
end
|
106
|
+
stub(@command).gemspec_changed? { true }
|
107
|
+
stub(@command).commit_gemspec! { true }
|
130
108
|
|
131
|
-
|
132
|
-
setup do
|
133
|
-
@repo = Object.new
|
134
|
-
stub(@repo) do
|
135
|
-
checkout(anything)
|
136
|
-
add(anything)
|
137
|
-
commit(anything)
|
138
|
-
push
|
139
|
-
end
|
109
|
+
stub(@repo).push
|
140
110
|
|
141
|
-
|
142
|
-
|
143
|
-
write
|
144
|
-
path {'zomg.gemspec'}
|
145
|
-
update_version('1.2.3')
|
146
|
-
end
|
111
|
+
stub(@command).release_not_tagged? { false }
|
112
|
+
dont_allow(@command).tag_release!
|
147
113
|
|
148
|
-
|
114
|
+
@command.run
|
115
|
+
end
|
149
116
|
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
:version => '1.2.3'
|
117
|
+
should "checkout master" do
|
118
|
+
assert_received(@repo) {|repo| repo.checkout('master') }
|
119
|
+
end
|
154
120
|
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
stub(@command).release_tagged? { true }
|
121
|
+
should "regenerate gemspec" do
|
122
|
+
assert_received(@command) {|command| command.regenerate_gemspec! }
|
123
|
+
end
|
159
124
|
|
160
|
-
|
161
|
-
|
125
|
+
should "commit gemspec" do
|
126
|
+
assert_received(@command) {|command| command.commit_gemspec! }
|
127
|
+
end
|
162
128
|
|
163
|
-
|
164
|
-
|
165
|
-
|
129
|
+
should "push" do
|
130
|
+
assert_received(@repo) {|repo| repo.push }
|
131
|
+
end
|
166
132
|
|
167
|
-
should "regenerate gemspec" do
|
168
|
-
assert_received(@command) {|command| command.regenerate_gemspec! }
|
169
133
|
end
|
170
134
|
|
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
|
173
|
-
end
|
174
135
|
end
|
175
136
|
|
137
|
+
|
176
138
|
build_command_context "building from jeweler" do
|
177
139
|
setup do
|
178
140
|
@command = Jeweler::Commands::Release.build_for(@jeweler)
|
@@ -203,41 +165,41 @@ class Jeweler
|
|
203
165
|
end
|
204
166
|
end
|
205
167
|
|
206
|
-
context "
|
168
|
+
context "clean_staging_area?" do
|
207
169
|
|
208
|
-
should "be
|
170
|
+
should "be false if there added files" do
|
209
171
|
repo = build_repo :added => %w(README)
|
210
172
|
|
211
173
|
command = Jeweler::Commands::Release.new :repo => repo
|
212
174
|
|
213
|
-
assert command.
|
175
|
+
assert ! command.clean_staging_area?
|
214
176
|
end
|
215
177
|
|
216
|
-
should "be
|
178
|
+
should "be false if there are changed files" do
|
217
179
|
repo = build_repo :changed => %w(README)
|
218
180
|
|
219
181
|
command = Jeweler::Commands::Release.new
|
220
182
|
command.repo = repo
|
221
183
|
|
222
|
-
assert command.
|
184
|
+
assert ! command.clean_staging_area?
|
223
185
|
end
|
224
186
|
|
225
|
-
should "be
|
187
|
+
should "be false if there are deleted files" do
|
226
188
|
repo = build_repo :deleted => %w(README)
|
227
189
|
|
228
190
|
command = Jeweler::Commands::Release.new
|
229
191
|
command.repo = repo
|
230
192
|
|
231
|
-
assert command.
|
193
|
+
assert ! command.clean_staging_area?
|
232
194
|
end
|
233
195
|
|
234
|
-
should "be
|
196
|
+
should "be true if nothing added, changed, or deleted" do
|
235
197
|
repo = build_repo
|
236
198
|
|
237
199
|
command = Jeweler::Commands::Release.new
|
238
200
|
command.repo = repo
|
239
201
|
|
240
|
-
assert
|
202
|
+
assert command.clean_staging_area?
|
241
203
|
end
|
242
204
|
end
|
243
205
|
|
@@ -340,12 +302,7 @@ class Jeweler
|
|
340
302
|
context "release_tagged? when no tag exists" do
|
341
303
|
setup do
|
342
304
|
@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
|
305
|
+
stub(@repo).tag('v1.2.3') { raise Git::GitTagNameDoesNotExist, tag }
|
349
306
|
|
350
307
|
@output = StringIO.new
|
351
308
|
|
@@ -355,8 +312,8 @@ class Jeweler
|
|
355
312
|
@command.version = '1.2.3'
|
356
313
|
end
|
357
314
|
|
358
|
-
should_eventually "be
|
359
|
-
assert
|
315
|
+
should_eventually "be true" do
|
316
|
+
assert @command.release_not_tagged?
|
360
317
|
end
|
361
318
|
|
362
319
|
end
|
@@ -376,8 +333,8 @@ class Jeweler
|
|
376
333
|
@command.version = '1.2.3'
|
377
334
|
end
|
378
335
|
|
379
|
-
should_eventually "be
|
380
|
-
assert @command.
|
336
|
+
should_eventually "be false" do
|
337
|
+
assert @command.release_not_tagged?
|
381
338
|
end
|
382
339
|
|
383
340
|
end
|
@@ -7,15 +7,82 @@ class Jeweler
|
|
7
7
|
Jeweler::Commands::SetupRubyforge.new
|
8
8
|
end
|
9
9
|
|
10
|
-
rubyforge_command_context "
|
10
|
+
rubyforge_command_context "package_exists?" do
|
11
|
+
setup do
|
12
|
+
stub(@gemspec).name { 'zomg' }
|
13
|
+
end
|
14
|
+
|
15
|
+
should "be true if rubyforge.lookup doesn't cause an Error" do
|
16
|
+
mock(@rubyforge).lookup('package', 'zomg')
|
17
|
+
|
18
|
+
assert @command.package_exists?
|
19
|
+
end
|
20
|
+
|
21
|
+
should "be false if rubyforge.lookup raises an error like: no <package_id> configured for <zomg>" do
|
22
|
+
mock(@rubyforge).lookup('package', 'zomg') do
|
23
|
+
raise RuntimeError, "no <package_id> configured for <zomg>"
|
24
|
+
end
|
25
|
+
|
26
|
+
assert ! @command.package_exists?
|
27
|
+
end
|
28
|
+
|
29
|
+
should "reraise any other Errors" do
|
30
|
+
mock(@rubyforge).lookup('package', 'zomg') do
|
31
|
+
raise RuntimeError, 'burnination!'
|
32
|
+
end
|
33
|
+
|
34
|
+
assert_raises RuntimeError, 'burnination!' do
|
35
|
+
@command.package_exists?
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
rubyforge_command_context "create_package" do
|
41
|
+
setup do
|
42
|
+
stub(@gemspec).name { 'zomg' }
|
43
|
+
end
|
44
|
+
|
45
|
+
context "when everything is happy" do
|
46
|
+
setup do
|
47
|
+
stub(@gemspec).rubyforge_project { 'myproject' }
|
48
|
+
stub(@rubyforge).create_package('myproject', 'zomg')
|
49
|
+
|
50
|
+
@command.create_package
|
51
|
+
end
|
52
|
+
|
53
|
+
should "create zomg package to myproject on rubyforge" do
|
54
|
+
assert_received(@rubyforge) {|rubyforge| rubyforge.create_package('myproject', 'zomg') }
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
context "when rubyforge project not existing or being setup in ~/.rubyforge/autoconfig.yml" do
|
60
|
+
setup do
|
61
|
+
stub(@gemspec).rubyforge_project { 'myproject' }
|
62
|
+
stub(@rubyforge).create_package('myproject', 'zomg')do
|
63
|
+
raise RuntimeError, "no <group_id> configured for <myproject>"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
should "raise RubyForgeProjectNotConfiguredError" do
|
68
|
+
assert_raises RubyForgeProjectNotConfiguredError do
|
69
|
+
@command.create_package
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
|
76
|
+
rubyforge_command_context "rubyforge_project defined in gemspec and project existing on rubyforge" do
|
11
77
|
setup do
|
12
78
|
stub(@rubyforge).configure
|
13
79
|
stub(@rubyforge).login
|
14
|
-
stub(@rubyforge).create_package('myproject', 'zomg')
|
15
80
|
|
16
81
|
stub(@gemspec).name { 'zomg' }
|
17
82
|
stub(@gemspec).rubyforge_project { 'myproject' }
|
18
83
|
|
84
|
+
stub(@command).package_exists? { false }
|
85
|
+
stub(@command).create_package
|
19
86
|
@command.run
|
20
87
|
end
|
21
88
|
|
@@ -28,11 +95,36 @@ class Jeweler
|
|
28
95
|
end
|
29
96
|
|
30
97
|
should "create zomg package to myproject on rubyforge" do
|
31
|
-
assert_received(@
|
98
|
+
assert_received(@command) {|command| command.create_package }
|
32
99
|
end
|
33
100
|
end
|
34
101
|
|
35
|
-
rubyforge_command_context "rubyforge_project
|
102
|
+
rubyforge_command_context "rubyforge_project defined in gemspec, project and project already existing on rubyforge" do
|
103
|
+
setup do
|
104
|
+
stub(@rubyforge).configure
|
105
|
+
stub(@rubyforge).login
|
106
|
+
|
107
|
+
|
108
|
+
stub(@gemspec).name { 'zomg' }
|
109
|
+
stub(@gemspec).rubyforge_project { 'myproject' }
|
110
|
+
|
111
|
+
stub(@command).package_exists? { true }
|
112
|
+
dont_allow(@command).create_package
|
113
|
+
@command.run
|
114
|
+
end
|
115
|
+
|
116
|
+
should "configure rubyforge" do
|
117
|
+
assert_received(@rubyforge) {|rubyforge| rubyforge.configure}
|
118
|
+
end
|
119
|
+
|
120
|
+
should "login to rubyforge" do
|
121
|
+
assert_received(@rubyforge) {|rubyforge| rubyforge.login}
|
122
|
+
end
|
123
|
+
|
124
|
+
end
|
125
|
+
|
126
|
+
|
127
|
+
rubyforge_command_context "rubyforge_project is not defined" do
|
36
128
|
setup do
|
37
129
|
stub(@gemspec).name { 'zomg' }
|
38
130
|
stub(@gemspec).rubyforge_project { nil }
|
@@ -45,16 +137,18 @@ class Jeweler
|
|
45
137
|
end
|
46
138
|
end
|
47
139
|
|
48
|
-
rubyforge_command_context "rubyforge project
|
140
|
+
rubyforge_command_context "rubyforge project not existing or being setup in ~/.rubyforge/autoconfig.yml" do
|
49
141
|
setup do
|
50
142
|
stub(@rubyforge).configure
|
51
143
|
stub(@rubyforge).login
|
52
|
-
stub(@rubyforge).create_package('some_project_that_doesnt_exist', 'zomg')do
|
53
|
-
raise RuntimeError, "no <group_id> configured for <some_project_that_doesnt_exist>"
|
54
|
-
end
|
55
144
|
|
56
145
|
stub(@gemspec).name { 'zomg' }
|
57
146
|
stub(@gemspec).rubyforge_project { 'some_project_that_doesnt_exist' }
|
147
|
+
|
148
|
+
stub(@command).package_exists? { false }
|
149
|
+
stub(@command).create_package do
|
150
|
+
raise RubyForgeProjectNotConfiguredError, 'some_project_that_doesnt_exist'
|
151
|
+
end
|
58
152
|
end
|
59
153
|
|
60
154
|
should "raise RubyForgeProjectNotConfiguredError" do
|