Class: Juwelier::VersionHelper
- Inherits:
-
Object
- Object
- Juwelier::VersionHelper
show all
- Defined in:
- lib/juwelier/version_helper.rb
Defined Under Namespace
Modules: PlaintextExtension, YamlExtension
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
86
87
88
89
90
91
92
93
94
95
96
97
98
|
# File 'lib/juwelier/version_helper.rb', line 86
def initialize(base_dir)
self.base_dir = base_dir
if File.exists?(yaml_path)
extend YamlExtension
parse_yaml
else
extend PlaintextExtension
if File.exists?(plaintext_path)
parse_plaintext
end
end
end
|
Instance Attribute Details
#base_dir ⇒ Object
Returns the value of attribute base_dir.
10
11
12
|
# File 'lib/juwelier/version_helper.rb', line 10
def base_dir
@base_dir
end
|
#build ⇒ Object
Returns the value of attribute build.
11
12
13
|
# File 'lib/juwelier/version_helper.rb', line 11
def build
@build
end
|
#major ⇒ Object
Returns the value of attribute major.
11
12
13
|
# File 'lib/juwelier/version_helper.rb', line 11
def major
@major
end
|
#minor ⇒ Object
Returns the value of attribute minor.
11
12
13
|
# File 'lib/juwelier/version_helper.rb', line 11
def minor
@minor
end
|
#patch ⇒ Object
Returns the value of attribute patch.
11
12
13
|
# File 'lib/juwelier/version_helper.rb', line 11
def patch
@patch
end
|
Instance Method Details
#bump_major ⇒ Object
100
101
102
103
104
105
|
# File 'lib/juwelier/version_helper.rb', line 100
def bump_major
@major += 1
@minor = 0
@patch = 0
@build = nil
end
|
#bump_minor ⇒ Object
107
108
109
110
111
|
# File 'lib/juwelier/version_helper.rb', line 107
def bump_minor
@minor += 1
@patch = 0
@build = nil
end
|
#bump_patch ⇒ Object
113
114
115
116
|
# File 'lib/juwelier/version_helper.rb', line 113
def bump_patch
@patch += 1
@build = nil
end
|
#plaintext_path ⇒ Object
135
136
137
138
139
|
# File 'lib/juwelier/version_helper.rb', line 135
def plaintext_path
denormalized_path = File.join(@base_dir, 'VERSION')
absolute_path = File.expand_path(denormalized_path)
absolute_path.gsub(Dir.getwd + File::SEPARATOR, '')
end
|
#to_s ⇒ Object
125
126
127
|
# File 'lib/juwelier/version_helper.rb', line 125
def to_s
[major, minor, patch, build].compact.join('.')
end
|
#update_to(major, minor, patch, build = nil) ⇒ Object
118
119
120
121
122
123
|
# File 'lib/juwelier/version_helper.rb', line 118
def update_to(major, minor, patch, build=nil)
@major = major
@minor = minor
@patch = patch
@build = build
end
|
#yaml_path ⇒ Object
129
130
131
132
133
|
# File 'lib/juwelier/version_helper.rb', line 129
def yaml_path
denormalized_path = File.join(@base_dir, 'VERSION.yml')
absolute_path = File.expand_path(denormalized_path)
absolute_path.gsub(Dir.getwd + File::SEPARATOR, '')
end
|