Class: StiDeploy::Version::VersionBumper

Inherits:
Object
  • Object
show all
Defined in:
lib/sti_deploy/version/version_bumper.rb

Direct Known Subclasses

Hotfix, PreRelease, Release, ReleaseCandidate

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(version) ⇒ VersionBumper

rubocop:enable Security/Eval



17
18
19
# File 'lib/sti_deploy/version/version_bumper.rb', line 17

def initialize(version)
  @version = version
end

Instance Attribute Details

#versionObject (readonly)

Returns the value of attribute version.



4
5
6
# File 'lib/sti_deploy/version/version_bumper.rb', line 4

def version
  @version
end

Class Method Details

.from_deploy_type(deploy_type, version) ⇒ Object

We use eval here because the only possible strings that will be evaluated live in a hardcoded hash inside StiDeploy::DeployType.

rubocop:disable Security/Eval



10
11
12
13
14
# File 'lib/sti_deploy/version/version_bumper.rb', line 10

def self.from_deploy_type(deploy_type, version)
  class_name = deploy_type.to_s.split('_').map(&:capitalize).join
  klass = eval("StiDeploy::Version::#{class_name}")
  klass.new(version)
end

Instance Method Details

#bumpObject



21
# File 'lib/sti_deploy/version/version_bumper.rb', line 21

def bump; end