class Jeweler::VersionHelper

Attributes

base_dir[RW]
build[R]
major[R]
minor[R]
patch[R]

Public Class Methods

new(base_dir) click to toggle source
# File lib/jeweler/version_helper.rb, line 86
def initialize(base_dir)
  self.base_dir = base_dir

  if File.exist?(yaml_path)
    extend YamlExtension
    parse_yaml
  else
    extend PlaintextExtension
    parse_plaintext if File.exist?(plaintext_path)
  end
end

Public Instance Methods

bump_major() click to toggle source
# File lib/jeweler/version_helper.rb, line 98
def bump_major
  @major += 1
  @minor = 0
  @patch = 0
  @build = nil
end
bump_minor() click to toggle source
# File lib/jeweler/version_helper.rb, line 105
def bump_minor
  @minor += 1
  @patch = 0
  @build = nil
end
bump_patch() click to toggle source
# File lib/jeweler/version_helper.rb, line 111
def bump_patch
  @patch += 1
  @build = nil
end
plaintext_path() click to toggle source
# File lib/jeweler/version_helper.rb, line 131
def plaintext_path
  path_to_version_file('VERSION')
end
to_s() click to toggle source
# File lib/jeweler/version_helper.rb, line 123
def to_s
  [major, minor, patch, build].compact.join('.')
end
update_to(major, minor, patch, build = nil) click to toggle source
# File lib/jeweler/version_helper.rb, line 116
def update_to(major, minor, patch, build = nil)
  @major = major
  @minor = minor
  @patch = patch
  @build = build
end
yaml_path() click to toggle source
# File lib/jeweler/version_helper.rb, line 127
def yaml_path
  path_to_version_file('VERSION.yml')
end

Private Instance Methods

path_to_version_file(filename) click to toggle source
# File lib/jeweler/version_helper.rb, line 137
def path_to_version_file(filename)
  denormalized_path = File.join(@base_dir, filename)
  absolute_path = File.expand_path(denormalized_path)
  absolute_path.gsub(Dir.getwd + File::SEPARATOR, '')
end