Module: GitVersioner
- Defined in:
- lib/git_versioner.rb,
lib/git_versioner/railtie.rb,
lib/git_versioner/version.rb,
lib/git_versioner/view_helpers.rb
Defined Under Namespace
Modules: ViewHelpers
Classes: Railtie
Constant Summary
collapse
- VERSION =
'0.1.1'
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
49
50
51
52
|
# File 'lib/git_versioner.rb', line 49
def format
@format = yield if block_given?
@format
end
|
.memorize ⇒ Object
40
41
42
43
|
# File 'lib/git_versioner.rb', line 40
def memorize
@memorize = yield if block_given?
@memorize
end
|
.version_file_path ⇒ Object
Returns the value of attribute version_file_path.
38
39
40
|
# File 'lib/git_versioner.rb', line 38
def version_file_path
@version_file_path
end
|
Class Method Details
.calculate_version ⇒ Object
63
64
65
66
67
68
69
|
# File 'lib/git_versioner.rb', line 63
def calculate_version
formatted_version = format.dup
%W[version_number git_hash].each do |var|
formatted_version.gsub! /%{#{var}}/, self.send(var)
end
formatted_version
end
|
.memorize? ⇒ Boolean
45
46
47
|
# File 'lib/git_versioner.rb', line 45
def memorize?
memorize == true
end
|
.version ⇒ Object
Also known as:
to_s
54
55
56
57
58
59
60
|
# File 'lib/git_versioner.rb', line 54
def version
if memorize?
@version ||= calculate_version
else
calculate_version
end
end
|