Sha256: 27f4617b55e235f4b9819b37ffcbf2f080ec2290ebde273349e31d6a5cc33807
Contents?: true
Size: 1.48 KB
Versions: 7
Compression:
Stored size: 1.48 KB
Contents
require 'active_record' require 'active_support' require 'fog' module CropDuster class << self 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 def aws_secret=(string) @aws_secret = string end def aws_key=(string) @aws_key = string end def aws_keys {:provider => 'AWS', :aws_access_key_id => @aws_key, :aws_secret_access_key => @aws_secret} end def aws_billing_bucket=(string) @aws_billing_bucket = string end def aws_billing_bucket @aws_billing_bucket end def tmp_dir=(string) @tmp_dir = string end def tmp_dir @tmp_dir end def configure(&block) block.call(self) end end end Dir.new(File.join(File.dirname(__FILE__), "models")).each do |file| next if file =~ /^\./ require File.join(File.dirname(__FILE__), "models", file) end Dir.new(File.join(File.dirname(__FILE__), "crop_duster")).each do |file| next if file =~ /^\./ require File.join(File.dirname(__FILE__), "crop_duster", file) end
Version data entries
7 entries across 7 versions & 1 rubygems