fog 0.0.39 → 0.0.40

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. data/README.rdoc +88 -31
  2. data/Rakefile +25 -2
  3. data/VERSION +1 -1
  4. data/bin/fog +57 -43
  5. data/fog.gemspec +52 -23
  6. data/lib/fog.rb +7 -4
  7. data/lib/fog/aws/ec2.rb +6 -2
  8. data/lib/fog/aws/models/ec2/address.rb +13 -13
  9. data/lib/fog/aws/models/ec2/addresses.rb +5 -5
  10. data/lib/fog/aws/models/ec2/flavor.rb +19 -0
  11. data/lib/fog/aws/models/ec2/flavors.rb +43 -0
  12. data/lib/fog/aws/models/ec2/image.rb +24 -0
  13. data/lib/fog/aws/models/ec2/images.rb +44 -0
  14. data/lib/fog/aws/models/ec2/{instance.rb → server.rb} +22 -10
  15. data/lib/fog/aws/models/ec2/{instances.rb → servers.rb} +12 -12
  16. data/lib/fog/aws/models/ec2/snapshot.rb +2 -2
  17. data/lib/fog/aws/models/ec2/volume.rb +17 -17
  18. data/lib/fog/aws/models/ec2/volumes.rb +5 -5
  19. data/lib/fog/aws/models/s3/{buckets.rb → directories.rb} +16 -13
  20. data/lib/fog/aws/models/s3/{bucket.rb → directory.rb} +5 -10
  21. data/lib/fog/aws/models/s3/{object.rb → file.rb} +16 -18
  22. data/lib/fog/aws/models/s3/{objects.rb → files.rb} +19 -19
  23. data/lib/fog/aws/requests/ec2/run_instances.rb +1 -1
  24. data/lib/fog/aws/s3.rb +6 -6
  25. data/lib/fog/rackspace/files.rb +6 -3
  26. data/lib/fog/rackspace/models/servers/flavor.rb +26 -1
  27. data/lib/fog/rackspace/models/servers/image.rb +3 -3
  28. data/lib/fog/rackspace/models/servers/server.rb +20 -9
  29. data/lib/fog/rackspace/models/servers/servers.rb +3 -1
  30. data/lib/fog/rackspace/servers.rb +2 -1
  31. data/spec/aws/models/ec2/address_spec.rb +8 -8
  32. data/spec/aws/models/ec2/server_spec.rb +109 -0
  33. data/spec/aws/models/ec2/servers_spec.rb +52 -0
  34. data/spec/aws/models/ec2/snapshot_spec.rb +2 -1
  35. data/spec/aws/models/ec2/volume_spec.rb +22 -22
  36. data/spec/aws/models/s3/directories_spec.rb +49 -0
  37. data/spec/aws/models/s3/directory_spec.rb +112 -0
  38. data/spec/aws/models/s3/file_spec.rb +106 -0
  39. data/spec/aws/models/s3/files_spec.rb +116 -0
  40. data/spec/rackspace/models/servers/server_spec.rb +51 -0
  41. data/spec/shared_examples/server_examples.rb +42 -0
  42. data/spec/spec_helper.rb +1 -1
  43. metadata +51 -22
  44. data/spec/aws/models/ec2/instance_spec.rb +0 -161
  45. data/spec/aws/models/ec2/instances_spec.rb +0 -70
  46. data/spec/aws/models/s3/bucket_spec.rb +0 -129
  47. data/spec/aws/models/s3/buckets_spec.rb +0 -70
  48. data/spec/aws/models/s3/object_spec.rb +0 -121
  49. data/spec/aws/models/s3/objects_spec.rb +0 -141
