fog 0.1.9 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -9,5 +9,5 @@ gem 'net-ssh', ">= 0"
9
9
  gem 'nokogiri', ">= 0"
10
10
  gem 'rspec', '>= 0'
11
11
  gem 'ruby-hmac', '>= 0'
12
- gem 'shindo', '>= 0.1.5'
12
+ gem 'shindo', '>= 0.1.6'
13
13
  gem 'builder', '>= 0'
@@ -39,7 +39,7 @@ dependencies:
39
39
  shindo:
40
40
  group:
41
41
  - :default
42
- version: ">= 0.1.5"
42
+ version: ">= 0.1.6"
43
43
  nokogiri:
44
44
  group:
45
45
  - :default
@@ -68,8 +68,8 @@ specs:
68
68
  - ruby-hmac:
69
69
  version: 0.4.0
70
70
  - shindo:
71
- version: 0.1.5
72
- hash: 12012795f07111bf764cef89d9ba91f521c54956
71
+ version: 0.1.6
72
+ hash: 83b7c53965ec61f532d9a504fcd8f5f67a285293
73
73
  sources:
74
74
  - Rubygems:
75
75
  uri: http://gemcutter.org
@@ -7,8 +7,8 @@ Gem::Specification.new do |s|
7
7
  ## If your rubyforge_project name is different, then edit it and comment out
8
8
  ## the sub! line in the Rakefile
9
9
  s.name = 'fog'
10
- s.version = '0.1.9'
11
- s.date = '2010-06-15'
10
+ s.version = '0.1.10'
11
+ s.date = '2010-06-18'
12
12
  s.rubyforge_project = 'fog'
13
13
 
14
14
  ## Make sure your summary is short. The description may be as long
data/lib/fog.rb CHANGED
@@ -38,7 +38,7 @@ require 'fog/vcloud'
38
38
  module Fog
39
39
 
40
40
  unless const_defined?(:VERSION)
41
- VERSION = '0.1.9'
41
+ VERSION = '0.1.10'
42
42
  end
43
43
 
44
44
  module Mock
@@ -14,14 +14,59 @@ module Fog
14
14
  @attributes ||= []
15
15
  end
16
16
 
17
- def attribute(name, other_names = [])
17
+ def attribute(name, options = {})
18
+ # FIXME: handle legacy where options would have been one or more aliases
19
+ if !options.is_a?(Hash)
20
+ options = {:aliases => options}
21
+ end
18
22
  class_eval <<-EOS, __FILE__, __LINE__
19
- attr_accessor :#{name}
23
+ attr_reader :#{name}
20
24
  EOS
25
+ case options[:type]
26
+ when :boolean
27
+ class_eval <<-EOS, __FILE__, __LINE__
28
+ def #{name}=(new_#{name})
29
+ @#{name} = case new_#{name}
30
+ when 'true'
31
+ true
32
+ when 'false'
33
+ false
34
+ end
35
+ end
36
+ EOS
37
+ when :float
38
+ class_eval <<-EOS, __FILE__, __LINE__
39
+ def #{name}=(new_#{name})
40
+ @#{name} = new_#{name}.to_f
41
+ end
42
+ EOS
43
+ when :integer
44
+ class_eval <<-EOS, __FILE__, __LINE__
45
+ def #{name}=(new_#{name})
46
+ @#{name} = new_#{name}.to_i
47
+ end
48
+ EOS
49
+ when :string
50
+ class_eval <<-EOS, __FILE__, __LINE__
51
+ def #{name}=(new_#{name})
52
+ @#{name} = new_#{name}.to_s
53
+ end
54
+ EOS
55
+ when :time
56
+ class_eval <<-EOS, __FILE__, __LINE__
57
+ def #{name}=(new_#{name})
58
+ @#{name} = Time.parse(new_#{name})
59
+ end
60
+ EOS
61
+ else
62
+ class_eval <<-EOS, __FILE__, __LINE__
63
+ attr_writer :#{name}
64
+ EOS
65
+ end
21
66
  @attributes ||= []
22
67
  @attributes |= [name]
23
- for other_name in [*other_names]
24
- aliases[other_name] = name
68
+ for new_alias in [*options[:aliases]]
69
+ aliases[new_alias] = name
25
70
  end
26
71
  end
27
72
 
@@ -30,9 +30,9 @@ module Fog
30
30
  data = connection.get_bucket(key, options).body
31
31
  directory = new(:key => data['Name'])
32
32
  options = {}
33
- for key, value in data
34
- if ['Delimiter', 'IsTruncated', 'Marker', 'MaxKeys', 'Prefix'].include?(key)
35
- options[key] = value
33
+ for k, v in data
34
+ if ['Delimiter', 'IsTruncated', 'Marker', 'MaxKeys', 'Prefix'].include?(k)
35
+ options[k] = v
36
36
  end
37
37
  end
38
38
  directory.files.merge_attributes(options)
@@ -65,7 +65,14 @@ module Fog
65
65
 
66
66
  def each
67
67
  super do |item|
68
- item.reload
68
+ item.reload unless item.loaded?
69
+ yield(item)
70
+ end
71
+ end
72
+
73
+ def map
74
+ super do |item|
75
+ item.reload unless item.loaded?
69
76
  yield(item)
70
77
  end
71
78
  end
@@ -61,7 +61,7 @@ describe 'Fog::AWS::EC2::Volume' do
61
61
 
62
62
  after(:each) do
63
63
  if @volume.id
64
- @volume.wait_for { state == 'attached' }
64
+ @volume.wait_for { state == 'in-use' }
65
65
  @volume.server = nil
66
66
  @volume.wait_for { ready? }
67
67
  @volume.destroy
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 9
9
- version: 0.1.9
8
+ - 10
9
+ version: 0.1.10
10
10
  platform: ruby
11
11
  authors:
12
12
  - geemus (Wesley Beary)
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-06-15 00:00:00 -07:00
17
+ date: 2010-06-18 00:00:00 -07:00
18
18
  default_executable: fog
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency