Class: Upfluence::Handler::Base
- Inherits:
-
Object
- Object
- Upfluence::Handler::Base
- Defined in:
- lib/upfluence/handler/base.rb
Instance Method Summary collapse
- #aliveSince ⇒ Object
- #getInterfaceVersions ⇒ Object
- #getName ⇒ Object
- #getStatus ⇒ Object
- #getVersion ⇒ Object
-
#initialize(modules = []) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(modules = []) ⇒ Base
Returns a new instance of Base.
8 9 10 11 12 13 |
# File 'lib/upfluence/handler/base.rb', line 8 def initialize(modules = []) @alive_since = Time.now.to_i @modules = modules.reduce({ 'base' => ::Base::VERSION }) do |acc, cur| acc.merge cur.name.downcase => cur::VERSION end end |
Instance Method Details
#aliveSince ⇒ Object
47 48 49 |
# File 'lib/upfluence/handler/base.rb', line 47 def aliveSince @alive_since end |
#getInterfaceVersions ⇒ Object
51 52 53 |
# File 'lib/upfluence/handler/base.rb', line 51 def getInterfaceVersions @modules end |
#getName ⇒ Object
39 40 41 |
# File 'lib/upfluence/handler/base.rb', line 39 def getName ENV['UNIT_NAME'] || 'default' end |
#getStatus ⇒ Object
43 44 45 |
# File 'lib/upfluence/handler/base.rb', line 43 def getStatus ::Base::Base_service::Status::ALIVE end |
#getVersion ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/upfluence/handler/base.rb', line 15 def getVersion semantic_version = if ENV['SEMVER_VERSION'] major, minor, patch = ENV['SEMVER_VERSION'].split('.') ::Base::Version::SemanticVersion.new( major: major[1..-1].to_i, minor: minor.to_i, patch: patch.to_i ) end git_version = if ENV['GIT_COMMIT'] ::Base::Version::GitVersion.new( commit: ENV['GIT_COMMIT'], branch: ENV['GIT_BRANCH'], remote: ENV['GIT_REMOTE'] ) end ::Base::Version::Version.new( semantic_version: semantic_version, git_version: git_version ) end |