Class: JewelerStyleVersioning

Inherits:
Object
  • Object
show all
Defined in:
lib/jeweler_style_versioning.rb,
lib/jeweler_style_versioning/commands.rb,
lib/jeweler_style_versioning/version_helper.rb,
lib/jeweler_style_versioning/commands/version/base.rb,
lib/jeweler_style_versioning/commands/version/write.rb,
lib/jeweler_style_versioning/commands/version/bump_major.rb,
lib/jeweler_style_versioning/commands/version/bump_minor.rb,
lib/jeweler_style_versioning/commands/version/bump_patch.rb,
lib/jeweler_style_versioning/tasks.rb

Defined Under Namespace

Modules: Commands Classes: Tasks, VersionHelper

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base_dir = ".") ⇒ JewelerStyleVersioning

Returns a new instance of JewelerStyleVersioning.



9
10
11
# File 'lib/jeweler_style_versioning.rb', line 9

def initialize(base_dir = ".")
  @version_helper = JewelerStyleVersioning::VersionHelper.new(base_dir)
end

Instance Attribute Details

#base_dirObject

Returns the value of attribute base_dir.



7
8
9
# File 'lib/jeweler_style_versioning.rb', line 7

def base_dir
  @base_dir
end

#version_helperObject (readonly)

Returns the value of attribute version_helper.



6
7
8
# File 'lib/jeweler_style_versioning.rb', line 6

def version_helper
  @version_helper
end

Instance Method Details

#bump_major_versionObject

Bumps the major version.

1.5.1 -> 2.0.0



53
54
55
# File 'lib/jeweler_style_versioning.rb', line 53

def bump_major_version()
  JewelerStyleVersioning::Commands::Version::BumpMajor.build_for(self).run
end

#bump_minor_versionObject

Bumps the minor version.

1.5.1 -> 1.6.0



46
47
48
# File 'lib/jeweler_style_versioning.rb', line 46

def bump_minor_version()
  JewelerStyleVersioning::Commands::Version::BumpMinor.build_for(self).run
end

#bump_patch_versionObject

Bumps the patch version.

1.5.1 -> 1.5.2



39
40
41
# File 'lib/jeweler_style_versioning.rb', line 39

def bump_patch_version()
  JewelerStyleVersioning::Commands::Version::BumpPatch.build_for(self).run
end

#major_versionObject

Major version, as defined by the gemspec’s Version module. For 1.5.3, this would return 1.



15
16
17
# File 'lib/jeweler_style_versioning.rb', line 15

def major_version
  @version_helper.major
end

#minor_versionObject

Minor version, as defined by the gemspec’s Version module. For 1.5.3, this would return 5.



21
22
23
# File 'lib/jeweler_style_versioning.rb', line 21

def minor_version
  @version_helper.minor
end

#patch_versionObject

Patch version, as defined by the gemspec’s Version module. For 1.5.3, this would return 5.



27
28
29
# File 'lib/jeweler_style_versioning.rb', line 27

def patch_version
  @version_helper.patch
end

#versionObject

Human readable version, which is used in the gemspec.



32
33
34
# File 'lib/jeweler_style_versioning.rb', line 32

def version
  @version_helper.to_s
end

#version_file_exists?Boolean

Returns:

  • (Boolean)


68
69
70
# File 'lib/jeweler_style_versioning.rb', line 68

def version_file_exists?
  File.exists?(@version_helper.plaintext_path) || File.exists?(@version_helper.yaml_path)
end

#write_version(major, minor, patch, build, options = {}) ⇒ Object

Bumps the version, to the specific major/minor/patch version, writing out the appropriate version.rb, and then reloads it.



58
59
60
61
62
63
64
65
66
# File 'lib/jeweler_style_versioning.rb', line 58

def write_version(major, minor, patch, build, options = {})
  command = JewelerStyleVersioning::Commands::Version::Write.build_for(self)
  command.major = major
  command.minor = minor
  command.patch = patch
  command.build = build

  command.run
end