Class: S3rbsync::Configure
- Inherits:
-
Object
- Object
- S3rbsync::Configure
- Defined in:
- lib/s3rbsync/configure.rb
Constant Summary collapse
- CONF_FILE =
"#{ENV["HOME"]}/.aws.yml"
Instance Attribute Summary collapse
-
#access_key ⇒ Object
Returns the value of attribute access_key.
-
#bucket_name ⇒ Object
Returns the value of attribute bucket_name.
-
#secret_key ⇒ Object
Returns the value of attribute secret_key.
Instance Method Summary collapse
- #connected? ⇒ Boolean
-
#initialize ⇒ Configure
constructor
A new instance of Configure.
- #valid_yaml_file? ⇒ Boolean
Constructor Details
#initialize ⇒ Configure
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.}" 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_key ⇒ Object
Returns the value of attribute access_key.
6 7 8 |
# File 'lib/s3rbsync/configure.rb', line 6 def access_key @access_key end |
#bucket_name ⇒ Object
Returns the value of attribute bucket_name.
6 7 8 |
# File 'lib/s3rbsync/configure.rb', line 6 def bucket_name @bucket_name end |
#secret_key ⇒ Object
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
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
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 |