fog 0.0.47 → 0.0.48

Sign up to get free protection for your applications and to get access to all the features.
@@ -178,4 +178,4 @@ module Fog
178
178
  end
179
179
  end
180
180
 
181
- Fog::AWS.dependencies.each {|dependency| require(dependency)}
181
+ Fog::AWS.reload
@@ -176,4 +176,4 @@ module Fog
176
176
  end
177
177
  end
178
178
 
179
- Fog::AWS::EC2.dependencies.each {|dependency| require(dependency)}
179
+ Fog::AWS::EC2.reload
@@ -22,19 +22,15 @@ module Fog
22
22
 
23
23
  def all(public_ip = @public_ip)
24
24
  @public_ip = public_ip
25
- if @loaded
26
- clear
27
- end
28
- @loaded = true
29
25
  data = connection.describe_addresses(public_ip).body
30
- addresses = []
31
- data['addressesSet'].each do |address|
32
- addresses << new(address.reject {|key, value| value.nil? || value.empty? })
33
- end
26
+ load(
27
+ data['addressesSet'].map do |address|
28
+ address.reject {|key, value| value.nil? || value.empty? }
29
+ end
30
+ )
34
31
  if server
35
- addresses = addresses.select {|address| address.instance_id == server.id}
32
+ self.replace(self.select {|address| address.instance_id == server.id})
36
33
  end
37
- self.replace(addresses)
38
34
  end
39
35
 
40
36
  def get(public_ip)
@@ -11,10 +11,6 @@ module Fog
11
11
  model Fog::AWS::EC2::Flavor
12
12
 
13
13
  def all
14
- if @loaded
15
- clear
16
- end
17
- @loaded = true
18
14
  data = [
19
15
  { :bits => 32, :cores => 1, :disk => 160, :id => 'm1.small', :name => 'Small Instance', :ram => 1740.8},
20
16
  { :bits => 64, :cores => 4, :disk => 850, :id => 'm1.large', :name => 'Large Instance', :ram => 7680},
@@ -26,9 +22,7 @@ module Fog
26
22
  { :bits => 64, :cores => 13, :disk => 850, :id => 'm2.2xlarge', :name => 'High Memory Double Extra Large', :ram => 35020.8},
27
23
  { :bits => 64, :cores => 26, :disk => 1690, :id => 'm2.4xlarge', :name => 'High Memory Quadruple Extra Large', :ram => 70041.6},
28
24
  ]
29
- for flavor in data
30
- self << new(flavor)
31
- end
25
+ load(data)
32
26
  self
33
27
  end
34
28
 
@@ -19,15 +19,8 @@ module Fog
19
19
 
20
20
  def all(image_id = @image_id)
21
21
  @image_id = image_id
22
- if @loaded
23
- clear
24
- end
25
- @loaded = true
26
22
  data = connection.describe_images('ImageId' => image_id).body
27
- data['imagesSet'].each do |image|
28
- self << new(image)
29
- end
30
- self
23
+ load(data['imagesSet'])
31
24
  end
32
25
 
33
26
  def get(image_id)
@@ -19,15 +19,8 @@ module Fog
19
19
 
20
20
  def all(key_name = @key_name)
21
21
  @key_name = key_name
22
- if @loaded
23
- clear
24
- end
25
- @loaded = true
26
22
  data = connection.describe_key_pairs(key_name).body
27
- data['keySet'].each do |key|
28
- self << new(key)
29
- end
30
- self
23
+ load(data['keySet'])
31
24
  end
32
25
 
33
26
  def get(key_name)
@@ -19,15 +19,8 @@ module Fog
19
19
 
20
20
  def all(group_name = @group_name)
21
21
  @group_name = group_name
22
- if @loaded
23
- clear
24
- end
25
- @loaded = true
26
22
  data = connection.describe_security_groups(group_name).body
27
- data['securityGroupInfo'].each do |security_group|
28
- self << new(security_group)
29
- end
30
- self
23
+ load(data['securityGroupInfo'])
31
24
  end
32
25
 
33
26
  def get(group_name)
@@ -19,17 +19,14 @@ module Fog
19
19
 
20
20
  def all(server_id = @server_id)
21
21
  @server_id = server_id
22
- if @loaded
23
- clear
24
- end
25
- @loaded = true
26
22
  data = connection.describe_instances(server_id).body
27
- data['reservationSet'].each do |reservation|
28
- reservation['instancesSet'].each do |instance|
29
- self << new(instance.merge(:groups => reservation['groupSet']))
23
+ load(
24
+ data['reservationSet'].map do |reservation|
25
+ reservation['instancesSet'].map do |instance|
26
+ instance.merge(:groups => reservation['groupSet'])
27
+ end
30
28
  end
31
- end
32
- self
29
+ )
33
30
  end
34
31
 
35
32
  def get(server_id)
@@ -22,19 +22,12 @@ module Fog
22
22
 
23
23
  def all(snapshot_id = @snapshot_id)
24
24
  @snapshot_id = snapshot_id
