Class: Menagerie::Release
- Inherits:
-
Object
- Object
- Menagerie::Release
- Defined in:
- lib/menagerie/release.rb
Overview
Release object containing artifacts
Instance Attribute Summary collapse
-
#base ⇒ Object
readonly
Returns the value of attribute base.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #artifacts ⇒ Object
- #delete ⇒ Object
-
#initialize(params = {}) ⇒ Release
constructor
A new instance of Release.
- #rotate ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ Release
Returns a new instance of Release.
10 11 12 13 14 15 |
# File 'lib/menagerie/release.rb', line 10 def initialize(params = {}) @options = params @logger = @options[:logger] || Menagerie.get_logger @path = @options[:path] || create parse_path end |
Instance Attribute Details
#base ⇒ Object (readonly)
Returns the value of attribute base.
8 9 10 |
# File 'lib/menagerie/release.rb', line 8 def base @base end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
8 9 10 |
# File 'lib/menagerie/release.rb', line 8 def id @id end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
8 9 10 |
# File 'lib/menagerie/release.rb', line 8 def path @path end |
Instance Method Details
#<=>(other) ⇒ Object
23 24 25 26 |
# File 'lib/menagerie/release.rb', line 23 def <=>(other) return nil unless other.is_a? Release @id.to_i <=> other.id.to_i end |
#artifacts ⇒ Object
17 18 19 20 21 |
# File 'lib/menagerie/release.rb', line 17 def artifacts Dir.glob("#{@path}/*").map do |x| Artifact.new path: x, paths: @options[:paths], logger: @logger end end |
#delete ⇒ Object
35 36 37 38 |
# File 'lib/menagerie/release.rb', line 35 def delete @logger.info "Deleting release: #{@path}" FileUtils.rm_r @path end |
#rotate ⇒ Object
28 29 30 31 32 33 |
# File 'lib/menagerie/release.rb', line 28 def rotate old_path = @path @path = "#{@base}/#{@id.to_i + 1}" FileUtils.mv old_path, @path parse_path end |