fog 0.0.35 → 0.0.36

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ require "#{current_directory}/lib/fog"
7
7
  begin
8
8
  require 'jeweler'
9
9
  Jeweler::Tasks.new do |gem|
10
- gem.add_dependency('excon', '>=0.0.11')
10
+ gem.add_dependency('excon', '>=0.0.13')
11
11
  gem.add_dependency('mime-types')
12
12
  gem.add_dependency('nokogiri')
13
13
  gem.add_dependency('ruby-hmac')
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.35
1
+ 0.0.36
data/bin/fog CHANGED
@@ -5,7 +5,11 @@ require 'yaml'
5
5
 
6
6
  module AWS
7
7
  class << self
8
- if Fog.credentials[:aws_access_key_id] && Fog.credentials[:aws_secret_access_key]
8
+ key = (ARGV.first && :"#{ARGV.first}") || :default
9
+ unless Fog.credentials(key)
10
+ raise ArgumentError.new("No credentials for :#{key}")
11
+ end
12
+ if Fog.credentials(key)[:aws_access_key_id] && Fog.credentials(key)[:aws_secret_access_key]
9
13
 
10
14
  @@ec2 = Fog::AWS::EC2.new(
11
15
  :aws_access_key_id => Fog.credentials[:aws_access_key_id],
@@ -51,7 +55,11 @@ end
51
55
 
52
56
  module Rackspace
53
57
  class << self
54
- if Fog.credentials[:rackspace_api_key] && Fog.credentials[:rackspace_username]
58
+ key = (ARGV.first && :"#{ARGV.first}") || :default
59
+ unless Fog.credentials(key)
60
+ raise ArgumentError.new("No credentials for :#{key}")
61
+ end
62
+ if Fog.credentials(key)[:rackspace_api_key] && Fog.credentials(key)[:rackspace_username]
55
63
 
56
64
  @@servers = Fog::Rackspace::Servers.new(
57
65
  :rackspace_api_key => Fog.credentials[:rackspace_api_key],
data/fog.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{fog}
8
- s.version = "0.0.35"
8
+ s.version = "0.0.36"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["geemus (Wesley Beary)"]
12
- s.date = %q{2009-12-08}
12
+ s.date = %q{2009-12-14}
13
13
  s.default_executable = %q{fog}
14
14
  s.description = %q{brings clouds to you}
15
15
  s.email = %q{me@geemus.com}
@@ -393,18 +393,18 @@ Gem::Specification.new do |s|
393
393
  s.specification_version = 3
394
394
 
395
395
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
396
- s.add_runtime_dependency(%q<excon>, [">= 0.0.11"])
396
+ s.add_runtime_dependency(%q<excon>, [">= 0.0.13"])
397
397
  s.add_runtime_dependency(%q<mime-types>, [">= 0"])
398
398
  s.add_runtime_dependency(%q<nokogiri>, [">= 0"])
399
399
  s.add_runtime_dependency(%q<ruby-hmac>, [">= 0"])
400
400
  else
401
- s.add_dependency(%q<excon>, [">= 0.0.11"])
401
+ s.add_dependency(%q<excon>, [">= 0.0.13"])
402
402
  s.add_dependency(%q<mime-types>, [">= 0"])
403
403
  s.add_dependency(%q<nokogiri>, [">= 0"])
404
404
  s.add_dependency(%q<ruby-hmac>, [">= 0"])
405
405
  end
406
406
  else
407
- s.add_dependency(%q<excon>, [">= 0.0.11"])
407
+ s.add_dependency(%q<excon>, [">= 0.0.13"])
408
408
  s.add_dependency(%q<mime-types>, [">= 0"])
409
409
  s.add_dependency(%q<nokogiri>, [">= 0"])
410
410
  s.add_dependency(%q<ruby-hmac>, [">= 0"])
data/lib/fog.rb CHANGED
@@ -38,11 +38,11 @@ module Fog
38
38
  load "fog/slicehost.rb"
39
39
  end
40
40
 
41
- def self.credentials(path = File.expand_path('~/.fog'))
41
+ def self.credentials(key = :default)
42
42
  @credentials ||= begin
43
43
  credentials = {}
44
- File.open(path) do |file|
45
- credentials = YAML.load(file.read)[:default]
44
+ File.open(File.expand_path('~/.fog')) do |file|
45
+ credentials = YAML.load(file.read)[key]
46
46
  end
47
47
  credentials
48
48
  end
@@ -13,10 +13,11 @@ module Fog
13
13
  model Fog::AWS::S3::Object
14
14
 
15
15
  def all(options = {})
16
- bucket.collection.get(
16
+ collection = bucket.collection.get(
17
17
  bucket.name,
18
18
  options.reject {|key, value| !['delimiter', 'marker', 'max-keys', 'prefix'].include?(key)}
19
- ).objects
19
+ )
20
+ collection && collection.objects
20
21
  end
21
22
 
22
23
  def bucket
@@ -33,6 +33,10 @@ describe 'Fog::AWS::S3::Objects' do
33
33
  @bucket.objects.all.should be_a(Fog::AWS::S3::Objects)
34
34
  end
35
35
 
36
+ it "should return nil if the bucket does not exist" do
37
+ bucket = s3.buckets.new(:name => 'notabucket')
38
+ bucket.objects.all.should be_nil
39
+ end
36
40
  end
37
41
 
38
42
  describe "#bucket" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.35
4
+ version: 0.0.36
5
5
  platform: ruby
6
6
  authors:
7
7
  - geemus (Wesley Beary)
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-08 00:00:00 -08:00
12
+ date: 2009-12-14 00:00:00 -08:00
13
13
  default_executable: fog
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 0.0.11
23
+ version: 0.0.13
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: mime-types