Class: Pipely::Build::S3PathBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/pipely/build/s3_path_builder.rb

Overview

Builds paths to assets, logs, and steps that are on S3.

Constant Summary collapse

START_TIME =
"\#{format(@scheduledStartTime,'YYYY-MM-dd_HHmmss')}"
START_DATE =
"\#{format(@scheduledStartTime,'YYYY-MM-dd')}"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ S3PathBuilder

Returns a new instance of S3PathBuilder.



13
14
15
16
17
18
# File 'lib/pipely/build/s3_path_builder.rb', line 13

def initialize(options)
  @assets_bucket = options[:assets]
  @logs_bucket = options[:logs]
  @steps_bucket = options[:steps]
  @s3prefix = options[:prefix]
end

Instance Attribute Details

#assets_bucketObject (readonly)

Returns the value of attribute assets_bucket.



8
9
10
# File 'lib/pipely/build/s3_path_builder.rb', line 8

def assets_bucket
  @assets_bucket
end

#logs_bucketObject (readonly)

Returns the value of attribute logs_bucket.



8
9
10
# File 'lib/pipely/build/s3_path_builder.rb', line 8

def logs_bucket
  @logs_bucket
end

#steps_bucketObject (readonly)

Returns the value of attribute steps_bucket.



8
9
10
# File 'lib/pipely/build/s3_path_builder.rb', line 8

def steps_bucket
  @steps_bucket
end

Instance Method Details

#bucket_relative_s3_asset_prefixObject



44
45
46
# File 'lib/pipely/build/s3_path_builder.rb', line 44

def bucket_relative_s3_asset_prefix
  "#{@s3prefix}/#{START_TIME}"
end

#s3_asset_prefixObject



32
33
34
# File 'lib/pipely/build/s3_path_builder.rb', line 32

def s3_asset_prefix
  "s3://#{@assets_bucket}/#{bucket_relative_s3_asset_prefix}"
end

#s3_log_prefixObject



20
21
22
# File 'lib/pipely/build/s3_path_builder.rb', line 20

def s3_log_prefix
  "s3://#{@logs_bucket}/#{@s3prefix}/#{START_TIME}"
end

#s3_shared_asset_prefixObject



40
41
42
# File 'lib/pipely/build/s3_path_builder.rb', line 40

def s3_shared_asset_prefix
  "s3://#{@assets_bucket}/#{@s3prefix}/shared/#{START_DATE}"
end

#s3_step_prefixObject



24
25
26
# File 'lib/pipely/build/s3_path_builder.rb', line 24

def s3_step_prefix
  "s3://#{@steps_bucket}/#{@s3prefix}"
end

#s3n_asset_prefixObject



36
37
38
# File 'lib/pipely/build/s3_path_builder.rb', line 36

def s3n_asset_prefix
  "s3n://#{@assets_bucket}/#{@s3prefix}/#{START_TIME}"
end

#s3n_step_prefixObject



28
29
30
# File 'lib/pipely/build/s3_path_builder.rb', line 28

def s3n_step_prefix
  "s3n://#{@steps_bucket}/#{@s3prefix}"
end

#to_hashObject



48
49
50
51
52
53
54
55
56
57
58
# File 'lib/pipely/build/s3_path_builder.rb', line 48

def to_hash
  {
    :s3_log_prefix => s3_log_prefix,
    :s3_step_prefix => s3_step_prefix,
    :s3n_step_prefix => s3n_step_prefix,
    :s3_asset_prefix => s3_asset_prefix,
    :s3n_asset_prefix => s3n_asset_prefix,
    :s3_shared_asset_prefix => s3_shared_asset_prefix,
    :bucket_relative_s3_asset_prefix => bucket_relative_s3_asset_prefix,
  }
end