Class: Lono::AppFile::Registry::Item
- Inherits:
-
Object
- Object
- Lono::AppFile::Registry::Item
- Defined in:
- lib/lono/app_file/registry/item.rb
Overview
Holds metadata about the item in the regsitry.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #directory? ⇒ Boolean
- #file? ⇒ Boolean
-
#initialize(name, blueprint, options = {}) ⇒ Item
constructor
A new instance of Item.
- #path ⇒ Object
- #s3_path ⇒ Object
- #zip_file_name ⇒ Object
-
#zip_file_path ⇒ Object
full path.
Constructor Details
#initialize(name, blueprint, options = {}) ⇒ Item
Returns a new instance of Item.
6 7 8 |
# File 'lib/lono/app_file/registry/item.rb', line 6 def initialize(name, blueprint, ={}) @name, @blueprint, @options = name, blueprint, end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/lono/app_file/registry/item.rb', line 5 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/lono/app_file/registry/item.rb', line 5 def @options end |
Instance Method Details
#directory? ⇒ Boolean
14 15 16 |
# File 'lib/lono/app_file/registry/item.rb', line 14 def directory? File.directory?(path) end |
#file? ⇒ Boolean
18 19 20 |
# File 'lib/lono/app_file/registry/item.rb', line 18 def file? File.file?(path) end |
#path ⇒ Object
10 11 12 |
# File 'lib/lono/app_file/registry/item.rb', line 10 def path "#{Lono.root}/output/#{@blueprint}/files/#{@name}" end |
#s3_path ⇒ Object
22 23 24 25 |
# File 'lib/lono/app_file/registry/item.rb', line 22 def s3_path file_path = zip_file_path.sub(%r{.*/output/[\w_-]+/files/}, '') # dont use basename. there might be subfolders "#{s3_prefix}/#{file_path}" end |
#zip_file_name ⇒ Object
32 33 34 |
# File 'lib/lono/app_file/registry/item.rb', line 32 def zip_file_name "#{File.basename(path)}-#{Lono::Md5.sum(path)}.zip" end |
#zip_file_path ⇒ Object
full path
28 29 30 |
# File 'lib/lono/app_file/registry/item.rb', line 28 def zip_file_path "#{File.dirname(path)}/#{zip_file_name}" end |