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')}"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ S3PathBuilder

Returns a new instance of S3PathBuilder.



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

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



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

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

#s3_asset_prefixObject



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

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

#s3_log_prefixObject



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

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

#s3_step_prefixObject



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

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

#s3n_asset_prefixObject



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

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

#s3n_step_prefixObject



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

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

#to_hashObject



43
44
45
46
47
48
49
50
51
52
# File 'lib/pipely/build/s3_path_builder.rb', line 43

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,
    :bucket_relative_s3_asset_prefix => bucket_relative_s3_asset_prefix,
  }
end