Module: CropDuster

Defined in:
lib/crop_duster.rb,
lib/crop_duster/cli.rb,
lib/crop_duster/importer.rb

Defined Under Namespace

Classes: CLI, Importer

Class Method Summary collapse

Class Method Details

.aws_billing_bucketObject



42
43
44
# File 'lib/crop_duster.rb', line 42

def aws_billing_bucket
  @aws_billing_bucket
end

.aws_billing_bucket=(string) ⇒ Object



38
39
40
# File 'lib/crop_duster.rb', line 38

def aws_billing_bucket=(string)
  @aws_billing_bucket = string
end

.aws_key=(string) ⇒ Object



30
31
32
# File 'lib/crop_duster.rb', line 30

def aws_key=(string)
  @aws_key = string
end

.aws_keysObject



34
35
36
# File 'lib/crop_duster.rb', line 34

def aws_keys
  {:provider => 'AWS', :aws_access_key_id => @aws_key, :aws_secret_access_key => @aws_secret}
end

.aws_secret=(string) ⇒ Object



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

def aws_secret=(string)
  @aws_secret = string
end

.configure(&block) ⇒ Object



54
55
56
# File 'lib/crop_duster.rb', line 54

def configure(&block)
  block.call(self)
end

.db=(url) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/crop_duster.rb', line 8

def db=(url)
  db_url  = URI.parse(url)
  options = (db_url.query || "").split(/\&/).inject({}) { |hash, s| hash[s.split(/=/)[0].to_sym] = s.split(/=/)[1]; hash }

  config_hash = {
    adapter: db_url.scheme,
    host: db_url.host,
    port: db_url.port,
    database: db_url.path.gsub(/^\//, ''),
    username: db_url.user,
    password: db_url.password
  }

  config_hash.delete_if { |k, v| v.nil? }

  ActiveRecord::Base.establish_connection config_hash.merge(options)
end

.tmp_dirObject



50
51
52
# File 'lib/crop_duster.rb', line 50

def tmp_dir
  @tmp_dir
end

.tmp_dir=(string) ⇒ Object



46
47
48
# File 'lib/crop_duster.rb', line 46

def tmp_dir=(string)
  @tmp_dir = string
end