Class: Versioner::YamlBackend

Inherits:
Object
  • Object
show all
Defined in:
lib/versioner/versioner_yaml.rb

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ YamlBackend

Returns a new instance of YamlBackend.



5
6
7
8
# File 'lib/versioner/versioner_yaml.rb', line 5

def initialize(path)
  self.path = path
  read
end

Instance Method Details

#force(major, minor, patch) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/versioner/versioner_yaml.rb', line 26

def force(major, minor, patch)
  self.major = major
  self.minor = minor
  self.patch = patch
  write
  version
end

#increment_majorObject



34
35
36
37
38
39
40
# File 'lib/versioner/versioner_yaml.rb', line 34

def increment_major
  self.major = major + 1
  self.minor = 0
  self.patch = 0
  write
  version
end

#increment_minorObject



42
43
44
45
46
47
# File 'lib/versioner/versioner_yaml.rb', line 42

def increment_minor
  self.minor = minor + 1
  self.patch = 0
  write
  version
end

#increment_patchObject



49
50
51
52
53
# File 'lib/versioner/versioner_yaml.rb', line 49

def increment_patch
  self.patch = patch + 1
  write
  version
end

#majorObject



14
15
16
# File 'lib/versioner/versioner_yaml.rb', line 14

def major
  data[:major]
end

#minorObject



18
19
20
# File 'lib/versioner/versioner_yaml.rb', line 18

def minor
  data[:minor]
end

#patchObject



22
23
24
# File 'lib/versioner/versioner_yaml.rb', line 22

def patch
  data[:patch]
end

#versionObject



10
11
12
# File 'lib/versioner/versioner_yaml.rb', line 10

def version
  "#{major}.#{minor}.#{patch}"
end