Module: RakeVersion

Defined in:
lib/rake-version.rb,
lib/rake-version/tasks.rb,
lib/rake-version/context.rb,
lib/rake-version/manager.rb,
lib/rake-version/version.rb

Defined Under Namespace

Classes: BadArgument, BadBumpType, BadContext, BadVersion, BadVersionString, Context, Error, Manager, MissingContext, Tasks, Version

Constant Summary collapse

VERSION =
File.open(File.join(File.dirname(__FILE__), '..', 'VERSION'), 'r').read

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#namespaceObject

Returns the value of attribute namespace.



4
5
6
# File 'lib/rake-version/manager.rb', line 4

def namespace
  @namespace
end

#rootObject

Returns the value of attribute root.



5
6
7
# File 'lib/rake-version/manager.rb', line 5

def root
  @root
end

#version_filenameObject

Returns the value of attribute version_filename.



6
7
8
# File 'lib/rake-version/manager.rb', line 6

def version_filename
  @version_filename
end

Class Method Details

.check_context(o) ⇒ Object



15
16
17
# File 'lib/rake-version.rb', line 15

def self.check_context o
  self.check_type o, RakeVersion::Context, BadContext
end

.check_type(o, expected_type, error_class = Error, name = nil) ⇒ Object

Raises:

  • (error_class)


23
24
25
26
27
# File 'lib/rake-version.rb', line 23

def self.check_type o, expected_type, error_class = Error, name = nil
  name ||= expected_type.to_s.sub(/.*::/, '')
  name = name.downcase
  raise error_class, "Expected #{name} to be a #{expected_type}." unless o.kind_of? expected_type
end

.check_version(o) ⇒ Object



19
20
21
# File 'lib/rake-version.rb', line 19

def self.check_version o
  self.check_type o, RakeVersion::Version, BadVersion
end