bueller 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog.markdown +141 -0
- data/LICENSE +20 -0
- data/README.markdown +182 -0
- data/bin/bueller +5 -0
- data/lib/bueller/commands/build_gem.rb +50 -0
- data/lib/bueller/commands/git_tag_release.rb +63 -0
- data/lib/bueller/commands/install_gem.rb +36 -0
- data/lib/bueller/commands/release_to_github.rb +41 -0
- data/lib/bueller/commands/release_to_rubygems.rb +26 -0
- data/lib/bueller/commands/version/base.rb +36 -0
- data/lib/bueller/commands/version/bump_major.rb +11 -0
- data/lib/bueller/commands/version/bump_minor.rb +12 -0
- data/lib/bueller/commands/version/bump_patch.rb +14 -0
- data/lib/bueller/commands/version/write.rb +21 -0
- data/lib/bueller/commands/write_gemspec.rb +29 -0
- data/lib/bueller/commands.rb +18 -0
- data/lib/bueller/errors.rb +8 -0
- data/lib/bueller/gemspec_helper.rb +83 -0
- data/lib/bueller/generator/application.rb +51 -0
- data/lib/bueller/generator/bacon_mixin.rb +43 -0
- data/lib/bueller/generator/github_mixin.rb +29 -0
- data/lib/bueller/generator/micronaut_mixin.rb +41 -0
- data/lib/bueller/generator/minitest_mixin.rb +42 -0
- data/lib/bueller/generator/options.rb +154 -0
- data/lib/bueller/generator/rdoc_mixin.rb +9 -0
- data/lib/bueller/generator/riot_mixin.rb +42 -0
- data/lib/bueller/generator/rspec_mixin.rb +50 -0
- data/lib/bueller/generator/shindo_mixin.rb +44 -0
- data/lib/bueller/generator/shoulda_mixin.rb +42 -0
- data/lib/bueller/generator/testspec_mixin.rb +42 -0
- data/lib/bueller/generator/testunit_mixin.rb +39 -0
- data/lib/bueller/generator/yard_mixin.rb +14 -0
- data/lib/bueller/generator.rb +291 -0
- data/lib/bueller/rubyforge_tasks.rb +88 -0
- data/lib/bueller/tasks.rb +133 -0
- data/lib/bueller/templates/.document +11 -0
- data/lib/bueller/templates/.gitignore +40 -0
- data/lib/bueller/templates/Gemfile +1 -0
- data/lib/bueller/templates/LICENSE +20 -0
- data/lib/bueller/templates/README.rdoc +17 -0
- data/lib/bueller/templates/Rakefile +20 -0
- data/lib/bueller/templates/bacon/flunking.rb +7 -0
- data/lib/bueller/templates/bacon/helper.rb +8 -0
- data/lib/bueller/templates/bueller_tasks.erb +10 -0
- data/lib/bueller/templates/features/default.feature +9 -0
- data/lib/bueller/templates/features/support/env.rb +16 -0
- data/lib/bueller/templates/gemspec +27 -0
- data/lib/bueller/templates/micronaut/flunking.rb +7 -0
- data/lib/bueller/templates/micronaut/helper.rb +17 -0
- data/lib/bueller/templates/minitest/flunking.rb +7 -0
- data/lib/bueller/templates/minitest/helper.rb +11 -0
- data/lib/bueller/templates/other_tasks.erb +84 -0
- data/lib/bueller/templates/riot/flunking.rb +11 -0
- data/lib/bueller/templates/riot/helper.rb +3 -0
- data/lib/bueller/templates/rspec/.rspec +1 -0
- data/lib/bueller/templates/rspec/flunking.rb +7 -0
- data/lib/bueller/templates/rspec/helper.rb +19 -0
- data/lib/bueller/templates/shindo/flunking.rb +8 -0
- data/lib/bueller/templates/shindo/helper.rb +5 -0
- data/lib/bueller/templates/shoulda/flunking.rb +7 -0
- data/lib/bueller/templates/shoulda/helper.rb +10 -0
- data/lib/bueller/templates/testspec/flunking.rb +7 -0
- data/lib/bueller/templates/testspec/helper.rb +7 -0
- data/lib/bueller/templates/testunit/flunking.rb +7 -0
- data/lib/bueller/templates/testunit/helper.rb +9 -0
- data/lib/bueller/version_helper.rb +59 -0
- data/lib/bueller.rb +139 -0
- data/spec/bueller/commands/build_gem_spec.rb +38 -0
- data/spec/bueller/commands/git_tag_release_spec.rb +79 -0
- data/spec/bueller/commands/install_gem_spec.rb +11 -0
- data/spec/bueller/commands/release_to_github_spec.rb +54 -0
- data/spec/bueller/commands/release_to_rubygems_spec.rb +15 -0
- data/spec/bueller/commands/version/bump_major_spec.rb +12 -0
- data/spec/bueller/commands/version/bump_minor_spec.rb +12 -0
- data/spec/bueller/commands/version/bump_patch_spec.rb +12 -0
- data/spec/bueller/commands/write_gemspec_spec.rb +32 -0
- data/spec/bueller/gemspec_helper_spec.rb +55 -0
- data/spec/bueller/generator/application_spec.rb +67 -0
- data/spec/bueller/generator/options_spec.rb +206 -0
- data/spec/bueller/generator_mixins_spec.rb +23 -0
- data/spec/bueller/generator_spec.rb +274 -0
- data/spec/bueller/tasks_spec.rb +29 -0
- data/spec/bueller/version_helper_spec.rb +57 -0
- data/spec/bueller_spec.rb +94 -0
- data/spec/fixtures/bar/bar.gemspec +41 -0
- data/spec/fixtures/bar/bin/foo_the_ultimate_bin +1 -0
- data/spec/fixtures/bar/hey_include_me_in_gemspec +0 -0
- data/spec/fixtures/bar/lib/foo_the_ultimate_lib.rb +1 -0
- data/spec/fixtures/existing-project/LICENSE +20 -0
- data/spec/fixtures/existing-project/README.rdoc +7 -0
- data/spec/fixtures/existing-project/Rakefile +69 -0
- data/spec/fixtures/existing-project/existing-project.gemspec +20 -0
- data/spec/fixtures/existing-project/lib/existing_project_with_version.rb +0 -0
- data/spec/fixtures/existing-project/test/existing_project_with_version_test.rb +7 -0
- data/spec/fixtures/existing-project/test/test_helper.rb +10 -0
- data/spec/fixtures/existing-project-with-version-constant/LICENSE +20 -0
- data/spec/fixtures/existing-project-with-version-constant/README.rdoc +7 -0
- data/spec/fixtures/existing-project-with-version-constant/Rakefile +69 -0
- data/spec/fixtures/existing-project-with-version-constant/existing-project-with-version.gemspec +19 -0
- data/spec/fixtures/existing-project-with-version-constant/lib/existing_project_with_version.rb +0 -0
- data/spec/fixtures/existing-project-with-version-constant/test/existing_project_with_version_test.rb +7 -0
- data/spec/fixtures/existing-project-with-version-constant/test/test_helper.rb +10 -0
- data/spec/spec_helper.rb +11 -0
- data/spec/support/application.rb +28 -0
- data/spec/support/file_system.rb +24 -0
- data/spec/support/gemspec.rb +28 -0
- data/spec/support/git.rb +19 -0
- data/spec/support/have_version.rb +18 -0
- metadata +381 -0
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
# FIXME: use example groups/it_should_behave_like instead
|
4
|
+
describe 'Bueller::Generator Mixins' do
|
5
|
+
[Bueller::Generator::BaconMixin,
|
6
|
+
Bueller::Generator::MicronautMixin,
|
7
|
+
Bueller::Generator::MinitestMixin,
|
8
|
+
Bueller::Generator::RspecMixin,
|
9
|
+
Bueller::Generator::ShouldaMixin,
|
10
|
+
Bueller::Generator::TestspecMixin,
|
11
|
+
Bueller::Generator::TestunitMixin,
|
12
|
+
].each do |mixin|
|
13
|
+
describe "#{mixin}" do
|
14
|
+
%w(default_task feature_support_require feature_support_extend
|
15
|
+
test_dir test_task test_pattern test_filename
|
16
|
+
test_helper_filename).each do |method|
|
17
|
+
it "should define #{method}" do
|
18
|
+
mixin.method_defined?(method).should be_true
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,274 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Bueller::Generator do
|
4
|
+
let(:options) do
|
5
|
+
{ :project_name => 'the-perfect-gem',
|
6
|
+
:user_name => 'John Doe',
|
7
|
+
:user_email => 'john@example.com',
|
8
|
+
:github_username => 'johndoe',
|
9
|
+
:github_token => 'yyz',
|
10
|
+
:documentation_framework => :rdoc,
|
11
|
+
:testing_framework => :rspec }
|
12
|
+
end
|
13
|
+
let(:generator) { Bueller::Generator.new options }
|
14
|
+
|
15
|
+
describe '#initialize' do
|
16
|
+
context "given a nil github repo name" do
|
17
|
+
before :each do
|
18
|
+
GitSupport.stub_config
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should raise NoGithubRepoNameGiven' do
|
22
|
+
pending "don't be so picky"
|
23
|
+
assert_raise Bueller::NoGitHubRepoNameGiven do
|
24
|
+
Bueller::Generator.new()
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context "without git user's name set" do
|
30
|
+
before :each do
|
31
|
+
GitSupport.stub_config
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'should raise an NoGitUserName' do
|
35
|
+
pending "don't be so picky"
|
36
|
+
assert_raise Bueller::NoGitUserName do
|
37
|
+
Bueller::Generator.new(:project_name => @project_name, :testing_framework => :shoulda, :documentation_framework => :rdoc)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
context "without git user's email set" do
|
43
|
+
before :each do
|
44
|
+
GitSupport.stub_config
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'should raise NoGitUserEmail' do
|
48
|
+
pending "don't be so picky"
|
49
|
+
assert_raise Bueller::NoGitUserEmail do
|
50
|
+
Bueller::Generator.new(:project_name => @project_name, :user_name => GitSupport.name, :testing_framework => :shoulda, :documentation_framework => :rdoc)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
context "without github username set" do
|
56
|
+
before :each do
|
57
|
+
GitSupport.stub_config
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'should raise NotGitHubUser' do
|
61
|
+
pending "don't be so picky"
|
62
|
+
assert_raise Bueller::NoGitHubUser do
|
63
|
+
Bueller::Generator.new(:project_name => @project_name, :user_name => GitSupport.name, :user_email => GitSupport.email, :testing_framework => :shoulda, :documentation_framework => :rdoc)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
context "without github token set" do
|
69
|
+
before :each do
|
70
|
+
GitSupport.stub_config
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'should raise NoGitHubToken if creating repo' do
|
74
|
+
pending "don't be so picky"
|
75
|
+
assert_raise Bueller::NoGitHubToken do
|
76
|
+
Bueller::Generator.new(:project_name => @project_name, :user_name => GitSupport.name, :user_email => GitSupport.email, :github_username => @github_user, :create_repo => true, :testing_framework => :shoulda, :documentation_framework => :rdoc)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
let(:defaults) do
|
82
|
+
defaults = { :project_name => GitSupport.project_name,
|
83
|
+
:user_name => GitSupport.name,
|
84
|
+
:user_email => GitSupport.email,
|
85
|
+
:github_username => GitSupport.github_user,
|
86
|
+
:github_token => GitSupport.github_token,
|
87
|
+
:testing_framework => :rspec,
|
88
|
+
:documentation_framework => :rdoc }
|
89
|
+
|
90
|
+
end
|
91
|
+
let(:generator) { Bueller::Generator.new(defaults) }
|
92
|
+
|
93
|
+
context "default configuration" do
|
94
|
+
before :each do
|
95
|
+
GitSupport.stub_config
|
96
|
+
end
|
97
|
+
|
98
|
+
it "should use rspec for testing" do
|
99
|
+
generator.testing_framework.should == :rspec
|
100
|
+
end
|
101
|
+
|
102
|
+
it "should use rdoc for documentation" do
|
103
|
+
generator.documentation_framework.should == :rdoc
|
104
|
+
end
|
105
|
+
|
106
|
+
it "should set todo in summary" do
|
107
|
+
generator.summary.should =~ /todo/i
|
108
|
+
end
|
109
|
+
|
110
|
+
it "should set todo in description" do
|
111
|
+
generator.description.should =~ /todo/i
|
112
|
+
end
|
113
|
+
|
114
|
+
it "should set target directory to the project name" do
|
115
|
+
generator.target_dir.should == GitSupport.project_name
|
116
|
+
end
|
117
|
+
|
118
|
+
it "should set user's name from git config" do
|
119
|
+
generator.user_name.should == GitSupport.name
|
120
|
+
end
|
121
|
+
|
122
|
+
it "should set email from git config" do
|
123
|
+
generator.user_email.should == GitSupport.email
|
124
|
+
end
|
125
|
+
|
126
|
+
it "should set origin remote as github, based on username and project name" do
|
127
|
+
generator.git_remote.should == "git@github.com:#{GitSupport.github_user}/#{GitSupport.project_name}.git"
|
128
|
+
end
|
129
|
+
|
130
|
+
it "should set homepage as github based on username and project name" do
|
131
|
+
generator.homepage.should == "http://github.com/#{GitSupport.github_user}/#{GitSupport.project_name}"
|
132
|
+
end
|
133
|
+
|
134
|
+
it "should set github username from git config" do
|
135
|
+
generator.github_username.should == GitSupport.github_user
|
136
|
+
end
|
137
|
+
|
138
|
+
it "should set project name as the-perfect-gem" do
|
139
|
+
generator.project_name.should == GitSupport.project_name
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
context "using yard" do
|
144
|
+
let(:generator) { Bueller::Generator.new(defaults.merge :documentation_framework => :yard) }
|
145
|
+
|
146
|
+
it "should set the doc_task to yardoc" do
|
147
|
+
generator.doc_task.should == "yardoc"
|
148
|
+
end
|
149
|
+
|
150
|
+
end
|
151
|
+
|
152
|
+
context "using rdoc" do
|
153
|
+
let(:generator) { Bueller::Generator.new(defaults.merge :documentation_framework => :rdoc) }
|
154
|
+
|
155
|
+
it "should set the doc_task to rdoc" do
|
156
|
+
generator.doc_task.should == "rdoc"
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
context "using a custom homepage" do
|
161
|
+
let(:generator) { Bueller::Generator.new(defaults.merge :homepage => 'http://zomg.com') }
|
162
|
+
|
163
|
+
it "should set the homepage" do
|
164
|
+
generator.homepage.should == "http://zomg.com"
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
it "should have the correct constant name" do
|
170
|
+
generator.constant_name.should == "ThePerfectGem"
|
171
|
+
end
|
172
|
+
|
173
|
+
it "should have the correct file name prefix" do
|
174
|
+
generator.file_name_prefix.should == "the_perfect_gem"
|
175
|
+
end
|
176
|
+
|
177
|
+
it "should have the correct require name" do
|
178
|
+
generator.require_name.should == "the-perfect-gem"
|
179
|
+
end
|
180
|
+
|
181
|
+
it "should have the correct lib file name" do
|
182
|
+
generator.lib_filename.should == "the-perfect-gem.rb"
|
183
|
+
end
|
184
|
+
|
185
|
+
it "should have the correct git-remote" do
|
186
|
+
generator.git_remote.should == 'git@github.com:johndoe/the-perfect-gem.git'
|
187
|
+
generator.git_remote = 'user@host:/path/to/repo'
|
188
|
+
generator.git_remote.should == 'user@host:/path/to/repo'
|
189
|
+
end
|
190
|
+
|
191
|
+
it 'should set up a project using shoulda' do
|
192
|
+
generator = Bueller::Generator.new options.merge(:testing_framework => :shoulda)
|
193
|
+
generator.test_task.should == 'test'
|
194
|
+
generator.test_dir.should == 'test'
|
195
|
+
generator.default_task.should == 'test'
|
196
|
+
generator.feature_support_require.should == 'test/unit/assertions'
|
197
|
+
generator.feature_support_extend.should == 'Test::Unit::Assertions'
|
198
|
+
generator.test_pattern.should == 'test/**/test_*.rb'
|
199
|
+
generator.test_filename.should == 'test_the-perfect-gem.rb'
|
200
|
+
generator.test_helper_filename.should == 'helper.rb'
|
201
|
+
end
|
202
|
+
|
203
|
+
it 'should create a project using testunit' do
|
204
|
+
generator = Bueller::Generator.new options.merge(:testing_framework => :testunit)
|
205
|
+
generator.test_task.should == 'test'
|
206
|
+
generator.test_dir.should == 'test'
|
207
|
+
generator.default_task.should == 'test'
|
208
|
+
generator.feature_support_require.should == 'test/unit/assertions'
|
209
|
+
generator.feature_support_extend.should == 'Test::Unit::Assertions'
|
210
|
+
generator.test_pattern.should == 'test/**/test_*.rb'
|
211
|
+
generator.test_filename.should == 'test_the-perfect-gem.rb'
|
212
|
+
generator.test_helper_filename.should == 'helper.rb'
|
213
|
+
end
|
214
|
+
|
215
|
+
it 'should create a project using minitest' do
|
216
|
+
generator = Bueller::Generator.new options.merge(:testing_framework => :minitest)
|
217
|
+
generator.test_task.should == 'test'
|
218
|
+
generator.test_dir.should == 'test'
|
219
|
+
generator.default_task.should == 'test'
|
220
|
+
generator.feature_support_require.should == 'minitest/unit'
|
221
|
+
generator.feature_support_extend.should == 'MiniTest::Assertions'
|
222
|
+
generator.test_pattern.should == 'test/**/test_*.rb'
|
223
|
+
generator.test_filename.should == 'test_the-perfect-gem.rb'
|
224
|
+
generator.test_helper_filename.should == 'helper.rb'
|
225
|
+
end
|
226
|
+
|
227
|
+
it 'should create a project using bacon' do
|
228
|
+
generator = Bueller::Generator.new options.merge(:testing_framework => :bacon)
|
229
|
+
generator.test_task.should == 'spec'
|
230
|
+
generator.test_dir.should == 'spec'
|
231
|
+
generator.default_task.should == 'spec'
|
232
|
+
generator.feature_support_require.should == 'test/unit/assertions'
|
233
|
+
generator.feature_support_extend.should == 'Test::Unit::Assertions'
|
234
|
+
generator.test_pattern.should == 'spec/**/*_spec.rb'
|
235
|
+
generator.test_filename.should == 'the-perfect-gem_spec.rb'
|
236
|
+
generator.test_helper_filename.should == 'spec_helper.rb'
|
237
|
+
end
|
238
|
+
|
239
|
+
it 'should create a project using rspec' do
|
240
|
+
generator = Bueller::Generator.new options.merge(:testing_framework => :rspec)
|
241
|
+
generator.test_task.should == 'examples'
|
242
|
+
generator.test_dir.should == 'spec'
|
243
|
+
generator.default_task.should == 'examples'
|
244
|
+
generator.feature_support_require.should == 'rspec/expectations'
|
245
|
+
generator.feature_support_extend.should == nil
|
246
|
+
generator.test_pattern.should == 'spec/**/*_spec.rb'
|
247
|
+
generator.test_filename.should == 'the-perfect-gem_spec.rb'
|
248
|
+
generator.test_helper_filename.should == 'spec_helper.rb'
|
249
|
+
end
|
250
|
+
|
251
|
+
it 'should create a project using micronaut' do
|
252
|
+
generator = Bueller::Generator.new options.merge(:testing_framework => :micronaut)
|
253
|
+
generator.test_task.should == 'examples'
|
254
|
+
generator.test_dir.should == 'examples'
|
255
|
+
generator.default_task.should == 'examples'
|
256
|
+
generator.feature_support_require.should == 'micronaut/expectations'
|
257
|
+
generator.feature_support_extend.should == 'Micronaut::Matchers'
|
258
|
+
generator.test_pattern.should == 'examples/**/*_example.rb'
|
259
|
+
generator.test_filename.should == 'the-perfect-gem_example.rb'
|
260
|
+
generator.test_helper_filename.should == 'example_helper.rb'
|
261
|
+
end
|
262
|
+
|
263
|
+
it 'should create a project using testspec' do
|
264
|
+
generator = Bueller::Generator.new options.merge(:testing_framework => :testspec)
|
265
|
+
generator.test_task.should == 'test'
|
266
|
+
generator.test_dir.should == 'test'
|
267
|
+
generator.default_task.should == 'test'
|
268
|
+
generator.feature_support_require.should == 'test/unit/assertions'
|
269
|
+
generator.feature_support_extend.should == 'Test::Unit::Assertions'
|
270
|
+
generator.test_pattern.should == 'test/**/*_test.rb'
|
271
|
+
generator.test_filename.should == 'the-perfect-gem_test.rb'
|
272
|
+
generator.test_helper_filename.should == 'test_helper.rb'
|
273
|
+
end
|
274
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
describe Bueller::Tasks do
|
5
|
+
let(:tasks) do
|
6
|
+
Dir.chdir(File.expand_path('../fixtures/bar', File.dirname(__FILE__))) do
|
7
|
+
Bueller::Tasks.new
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
after :each do
|
12
|
+
Rake::Task.clear
|
13
|
+
end
|
14
|
+
|
15
|
+
describe '#initialize' do
|
16
|
+
it 'should not eagerly initialize Bueller' do
|
17
|
+
tasks.instance_variable_defined?(:@bueller).should be_false
|
18
|
+
end
|
19
|
+
it 'should set self as the application-wide bueller tasks' do
|
20
|
+
tasks.should == Rake.application.bueller_tasks
|
21
|
+
end
|
22
|
+
end
|
23
|
+
describe '#bueller' do
|
24
|
+
it 'should initailize Bueller' do
|
25
|
+
tasks.bueller
|
26
|
+
tasks.instance_variable_defined?(:@bueller).should be_true
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Bueller::VersionHelper do
|
4
|
+
|
5
|
+
let(:gemspec_helper) { mock Bueller::GemSpecHelper, :has_version? => true }
|
6
|
+
let(:helper) { Bueller::VersionHelper.new gemspec_helper }
|
7
|
+
|
8
|
+
describe "full version" do
|
9
|
+
before do
|
10
|
+
gemspec_helper.stub!(:version).and_return '3.5.4'
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should have version 3.5.4' do
|
14
|
+
helper.should have_version(3, 5, 4)
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should bump major version" do
|
18
|
+
helper.bump_major
|
19
|
+
helper.should have_version(4, 0, 0)
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should bump the minor version" do
|
23
|
+
helper.bump_minor
|
24
|
+
helper.should have_version(3, 6, 0)
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should bump the patch version" do
|
28
|
+
helper.bump_patch
|
29
|
+
helper.should have_version(3, 5, 5)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe "prerelease version" do
|
34
|
+
before do
|
35
|
+
gemspec_helper.stub!(:version).and_return '3.5.4.a1'
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'should be version 3.5.4.a1' do
|
39
|
+
helper.should have_build_version(3, 5, 4, 'a1')
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should bump major version" do
|
43
|
+
helper.bump_major
|
44
|
+
helper.should have_build_version(4, 0, 0, nil)
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should bump the minor version" do
|
48
|
+
helper.bump_minor
|
49
|
+
helper.should have_build_version(3, 6, 0, nil)
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should bump the patch version" do
|
53
|
+
helper.bump_patch
|
54
|
+
helper.should have_build_version(3, 5, 5, nil)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Bueller do
|
4
|
+
let(:bueller_with_git) { Bueller.new(git_dir_path) }
|
5
|
+
let(:bueller_without_git) { Bueller.new(non_git_dir_path) }
|
6
|
+
let(:bueller) { Bueller.new(git_dir_path) }
|
7
|
+
let(:git_dir_path) { File.join(FileSystem.tmp_dir, 'git') }
|
8
|
+
let(:non_git_dir_path) { File.join(FileSystem.tmp_dir, 'nongit') }
|
9
|
+
|
10
|
+
describe '#in_git_repo?' do
|
11
|
+
it 'should return true if it is in a git repo' do
|
12
|
+
FileUtils.mkdir_p git_dir_path
|
13
|
+
Dir.chdir git_dir_path do
|
14
|
+
Git.init
|
15
|
+
end
|
16
|
+
bueller_with_git.should be_in_git_repo
|
17
|
+
end
|
18
|
+
it 'should return false if it is not in a git repo' do
|
19
|
+
FileUtils.mkdir_p non_git_dir_path
|
20
|
+
bueller_without_git.should_not be_in_git_repo
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '#git_base_dir' do
|
25
|
+
it 'should find the base repo' do
|
26
|
+
bueller = Bueller.new(File.dirname(File.expand_path(__FILE__)))
|
27
|
+
bueller.git_base_dir.should == File.dirname(File.dirname(File.expand_path(__FILE__)))
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe '#write_gemspec' do
|
32
|
+
it 'should build and run write gemspec command when writing gemspec' do
|
33
|
+
Bueller::Commands::WriteGemspec.should_receive(:run_for).with(bueller)
|
34
|
+
|
35
|
+
bueller.write_gemspec
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe '#build_gem' do
|
40
|
+
it 'should build and run build gem command when building gem' do
|
41
|
+
Bueller::Commands::BuildGem.should_receive(:run_for).with(bueller)
|
42
|
+
|
43
|
+
bueller.build_gem
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe '#install_gem' do
|
48
|
+
it 'should build and run build gem command when installing gem' do
|
49
|
+
Bueller::Commands::InstallGem.should_receive(:run_for).with(bueller)
|
50
|
+
|
51
|
+
bueller.install_gem
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
describe '#bump_major_version' do
|
56
|
+
it 'should build and run bump major version command when bumping major version' do
|
57
|
+
Bueller::Commands::Version::BumpMajor.should_receive(:run_for).with(bueller)
|
58
|
+
|
59
|
+
bueller.bump_major_version
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe '#bump_major_version' do
|
64
|
+
it 'should build and run bump minor version command when bumping minor version' do
|
65
|
+
Bueller::Commands::Version::BumpMinor.should_receive(:run_for).with(bueller)
|
66
|
+
|
67
|
+
bueller.bump_minor_version
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
describe '#bump_major_version' do
|
72
|
+
it 'should build and run write version command when writing version' do
|
73
|
+
Bueller::Commands::Version::Write.should_receive(:run_for).with(bueller, 1, 5, 2, 'a1')
|
74
|
+
|
75
|
+
bueller.write_version(1, 5, 2, 'a1')
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
describe '#bump_major_version' do
|
80
|
+
it 'should build and run release to github command when running release_gem_to_github' do
|
81
|
+
Bueller::Commands::ReleaseToGithub.should_receive(:run_for).with(bueller)
|
82
|
+
|
83
|
+
bueller.release_gem_to_github
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
describe '#bump_major_version' do
|
88
|
+
it 'should build and tag the release' do
|
89
|
+
Bueller::Commands::GitTagRelease.should_receive(:run_for).with(bueller)
|
90
|
+
|
91
|
+
bueller.git_tag_release
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|