Class: SimpleDeployer::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_deployer/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#access_keyObject

Returns the value of attribute access_key.



3
4
5
# File 'lib/simple_deployer/config.rb', line 3

def access_key
  @access_key
end

#aws_access_keyObject

Returns the value of attribute aws_access_key.



3
4
5
# File 'lib/simple_deployer/config.rb', line 3

def aws_access_key
  @aws_access_key
end

#aws_secret_keyObject

Returns the value of attribute aws_secret_key.



3
4
5
# File 'lib/simple_deployer/config.rb', line 3

def aws_secret_key
  @aws_secret_key
end

#hostObject

Returns the value of attribute host.



3
4
5
# File 'lib/simple_deployer/config.rb', line 3

def host
  @host
end

#project_idObject

Returns the value of attribute project_id.



3
4
5
# File 'lib/simple_deployer/config.rb', line 3

def project_id
  @project_id
end

#secret_keyObject

Returns the value of attribute secret_key.



3
4
5
# File 'lib/simple_deployer/config.rb', line 3

def secret_key
  @secret_key
end

Instance Method Details

#config_fileObject



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

def config_file
    Dir.pwd + "/.sd/config.yaml"
end

#readObject



11
12
13
14
15
16
17
18
19
20
# File 'lib/simple_deployer/config.rb', line 11

def read
    credentials = read_from_file
    if credentials
        parse(credentials)
    else
        credentials = read_from_cli
        write_to_file(credentials)
        parse(credentials)
    end
end

#s3Object



28
29
30
# File 'lib/simple_deployer/config.rb', line 28

def s3
    Aws::S3.new(aws_access_key, aws_secret_key, {:connection_mode => :per_request})
end

#s3_bucketObject



23
24
25
# File 'lib/simple_deployer/config.rb', line 23

def s3_bucket
    return s3.bucket(s3_bucket_name, true)
end

#s3_bucket_nameObject



33
34
35
# File 'lib/simple_deployer/config.rb', line 33

def s3_bucket_name
    'sd_store'
end

#save_configObject



43
44
45
# File 'lib/simple_deployer/config.rb', line 43

def save_config
    write_to_file({"access_key"=>self.access_key, "secret_key"=>self.secret_key, "aws_access_key"=>self.aws_access_key, "aws_secret_key"=>self.aws_secret_key, "project_id"=>self.project_id})
end