Class: Astrails::Safe::Source

Inherits:
Stream
  • Object
show all
Defined in:
lib/astrails/safe/source.rb

Direct Known Subclasses

Archive, Mysqldump

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Stream

#compressed?, #config, #id

Constructor Details

#initialize(id, config) ⇒ Source

Returns a new instance of Source.



5
6
7
# File 'lib/astrails/safe/source.rb', line 5

def initialize(id, config)
  @id, @config = id, config
end

Class Method Details

.run(config) ⇒ Object

process each config key as source (with full pipe)



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/astrails/safe/source.rb', line 14

def self.run(config)
  unless config
    puts "No configuration found for #{human_name}"
    return
  end

  config.each do |key, value|
    stream = [Gpg, Gzip, Local, S3].inject(new(key, value)) do |res, klass|
      klass.new(res)
    end
    stream.run
  end
end

Instance Method Details

#filenameObject



9
10
11
# File 'lib/astrails/safe/source.rb', line 9

def filename
  @filename ||= expand(":kind-:id.:timestamp#{extension}")
end