Module: Brillo

Defined in:
lib/brillo.rb,
lib/brillo/config.rb,
lib/brillo/errors.rb,
lib/brillo/loader.rb,
lib/brillo/logger.rb,
lib/brillo/railtie.rb,
lib/brillo/version.rb,
lib/brillo/scrubber.rb,
lib/brillo/adapter/base.rb,
lib/brillo/adapter/mysql.rb,
lib/brillo/transferrer/s3.rb,
lib/brillo/adapter/postgres.rb,
lib/brillo/transferrer/config.rb,
lib/brillo/dumper/mysql_dumper.rb,
lib/brillo/helpers/exec_helper.rb

Defined Under Namespace

Modules: Adapter, Dumper, Helpers, Logger, Transferrer Classes: Config, Loader, Railtie, Scrubber

Constant Summary collapse

ConfigParseError =
Class.new(StandardError)
CredentialsError =
Class.new(StandardError)
VERSION =
"2.1.0"

Class Method Summary collapse

Class Method Details

.configObject



44
45
46
47
48
49
50
51
# File 'lib/brillo.rb', line 44

def self.config
  @config ||= begin
    static_config = YAML.load(ERB.new(File.read("#{Rails.root.to_s}/config/brillo.yml")).result).deep_symbolize_keys
    c = Config.new(static_config)
    yield c if block_given?
    c
  end
end

.config=(config) ⇒ Object



53
54
55
# File 'lib/brillo.rb', line 53

def self.config=(config)
  @config = config
end

.configure {|config| ... } ⇒ Object

Yields:



26
27
28
# File 'lib/brillo.rb', line 26

def self.configure
  yield config
end

.load!(keep_local: false, logger: ::Logger.new(STDOUT), filename: nil) ⇒ Object



37
38
39
40
41
42
# File 'lib/brillo.rb', line 37

def self.load!(keep_local: false, logger: ::Logger.new(STDOUT), filename: nil)
  Brillo::Logger.logger = logger
  configuration = config
  configuration.app_name = filename if filename
  Loader.new(configuration).load! keep_local
end

.scrub!(logger: ::Logger.new(STDOUT), filename: nil) ⇒ Object



30
31
32
33
34
35
# File 'lib/brillo.rb', line 30

def self.scrub!(logger: ::Logger.new(STDOUT), filename: nil)
  Brillo::Logger.logger = logger
  configuration = config
  configuration.app_name = filename if filename
  Scrubber.new(configuration).scrub!
end