Class: Hillary::Slug
- Inherits:
-
Object
- Object
- Hillary::Slug
- Includes:
- Shellable
- Defined in:
- lib/hillary/slug.rb,
lib/hillary/slug/bucket.rb
Defined Under Namespace
Classes: Bucket
Constant Summary collapse
- SlugArchiveError =
Class.new(StandardError)
- SlugNotFoundError =
Class.new(StandardError)
Instance Attribute Summary collapse
-
#branch ⇒ Object
readonly
Returns the value of attribute branch.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Class Method Summary collapse
Instance Method Summary collapse
- #build ⇒ Object
- #canonical_name ⇒ Object
-
#initialize(path, version, options = {}) ⇒ Slug
constructor
A new instance of Slug.
- #name ⇒ Object
Methods included from Shellable
Constructor Details
#initialize(path, version, options = {}) ⇒ Slug
Returns a new instance of Slug.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/hillary/slug.rb', line 24 def initialize(path, version, = {}) @path = path @version = version @bucket = [:bucket] || Bucket.new @logger = if [:logger] [:logger] else Logger.new($stdout).tap do |logger| logger.formatter = proc do |severity, time, _, msg| "#{time.strftime('%Y-%m-%d %H:%M:%S')} #{severity} - #{msg}\n" end end end end |
Instance Attribute Details
#branch ⇒ Object (readonly)
Returns the value of attribute branch.
11 12 13 |
# File 'lib/hillary/slug.rb', line 11 def branch @branch end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
11 12 13 |
# File 'lib/hillary/slug.rb', line 11 def version @version end |
Class Method Details
Instance Method Details
#build ⇒ Object
40 41 42 43 44 45 46 47 48 |
# File 'lib/hillary/slug.rb', line 40 def build if version.master? create_slug_if_missing copy_slug elsif version.dev? create_slug upload_slug end end |
#canonical_name ⇒ Object
54 55 56 |
# File 'lib/hillary/slug.rb', line 54 def canonical_name "#{project_name}_slug_#{version.sha}" end |
#name ⇒ Object
50 51 52 |
# File 'lib/hillary/slug.rb', line 50 def name "#{project_name}_slug_#{version.name}" end |