Sha256: c38c223bcf4de5a5e4a66dec227708e644707bc5aef79c84d4040a13ecf526da

Contents?: true

Size: 1.12 KB

Versions: 2

Compression:

Stored size: 1.12 KB

Contents

module Lono::Configset::S3File
  # Holds metadata about the item in the regsitry.
  class Item
    include Lono::Utils::Item::FileMethods

    attr_reader :name, :configset, :root
    def initialize(name, options={})
      @name, @options = name, options
      @blueprint = options[:blueprint]
      @configset = options[:configset]
      @root = options[:root]
      @type = options[:type] || 'file'
    end

    def src_path
      "#{@root}/lib/files"
    end

    def output_path
      "#{Lono.root}/output/#{@blueprint.name}/configsets/#{@configset}/files/#{@name}"
    end

    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
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lono-8.0.0.pre.rc2 lib/lono/configset/s3_file/item.rb
lono-8.0.0.pre.rc1 lib/lono/configset/s3_file/item.rb