fog 0.0.40 → 0.0.41

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. data/README.rdoc +2 -0
  2. data/Rakefile +12 -0
  3. data/VERSION +1 -1
  4. data/bin/fog +28 -40
  5. data/fog.gemspec +16 -3
  6. data/lib/fog.rb +27 -3
  7. data/lib/fog/aws/ec2.rb +7 -3
  8. data/lib/fog/aws/models/ec2/security_group.rb +1 -1
  9. data/lib/fog/aws/models/ec2/server.rb +8 -3
  10. data/lib/fog/aws/models/ec2/servers.rb +1 -1
  11. data/lib/fog/aws/parsers/ec2/terminate_instances.rb +10 -10
  12. data/lib/fog/aws/requests/ec2/run_instances.rb +1 -1
  13. data/lib/fog/aws/s3.rb +6 -2
  14. data/lib/fog/rackspace.rb +8 -2
  15. data/lib/fog/slicehost.rb +3 -1
  16. data/spec/aws/models/ec2/address_spec.rb +8 -8
  17. data/spec/aws/models/ec2/addresses_spec.rb +10 -10
  18. data/spec/aws/models/ec2/key_pair_spec.rb +8 -8
  19. data/spec/aws/models/ec2/key_pairs_spec.rb +10 -10
  20. data/spec/aws/models/ec2/security_group_spec.rb +8 -8
  21. data/spec/aws/models/ec2/security_groups_spec.rb +10 -10
  22. data/spec/aws/models/ec2/server_spec.rb +1 -4
  23. data/spec/aws/models/ec2/servers_spec.rb +1 -1
  24. data/spec/aws/models/ec2/snapshot_spec.rb +12 -10
  25. data/spec/aws/models/ec2/snapshots_spec.rb +20 -20
  26. data/spec/aws/models/ec2/volume_spec.rb +10 -10
  27. data/spec/aws/models/ec2/volumes_spec.rb +10 -10
  28. data/spec/aws/models/s3/directories_spec.rb +8 -8
  29. data/spec/aws/models/s3/directory_spec.rb +11 -11
  30. data/spec/aws/models/s3/file_spec.rb +2 -2
  31. data/spec/aws/models/s3/files_spec.rb +2 -2
  32. data/spec/aws/requests/ec2/allocate_address_spec.rb +2 -2
  33. data/spec/aws/requests/ec2/associate_address_spec.rb +15 -13
  34. data/spec/aws/requests/ec2/attach_volume_spec.rb +12 -12
  35. data/spec/aws/requests/ec2/authorize_security_group_ingress_spec.rb +3 -3
  36. data/spec/aws/requests/ec2/create_key_pair_spec.rb +5 -5
  37. data/spec/aws/requests/ec2/create_security_group_spec.rb +5 -5
  38. data/spec/aws/requests/ec2/create_snapshot_spec.rb +5 -5
  39. data/spec/aws/requests/ec2/create_volume_spec.rb +2 -2
  40. data/spec/aws/requests/ec2/delete_key_pair_spec.rb +3 -3
  41. data/spec/aws/requests/ec2/delete_security_group_spec.rb +3 -3
  42. data/spec/aws/requests/ec2/delete_snapshot_spec.rb +5 -5
  43. data/spec/aws/requests/ec2/delete_volume_spec.rb +3 -3
  44. data/spec/aws/requests/ec2/describe_addresses_spec.rb +5 -5
  45. data/spec/aws/requests/ec2/describe_availability_zones_spec.rb +2 -2
  46. data/spec/aws/requests/ec2/describe_images_spec.rb +2 -2
  47. data/spec/aws/requests/ec2/describe_instances_spec.rb +5 -5
  48. data/spec/aws/requests/ec2/describe_key_pairs_spec.rb +5 -5
  49. data/spec/aws/requests/ec2/describe_regions_spec.rb +2 -2
  50. data/spec/aws/requests/ec2/describe_security_groups_spec.rb +5 -5
  51. data/spec/aws/requests/ec2/describe_snapshots_spec.rb +7 -7
  52. data/spec/aws/requests/ec2/describe_volumes_spec.rb +5 -5
  53. data/spec/aws/requests/ec2/detach_volume_spec.rb +7 -7
  54. data/spec/aws/requests/ec2/disassociate_address_spec.rb +9 -7
  55. data/spec/aws/requests/ec2/get_console_output_spec.rb +4 -4
  56. data/spec/aws/requests/ec2/reboot_instances_spec.rb +4 -4
  57. data/spec/aws/requests/ec2/release_address_spec.rb +3 -3
  58. data/spec/aws/requests/ec2/revoke_security_group_ingress_spec.rb +4 -4
  59. data/spec/aws/requests/ec2/run_instances_spec.rb +2 -2
  60. data/spec/aws/requests/ec2/terminate_instances_spec.rb +7 -7
  61. data/spec/aws/requests/s3/copy_object_spec.rb +11 -11
  62. data/spec/aws/requests/s3/delete_bucket_spec.rb +8 -8
  63. data/spec/aws/requests/s3/delete_object_spec.rb +8 -8
  64. data/spec/aws/requests/s3/get_bucket_location_spec.rb +4 -4
  65. data/spec/aws/requests/s3/get_bucket_spec.rb +12 -12
  66. data/spec/aws/requests/s3/get_object_spec.rb +9 -9
  67. data/spec/aws/requests/s3/get_request_payment_spec.rb +4 -4
  68. data/spec/aws/requests/s3/get_service_spec.rb +4 -4
  69. data/spec/aws/requests/s3/head_object_spec.rb +5 -5
  70. data/spec/aws/requests/s3/put_bucket_spec.rb +3 -3
  71. data/spec/aws/requests/s3/put_object_spec.rb +11 -11
  72. data/spec/aws/requests/s3/put_request_payment_spec.rb +4 -4
  73. data/spec/aws/requests/simpledb/batch_put_attributes_spec.rb +4 -4
  74. data/spec/aws/requests/simpledb/create_domain_spec.rb +4 -4
  75. data/spec/aws/requests/simpledb/delete_attributes_spec.rb +8 -8
  76. data/spec/aws/requests/simpledb/delete_domain_spec.rb +3 -3
  77. data/spec/aws/requests/simpledb/domain_metadata_spec.rb +6 -6
  78. data/spec/aws/requests/simpledb/get_attributes_spec.rb +9 -9
  79. data/spec/aws/requests/simpledb/list_domains_spec.rb +4 -4
  80. data/spec/aws/requests/simpledb/put_attributes_spec.rb +4 -4
  81. data/spec/compact_progress_bar_formatter.rb +195 -0
  82. data/spec/rackspace/models/servers/server_spec.rb +1 -1
  83. data/spec/rackspace/requests/files/delete_container_spec.rb +3 -3
  84. data/spec/rackspace/requests/files/delete_object_spec.rb +8 -8
  85. data/spec/rackspace/requests/files/get_container_spec.rb +6 -6
  86. data/spec/rackspace/requests/files/get_containers_spec.rb +3 -3
  87. data/spec/rackspace/requests/files/head_container_spec.rb +6 -6
  88. data/spec/rackspace/requests/files/head_containers_spec.rb +3 -3
  89. data/spec/rackspace/requests/files/put_container_spec.rb +2 -2
  90. data/spec/rackspace/requests/files/put_object_spec.rb +4 -4
  91. data/spec/rackspace/requests/servers/create_image_spec.rb +4 -4
  92. data/spec/rackspace/requests/servers/create_server_spec.rb +2 -2
  93. data/spec/rackspace/requests/servers/delete_image_spec.rb +5 -5
  94. data/spec/rackspace/requests/servers/delete_server_spec.rb +3 -3
  95. data/spec/rackspace/requests/servers/get_flavor_details_spec.rb +1 -1
  96. data/spec/rackspace/requests/servers/get_server_details_spec.rb +4 -4
  97. data/spec/rackspace/requests/servers/list_addresses_spec.rb +4 -4
  98. data/spec/rackspace/requests/servers/list_flavors_detail_spec.rb +1 -1
  99. data/spec/rackspace/requests/servers/list_flavors_spec.rb +1 -1
  100. data/spec/rackspace/requests/servers/list_images_detail_spec.rb +1 -1
  101. data/spec/rackspace/requests/servers/list_images_spec.rb +1 -1
  102. data/spec/rackspace/requests/servers/list_private_addresses_spec.rb +4 -4
  103. data/spec/rackspace/requests/servers/list_public_addresses_spec.rb +4 -4
  104. data/spec/rackspace/requests/servers/list_servers_detail_spec.rb +3 -3
  105. data/spec/rackspace/requests/servers/list_servers_spec.rb +3 -3
  106. data/spec/rackspace/requests/servers/reboot_server_spec.rb +4 -4
  107. data/spec/rackspace/requests/servers/update_server_spec.rb +4 -4
  108. data/spec/slicehost/requests/create_slice_spec.rb +2 -2
  109. data/spec/slicehost/requests/delete_slice_spec.rb +2 -2
  110. data/spec/slicehost/requests/get_backups_spec.rb +1 -1
  111. data/spec/slicehost/requests/get_flavors_spec.rb +1 -1
  112. data/spec/slicehost/requests/get_images_spec.rb +1 -1
  113. data/spec/slicehost/requests/get_slices_spec.rb +1 -1
  114. data/spec/spec_helper.rb +60 -38
  115. metadata +16 -3
  116. data/spec/spec.opts +0 -1
