Class: Statistrano::Deployment::Strategy::Branches::Release
- Inherits:
-
Object
- Object
- Statistrano::Deployment::Strategy::Branches::Release
- Defined in:
- lib/statistrano/deployment/strategy/branches/release.rb
Overview
Manages the state of a single release for the manifest
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #commit ⇒ Object
- #href ⇒ Object
-
#initialize(name, config, options = {}) ⇒ Release
constructor
init a release.
- #link ⇒ Object
- #time ⇒ Object
-
#to_hash ⇒ Object
def get_binding binding end.
-
#to_json ⇒ String
convert the release to a json object.
Constructor Details
#initialize(name, config, options = {}) ⇒ Release
init a release
17 18 19 20 21 |
# File 'lib/statistrano/deployment/strategy/branches/release.rb', line 17 def initialize name, config, ={} @name = name @config = config @options = Util.symbolize_hash_keys end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
11 12 13 |
# File 'lib/statistrano/deployment/strategy/branches/release.rb', line 11 def config @config end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
11 12 13 |
# File 'lib/statistrano/deployment/strategy/branches/release.rb', line 11 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
11 12 13 |
# File 'lib/statistrano/deployment/strategy/branches/release.rb', line 11 def @options end |
Instance Method Details
#commit ⇒ Object
27 28 29 |
# File 'lib/statistrano/deployment/strategy/branches/release.rb', line 27 def commit @_commit ||= .fetch(:commit) { Asgit.current_commit } end |
#href ⇒ Object
35 36 37 |
# File 'lib/statistrano/deployment/strategy/branches/release.rb', line 35 def href "http://#{name}.#{config.base_domain}" end |
#link ⇒ Object
31 32 33 |
# File 'lib/statistrano/deployment/strategy/branches/release.rb', line 31 def link @_link ||= .fetch(:link) { ([:repo_url]) ? "#{[:repo_url]}/tree/#{commit}" : nil } end |
#time ⇒ Object
23 24 25 |
# File 'lib/statistrano/deployment/strategy/branches/release.rb', line 23 def time @_time ||= .fetch(:time) { Time.now.to_i } end |
#to_hash ⇒ Object
def get_binding
binding
end
52 53 54 55 56 57 58 59 60 61 |
# File 'lib/statistrano/deployment/strategy/branches/release.rb', line 52 def to_hash hash = { name: name, time: time, commit: commit } hash.merge({ link: link }) if link return hash end |
#to_json ⇒ String
convert the release to a json object
65 66 67 |
# File 'lib/statistrano/deployment/strategy/branches/release.rb', line 65 def to_json return to_hash.to_json end |