25
- if @loaded
26
- clear
27
- end
28
- @loaded = true
29
25
  data = connection.describe_snapshots(snapshot_id).body
30
- snapshots = []
31
- data['snapshotSet'].each do |snapshot|
32
- snapshots << new(snapshot)
33
- end
26
+ load(data['snapshotSet'])
34
27
  if volume
35
- snapshots = snapshots.select {|snapshot| snapshot.volume_id == volume.id}
28
+ self.replace(self.select {|snapshot| snapshot.volume_id == volume.id})
36
29
  end
37
- self.replace(snapshots)
30
+ self
38
31
  end
39
32
 
40
33
  def get(snapshot_id)
@@ -22,19 +22,11 @@ module Fog
22
22
 
23
23
  def all(volume_id = @volume_id)
24
24
  @volume_id = volume_id
25
- if @loaded
26
- clear
27
- end
28
- @loaded = true
29
25
  data = connection.describe_volumes(volume_id).body
30
- volumes = []
31
- data['volumeSet'].each do |volume|
32
- volumes << new(volume)
33
- end
26
+ load(data['volumeSet'])
34
27
  if server
35
- volumes = volumes.select {|volume| volume.server_id == server.id}
28
+ self.replace(self.select {|volume| volume.server_id == server.id})
36
29
  end
37
- self.replace(volumes)
38
30
  end
39
31
 
40
32
  def get(volume_id)
@@ -11,15 +11,8 @@ module Fog
11
11
  model Fog::AWS::S3::Directory
12
12
 
13
13
  def all
14
- if @loaded
15
- clear
16
- end
17
- @loaded = true
18
- data = connection.get_service.body
19
- data['Buckets'].each do |directory|
20
- self << new(directory)
21
- end
22
- self
14
+ data = connection.get_service.body['Buckets']
15
+ load(data)
23
16
  end
24
17
 
25
18
  def get(name, options = {})
@@ -14,16 +14,12 @@ module Fog
14
14
 
15
15
  def all(options = {})
16
16
  merge_attributes(options)
17
- if @loaded
18
- clear
19
- end
20
- @loaded = true
21
17
  collection = directory.collection.get(
22
18
  directory.name,
23
19
  options
24
20
  )
25
21
  if collection
26
- self.replace(collection.files)
22
+ load(collection.files {|file| file.attributes})
27
23
  else
28
24
  nil
29
25
  end
@@ -167,4 +167,4 @@ DATA
167
167
  end
168
168
  end
169
169
 
170
- Fog::AWS::S3.dependencies.each {|dependency| require(dependency)}
170
+ Fog::AWS::S3.reload
@@ -156,4 +156,4 @@ module Fog
156
156
  end
157
157
  end
158
158
 
159
- Fog::AWS::SimpleDB.dependencies.each {|dependency| require(dependency)}
159
+ Fog::AWS::SimpleDB.reload
@@ -101,9 +101,15 @@ module Fog
101
101
  data
102
102
  end
103
103
 
104
- def load(array)
104
+ def load(objects)
105
+ if @loaded
106
+ clear
107
+ end
105
108
  @loaded = true
106
- self.clear.concat(array)
109
+ for object in objects
110
+ self << new(object)
111
+ end
112
+ self
107
113
  end
108
114
 
109
115
  def model
@@ -58,4 +58,4 @@ module Fog
58
58
  end
59
59
  end
60
60
 
61
- Fog::Rackspace.dependencies.each {|dependency| require(dependency)}
61
+ Fog::Rackspace.reload
@@ -105,4 +105,4 @@ module Fog
105
105
  end
106
106
  end
107
107
 
108
- Fog::Rackspace::Files.dependencies.each {|dependency| require(dependency)}
108
+ Fog::Rackspace::Files.reload
@@ -11,15 +11,8 @@ module Fog
11
11
  model Fog::Rackspace::Files::Directory
12
12
 
13
13
  def all
14
- if @loaded
15
- clear
16
- end
17
- @loaded = true
18
14
  data = connection.get_containers.body
19
- data.each do |directory|
20
- self << new(directory)
21
- end
22
- self
15
+ load(data)
23
16
  end
24
17
 
25
18
  def get(name, options = {})
@@ -13,16 +13,12 @@ module Fog
13
13
 
14
14
  def all(options = {})
15
15
  merge_attributes(options)
16
- if @loaded
17
- clear
18
- end
19
- @loaded = true
20
16
  collection = directory.collection.get(
21
17
  directory.name,
22
18
  options
23
19
  )
24
20
  if collection
25
- self.replace(collection.files)
21
+ load(collection.files.map {|file| file.attributes})
26
22
  else
27
23
  nil
28
24
  end
@@ -11,15 +11,8 @@ module Fog
11
11
  model Fog::Rackspace::Servers::Flavor
12
12
 
13
13
  def all
14
- if @loaded
15
- clear
16
- end
17
- @loaded = true
18
- data = connection.list_flavors_detail.body
19
- for flavor in data['flavors']
20
- self << new(flavor)
21
- end
22
- self
14
+ data = connection.list_flavors_detail.body['flavors']
15
+ load(data)
23
16
  end