@@ -5,13 +5,13 @@ describe 'Slicehost.create_slice' do
5
5
 
6
6
  after(:each) do
7
7
  eventually(128) do
8
- slicehost.delete_slice(@slice_id)
8
+ Slicehost[:slices].delete_slice(@slice_id)
9
9
  end
10
10
  end
11
11
 
12
12
  it "should return proper attributes" do
13
13
  # flavor_id 1: 256 ram, image_id 3: Gentoo 2008.0
14
- actual = slicehost.create_slice(1, 3, 'fog_create_slice').body
14
+ actual = Slicehost[:slices].create_slice(1, 3, 'fog_create_slice').body
15
15
  actual['addresses'].should be_a(Array)
16
16
  # actual['backup-id'].should be_an(Integer)
17
17
  actual['bw-in'].should be_an(Float)
@@ -5,12 +5,12 @@ describe 'Slicehost.delete_slice' do
5
5
 
6
6
  before(:each) do
7
7
  # flavor_id 1: 256 ram, image_id 3: Gentoo 2008.0
8
- @slice_id = slicehost.create_slice(1, 3, 'fog_delete_slice').body['id']
8
+ @slice_id = Slicehost[:slices].create_slice(1, 3, 'fog_delete_slice').body['id']
9
9
  end
10
10
 
