Class: Reyes::S3Loader
- Inherits:
-
Object
- Object
- Reyes::S3Loader
- Includes:
- Chalk::Log
- Defined in:
- lib/reyes/s3_loader.rb
Instance Method Summary collapse
- #archive_rules(data, slug) ⇒ Object
- #fetch_rules ⇒ Object
-
#initialize(aws, config, print_signatures = true) ⇒ S3Loader
constructor
A new instance of S3Loader.
- #upload_rules(data) ⇒ Object
Constructor Details
#initialize(aws, config, print_signatures = true) ⇒ S3Loader
Returns a new instance of S3Loader.
8 9 10 11 12 13 14 |
# File 'lib/reyes/s3_loader.rb', line 8 def initialize(aws, config, print_signatures=true) @aws = aws @config = config @print_sig = print_signatures log.info("Initialized S3Loader: #{bucket.inspect}/#{path.inspect}") end |
Instance Method Details
#archive_rules(data, slug) ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/reyes/s3_loader.rb', line 34 def archive_rules(data, slug) archive_path = "archive/#{slug}-#{path}" log.info("archive_rules to #{bucket.inspect}/#{archive_path.inspect}") log.info("MD5: #{Digest::MD5.hexdigest(data)}") if @print_sig log.info("size: #{data.length}") if @print_sig @aws.s3.buckets[bucket].objects[archive_path].write(data) end |
#fetch_rules ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/reyes/s3_loader.rb', line 16 def fetch_rules log.info("fetch_rules from #{bucket.inspect}/#{path.inspect}") data = @aws.s3.buckets[bucket].objects[path].read log.info("MD5: #{Digest::MD5.hexdigest(data)}") if @print_sig log.info("size: #{data.length}") if @print_sig data end |
#upload_rules(data) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/reyes/s3_loader.rb', line 26 def upload_rules(data) log.info("upload_rules to #{bucket.inspect}/#{path.inspect}") log.info("MD5: #{Digest::MD5.hexdigest(data)}") if @print_sig log.info("size: #{data.length}") if @print_sig @aws.s3.buckets[bucket].objects[path].write(data) end |