Class: Lono::Configset::S3File::Item
- Inherits:
-
Object
- Object
- Lono::Configset::S3File::Item
- Includes:
- Utils::Item::FileMethods
- Defined in:
- lib/lono/configset/s3_file/item.rb
Overview
Holds metadata about the item in the regsitry.
Instance Attribute Summary collapse
-
#configset ⇒ Object
readonly
Returns the value of attribute configset.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Instance Method Summary collapse
-
#initialize(name, options = {}) ⇒ Item
constructor
A new instance of Item.
- #output_path ⇒ Object
- #replacement_value ⇒ Object
- #src_path ⇒ Object
Methods included from Utils::Item::FileMethods
#directory?, #exist?, #file?, #s3_path, #zip_file_name, #zip_file_path
Constructor Details
#initialize(name, options = {}) ⇒ Item
Returns a new instance of Item.
7 8 9 10 11 12 13 |
# File 'lib/lono/configset/s3_file/item.rb', line 7 def initialize(name, ={}) @name, @options = name, @blueprint = [:blueprint] @configset = [:configset] @root = [:root] @type = [:type] || 'file' end |
Instance Attribute Details
#configset ⇒ Object (readonly)
Returns the value of attribute configset.
6 7 8 |
# File 'lib/lono/configset/s3_file/item.rb', line 6 def configset @configset end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/lono/configset/s3_file/item.rb', line 6 def name @name end |
#root ⇒ Object (readonly)
Returns the value of attribute root.
6 7 8 |
# File 'lib/lono/configset/s3_file/item.rb', line 6 def root @root end |
Instance Method Details
#output_path ⇒ Object
19 20 21 |
# File 'lib/lono/configset/s3_file/item.rb', line 19 def output_path "#{Lono.config.output_path}/#{@blueprint}/configsets/#{@configset}/files/#{@name}" end |
#replacement_value ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/lono/configset/s3_file/item.rb', line 23 def replacement_value aws_data = AwsData.new # # "https://s3.amazonaws.com/#{Lono::S3::Bucket.name}/#{s3_path}" # "https://lono-bucket-12di8xz5sy72z.s3-us-west-2.amazonaws.com/stuff/s3-antivirus.tgz" # # us-east-1 is special case: # # "https://lono-bucket-12di8xz5sy72z.s3.amazonaws.com/stuff/s3-antivirus.tgz" # region = "" region = "-#{aws_data.region}" unless aws_data.region == "us-east-1" "https://#{Lono::S3::Bucket.name}.s3#{region}.amazonaws.com/#{s3_path}" end |
#src_path ⇒ Object
15 16 17 |
# File 'lib/lono/configset/s3_file/item.rb', line 15 def src_path "#{@root}/lib/files" end |