11
11
  it "should return proper attributes" do
12
12
  eventually(128) do
13
- actual = slicehost.delete_slice(@slice_id)
13
+ actual = Slicehost[:slices].delete_slice(@slice_id)
14
14
  end
15
15
  end
16
16
 
@@ -4,7 +4,7 @@ describe 'Slicehost.get_backups' do
4
4
  describe 'success' do
5
5
 
6
6
  it "should return proper attributes" do
7
- actual = slicehost.get_backups.body
7
+ actual = Slicehost[:slices].get_backups.body
8
8
  actual['backups'].should be_an(Array)
9
9
  backup = actual['backups'].first
10
10
  # backup['date'].should be_a(String)
@@ -4,7 +4,7 @@ describe 'Slicehost.get_flavors' do
4
4
  describe 'success' do
5
5
 
6
6
  it "should return proper attributes" do
7
- actual = slicehost.get_flavors.body
7
+ actual = Slicehost[:slices].get_flavors.body
8
8
  actual['flavors'].should be_an(Array)
9
9
  flavor = actual['flavors'].first
10
10
  flavor['id'].should be_an(Integer)
@@ -4,7 +4,7 @@ describe 'Slicehost.get_images' do
4
4
  describe 'success' do
5
5
 
6
6
  it "should return proper attributes" do
