| Class | Sprout::VersionFile |
| In: |
sprout/lib/sprout/version_file.rb
|
| Parent: | Object |
Used by the GitTask to load, parse and persist Version information related to a project. Expects a file with a 3 digit number, separated by periods like:
3.4.2
Create with a path to the file like:
version = VersionFile.new('path/Version.txt')
# File sprout/lib/sprout/version_file.rb, line 15 def initialize(file_path) @file_path = file_path read_value end
# File sprout/lib/sprout/version_file.rb, line 41 def increment_revision self.revision = self.revision + 1 end
# File sprout/lib/sprout/version_file.rb, line 29 def major_version @value.split('.').shift.to_i end
# File sprout/lib/sprout/version_file.rb, line 53 def to_tag parts = value.split('.') parts[0] = add_leading_zeros(parts[0], 2) parts[1] = add_leading_zeros(parts[1], 2) parts[2] = add_leading_zeros(parts[2], 3) return parts.join('.') end