Class: VersionManager::Make

Inherits:
Object
  • Object
show all
Defined in:
lib/version-manager/make.rb

Defined Under Namespace

Classes: BranchIsNotUpToDateError, ForbiddenBranchError

Instance Method Summary collapse

Constructor Details

#initialize(vcs, version_storage) ⇒ Make

Returns a new instance of Make.



15
16
17
18
# File 'lib/version-manager/make.rb', line 15

def initialize(vcs, version_storage)
  @vcs = vcs
  @version_storage = version_storage
end

Instance Method Details

#major!(version) ⇒ Object



25
26
27
# File 'lib/version-manager/make.rb', line 25

def major!(version)
  default_strategy(version.bump_major)
end

#minor!(version) ⇒ Object



29
30
31
# File 'lib/version-manager/make.rb', line 29

def minor!(version)
  default_strategy(version.bump_minor)
end

#patch!(version) ⇒ Object



33
34
35
36
37
38
39
# File 'lib/version-manager/make.rb', line 33

def patch!(version)
  version = version.bump_patch
  vcs.commit(version_storage.store(version), default_commit_message(version))
  vcs.add_tag(version.to_s, default_commit_message(version))
  vcs.push_tag(version.to_s)
  vcs.push
end

#validate!(release_type) ⇒ Object



20
21
22
23
# File 'lib/version-manager/make.rb', line 20

def validate!(release_type)
  raise BranchIsNotUpToDateError unless vcs.master_state_actual?
  raise ForbiddenBranchError unless appropriate_branch_for?(release_type)
end