class Jeweler::Commands::Version::Base

Attributes

base_dir[RW]
commit[RW]
gemspec[RW]
repo[RW]
version_helper[RW]

Public Class Methods

build_for(jeweler) click to toggle source
# File lib/jeweler/commands/version/base.rb, line 37
def self.build_for(jeweler)
  command = new
  command.repo = jeweler.repo
  command.version_helper = jeweler.version_helper
  command.gemspec = jeweler.gemspec
  command.commit = jeweler.commit
  command.base_dir = jeweler.base_dir

  command
end

Public Instance Methods

base_dir_path() click to toggle source
# File lib/jeweler/commands/version/base.rb, line 33
def base_dir_path
  Pathname.new(base_dir).realpath
end
commit_version() click to toggle source
# File lib/jeweler/commands/version/base.rb, line 22
def commit_version
  if repo
    repo.add(working_subdir.join(version_helper.path).to_s)
    repo.commit("Version bump to #{version_helper}")
  end
end
run() click to toggle source
# File lib/jeweler/commands/version/base.rb, line 9
def run
  update_version

  version_helper.write
  gemspec.version = version_helper.to_s

  commit_version if repo && commit
end
update_version() click to toggle source
# File lib/jeweler/commands/version/base.rb, line 18
def update_version
  raise 'Subclasses should implement this'
end
working_subdir() click to toggle source
# File lib/jeweler/commands/version/base.rb, line 29
def working_subdir
  @working_subdir ||= base_dir_path.relative_path_from(Pathname.new(repo.dir.path))
end