Class: AwsAuditor::Google

Inherits:
Object
  • Object
show all
Defined in:
lib/aws_auditor/google.rb

Constant Summary collapse

FILE_NAMES =
%w[.google.yml]

Class Method Summary collapse

Class Method Details

.config_pathObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/aws_auditor/google.rb', line 23

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

.configurationObject



9
10
11
12
# File 'lib/aws_auditor/google.rb', line 9

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

.fileObject



14
15
16
# File 'lib/aws_auditor/google.rb', line 14

def self.file
  load_config[:file]
end

.load_configObject



18
19
20
21
# File 'lib/aws_auditor/google.rb', line 18

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