7
- actual = slicehost.get_images.body
7
+ actual = Slicehost[:slices].get_images.body
8
8
  actual['images'].should be_an(Array)
9
9
  image = actual['images'].first
10
10
  image['id'].should be_an(Integer)
@@ -4,7 +4,7 @@ describe 'Slicehost.get_slices' do
4
4
  describe 'success' do
5
5
 
6
6
  it "should return proper attributes" do
7
- actual = slicehost.get_slices.body
7
+ actual = Slicehost[:slices].get_slices.body
8
8
  actual['slices'].should be_an(Array)
9
9
  slice = actual['slices'].first
10
10
  # slice['addresses'].should be_a(Array)
@@ -5,54 +5,76 @@ current_directory = File.dirname(__FILE__)
5
5
  require "#{current_directory}/../lib/fog"
6
6
  # Fog.mock!
7
7
 
8
- def ec2
9
- Fog::AWS::EC2.new(
10
- :aws_access_key_id => Fog.credentials[:aws_access_key_id],
11
- :aws_secret_access_key => Fog.credentials[:aws_secret_access_key]
12
- )
8
+ unless defined?(LOADED_SPEC_OPTS)
9
+ # inlined spec.opts
10
+ require "#{current_directory}/compact_progress_bar_formatter"
11
+ Spec::Runner.options.parse_format("Spec::Runner::Formatter::CompactProgressBarFormatter")
12
+ Spec::Runner.options.loadby = 'mtime'
13
+ Spec::Runner.options.reverse = true
14
+ LOADED_SPEC_OPTS = true
13
15
  end
14
16
 
15
- def eu_s3
16
- Fog::AWS::S3.new(
17
- :aws_access_key_id => Fog.credentials[:aws_access_key_id],
18
- :aws_secret_access_key => Fog.credentials[:aws_secret_access_key],
19
- :host => 's3-external-3.amazonaws.com'
20
- )
21
- end
22
17
 
23
- def files
24
- Fog::Rackspace::Files.new(
25
- :rackspace_api_key => Fog.credentials[:rackspace_api_key],
26
- :rackspace_username => Fog.credentials[:rackspace_username]
27
- )
18
+ module AWS
19
+ class << self
20
+ def [](service)
21
+ @@connections ||= Hash.new do |hash, key|
22
+ credentials = Fog.credentials.reject do |k, v|
23
+ ![:aws_access_key_id, :aws_secret_access_key].include?(k)
24
+ end
25
+ hash[key] = case key
26
+ when :ec2
27
+ Fog::AWS::EC2.new(credentials)
28
+ when :eu_s3
29
+ Fog::AWS::S3.new(credentials.merge!(:host => 's3-external-3.amazonaws.com'))
30
+ when :sdb
31
+ Fog::AWS::SimpleDB.new(credentials)
32
+ when :s3
33
+ Fog::AWS::S3.new(credentials)
34
+ end
35
+ end
36
+ @@connections[service]
37
+ end
38
+ end
28
39
  end
29
40
 
30
- def sdb
31
- Fog::AWS::SimpleDB.new(
32
- :aws_access_key_id => Fog.credentials[:aws_access_key_id],
33
- :aws_secret_access_key => Fog.credentials[:aws_secret_access_key]
34
- )
41
+ module Rackspace
42
+ class << self
43
+ def [](service)
44
+ @@connections ||= Hash.new do |hash, key|
45
+ credentials = Fog.credentials.reject do |k, v|
46
+ ![:rackspace_api_key, :rackspace_username].include?(k)
47
+ end
48
+ hash[key] = case key
49
+ when :files
50
+ Fog::Rackspace::Files.new(credentials)
51
+ when :servers
52
+ Fog::Rackspace::Servers.new(credentials)
53
+ end
54
+ end
55
+ @@connections[service]
56
+ end
57
+ end
35
58
  end
