Skip to content

Commit

Permalink
Fix version:bump commands.
Browse files Browse the repository at this point in the history
  • Loading branch information
pwnall committed Sep 5, 2013
1 parent e63de8c commit fc58148
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/jeweler/commands/version/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def update_version

def commit_version
if self.repo
self.repo.add(working_subdir.join(version_helper.path))
self.repo.add(working_subdir.join(version_helper.path).to_s)
self.repo.commit("Version bump to #{self.version_helper.to_s}")
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/jeweler/generator/options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def initialize(args)
o.banner = "Usage: #{File.basename($0)} [options] reponame\ne.g. #{File.basename($0)} the-perfect-gem"

o.on('--directory [DIRECTORY]', 'specify the directory to generate into (deprecated)') do |directory|
warn "--directory is deprecated and will be removed in 2.0.0. Please specify an absolute path to a directoy as the last argument instead" # DEPRECATE
warn "--directory is deprecated and will be removed in 2.0.0. Please specify an absolute path to a directory as the last argument instead" # DEPRECATE
self[:directory] = directory
end

Expand Down Expand Up @@ -130,7 +130,7 @@ def initialize(args)
o.on('--rdoc', 'use rdoc for documentation') do
self[:documentation_framework] = :rdoc
end

o.on('-v', '--version', 'show version') do
self[:show_version] = true
end
Expand Down
23 changes: 22 additions & 1 deletion test/jeweler/commands/version/test_base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,30 @@ class TestBase < Test::Unit::TestCase
assert_equal @gemspec, @command.gemspec
end

should"assign commit" do
should "assign commit" do
assert_equal @commit, @command.commit
end

context "commit_version" do
setup do
@dir = Object.new
stub(@repo).dir { @dir }
stub(@dir).path { Dir.pwd }
stub(@version_helper).path { Pathname.new 'VERSION' }
stub(@version_helper).to_s { '1.0.0' }
stub(@repo) do
add(anything)
commit(anything)
end
@command.base_dir = Dir.pwd
@command.commit_version
end

should "add VERSION" do
assert_received(@repo) {|repo| repo.add('VERSION')}
assert_received(@repo) {|repo| repo.commit('Version bump to 1.0.0')}
end
end
end
end
end
Expand Down

0 comments on commit fc58148

Please sign in to comment.