@@ -1,141 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../../spec_helper'
2
-
3
- describe 'Fog::AWS::S3::Objects' do
4
-
5
- before(:each) do
6
- @bucket = s3.buckets.create(:name => 'fogbucketname')
7
- end
8
-
9
- after(:each) do
10
- @bucket.destroy
11
- end
12
-
13
- describe "#initialize" do
14
-
15
- it "should remap attributes from parser" do
16
- objects = Fog::AWS::S3::Objects.new(
17
- 'IsTruncated' => true,
18
- 'Marker' => 'marker',
19
- 'MaxKeys' => 1,
20
- 'Prefix' => 'prefix'
21
- )
22
- objects.is_truncated.should == true
23
- objects.marker.should == 'marker'
24
- objects.max_keys.should == 1
25
- objects.prefix.should == 'prefix'
26
- end
27
-
28
- end
29
-
30
- describe "#all" do
31
-
32
- it "should return a Fog::AWS::S3::Objects" do
33
- @bucket.objects.all.should be_a(Fog::AWS::S3::Objects)
34
- end
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
40
- end
41
-
42
- describe "#bucket" do
43
-
44
- it "should return a Fog::AWS::S3::Bucket" do
45
- @bucket.objects.bucket.should be_a(Fog::AWS::S3::Bucket)
46
- end
47
-
48
- it "should be the bucket the objects are related to" do
49
- @bucket.objects.bucket.should == @bucket
50
- end
51
- end
52
-
53
- describe "#create" do
54
-
55
- it "should return a Fog::AWS::S3::Object" do
56
- file = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r')
57
- object = @bucket.objects.create(:key => 'fogobjectname', :body => file)
58
- object.should be_a(Fog::AWS::S3::Object)
59
- object.destroy
60
- end
61
-
62
- it "should exist on s3" do
63
- file = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r')
64
- object = @bucket.objects.create(:key => 'fogobjectname', :body => file)
65
- @bucket.objects.get('fogobjectname').should_not be_nil
66
- object.destroy
67
- end
68
-
69
- end
70
-
71
- describe "#get" do
72
-
73
- it "should return a Fog::AWS::S3::Object with metadata and data" do
74
- file = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r')
75
- object = @bucket.objects.create(:key => 'fogobjectname', :body => file)
76
- object = @bucket.objects.get('fogobjectname')
77
- object.body.should_not be_nil
78
- object.content_length.should_not be_nil
79
- object.etag.should_not be_nil
80
- object.last_modified.should_not be_nil
81
- object.destroy
82
- end
83
-
84
- it "should return chunked data if given a block" do
85
- file = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r')
86
- object = @bucket.objects.create(:key => 'fogobjectname', :body => file)
87
- data = ''
88
- @bucket.objects.get('fogobjectname') do |chunk|
89
- data << chunk
90
- end
91
- data.should == File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r').read
92
- object.destroy
93
- end
94
-
95
- end
96
-
97
- describe "#get_url" do
98
-
99
- it "should return a signed expiring url" do
100
- file = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r')
101
- object = @bucket.objects.create(:key => 'fogobjectname', :body => file)
102
- url = @bucket.objects.get_url('fogobjectname', Time.now + 60 * 10)
103
- unless Fog.mocking?
104
- open(url).read.should == File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r').read
105
- end
106
- object.destroy
107
- end
108
-
109
- end
110
-
111
- describe "#head" do
112
-
113
- it "should return a Fog::AWS::S3::Object with metadata" do
114
- file = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r')
115
- object = @bucket.objects.create(:key => 'fogobjectname', :body => file)
116
- object = @bucket.objects.get('fogobjectname')
117
- object.content_length.should_not be_nil
118
- object.etag.should_not be_nil
119
- object.last_modified.should_not be_nil
120
- object.destroy
121
- end
122
-
123
- end
124
-
125
- describe "#new" do
126
-
127
- it "should return a Fog::AWS::S3::Object" do
128
- @bucket.objects.new.should be_a(Fog::AWS::S3::Object)
129
- end
130
-
131
- end
132
-
133
- describe "#reload" do
134
-
135
- it "should reload from s3" do
136
- @bucket.objects.reload.should == @bucket.objects
137
- end
138
-
139
- end
140
-
141
- end