Sha256: 41d1277ff02d2292438609da27d3f5aca18d616b9a1e145a006aa89b2a55a5d9

Contents?: true

Size: 847 Bytes

Versions: 3

Compression:

Stored size: 847 Bytes

Contents

module AwsAuditor
	class GoogleConfig < Hash
    include Hashie::Extensions::IndifferentAccess
  end

  class Google
  FILE_NAMES = %w[.google.yml]

    def self.configuration
      credentials = load_config[:login]
      GoogleDrive.login(credentials[:email],credentials[:password])
    end

    def self.file
      load_config[:file]
    end

    def self.load_config
      return @config if @config
      @config = GoogleConfig[YAML.load_file(config_path)]
    end

    def self.config_path
      if filepath = FILE_NAMES.detect {|filename| File.exists?(filename)}
        File.join(Dir.pwd, filepath)
      else
        old_dir = Dir.pwd
        Dir.chdir('..')
        if old_dir != Dir.pwd
          config_path
        else
          puts "Could not find #{FILE_NAMES.join(' or ')}"
          exit
        end
      end
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
aws_auditor-0.1.2 lib/aws_auditor/google.rb
aws_auditor-0.1.1 lib/aws_auditor/google.rb
aws_auditor-0.1.0 lib/aws_auditor/google.rb