juwelier 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.coveralls.yml +2 -0
- data/.document +8 -0
- data/.semver +5 -0
- data/.travis.yml +7 -0
- data/.yardopts +2 -0
- data/ChangeLog.markdown +230 -0
- data/Gemfile +40 -0
- data/LICENSE.txt +20 -0
- data/README.markdown +252 -0
- data/Rakefile +78 -0
- data/bin/juwelier +9 -0
- data/features/generator/cucumber.feature +103 -0
- data/features/generator/directory_layout.feature +86 -0
- data/features/generator/dotdocument.feature +13 -0
- data/features/generator/env_options.feature +9 -0
- data/features/generator/gemfile.feature +81 -0
- data/features/generator/git.feature +102 -0
- data/features/generator/license.feature +20 -0
- data/features/generator/rakefile.feature +158 -0
- data/features/generator/readme.feature +12 -0
- data/features/generator/test.feature +54 -0
- data/features/generator/test_helper.feature +149 -0
- data/features/placeholder.feature +5 -0
- data/features/step_definitions/debug_steps.rb +6 -0
- data/features/step_definitions/filesystem_steps.rb +70 -0
- data/features/step_definitions/generator_steps.rb +387 -0
- data/features/step_definitions/task_steps.rb +6 -0
- data/features/support/env.rb +41 -0
- data/features/tasks/build_gem.feature +9 -0
- data/features/tasks/version.feature +31 -0
- data/features/tasks/version_bumping.feature +49 -0
- data/juwelier.gemspec +241 -0
- data/lib/juwelier.rb +178 -0
- data/lib/juwelier/commands.rb +20 -0
- data/lib/juwelier/commands/build_gem.rb +40 -0
- data/lib/juwelier/commands/check_dependencies.rb +66 -0
- data/lib/juwelier/commands/install_gem.rb +31 -0
- data/lib/juwelier/commands/release_gemspec.rb +87 -0
- data/lib/juwelier/commands/release_to_git.rb +64 -0
- data/lib/juwelier/commands/release_to_rubygems.rb +28 -0
- data/lib/juwelier/commands/validate_gemspec.rb +30 -0
- data/lib/juwelier/commands/version/base.rb +55 -0
- data/lib/juwelier/commands/version/bump_major.rb +13 -0
- data/lib/juwelier/commands/version/bump_minor.rb +12 -0
- data/lib/juwelier/commands/version/bump_patch.rb +14 -0
- data/lib/juwelier/commands/version/write.rb +12 -0
- data/lib/juwelier/commands/write_gemspec.rb +39 -0
- data/lib/juwelier/errors.rb +8 -0
- data/lib/juwelier/gemcutter_tasks.rb +8 -0
- data/lib/juwelier/gemspec_helper.rb +87 -0
- data/lib/juwelier/generator.rb +304 -0
- data/lib/juwelier/generator/application.rb +63 -0
- data/lib/juwelier/generator/bacon_mixin.rb +43 -0
- data/lib/juwelier/generator/github_mixin.rb +22 -0
- data/lib/juwelier/generator/micronaut_mixin.rb +41 -0
- data/lib/juwelier/generator/minitest_mixin.rb +42 -0
- data/lib/juwelier/generator/options.rb +172 -0
- data/lib/juwelier/generator/rdoc_mixin.rb +13 -0
- data/lib/juwelier/generator/riot_mixin.rb +42 -0
- data/lib/juwelier/generator/rspec_mixin.rb +42 -0
- data/lib/juwelier/generator/shindo_mixin.rb +44 -0
- data/lib/juwelier/generator/shoulda_mixin.rb +42 -0
- data/lib/juwelier/generator/testspec_mixin.rb +42 -0
- data/lib/juwelier/generator/testunit_mixin.rb +39 -0
- data/lib/juwelier/generator/yard_mixin.rb +15 -0
- data/lib/juwelier/rubyforge_tasks.rb +95 -0
- data/lib/juwelier/rubygems_dot_org_tasks.rb +38 -0
- data/lib/juwelier/rubygems_tasks.rb +38 -0
- data/lib/juwelier/specification.rb +110 -0
- data/lib/juwelier/tasks.rb +239 -0
- data/lib/juwelier/templates/.document +5 -0
- data/lib/juwelier/templates/.gitignore +49 -0
- data/lib/juwelier/templates/Gemfile +12 -0
- data/lib/juwelier/templates/LICENSE.txt +20 -0
- data/lib/juwelier/templates/README.rdoc +19 -0
- data/lib/juwelier/templates/Rakefile +9 -0
- data/lib/juwelier/templates/bacon/flunking.rb +7 -0
- data/lib/juwelier/templates/bacon/helper.rb +10 -0
- data/lib/juwelier/templates/bundler_setup.erb +10 -0
- data/lib/juwelier/templates/features/default.feature +9 -0
- data/lib/juwelier/templates/features/support/env.rb +11 -0
- data/lib/juwelier/templates/juwelier_tasks.erb +31 -0
- data/lib/juwelier/templates/micronaut/flunking.rb +7 -0
- data/lib/juwelier/templates/micronaut/helper.rb +19 -0
- data/lib/juwelier/templates/minitest/flunking.rb +7 -0
- data/lib/juwelier/templates/minitest/helper.rb +13 -0
- data/lib/juwelier/templates/other_tasks.erb +70 -0
- data/lib/juwelier/templates/riot/flunking.rb +11 -0
- data/lib/juwelier/templates/riot/helper.rb +5 -0
- data/lib/juwelier/templates/rspec/.rspec +1 -0
- data/lib/juwelier/templates/rspec/flunking.rb +7 -0
- data/lib/juwelier/templates/rspec/helper.rb +14 -0
- data/lib/juwelier/templates/shindo/flunking.rb +8 -0
- data/lib/juwelier/templates/shindo/helper.rb +7 -0
- data/lib/juwelier/templates/shoulda/flunking.rb +7 -0
- data/lib/juwelier/templates/shoulda/helper.rb +12 -0
- data/lib/juwelier/templates/simplecov.erb +16 -0
- data/lib/juwelier/templates/testspec/flunking.rb +7 -0
- data/lib/juwelier/templates/testspec/helper.rb +7 -0
- data/lib/juwelier/templates/testunit/flunking.rb +7 -0
- data/lib/juwelier/templates/testunit/helper.rb +11 -0
- data/lib/juwelier/version.rb +10 -0
- data/lib/juwelier/version_helper.rb +141 -0
- data/test/fixtures/bar/VERSION.yml +4 -0
- data/test/fixtures/bar/bin/foo_the_ultimate_bin +1 -0
- data/test/fixtures/bar/hey_include_me_in_gemspec +0 -0
- data/test/fixtures/bar/lib/foo_the_ultimate_lib.rb +1 -0
- data/test/fixtures/existing-project-with-version-constant/.document +5 -0
- data/test/fixtures/existing-project-with-version-constant/.gitignore +5 -0
- data/test/fixtures/existing-project-with-version-constant/LICENSE.txt +20 -0
- data/test/fixtures/existing-project-with-version-constant/README.rdoc +7 -0
- data/test/fixtures/existing-project-with-version-constant/Rakefile +85 -0
- data/test/fixtures/existing-project-with-version-constant/existing-project-with-version.gemspec +29 -0
- data/test/fixtures/existing-project-with-version-constant/lib/existing_project_with_version.rb +0 -0
- data/test/fixtures/existing-project-with-version-constant/test/existing_project_with_version_test.rb +7 -0
- data/test/fixtures/existing-project-with-version-constant/test/test_helper.rb +10 -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-plaintext/LICENSE.txt +20 -0
- data/test/fixtures/existing-project-with-version-plaintext/README.rdoc +7 -0
- data/test/fixtures/existing-project-with-version-plaintext/Rakefile +84 -0
- data/test/fixtures/existing-project-with-version-plaintext/VERSION +1 -0
- data/test/fixtures/existing-project-with-version-plaintext/existing-project-with-version.gemspec +29 -0
- data/test/fixtures/existing-project-with-version-plaintext/lib/existing_project_with_version.rb +0 -0
- data/test/fixtures/existing-project-with-version-plaintext/test/existing_project_with_version_test.rb +7 -0
- data/test/fixtures/existing-project-with-version-plaintext/test/test_helper.rb +10 -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.txt +20 -0
- data/test/fixtures/existing-project-with-version-yaml/README.rdoc +7 -0
- data/test/fixtures/existing-project-with-version-yaml/Rakefile +84 -0
- data/test/fixtures/existing-project-with-version-yaml/VERSION.yml +4 -0
- data/test/fixtures/existing-project-with-version-yaml/bin/foo_the_ultimate_bin +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/geminstaller.yml +12 -0
- data/test/juwelier/commands/test_build_gem.rb +112 -0
- data/test/juwelier/commands/test_install_gem.rb +35 -0
- data/test/juwelier/commands/test_release_to_gemcutter.rb +39 -0
- data/test/juwelier/commands/test_release_to_git.rb +271 -0
- data/test/juwelier/commands/test_release_to_github.rb +477 -0
- data/test/juwelier/commands/test_validate_gemspec.rb +27 -0
- data/test/juwelier/commands/test_write_gemspec.rb +103 -0
- data/test/juwelier/commands/version/test_base.rb +53 -0
- data/test/juwelier/commands/version/test_bump_major.rb +22 -0
- data/test/juwelier/commands/version/test_bump_minor.rb +19 -0
- data/test/juwelier/commands/version/test_bump_patch.rb +20 -0
- data/test/juwelier/commands/version/test_write.rb +22 -0
- data/test/juwelier/generator/test_application.rb +142 -0
- data/test/juwelier/generator/test_options.rb +227 -0
- data/test/juwelier/test_gemspec_helper.rb +44 -0
- data/test/juwelier/test_generator.rb +140 -0
- data/test/juwelier/test_generator_initialization.rb +150 -0
- data/test/juwelier/test_generator_mixins.rb +23 -0
- data/test/juwelier/test_specification.rb +245 -0
- data/test/juwelier/test_tasks.rb +50 -0
- data/test/juwelier/test_version_helper.rb +214 -0
- data/test/shoulda_macros/juwelier_macros.rb +35 -0
- data/test/test_helper.rb +174 -0
- data/test/test_juwelier.rb +177 -0
- metadata +396 -0
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
require 'rake'
|
4
|
+
class TestTasks < Test::Unit::TestCase
|
5
|
+
include Rake
|
6
|
+
|
7
|
+
context 'instantiating Juwelier::Tasks' do
|
8
|
+
setup do
|
9
|
+
@gemspec_building_block = lambda {|gemspec|}
|
10
|
+
@tasks = Juwelier::Tasks.new &@gemspec_building_block
|
11
|
+
end
|
12
|
+
|
13
|
+
teardown do
|
14
|
+
Task.clear
|
15
|
+
end
|
16
|
+
|
17
|
+
should 'assign @gemspec' do
|
18
|
+
assert_not_nil @tasks.gemspec
|
19
|
+
end
|
20
|
+
|
21
|
+
should 'not eagerly initialize Juwelier' do
|
22
|
+
assert ! @tasks.instance_variable_defined?(:@juwelier)
|
23
|
+
end
|
24
|
+
|
25
|
+
should 'set self as the application-wide juwelier tasks' do
|
26
|
+
assert_same @tasks, Rake.application.juwelier_tasks
|
27
|
+
end
|
28
|
+
|
29
|
+
should 'save gemspec building block for later' do
|
30
|
+
assert_same @gemspec_building_block, @tasks.gemspec_building_block
|
31
|
+
end
|
32
|
+
|
33
|
+
context 'Juwelier instance' do
|
34
|
+
setup do
|
35
|
+
@tasks.juwelier
|
36
|
+
end
|
37
|
+
|
38
|
+
should 'initailize Juwelier' do
|
39
|
+
assert @tasks.instance_variable_defined?(:@juwelier)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
should 'yield the gemspec instance' do
|
44
|
+
spec = nil
|
45
|
+
@tasks = Juwelier::Tasks.new { |s| spec = s }
|
46
|
+
assert_not_nil @tasks.juwelier.gemspec
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,214 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class TestVersionHelper < Test::Unit::TestCase
|
4
|
+
|
5
|
+
VERSION_TMP_DIR = File.dirname(__FILE__) + '/version_tmp'
|
6
|
+
|
7
|
+
def self.should_have_version(major, minor, patch, build=nil)
|
8
|
+
should "have major version #{major}" do
|
9
|
+
assert_equal major, @version_helper.major
|
10
|
+
end
|
11
|
+
|
12
|
+
should "have minor version #{minor}" do
|
13
|
+
assert_equal minor, @version_helper.minor
|
14
|
+
end
|
15
|
+
|
16
|
+
should "have patch version #{patch}" do
|
17
|
+
assert_equal patch, @version_helper.patch
|
18
|
+
end
|
19
|
+
|
20
|
+
should "have build version #{build}" do
|
21
|
+
assert_equal build, @version_helper.build
|
22
|
+
end
|
23
|
+
|
24
|
+
version_s = [major, minor, patch, build].compact.join('.')
|
25
|
+
should "render string as #{version_s.inspect}" do
|
26
|
+
assert_equal version_s, @version_helper.to_s
|
27
|
+
end
|
28
|
+
|
29
|
+
#version_hash = {:major => major, :minor => minor, :patch => patch}
|
30
|
+
#should "render hash as #{version_hash.inspect}" do
|
31
|
+
#assert_equal version_hash, @version_helper.to_hash
|
32
|
+
#end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
context "VERSION.yml with 3.5.4" do
|
37
|
+
setup do
|
38
|
+
FileUtils.rm_rf VERSION_TMP_DIR
|
39
|
+
FileUtils.mkdir_p VERSION_TMP_DIR
|
40
|
+
|
41
|
+
build_version_yml VERSION_TMP_DIR, 3, 5, 4
|
42
|
+
|
43
|
+
@version_helper = Juwelier::VersionHelper.new VERSION_TMP_DIR
|
44
|
+
end
|
45
|
+
|
46
|
+
should_have_version 3, 5, 4
|
47
|
+
|
48
|
+
context "bumping major version" do
|
49
|
+
setup { @version_helper.bump_major }
|
50
|
+
should_have_version 4, 0, 0
|
51
|
+
end
|
52
|
+
|
53
|
+
context "bumping the minor version" do
|
54
|
+
setup { @version_helper.bump_minor }
|
55
|
+
should_have_version 3, 6, 0
|
56
|
+
end
|
57
|
+
|
58
|
+
context "bumping the patch version" do
|
59
|
+
setup { @version_helper.bump_patch }
|
60
|
+
should_have_version 3, 5, 5
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
context "VERSION.yml with 3.5.4.a1" do
|
65
|
+
setup do
|
66
|
+
FileUtils.rm_rf VERSION_TMP_DIR
|
67
|
+
FileUtils.mkdir_p VERSION_TMP_DIR
|
68
|
+
|
69
|
+
build_version_yml VERSION_TMP_DIR, 3, 5, 4, 'a1'
|
70
|
+
|
71
|
+
@version_helper = Juwelier::VersionHelper.new VERSION_TMP_DIR
|
72
|
+
end
|
73
|
+
|
74
|
+
should_have_version 3, 5, 4, 'a1'
|
75
|
+
|
76
|
+
context "bumping major version" do
|
77
|
+
setup { @version_helper.bump_major }
|
78
|
+
should_have_version 4, 0, 0, nil
|
79
|
+
end
|
80
|
+
|
81
|
+
context "bumping the minor version" do
|
82
|
+
setup { @version_helper.bump_minor }
|
83
|
+
should_have_version 3, 6, 0, nil
|
84
|
+
end
|
85
|
+
|
86
|
+
context "bumping the patch version" do
|
87
|
+
setup { @version_helper.bump_patch }
|
88
|
+
should_have_version 3, 5, 5, nil
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
context "VERSION with 3.5.4" do
|
93
|
+
setup do
|
94
|
+
FileUtils.rm_rf VERSION_TMP_DIR
|
95
|
+
FileUtils.mkdir_p VERSION_TMP_DIR
|
96
|
+
|
97
|
+
build_version_plaintext VERSION_TMP_DIR, 3, 5, 4
|
98
|
+
|
99
|
+
@version_helper = Juwelier::VersionHelper.new VERSION_TMP_DIR
|
100
|
+
end
|
101
|
+
|
102
|
+
should_have_version 3, 5, 4
|
103
|
+
|
104
|
+
context "bumping major version" do
|
105
|
+
setup { @version_helper.bump_major }
|
106
|
+
should_have_version 4, 0, 0
|
107
|
+
end
|
108
|
+
|
109
|
+
context "bumping the minor version" do
|
110
|
+
setup { @version_helper.bump_minor }
|
111
|
+
should_have_version 3, 6, 0
|
112
|
+
end
|
113
|
+
|
114
|
+
context "bumping the patch version" do
|
115
|
+
setup { @version_helper.bump_patch }
|
116
|
+
should_have_version 3, 5, 5
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
context "VERSION with 3.5.4.a1" do
|
121
|
+
setup do
|
122
|
+
FileUtils.rm_rf VERSION_TMP_DIR
|
123
|
+
FileUtils.mkdir_p VERSION_TMP_DIR
|
124
|
+
|
125
|
+
build_version_plaintext VERSION_TMP_DIR, 3, 5, 4, 'a1'
|
126
|
+
|
127
|
+
@version_helper = Juwelier::VersionHelper.new VERSION_TMP_DIR
|
128
|
+
end
|
129
|
+
|
130
|
+
should_have_version 3, 5, 4, 'a1'
|
131
|
+
|
132
|
+
context "bumping major version" do
|
133
|
+
setup { @version_helper.bump_major }
|
134
|
+
should_have_version 4, 0, 0, nil
|
135
|
+
end
|
136
|
+
|
137
|
+
context "bumping the minor version" do
|
138
|
+
setup { @version_helper.bump_minor }
|
139
|
+
should_have_version 3, 6, 0, nil
|
140
|
+
end
|
141
|
+
|
142
|
+
context "bumping the patch version" do
|
143
|
+
setup { @version_helper.bump_patch }
|
144
|
+
should_have_version 3, 5, 5, nil
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
context "Non-existant VERSION.yml" do
|
149
|
+
setup do
|
150
|
+
FileUtils.rm_rf VERSION_TMP_DIR
|
151
|
+
FileUtils.mkdir_p VERSION_TMP_DIR
|
152
|
+
end
|
153
|
+
|
154
|
+
should "not raise error if the VERSION.yml doesn't exist" do
|
155
|
+
assert_nothing_raised Juwelier::VersionYmlError do
|
156
|
+
Juwelier::VersionHelper.new(VERSION_TMP_DIR)
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
context "setting an initial version" do
|
161
|
+
setup do
|
162
|
+
@version_helper = Juwelier::VersionHelper.new(VERSION_TMP_DIR)
|
163
|
+
@version_helper.update_to 0, 0, 1
|
164
|
+
end
|
165
|
+
|
166
|
+
should_have_version 0, 0, 1
|
167
|
+
should "not create VERSION.yml" do
|
168
|
+
assert ! File.exists?(File.join(VERSION_TMP_DIR, 'VERSION.yml'))
|
169
|
+
end
|
170
|
+
should "not create VERSION" do
|
171
|
+
assert ! File.exists?(File.join(VERSION_TMP_DIR, 'VERSION'))
|
172
|
+
end
|
173
|
+
|
174
|
+
context "outputting" do
|
175
|
+
setup do
|
176
|
+
@version_helper.write
|
177
|
+
end
|
178
|
+
|
179
|
+
should "create VERSION" do
|
180
|
+
assert File.exists?(File.join(VERSION_TMP_DIR, 'VERSION'))
|
181
|
+
end
|
182
|
+
|
183
|
+
context "re-reading VERSION" do
|
184
|
+
setup do
|
185
|
+
@version_helper = Juwelier::VersionHelper.new(VERSION_TMP_DIR)
|
186
|
+
end
|
187
|
+
|
188
|
+
should_have_version 0, 0, 1
|
189
|
+
end
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
def build_version_yml(base_dir, major, minor, patch, build=nil)
|
195
|
+
version_path = File.join(base_dir, 'VERSION.yml')
|
196
|
+
|
197
|
+
File.open(version_path, 'w+') do |f|
|
198
|
+
version_hash = {
|
199
|
+
'major' => major.to_i,
|
200
|
+
'minor' => minor.to_i,
|
201
|
+
'patch' => patch.to_i
|
202
|
+
}
|
203
|
+
version_hash['build'] = build if build
|
204
|
+
YAML.dump(version_hash, f)
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
def build_version_plaintext(base_dir, major, minor, patch, build=nil)
|
209
|
+
version_path = File.join(base_dir, 'VERSION')
|
210
|
+
File.open(version_path, 'w+') do |f|
|
211
|
+
f.puts [major, minor, patch, build].compact.join('.')
|
212
|
+
end
|
213
|
+
end
|
214
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
class Test::Unit::TestCase
|
2
|
+
class << self
|
3
|
+
def should_have_major_version(version)
|
4
|
+
should "have major version of #{version}" do
|
5
|
+
assert_equal version, @juwelier.major_version
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
def should_have_minor_version(version)
|
10
|
+
should "have minor version of #{version}" do
|
11
|
+
assert_equal version, @juwelier.minor_version
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def should_have_patch_version(version)
|
16
|
+
should "have patch version of #{version}" do
|
17
|
+
assert_equal version, @juwelier.patch_version
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def should_be_version(version)
|
22
|
+
should "be version #{version}" do
|
23
|
+
assert_equal version, @juwelier.version
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def should_bump_version(major, minor, patch)
|
28
|
+
version = "#{major}.#{minor}.#{patch}"
|
29
|
+
should_have_major_version major
|
30
|
+
should_have_minor_version minor
|
31
|
+
should_have_patch_version patch
|
32
|
+
should_be_version version
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,174 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'rubygems'
|
3
|
+
|
4
|
+
require 'bundler'
|
5
|
+
require 'coveralls'
|
6
|
+
Coveralls.wear!
|
7
|
+
|
8
|
+
begin
|
9
|
+
Bundler.setup(:default, :xzibit, :test)
|
10
|
+
rescue Bundler::BundlerError => e
|
11
|
+
$stderr.puts e.message
|
12
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
13
|
+
exit e.status_code
|
14
|
+
end
|
15
|
+
|
16
|
+
require 'rake'
|
17
|
+
require 'shoulda'
|
18
|
+
require 'rr'
|
19
|
+
#require 'redgreen'
|
20
|
+
require 'construct'
|
21
|
+
require 'git'
|
22
|
+
require 'time'
|
23
|
+
|
24
|
+
require 'juwelier'
|
25
|
+
|
26
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
27
|
+
require 'shoulda_macros/juwelier_macros'
|
28
|
+
|
29
|
+
TMP_DIR = '/tmp/juwelier_test'
|
30
|
+
FIXTURE_DIR = File.expand_path('../fixtures', __FILE__)
|
31
|
+
|
32
|
+
class RubyForgeStub
|
33
|
+
attr_accessor :userconfig, :autoconfig
|
34
|
+
def initialize
|
35
|
+
@userconfig = {}
|
36
|
+
@autoconfig = {}
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
class Test::Unit::TestCase
|
41
|
+
include RR::Adapters::TestUnit unless include?(RR::Adapters::TestUnit)
|
42
|
+
include Construct::Helpers
|
43
|
+
|
44
|
+
def tmp_dir
|
45
|
+
TMP_DIR
|
46
|
+
end
|
47
|
+
|
48
|
+
def fixture_dir
|
49
|
+
File.join(FIXTURE_DIR, 'bar')
|
50
|
+
end
|
51
|
+
|
52
|
+
def remove_tmpdir!
|
53
|
+
FileUtils.rm_rf(tmp_dir)
|
54
|
+
end
|
55
|
+
|
56
|
+
def create_tmpdir!
|
57
|
+
FileUtils.mkdir_p(tmp_dir)
|
58
|
+
end
|
59
|
+
|
60
|
+
def build_spec(*files)
|
61
|
+
Gem::Specification.new do |s|
|
62
|
+
s.name = "bar"
|
63
|
+
s.summary = "Simple and opinionated helper for creating Rubygem projects on GitHub"
|
64
|
+
s.email = "fred.mitchell@gmx.com"
|
65
|
+
s.homepage = "http://github.com/flajann2/juwelier"
|
66
|
+
s.description = "Simple and opinionated helper for creating Rubygem projects on GitHub"
|
67
|
+
s.authors = ["Josh Nichols"]
|
68
|
+
s.files = FileList[*files] unless files.empty?
|
69
|
+
s.version = '0.1.1'
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def self.gemcutter_command_context(description, &block)
|
74
|
+
context description do
|
75
|
+
setup do
|
76
|
+
@command = eval(self.class.name.gsub(/::Test/, '::')).new
|
77
|
+
|
78
|
+
if @command.respond_to? :gemspec_helper=
|
79
|
+
@gemspec_helper = Object.new
|
80
|
+
@command.gemspec_helper = @gemspec_helper
|
81
|
+
end
|
82
|
+
|
83
|
+
if @command.respond_to? :output
|
84
|
+
@output = StringIO.new
|
85
|
+
@command.output = @output
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
context "", &block
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
def self.rubyforge_command_context(description, &block)
|
94
|
+
context description do
|
95
|
+
setup do
|
96
|
+
@command = eval(self.class.name.gsub(/::Test/, '::')).new
|
97
|
+
|
98
|
+
if @command.respond_to? :gemspec=
|
99
|
+
@gemspec = Object.new
|
100
|
+
@command.gemspec = @gemspec
|
101
|
+
end
|
102
|
+
|
103
|
+
if @command.respond_to? :gemspec_helper=
|
104
|
+
@gemspec_helper = Object.new
|
105
|
+
@command.gemspec_helper = @gemspec_helper
|
106
|
+
end
|
107
|
+
|
108
|
+
if @command.respond_to? :rubyforge=
|
109
|
+
@rubyforge = RubyForgeStub.new
|
110
|
+
@command.rubyforge = @rubyforge
|
111
|
+
end
|
112
|
+
|
113
|
+
if @command.respond_to? :output
|
114
|
+
@output = StringIO.new
|
115
|
+
@command.output = @output
|
116
|
+
end
|
117
|
+
|
118
|
+
if @command.respond_to? :repo
|
119
|
+
@repo = Object.new
|
120
|
+
@command.repo = @repo
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
context "", &block
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
def self.build_command_context(description, &block)
|
129
|
+
context description do
|
130
|
+
setup do
|
131
|
+
|
132
|
+
@repo = Object.new
|
133
|
+
@version_helper = Object.new
|
134
|
+
@gemspec = Object.new
|
135
|
+
@commit = Object.new
|
136
|
+
@version = Object.new
|
137
|
+
@output = Object.new
|
138
|
+
@base_dir = Object.new
|
139
|
+
@gemspec_helper = Object.new
|
140
|
+
@rubyforge = Object.new
|
141
|
+
|
142
|
+
@juwelier = Object.new
|
143
|
+
|
144
|
+
stub(@juwelier).repo { @repo }
|
145
|
+
stub(@juwelier).version_helper { @version_helper }
|
146
|
+
stub(@juwelier).gemspec { @gemspec }
|
147
|
+
stub(@juwelier).commit { @commit }
|
148
|
+
stub(@juwelier).version { @version }
|
149
|
+
stub(@juwelier).output { @output }
|
150
|
+
stub(@juwelier).gemspec_helper { @gemspec_helper }
|
151
|
+
stub(@juwelier).base_dir { @base_dir }
|
152
|
+
stub(@juwelier).rubyforge { @rubyforge }
|
153
|
+
end
|
154
|
+
|
155
|
+
context "", &block
|
156
|
+
end
|
157
|
+
|
158
|
+
end
|
159
|
+
|
160
|
+
def stub_git_config(options = {})
|
161
|
+
stub(Git).global_config() { options }
|
162
|
+
end
|
163
|
+
|
164
|
+
def set_default_git_config
|
165
|
+
@project_name = 'the-perfect-gem'
|
166
|
+
@git_name = 'foo'
|
167
|
+
@git_email = 'bar@example.com'
|
168
|
+
@github_user = 'flajann2'
|
169
|
+
end
|
170
|
+
|
171
|
+
def valid_git_config
|
172
|
+
{ 'user.name' => @git_name, 'user.email' => @git_email, 'github.user' => @github_user }
|
173
|
+
end
|
174
|
+
end
|