24
17
 
25
18
  def get(flavor_id)
@@ -15,19 +15,11 @@ module Fog
15
15
  attribute :server
16
16
 
17
17
  def all
18
- if @loaded
19
- clear
20
- end
21
- @loaded = true
22
- data = connection.list_images_detail.body
23
- images = []
24
- for image in data['images']
25
- images << new(image)
26
- end
18
+ data = connection.list_images_detail.body['images']
19
+ load(images)
27
20
  if server
28
- images = images.select {|image| image.server_id == server.id}
21
+ self.replace(self.select {|image| image.server_id == server.id})
29
22
  end
30
- self.replace(images)
31
23
  end
32
24
 
33
25
  def get(image_id)
@@ -11,15 +11,8 @@ module Fog
11
11
  model Fog::Rackspace::Servers::Server
12
12
 
13
13
  def all
14
- if @loaded
15
- clear
16
- end
17
- @loaded = true
18
- data = connection.list_servers_detail.body
19
- for server in data['servers']
20
- self << new(server)
21
- end
22
- self
14
+ data = connection.list_servers_detail.body['servers']
15
+ load(data)
23
16
  end
24
17
 
25
18
  def get(server_id)
@@ -86,4 +86,4 @@ module Fog
86
86
  end
87
87
  end
88
88
 
89
- Fog::Rackspace::Servers.dependencies.each {|dependency| require(dependency)}
89
+ Fog::Rackspace::Servers.reload
@@ -83,4 +83,4 @@ module Fog
83
83
  end
84
84
  end
85
85
 
86
- Fog::Slicehost.dependencies.each {|dependency| require(dependency)}
86
+ Fog::Slicehost.reload
@@ -10,15 +10,8 @@ module Fog
10
10
  model Fog::Slicehost::Flavor
11
11
 
12
12
  def all
13
- if @loaded
14
- clear
15
- end
16
- @loaded = true
17
- data = connection.get_flavors.body
18
- for flavor in data['flavors']
19
- self << new(flavor)
20
- end
21
- self
13
+ data = connection.get_flavors.body['flavors']
14
+ load(self)
22
15
  end
23
16
 
24
17
  def get(flavor_id)
@@ -12,15 +12,8 @@ module Fog
12
12
  model Fog::Slicehost::Image
13
13
 
14
14
  def all
15
- if @loaded
16
- clear
17
- end
18
- @loaded = true
19
- data = connection.get_images.body
20
- for image in data['images']
21
- self << new(image)
22
- end
23
- self
15
+ data = connection.get_images.body['images']
16
+ load(data)
24
17
  end
25
18
 
26
19
  def get(image_id)
@@ -10,15 +10,8 @@ module Fog
10
10
  model Fog::Slicehost::Server
11
11
 
12
12
  def all
13
- if @loaded
14
- clear
15
- end
16
- @loaded = true
17
13
  data = connection.get_slices.body['slices']
18
- for server in data
19
- self << new(server)
20
- end
21
- self
14
+ load(data)
22
15
  end
23
16
 
24
17
  def get(server_id)
@@ -68,4 +68,4 @@ module Fog
68
68
  end
69
69
  end
70
70
 
71
- Fog::Terremark.dependencies.each {|dependency| require(dependency)}
71
+ Fog::Terremark.reload
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 47
9
- version: 0.0.47
8
+ - 48
9
+ version: 0.0.48
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-03-03 00:00:00 -08:00
17
+ date: 2010-03-08 00:00:00 -08:00
18
18
  default_executable: fog
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -425,40 +425,7 @@ has_rdoc: true
425
425
  homepage: http://github.com/geemus/fog
426
426
  licenses: []
427
427
 
428
- post_install_message: |
429
- ==================================================
430
-
431
- fog 0.0.41 has a minor change to the API for ec2 servers:
432
-
433
- # what_it_was => what_it_is
434
-
435
- ec2.servers.new(:group_id => 'foo') => ec2.servers.new(:groups => ['foo'])
436
-
437
- Updating to the newest api version also means you can now assign multiple groups:
438
-
439
- ec2.servers.new(:groups => ['foo', 'bar'])
440
-
441
- ==================================================
442
-
443
- fog 0.0.40 has API changes you should know about.
444
-
445
- Some changes you might care about happened in the models:
446
-
447
- # what_it_was => what_it_is
448
-
449
- ec2.instances => ec2.servers
450
- ec2.instance => ec2.server
451
-
452
- s3.buckets => s3.directories
453
- s3.bucket => s3.directory
454
-
455
- s3.objects => s3.files
456
- s3.object => s3.file
457
-
458
- Sorry for the bother, but it will allow for a more consistent API as fog continues to expand.
459
-
460
- ==================================================
461
-
428
+ post_install_message:
462
429
  rdoc_options:
463
430
  - --charset=UTF-8
464
431
  require_paths: