Class: S3rbsync::Configure

Inherits:
Object
  • Object
show all
Defined in:
lib/s3rbsync/configure.rb

Constant Summary collapse

CONF_FILE =
"#{ENV["HOME"]}/.aws.yml"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfigure

Returns a new instance of Configure.



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/s3rbsync/configure.rb', line 8

def initialize
  @access_key = @secret_key = @bucket_name = @error_message = nil
  begin
    @conf = YAML.load_file CONF_FILE
  rescue => e
    @error_message = "Error: #{e.message}"
  else
    @access_key  = @conf[:aws_access_key]
    @secret_key  = @conf[:aws_secret_access_key]
    @bucket_name = @conf[:bucket_name]
  end
end

Instance Attribute Details

#access_keyObject

Returns the value of attribute access_key.



6
7
8
# File 'lib/s3rbsync/configure.rb', line 6

def access_key
  @access_key
end

#bucket_nameObject

Returns the value of attribute bucket_name.



6
7
8
# File 'lib/s3rbsync/configure.rb', line 6

def bucket_name
  @bucket_name
end

#secret_keyObject

Returns the value of attribute secret_key.



6
7
8
# File 'lib/s3rbsync/configure.rb', line 6

def secret_key
  @secret_key
end

Instance Method Details

#connected?Boolean

Returns:

  • (Boolean)


25
26
27
28
# File 'lib/s3rbsync/configure.rb', line 25

def connected?
  s3 = S3rbsync::Synchronizer.new(self)
  s3.connected?
end

#valid_yaml_file?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/s3rbsync/configure.rb', line 21

def valid_yaml_file?
  @error_message.nil? and @access_key and @secret_key and @bucket_name
end