bueller 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +7 -61
- data/lib/bueller/commands.rb +0 -5
- data/lib/bueller/tasks.rb +3 -26
- data/lib/bueller.rb +1 -22
- data/spec/bueller_spec.rb +0 -24
- data/spec/fixtures/bar/bar.gemspec +1 -1
- metadata +6 -18
- data/lib/bueller/commands/build_gem.rb +0 -50
- data/lib/bueller/commands/git_tag_release.rb +0 -69
- data/lib/bueller/commands/install_gem.rb +0 -36
- data/lib/bueller/commands/release_to_rubygems.rb +0 -26
- data/spec/bueller/commands/build_gem_spec.rb +0 -38
- data/spec/bueller/commands/git_tag_release_spec.rb +0 -87
- data/spec/bueller/commands/install_gem_spec.rb +0 -11
- data/spec/bueller/commands/release_to_rubygems_spec.rb +0 -15
data/README.markdown
CHANGED
@@ -1,12 +1,13 @@
|
|
1
|
-
# Bueller:
|
1
|
+
# Bueller: A Tool for Crafting Gems Along With Bundler
|
2
2
|
|
3
3
|
Bueller provides two things:
|
4
4
|
|
5
|
-
* Rake tasks for managing gems and versioning of a <a href="http://github.com">GitHub</a> project
|
6
5
|
* A generator for creating/kickstarting a new project
|
6
|
+
* Rake tasks for managing gems and versioning of a <a href="http://github.com">GitHub</a> project
|
7
7
|
|
8
8
|
## Quick Links
|
9
9
|
|
10
|
+
* [Web](http://dkastner.github.com/bueller)
|
10
11
|
* [Wiki](http://wiki.github.com/dkastner/bueller)
|
11
12
|
* [Bugs](http://github.com/dkastner/bueller/issues)
|
12
13
|
|
@@ -37,10 +38,10 @@ This will prepare a project in the 'the-perfect-gem' directory, setup to use Bue
|
|
37
38
|
It supports a number of options. Here's a taste, but `bueller --help` will give you the most up-to-date listing:
|
38
39
|
|
39
40
|
* --create-repo: in addition to preparing a project, it create an repo up on GitHub and enable RubyGem generation
|
41
|
+
* --rspec: generate spec_helper.rb and spec ready for rspec (this is the default TDD framework)
|
40
42
|
* --testunit: generate test_helper.rb and test ready for test/unit
|
41
43
|
* --minitest: generate test_helper.rb and test ready for minitest
|
42
44
|
* --shoulda: generate test_helper.rb and test ready for shoulda
|
43
|
-
* --rspec: generate spec_helper.rb and spec ready for rspec (this is the default)
|
44
45
|
* --bacon: generate spec_helper.rb and spec ready for bacon
|
45
46
|
* --gemcutter: setup releasing to gemcutter
|
46
47
|
* --rubyforge: setup releasing to rubyforge
|
@@ -87,13 +88,6 @@ Initially, your project starts out at 0.0.0. Bueller provides Rake tasks for bum
|
|
87
88
|
rake version:bump:minor
|
88
89
|
rake version:bump:patch
|
89
90
|
|
90
|
-
You can also programmatically set the version if you wish. Typically, you use this to have a module with the version info so clients can access it. The only downside here is you no longer can use the version:bump tasks.
|
91
|
-
|
92
|
-
Gem::Specification.new do |s|
|
93
|
-
s.version = MyProject::VERSION
|
94
|
-
# more stuff
|
95
|
-
end
|
96
|
-
|
97
91
|
### Prerelease versioning
|
98
92
|
|
99
93
|
Major, minor, and patch versions have a distant cousin: build. You can use this to add an arbitrary (or you know, regular type) version. This is particularly useful for prereleases.
|
@@ -117,63 +111,15 @@ It does the following for you:
|
|
117
111
|
|
118
112
|
As is though, it doesn't actually get your gem anywhere. To do that, you'll need to use rubyforge or gemcutter.
|
119
113
|
|
120
|
-
### Releasing to
|
121
|
-
|
122
|
-
Bueller can also handle releasing to [Gemcutter](http://gemcutter.org). There are a few steps you need to do before doing any Gemcutter releases with Bueller:
|
123
|
-
|
124
|
-
* [Create an account on Gemcutter](http://gemcutter.org/sign_up)
|
125
|
-
* Install the Gemcutter gem: gem install gemcutter
|
126
|
-
* Run 'gem tumble' to set up RubyGems to use gemcutter as the default source if you haven't already
|
127
|
-
* Update your Rakefile to make an instance of `Bueller::GemcutterTasks`
|
128
|
-
|
129
|
-
|
130
|
-
A Rakefile setup for gemcutter would include something like this:
|
131
|
-
|
132
|
-
begin
|
133
|
-
require 'bueller'
|
134
|
-
Bueller::Tasks.new
|
135
|
-
Bueller::GemcutterTasks.new
|
136
|
-
rescue LoadError
|
137
|
-
puts "Bueller (or a dependency) not available. Install it with: gem install bueller"
|
138
|
-
end
|
114
|
+
### Releasing to Rubygems
|
139
115
|
|
116
|
+
Bueller can also handle releasing to [Rubygems](http://rubygems.org). You must [create an account](http://rubygems.org/sign_up) on Rubygems before doing any Rubygems releases with Bueller.
|
140
117
|
|
141
118
|
After you have configured this, `rake release` will now also release to Gemcutter.
|
142
119
|
|
143
120
|
If you need to release it without the rest of the release task, you can run:
|
144
121
|
|
145
|
-
$ rake
|
146
|
-
|
147
|
-
### Releasing to RubyForge
|
148
|
-
|
149
|
-
Bueller can also handle releasing to [RubyForge](http://rubyforge.org). There are a few steps you need to do before doing any RubyForge releases with Bueller:
|
150
|
-
|
151
|
-
* [Create an account on RubyForge](http://rubyforge.org/account/register.php)
|
152
|
-
* Request a project on RubyForge.
|
153
|
-
* Install the RubyForge gem: gem install rubyforge
|
154
|
-
* Run 'rubyforge setup' and fill in your username and password for RubyForge
|
155
|
-
* Run 'rubyforge config' to pull down information about your projects
|
156
|
-
* Run 'rubyforge login' to make sure you are able to login
|
157
|
-
* In Bueller::Tasks, you must set `rubyforge_project` to the project you just created
|
158
|
-
* Add Bueller::RubyforgeTasks to bring in the appropriate tasks.
|
159
|
-
* Note, using `bueller --rubyforge` when generating the project does this for you automatically.
|
160
|
-
|
161
|
-
A gemspec setup for rubyforge would include something like this:
|
162
|
-
|
163
|
-
Gem::Specification.new do |s|
|
164
|
-
# ommitted for brevity
|
165
|
-
gemspec.rubyforge_project = 'the-perfect-gem' # This line would be new
|
166
|
-
end
|
167
|
-
|
168
|
-
Now you must initially create a 'package' for your gem in your RubyForge 'project':
|
169
|
-
|
170
|
-
$ rake rubyforge:setup
|
171
|
-
|
172
|
-
After you have configured this, `rake release` will now also release to RubyForge.
|
173
|
-
|
174
|
-
If you need to release it without the rest of the release task, you can run:
|
175
|
-
|
176
|
-
$ rake rubyforge:release
|
122
|
+
$ rake rubygems:release
|
177
123
|
|
178
124
|
## Development and Release Workflow
|
179
125
|
|
data/lib/bueller/commands.rb
CHANGED
@@ -1,10 +1,5 @@
|
|
1
1
|
class Bueller
|
2
2
|
module Commands
|
3
|
-
autoload :BuildGem, 'bueller/commands/build_gem'
|
4
|
-
autoload :InstallGem, 'bueller/commands/install_gem'
|
5
|
-
autoload :GitTagRelease, 'bueller/commands/git_tag_release'
|
6
|
-
autoload :ReleaseToGithub, 'bueller/commands/release_to_github'
|
7
|
-
autoload :ReleaseToRubygems, 'bueller/commands/release_to_rubygems'
|
8
3
|
autoload :WriteGemspec, 'bueller/commands/write_gemspec'
|
9
4
|
|
10
5
|
module Version
|
data/lib/bueller/tasks.rb
CHANGED
@@ -32,22 +32,14 @@ class Bueller
|
|
32
32
|
private
|
33
33
|
|
34
34
|
def define
|
35
|
+
gem_helper = Bundler::GemHelper.install_tasks
|
36
|
+
|
35
37
|
task :gemspec_required do
|
36
38
|
unless File.exist?(bueller.gemspec_helper.path)
|
37
39
|
abort "Expected #{bueller.gemspec_helper.path} to exist. See 'rake gemspec:write' to create it"
|
38
40
|
end
|
39
41
|
end
|
40
42
|
|
41
|
-
desc "Build gem"
|
42
|
-
task :build do
|
43
|
-
bueller.build_gem
|
44
|
-
end
|
45
|
-
|
46
|
-
desc "Install gem"
|
47
|
-
task :install => [:build] do
|
48
|
-
bueller.install_gem
|
49
|
-
end
|
50
|
-
|
51
43
|
namespace :gemspec do
|
52
44
|
desc 'Validates the gemspec'
|
53
45
|
task :validate => :gemspec_required do
|
@@ -95,27 +87,12 @@ class Bueller
|
|
95
87
|
end
|
96
88
|
end
|
97
89
|
|
98
|
-
desc "Release gem"
|
99
|
-
task :release do
|
100
|
-
end
|
101
|
-
|
102
|
-
namespace :git do
|
103
|
-
desc "Tag a release and push to origin"
|
104
|
-
task :release do
|
105
|
-
bueller.git_tag_release
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
task :release => 'git:release'
|
110
|
-
|
111
90
|
namespace :rubygems do
|
112
91
|
desc "Release gem to Rubygems"
|
113
92
|
task :release => :build do
|
114
|
-
bueller.
|
93
|
+
gem_helper.rubygem_push bueller.gemspec_helper.gem_path
|
115
94
|
end
|
116
95
|
end
|
117
|
-
|
118
|
-
task :release => 'rubygems:release'
|
119
96
|
end
|
120
97
|
end
|
121
98
|
end
|
data/lib/bueller.rb
CHANGED
@@ -3,10 +3,7 @@ require 'git'
|
|
3
3
|
|
4
4
|
# Bueller helps you craft the perfect Rubygem. Give him a gemspec, and he takes care of the rest.
|
5
5
|
#
|
6
|
-
# See Bueller::Tasks for examples of how to get started.
|
7
|
-
#
|
8
|
-
# * http://wiki.github.com/technicalpickles/bueller/create-a-new-project
|
9
|
-
# * http://wiki.github.com/technicalpickles/bueller/configure-an-existing-project
|
6
|
+
# See Bueller::Tasks for examples of how to get started.
|
10
7
|
class Bueller
|
11
8
|
require 'bueller/errors'
|
12
9
|
require 'rubygems/user_interaction'
|
@@ -75,16 +72,6 @@ class Bueller
|
|
75
72
|
Bueller::Commands::WriteGemspec.run_for self
|
76
73
|
end
|
77
74
|
|
78
|
-
# Build a gem using the project's latest Gem::Specification
|
79
|
-
def build_gem
|
80
|
-
Bueller::Commands::BuildGem.run_for self
|
81
|
-
end
|
82
|
-
|
83
|
-
# Install a previously built gem
|
84
|
-
def install_gem
|
85
|
-
Bueller::Commands::InstallGem.run_for self
|
86
|
-
end
|
87
|
-
|
88
75
|
# Bumps the patch version.
|
89
76
|
#
|
90
77
|
# 1.5.1 -> 1.5.2
|
@@ -111,14 +98,6 @@ class Bueller
|
|
111
98
|
Bueller::Commands::Version::Write.run_for self, major, minor, patch, build
|
112
99
|
end
|
113
100
|
|
114
|
-
def git_tag_release
|
115
|
-
Bueller::Commands::GitTagRelease.run_for self
|
116
|
-
end
|
117
|
-
|
118
|
-
def release_gem_to_rubygems
|
119
|
-
Bueller::Commands::ReleaseToRubygems.run_for self
|
120
|
-
end
|
121
|
-
|
122
101
|
def git_base_dir(base_dir = nil)
|
123
102
|
if base_dir
|
124
103
|
base_dir = File.dirname(base_dir)
|
data/spec/bueller_spec.rb
CHANGED
@@ -36,22 +36,6 @@ describe Bueller do
|
|
36
36
|
end
|
37
37
|
end
|
38
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
39
|
describe '#bump_major_version' do
|
56
40
|
it 'should build and run bump major version command when bumping major version' do
|
57
41
|
Bueller::Commands::Version::BumpMajor.should_receive(:run_for).with(bueller)
|
@@ -75,12 +59,4 @@ describe Bueller do
|
|
75
59
|
bueller.write_version(1, 5, 2, 'a1')
|
76
60
|
end
|
77
61
|
end
|
78
|
-
|
79
|
-
describe '#git_tag_release' do
|
80
|
-
it 'should build and tag the release' do
|
81
|
-
Bueller::Commands::GitTagRelease.should_receive(:run_for).with(bueller)
|
82
|
-
|
83
|
-
bueller.git_tag_release
|
84
|
-
end
|
85
|
-
end
|
86
62
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 4
|
9
|
+
version: 0.0.4
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Derek Kastner
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-01-
|
17
|
+
date: 2011-01-27 00:00:00 -05:00
|
18
18
|
default_executable: bueller
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -27,8 +27,8 @@ dependencies:
|
|
27
27
|
segments:
|
28
28
|
- 1
|
29
29
|
- 0
|
30
|
-
-
|
31
|
-
version: 1.0.
|
30
|
+
- 9
|
31
|
+
version: 1.0.9
|
32
32
|
type: :runtime
|
33
33
|
prerelease: false
|
34
34
|
version_requirements: *id001
|
@@ -197,10 +197,6 @@ files:
|
|
197
197
|
- lib/bueller/tasks.rb
|
198
198
|
- lib/bueller/rubyforge_tasks.rb
|
199
199
|
- lib/bueller/generator.rb
|
200
|
-
- lib/bueller/commands/build_gem.rb
|
201
|
-
- lib/bueller/commands/release_to_rubygems.rb
|
202
|
-
- lib/bueller/commands/install_gem.rb
|
203
|
-
- lib/bueller/commands/git_tag_release.rb
|
204
200
|
- lib/bueller/commands/write_gemspec.rb
|
205
201
|
- lib/bueller/commands/version/bump_patch.rb
|
206
202
|
- lib/bueller/commands/version/bump_major.rb
|
@@ -283,11 +279,7 @@ files:
|
|
283
279
|
- spec/fixtures/bar/lib/foo_the_ultimate_lib.rb
|
284
280
|
- spec/fixtures/bar/bar.gemspec
|
285
281
|
- spec/bueller/gemspec_helper_spec.rb
|
286
|
-
- spec/bueller/commands/git_tag_release_spec.rb
|
287
|
-
- spec/bueller/commands/release_to_rubygems_spec.rb
|
288
|
-
- spec/bueller/commands/build_gem_spec.rb
|
289
282
|
- spec/bueller/commands/write_gemspec_spec.rb
|
290
|
-
- spec/bueller/commands/install_gem_spec.rb
|
291
283
|
- spec/bueller/commands/version/bump_patch_spec.rb
|
292
284
|
- spec/bueller/commands/version/bump_minor_spec.rb
|
293
285
|
- spec/bueller/commands/version/bump_major_spec.rb
|
@@ -312,7 +304,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
312
304
|
requirements:
|
313
305
|
- - ">="
|
314
306
|
- !ruby/object:Gem::Version
|
315
|
-
hash:
|
307
|
+
hash: 879101009
|
316
308
|
segments:
|
317
309
|
- 0
|
318
310
|
version: "0"
|
@@ -359,11 +351,7 @@ test_files:
|
|
359
351
|
- spec/fixtures/bar/lib/foo_the_ultimate_lib.rb
|
360
352
|
- spec/fixtures/bar/bar.gemspec
|
361
353
|
- spec/bueller/gemspec_helper_spec.rb
|
362
|
-
- spec/bueller/commands/git_tag_release_spec.rb
|
363
|
-
- spec/bueller/commands/release_to_rubygems_spec.rb
|
364
|
-
- spec/bueller/commands/build_gem_spec.rb
|
365
354
|
- spec/bueller/commands/write_gemspec_spec.rb
|
366
|
-
- spec/bueller/commands/install_gem_spec.rb
|
367
355
|
- spec/bueller/commands/version/bump_patch_spec.rb
|
368
356
|
- spec/bueller/commands/version/bump_minor_spec.rb
|
369
357
|
- spec/bueller/commands/version/bump_major_spec.rb
|
@@ -1,50 +0,0 @@
|
|
1
|
-
class Bueller
|
2
|
-
module Commands
|
3
|
-
class BuildGem
|
4
|
-
def self.run_for(bueller)
|
5
|
-
command = new bueller
|
6
|
-
command.run
|
7
|
-
command
|
8
|
-
end
|
9
|
-
|
10
|
-
attr_reader :bueller
|
11
|
-
|
12
|
-
def initialize(bueller)
|
13
|
-
@bueller = bueller
|
14
|
-
end
|
15
|
-
|
16
|
-
def base_dir
|
17
|
-
bueller.base_dir
|
18
|
-
end
|
19
|
-
def gemspec_helper
|
20
|
-
bueller.gemspec_helper
|
21
|
-
end
|
22
|
-
def version_helper
|
23
|
-
bueller.version_helper
|
24
|
-
end
|
25
|
-
|
26
|
-
def run
|
27
|
-
make_package_directory
|
28
|
-
move_gem_file
|
29
|
-
end
|
30
|
-
|
31
|
-
def pkg_dir
|
32
|
-
@pkg_dir ||= File.join(base_dir, 'pkg')
|
33
|
-
end
|
34
|
-
|
35
|
-
def make_package_directory
|
36
|
-
FileUtils.mkdir_p pkg_dir
|
37
|
-
end
|
38
|
-
|
39
|
-
def build_gem
|
40
|
-
Gem::Builder.new(gemspec_helper.spec).build
|
41
|
-
end
|
42
|
-
|
43
|
-
def move_gem_file
|
44
|
-
gem_file_name = build_gem
|
45
|
-
gem_file_path = File.join(base_dir, gem_file_name)
|
46
|
-
FileUtils.mv gem_file_path, pkg_dir
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
@@ -1,69 +0,0 @@
|
|
1
|
-
class Bueller
|
2
|
-
module Commands
|
3
|
-
class GitTagRelease
|
4
|
-
def self.run_for(bueller)
|
5
|
-
command = new bueller
|
6
|
-
command.run
|
7
|
-
command
|
8
|
-
end
|
9
|
-
|
10
|
-
attr_accessor :repo, :output
|
11
|
-
attr_reader :bueller
|
12
|
-
|
13
|
-
def initialize(bueller, attributes = {})
|
14
|
-
self.output = $stdout
|
15
|
-
@bueller = bueller
|
16
|
-
|
17
|
-
attributes.each_pair do |key, value|
|
18
|
-
send("#{key}=", value)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def base_dir; bueller.base_dir; end
|
23
|
-
def version; bueller.version; end
|
24
|
-
def repo; bueller.repo; end
|
25
|
-
|
26
|
-
def run
|
27
|
-
run = true
|
28
|
-
unless clean_staging_area?
|
29
|
-
output.puts "There are some modified files that haven't been committed. Proceed anyway?"
|
30
|
-
run = $stdin.gets =~ /(y|yes)/i ? true : false
|
31
|
-
end
|
32
|
-
|
33
|
-
if run
|
34
|
-
repo.checkout('master')
|
35
|
-
|
36
|
-
unless release_tagged?
|
37
|
-
output.puts "Tagging #{release_tag}"
|
38
|
-
repo.add_tag release_tag
|
39
|
-
end
|
40
|
-
output.puts "Pushing #{release_tag} to origin"
|
41
|
-
repo.push 'origin', release_tag
|
42
|
-
else
|
43
|
-
raise "Release cancelled"
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def clean_staging_area?
|
48
|
-
status.added.empty? && status.deleted.empty? && status.changed.empty?
|
49
|
-
end
|
50
|
-
|
51
|
-
def status
|
52
|
-
repo.status
|
53
|
-
end
|
54
|
-
|
55
|
-
def release_tag
|
56
|
-
"v#{version}"
|
57
|
-
end
|
58
|
-
|
59
|
-
def release_tagged?
|
60
|
-
begin
|
61
|
-
repo.tag(release_tag)
|
62
|
-
true
|
63
|
-
rescue
|
64
|
-
false
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
class Bueller
|
2
|
-
module Commands
|
3
|
-
class InstallGem
|
4
|
-
def self.run_for(bueller)
|
5
|
-
command = new bueller
|
6
|
-
command.run
|
7
|
-
command
|
8
|
-
end
|
9
|
-
|
10
|
-
attr_reader :bueller
|
11
|
-
|
12
|
-
def initialize(bueller)
|
13
|
-
@bueller = bueller
|
14
|
-
bueller.output = $stdout
|
15
|
-
end
|
16
|
-
|
17
|
-
def output
|
18
|
-
bueller.output
|
19
|
-
end
|
20
|
-
def gemspec_helper
|
21
|
-
bueller.gemspec_helper
|
22
|
-
end
|
23
|
-
|
24
|
-
def run
|
25
|
-
command = "#{gem_command} install #{gemspec_helper.gem_path}"
|
26
|
-
output.puts "Executing #{command.inspect}:"
|
27
|
-
|
28
|
-
sh command
|
29
|
-
end
|
30
|
-
|
31
|
-
def gem_command
|
32
|
-
"bundle exec gem"
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
class Bueller
|
2
|
-
module Commands
|
3
|
-
class ReleaseToRubygems
|
4
|
-
attr_reader :bueller
|
5
|
-
|
6
|
-
def initialize(bueller)
|
7
|
-
@bueller = bueller
|
8
|
-
end
|
9
|
-
|
10
|
-
def gemspec_helper; bueller.gemspec_helper; end
|
11
|
-
def version; bueller.version; end
|
12
|
-
|
13
|
-
def run
|
14
|
-
command = "gem push #{gemspec_helper.gem_path}"
|
15
|
-
$stdout.puts "Executing #{command.inspect}:"
|
16
|
-
sh command
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.run_for(bueller)
|
20
|
-
command = new bueller
|
21
|
-
command.run
|
22
|
-
command
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Bueller::Commands::BuildGem do
|
4
|
-
let(:bueller) { Bueller.new }
|
5
|
-
let(:command) { Bueller::Commands::BuildGem.new bueller }
|
6
|
-
|
7
|
-
describe '#run' do
|
8
|
-
it 'should make the gem' do
|
9
|
-
command.should_receive :make_package_directory
|
10
|
-
command.run
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'should move the gem into the package directory' do
|
14
|
-
command.should_receive :move_gem_file
|
15
|
-
command.run
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe '#base_dir' do
|
20
|
-
it "should delegate to bueller" do
|
21
|
-
command.base_dir.should == '.'
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
describe '#gemspec_helper' do
|
26
|
-
it "should delegate to bueller" do
|
27
|
-
command.gemspec_helper.should == bueller.gemspec_helper
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
describe '#make_package_directory' do
|
32
|
-
it 'should make a package directory' do
|
33
|
-
command = Bueller::Commands::BuildGem.new bueller
|
34
|
-
FileUtils.should_receive(:mkdir_p).with './pkg'
|
35
|
-
command.make_package_directory
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
@@ -1,87 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Bueller::Commands::GitTagRelease do
|
4
|
-
let(:bueller) { Bueller.new }
|
5
|
-
let(:command) { Bueller::Commands::GitTagRelease.new bueller, :output => StringIO.new }
|
6
|
-
|
7
|
-
before :each do
|
8
|
-
status = mock(Object)
|
9
|
-
bueller.repo = mock(Git, :status => status)
|
10
|
-
|
11
|
-
command.repo.status.stub!(:added).and_return []
|
12
|
-
command.repo.status.stub!(:changed).and_return []
|
13
|
-
command.repo.status.stub!(:deleted).and_return []
|
14
|
-
end
|
15
|
-
|
16
|
-
describe '#run' do
|
17
|
-
before :each do
|
18
|
-
command.repo.stub! :checkout
|
19
|
-
command.repo.stub! :push
|
20
|
-
command.repo.stub! :add_tag
|
21
|
-
command.stub!(:clean_staging_area?).and_return true
|
22
|
-
command.stub!(:release_tagged?).and_return true
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'should not run if the staging area is unclean and user does not confirm' do
|
26
|
-
command.stub!(:clean_staging_area?).and_return false
|
27
|
-
$stdin.stub!(:gets).and_return 'no'
|
28
|
-
expect { command.run }.should raise_error
|
29
|
-
end
|
30
|
-
it 'should run if the staging area is unclean and user confirms' do
|
31
|
-
command.stub!(:clean_staging_area?).and_return false
|
32
|
-
$stdin.stub!(:gets).and_return 'yes'
|
33
|
-
command.repo.should_receive :checkout
|
34
|
-
command.run
|
35
|
-
end
|
36
|
-
it 'should check out master' do
|
37
|
-
command.repo.should_receive(:checkout).with 'master'
|
38
|
-
command.run
|
39
|
-
end
|
40
|
-
it 'should push' do
|
41
|
-
command.repo.should_receive :push
|
42
|
-
command.run
|
43
|
-
end
|
44
|
-
it 'should not push tags if the release is already tagged' do
|
45
|
-
command.repo.should_not_receive :add_tag
|
46
|
-
command.repo.should_receive :push
|
47
|
-
|
48
|
-
command.run
|
49
|
-
end
|
50
|
-
it 'should push tags if the release is not tagged' do
|
51
|
-
command.stub!(:release_tagged?).and_return false
|
52
|
-
command.repo.should_receive :add_tag
|
53
|
-
command.repo.should_receive :push
|
54
|
-
|
55
|
-
command.run
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
describe "#release_tagged?" do
|
60
|
-
it 'should be true if a tag exists' do
|
61
|
-
command.repo.stub!(:tag).and_raise RuntimeError
|
62
|
-
command.release_tagged?.should be_false
|
63
|
-
end
|
64
|
-
it 'should be false if no tag exists' do
|
65
|
-
command.repo.stub!(:tag)
|
66
|
-
command.release_tagged?.should be_true
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
describe '#clean_staging_area?' do
|
71
|
-
it 'should return true if there are no added, changed, or deleted files' do
|
72
|
-
command.should be_clean_staging_area
|
73
|
-
end
|
74
|
-
it 'should return false if there are added files' do
|
75
|
-
command.repo.status.stub!(:added).and_return ['Gemfile.lock']
|
76
|
-
command.should_not be_clean_staging_area
|
77
|
-
end
|
78
|
-
it 'should return false if there are changed files' do
|
79
|
-
command.repo.status.stub!(:changed).and_return ['Gemfile.lock']
|
80
|
-
command.should_not be_clean_staging_area
|
81
|
-
end
|
82
|
-
it 'should return false if there are deleted files' do
|
83
|
-
command.repo.status.stub!(:deleted).and_return ['Gemfile.lock']
|
84
|
-
command.should_not be_clean_staging_area
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Bueller::Commands::InstallGem do
|
4
|
-
|
5
|
-
it "should call sh with gem install" do
|
6
|
-
bueller = Bueller.new FileSystem.fixture_path('existing-project')
|
7
|
-
command = Bueller::Commands::InstallGem.new bueller
|
8
|
-
command.should_receive(:sh).with /bundle exec gem install .*\/pkg\/existing-project-1.5.3.gem/
|
9
|
-
command.run
|
10
|
-
end
|
11
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Bueller::Commands::ReleaseToRubygems do
|
4
|
-
let(:gemspec_helper) { mock(Bueller::GemSpecHelper) }
|
5
|
-
let(:bueller) { mock(Bueller, :gemspec_helper => gemspec_helper) }
|
6
|
-
let(:command) { Bueller::Commands::ReleaseToRubygems.new bueller }
|
7
|
-
|
8
|
-
describe '.run' do
|
9
|
-
it "should push to gemcutter" do
|
10
|
-
command.gemspec_helper.stub!(:gem_path).and_return 'pkg/zomg-1.2.3.gem'
|
11
|
-
command.should_receive(:sh).with(/gem push pkg\/zomg-1\.2\.3\.gem/)
|
12
|
-
command.run
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|