36
59
 
37
- def s3
38
- Fog::AWS::S3.new(
39
- :aws_access_key_id => Fog.credentials[:aws_access_key_id],
40
- :aws_secret_access_key => Fog.credentials[:aws_secret_access_key]
41
- )
60
+ module Slicehost
61
+ class << self
62
+ def [](service)
63
+ @@connections ||= Hash.new do |hash, key|
64
+ credentials = Fog.credentials.reject do |k, v|
65
+ ![:slicehost_password].include?(k)
66
+ end
67
+ hash[key] = case key
68
+ when :slices
69
+ Fog::Slicehost.new(credentials)
70
+ end
71
+ end
72
+ @@connections[service]
73
+ end
74
+ end
42
75
  end
43
76
 
44
- def servers
45
- Fog::Rackspace::Servers.new(
46
- :rackspace_api_key => Fog.credentials[:rackspace_api_key],
47
- :rackspace_username => Fog.credentials[:rackspace_username]
48
- )
49
- end
50
77
 
51
- def slicehost
52
- Fog::Slicehost.new(
53
- :password => Fog.credentials[:slicehost_password]
54
- )
55
- end
56
78
 
57
79
  def eventually(max_delay = 16, &block)
58
80
  delays = [0]
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.40
4
+ version: 0.0.41
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: 2010-01-14 00:00:00 -08:00
12
+ date: 2010-01-25 00:00:00 -08:00
13
13
  default_executable: fog
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -291,6 +291,7 @@ files:
291
291
  - spec/aws/requests/simpledb/list_domains_spec.rb
292
292
  - spec/aws/requests/simpledb/put_attributes_spec.rb
293
293
  - spec/aws/requests/simpledb/select_spec.rb
294
+ - spec/compact_progress_bar_formatter.rb
294
295
  - spec/lorem.txt
295
296
  - spec/rackspace/models/servers/server_spec.rb
296
297
  - spec/rackspace/requests/files/delete_container_spec.rb
@@ -325,13 +326,24 @@ files:
325
326
  - spec/slicehost/requests/get_flavors_spec.rb
326
327
  - spec/slicehost/requests/get_images_spec.rb
327
328
  - spec/slicehost/requests/get_slices_spec.rb
328
- - spec/spec.opts
329
329
  - spec/spec_helper.rb
330
330
  has_rdoc: true
331
331
  homepage: http://github.com/geemus/fog
332
332
  licenses: []
333
333
 
334
334
  post_install_message: |
335
+ ==================================================
336
+
337
+ fog 0.0.41 has a minor change to the API for ec2 servers:
338
+
339
+ # what_it_was => what_it_is
340
+
341
+ ec2.servers.new(:group_id => 'foo') => ec2.servers.new(:groups => ['foo'])
342
+
343
+ Updating to the newest api version also means you can now assign multiple groups:
344
+
345
+ ec2.servers.new(:groups => ['foo', 'bar'])
346
+
335
347
  ==================================================
336
348
 
337
349
  fog 0.0.40 has API changes you should know about.
@@ -443,6 +455,7 @@ test_files:
443
455
  - spec/aws/requests/simpledb/list_domains_spec.rb
444
456
  - spec/aws/requests/simpledb/put_attributes_spec.rb
445
457
  - spec/aws/requests/simpledb/select_spec.rb
458
+ - spec/compact_progress_bar_formatter.rb
446
459
  - spec/rackspace/models/servers/server_spec.rb
447
460
  - spec/rackspace/requests/files/delete_container_spec.rb
448
461
  - spec/rackspace/requests/files/delete_object_spec.rb
@@ -1 +0,0 @@
1
- --colour