./lib/animoto/client.rb in animoto-0.0.0.alpha5 vs ./lib/animoto/client.rb in animoto-0.0.0.alpha6
- old
+ new
@@ -159,28 +159,25 @@
# Sets the API credentials from an .animotorc file. First looks for one in the current
# directory, then checks ~/.animotorc, then finally /etc/.animotorc.
#
# @raise [ArgumentError] if none of the files are found
def configure_from_rc_file
- catch(:done) do
- current_path = Dir.pwd + '/.animotorc'
- home_path = File.expand_path('~/.animotorc')
- config = if File.exist?(current_path)
- YAML.load(File.read(current_path))
- elsif File.exist?(home_path)
- home_path = File.expand_path '~/.animotorc'
- YAML.load(File.read(home_path))
- elsif File.exist?('/etc/.animotorc')
- YAML.load(File.read('/etc/.animotorc'))
- end
- if config
- @key ||= config['key']
- @secret ||= config['secret']
- @endpoint ||= config['endpoint']
- throw :done if @key && @secret
- end
- raise ArgumentError, "You must supply your key and secret"
+ current_path = Dir.pwd + '/.animotorc'
+ home_path = File.expand_path('~/.animotorc')
+ config = if File.exist?(current_path)
+ YAML.load(File.read(current_path))
+ elsif File.exist?(home_path)
+ home_path = File.expand_path '~/.animotorc'
+ YAML.load(File.read(home_path))
+ elsif File.exist?('/etc/.animotorc')
+ YAML.load(File.read('/etc/.animotorc'))
end
+ if config
+ @key ||= config['key']
+ @secret ||= config['secret']
+ @endpoint ||= config['endpoint']
+ end
+ @key && @secret ? return : raise(ArgumentError, "You must supply your key and secret")
end
# Builds a request to find a resource.
#
# @param [Class] klass the Resource class you're looking for
\ No newline at end of file