fog 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -1
- data/changelog.txt +11 -0
- data/fog.gemspec +5 -5
- data/lib/fog.rb +1 -1
- data/lib/fog/aws/simpledb.rb +4 -4
- data/lib/fog/cdn/aws.rb +1 -1
- data/lib/fog/cdn/rackspace.rb +1 -1
- data/lib/fog/compute/aws.rb +1 -1
- data/lib/fog/compute/bluebox.rb +1 -1
- data/lib/fog/compute/go_grid.rb +1 -1
- data/lib/fog/compute/linode.rb +1 -1
- data/lib/fog/compute/new_servers.rb +1 -1
- data/lib/fog/compute/rackspace.rb +5 -3
- data/lib/fog/compute/slicehost.rb +1 -1
- data/lib/fog/compute/voxel.rb +1 -1
- data/lib/fog/core/credentials.rb +1 -0
- data/lib/fog/dns/aws.rb +1 -1
- data/lib/fog/dns/bluebox.rb +1 -1
- data/lib/fog/dns/linode.rb +1 -1
- data/lib/fog/dns/slicehost.rb +1 -1
- data/lib/fog/dns/zerigo.rb +1 -1
- data/lib/fog/storage.rb +20 -9
- data/lib/fog/storage/aws.rb +1 -1
- data/lib/fog/storage/google.rb +1 -1
- data/lib/fog/storage/local.rb +1 -1
- data/lib/fog/storage/models/aws/file.rb +3 -5
- data/lib/fog/storage/models/aws/files.rb +7 -0
- data/lib/fog/storage/rackspace.rb +4 -3
- metadata +13 -14
- data/Gemfile.lock +0 -42
data/.gitignore
CHANGED
data/changelog.txt
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
0.7.1 03/21/2011
|
2
|
+
================
|
3
|
+
|
4
|
+
[aws|storage] normalize headers. thanks pweldon
|
5
|
+
|
6
|
+
[mock] fix reset_data to not be called in Mock#initialize
|
7
|
+
|
8
|
+
[rackspace] add support for using servicenet. thanks minter
|
9
|
+
|
10
|
+
[storage] provide for non file/string files. thanks pweldon
|
11
|
+
|
1
12
|
0.7.0 03/14/2011
|
2
13
|
================
|
3
14
|
|
data/fog.gemspec
CHANGED
@@ -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.7.
|
11
|
-
s.date = '2011-03-
|
10
|
+
s.version = '0.7.1'
|
11
|
+
s.date = '2011-03-21'
|
12
12
|
s.rubyforge_project = 'fog'
|
13
13
|
|
14
14
|
## Make sure your summary is short. The description may be as long
|
@@ -43,8 +43,8 @@ Gem::Specification.new do |s|
|
|
43
43
|
## List your runtime dependencies here. Runtime dependencies are those
|
44
44
|
## that are needed for an end user to actually USE your code.
|
45
45
|
s.add_dependency('builder')
|
46
|
-
s.add_dependency('excon', '>=0.5.
|
47
|
-
s.add_dependency('formatador', '>=0.1.
|
46
|
+
s.add_dependency('excon', '>=0.5.7')
|
47
|
+
s.add_dependency('formatador', '>=0.1.2')
|
48
48
|
s.add_dependency('json')
|
49
49
|
s.add_dependency('mime-types')
|
50
50
|
s.add_dependency('net-ssh', '>=2.0.23')
|
@@ -55,7 +55,7 @@ Gem::Specification.new do |s|
|
|
55
55
|
## those that are only needed during development
|
56
56
|
s.add_development_dependency('rake')
|
57
57
|
s.add_development_dependency('rspec', '1.3.1')
|
58
|
-
s.add_development_dependency('shindo', '0.3.
|
58
|
+
s.add_development_dependency('shindo', '0.3.4')
|
59
59
|
s.add_development_dependency('virtualbox', '0.8.3')
|
60
60
|
|
61
61
|
s.files = `git ls-files`.split("\n")
|
data/lib/fog.rb
CHANGED
data/lib/fog/aws/simpledb.rb
CHANGED
@@ -4,7 +4,7 @@ module Fog
|
|
4
4
|
|
5
5
|
requires :aws_access_key_id, :aws_secret_access_key
|
6
6
|
recognizes :host, :nil_string, :path, :port, :scheme, :persistent
|
7
|
-
|
7
|
+
|
8
8
|
request_path 'fog/aws/requests/simpledb'
|
9
9
|
request :batch_put_attributes
|
10
10
|
request :create_domain
|
@@ -28,7 +28,7 @@ module Fog
|
|
28
28
|
|
29
29
|
def initialize(options={})
|
30
30
|
@aws_access_key_id = options[:aws_access_key_id]
|
31
|
-
|
31
|
+
@data = self.class.data[@aws_access_key_id]
|
32
32
|
end
|
33
33
|
|
34
34
|
def reset_data
|
@@ -43,7 +43,7 @@ module Fog
|
|
43
43
|
# Initialize connection to SimpleDB
|
44
44
|
#
|
45
45
|
# ==== Notes
|
46
|
-
# options parameter must include values for :aws_access_key_id and
|
46
|
+
# options parameter must include values for :aws_access_key_id and
|
47
47
|
# :aws_secret_access_key in order to create a connection
|
48
48
|
#
|
49
49
|
# ==== Examples
|
@@ -164,7 +164,7 @@ module Fog
|
|
164
164
|
response = @connection.request({
|
165
165
|
:body => body,
|
166
166
|
:expects => 200,
|
167
|
-
:headers => { 'Content-Type' => 'application/x-www-form-urlencoded' },
|
167
|
+
:headers => { 'Content-Type' => 'application/x-www-form-urlencoded; charset=utf-8' },
|
168
168
|
:host => @host,
|
169
169
|
:idempotent => idempotent,
|
170
170
|
:method => 'POST',
|
data/lib/fog/cdn/aws.rb
CHANGED
data/lib/fog/cdn/rackspace.rb
CHANGED
data/lib/fog/compute/aws.rb
CHANGED
data/lib/fog/compute/bluebox.rb
CHANGED
data/lib/fog/compute/go_grid.rb
CHANGED
data/lib/fog/compute/linode.rb
CHANGED
@@ -3,7 +3,7 @@ module Fog
|
|
3
3
|
class Compute < Fog::Service
|
4
4
|
|
5
5
|
requires :rackspace_api_key, :rackspace_username
|
6
|
-
recognizes :rackspace_auth_url, :persistent
|
6
|
+
recognizes :rackspace_auth_url, :rackspace_servicenet, :persistent
|
7
7
|
recognizes :provider # remove post deprecation
|
8
8
|
|
9
9
|
model_path 'fog/compute/models/rackspace'
|
@@ -62,7 +62,7 @@ module Fog
|
|
62
62
|
end
|
63
63
|
|
64
64
|
@rackspace_username = options[:rackspace_username]
|
65
|
-
|
65
|
+
@data = self.class.data[@rackspace_username]
|
66
66
|
end
|
67
67
|
|
68
68
|
def reset_data
|
@@ -86,7 +86,9 @@ module Fog
|
|
86
86
|
@rackspace_api_key = options[:rackspace_api_key]
|
87
87
|
@rackspace_username = options[:rackspace_username]
|
88
88
|
@rackspace_auth_url = options[:rackspace_auth_url]
|
89
|
+
@rackspace_servicenet = options[:rackspace_servicenet]
|
89
90
|
authenticate
|
91
|
+
Excon.ssl_verify_peer = false if options[:rackspace_servicenet] == true
|
90
92
|
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", options[:persistent])
|
91
93
|
end
|
92
94
|
|
@@ -137,7 +139,7 @@ module Fog
|
|
137
139
|
credentials = Fog::Rackspace.authenticate(options)
|
138
140
|
@auth_token = credentials['X-Auth-Token']
|
139
141
|
uri = URI.parse(credentials['X-Server-Management-Url'])
|
140
|
-
@host = uri.host
|
142
|
+
@host = @rackspace_servicenet == true ? "snet-#{uri.host}" : uri.host
|
141
143
|
@path = uri.path
|
142
144
|
@port = uri.port
|
143
145
|
@scheme = uri.scheme
|
data/lib/fog/compute/voxel.rb
CHANGED
data/lib/fog/core/credentials.rb
CHANGED
data/lib/fog/dns/aws.rb
CHANGED
data/lib/fog/dns/bluebox.rb
CHANGED
data/lib/fog/dns/linode.rb
CHANGED
data/lib/fog/dns/slicehost.rb
CHANGED
data/lib/fog/dns/zerigo.rb
CHANGED
data/lib/fog/storage.rb
CHANGED
@@ -21,26 +21,37 @@ module Fog
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
+
def self.get_body_size(body)
|
25
|
+
case
|
26
|
+
when body.respond_to?(:bytesize)
|
27
|
+
body.bytesize
|
28
|
+
when body.respond_to?(:size)
|
29
|
+
body.size
|
30
|
+
when body.respond_to?(:stat)
|
31
|
+
body.stat.size
|
32
|
+
else
|
33
|
+
0
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
24
37
|
def self.parse_data(data)
|
25
38
|
metadata = {
|
26
39
|
:body => nil,
|
27
40
|
:headers => {}
|
28
41
|
}
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
42
|
+
|
43
|
+
metadata[:body] = data
|
44
|
+
metadata[:headers]['Content-Length'] = get_body_size(data)
|
45
|
+
|
46
|
+
if data.respond_to?(:path)
|
34
47
|
filename = ::File.basename(data.path)
|
35
48
|
unless (mime_types = MIME::Types.of(filename)).empty?
|
36
49
|
metadata[:headers]['Content-Type'] = mime_types.first.content_type
|
37
50
|
end
|
38
|
-
metadata[:body] = data
|
39
|
-
metadata[:headers]['Content-Length'] = ::File.size(data.path)
|
40
51
|
end
|
41
52
|
# metadata[:headers]['Content-MD5'] = Base64.encode64(Digest::MD5.digest(metadata[:body])).strip
|
42
53
|
metadata
|
43
54
|
end
|
44
|
-
|
55
|
+
|
45
56
|
end
|
46
|
-
end
|
57
|
+
end
|
data/lib/fog/storage/aws.rb
CHANGED
data/lib/fog/storage/google.rb
CHANGED
data/lib/fog/storage/local.rb
CHANGED
@@ -117,12 +117,10 @@ module Fog
|
|
117
117
|
options['x-amz-storage-class'] = storage_class if storage_class
|
118
118
|
|
119
119
|
data = connection.put_object(directory.key, key, body, options)
|
120
|
+
data.headers.delete('Content-Length')
|
121
|
+
data.headers['ETag'].gsub!('"','')
|
120
122
|
merge_attributes(data.headers)
|
121
|
-
|
122
|
-
self.content_length = body.size
|
123
|
-
else
|
124
|
-
self.content_length = ::File.size(body.path)
|
125
|
-
end
|
123
|
+
self.content_length = Fog::Storage.get_body_size(body)
|
126
124
|
true
|
127
125
|
end
|
128
126
|
|
@@ -46,6 +46,7 @@ module Fog
|
|
46
46
|
:body => data.body,
|
47
47
|
:key => key
|
48
48
|
})
|
49
|
+
normalise_headers(file_data)
|
49
50
|
new(file_data)
|
50
51
|
rescue Excon::Errors::NotFound
|
51
52
|
nil
|
@@ -62,6 +63,7 @@ module Fog
|
|
62
63
|
file_data = data.headers.merge({
|
63
64
|
:key => key
|
64
65
|
})
|
66
|
+
normalise_headers(file_data)
|
65
67
|
new(file_data)
|
66
68
|
rescue Excon::Errors::NotFound
|
67
69
|
nil
|
@@ -72,6 +74,11 @@ module Fog
|
|
72
74
|
super({ :directory => directory }.merge!(attributes))
|
73
75
|
end
|
74
76
|
|
77
|
+
def normalise_headers(headers)
|
78
|
+
headers['Last-Modified'] = Time.parse(headers['Last-Modified'])
|
79
|
+
headers['ETag'].gsub!('"','')
|
80
|
+
end
|
81
|
+
|
75
82
|
end
|
76
83
|
|
77
84
|
end
|
@@ -3,7 +3,7 @@ module Fog
|
|
3
3
|
class Storage < Fog::Service
|
4
4
|
|
5
5
|
requires :rackspace_api_key, :rackspace_username
|
6
|
-
recognizes :rackspace_auth_url, :persistent
|
6
|
+
recognizes :rackspace_auth_url, :rackspace_servicenet, :persistent
|
7
7
|
recognizes :provider # remove post deprecation
|
8
8
|
|
9
9
|
model_path 'fog/storage/models/rackspace'
|
@@ -56,7 +56,7 @@ module Fog
|
|
56
56
|
require 'mime/types'
|
57
57
|
@rackspace_api_key = options[:rackspace_api_key]
|
58
58
|
@rackspace_username = options[:rackspace_username]
|
59
|
-
|
59
|
+
@data = self.class.data[@rackspace_username]
|
60
60
|
end
|
61
61
|
|
62
62
|
def reset_data
|
@@ -85,10 +85,11 @@ module Fog
|
|
85
85
|
@auth_token = credentials['X-Auth-Token']
|
86
86
|
|
87
87
|
uri = URI.parse(credentials['X-Storage-Url'])
|
88
|
-
@host = uri.host
|
88
|
+
@host = options[:rackspace_servicenet] == true ? "snet-#{uri.host}" : uri.host
|
89
89
|
@path = uri.path
|
90
90
|
@port = uri.port
|
91
91
|
@scheme = uri.scheme
|
92
|
+
Excon.ssl_verify_peer = false if options[:rackspace_servicenet] == true
|
92
93
|
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", options[:persistent])
|
93
94
|
end
|
94
95
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 7
|
9
|
-
-
|
10
|
-
version: 0.7.
|
9
|
+
- 1
|
10
|
+
version: 0.7.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- geemus (Wesley Beary)
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-03-
|
18
|
+
date: 2011-03-21 00:00:00 -07:00
|
19
19
|
default_executable: fog
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -38,12 +38,12 @@ dependencies:
|
|
38
38
|
requirements:
|
39
39
|
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
hash:
|
41
|
+
hash: 5
|
42
42
|
segments:
|
43
43
|
- 0
|
44
44
|
- 5
|
45
|
-
-
|
46
|
-
version: 0.5.
|
45
|
+
- 7
|
46
|
+
version: 0.5.7
|
47
47
|
name: excon
|
48
48
|
prerelease: false
|
49
49
|
version_requirements: *id002
|
@@ -54,12 +54,12 @@ dependencies:
|
|
54
54
|
requirements:
|
55
55
|
- - ">="
|
56
56
|
- !ruby/object:Gem::Version
|
57
|
-
hash:
|
57
|
+
hash: 31
|
58
58
|
segments:
|
59
59
|
- 0
|
60
60
|
- 1
|
61
|
-
-
|
62
|
-
version: 0.1.
|
61
|
+
- 2
|
62
|
+
version: 0.1.2
|
63
63
|
name: formatador
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: *id003
|
@@ -174,12 +174,12 @@ dependencies:
|
|
174
174
|
requirements:
|
175
175
|
- - "="
|
176
176
|
- !ruby/object:Gem::Version
|
177
|
-
hash:
|
177
|
+
hash: 27
|
178
178
|
segments:
|
179
179
|
- 0
|
180
180
|
- 3
|
181
|
-
-
|
182
|
-
version: 0.3.
|
181
|
+
- 4
|
182
|
+
version: 0.3.4
|
183
183
|
name: shindo
|
184
184
|
prerelease: false
|
185
185
|
version_requirements: *id011
|
@@ -212,7 +212,6 @@ files:
|
|
212
212
|
- .document
|
213
213
|
- .gitignore
|
214
214
|
- Gemfile
|
215
|
-
- Gemfile.lock
|
216
215
|
- README.rdoc
|
217
216
|
- Rakefile
|
218
217
|
- benchs/fog_vs.rb
|
data/Gemfile.lock
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
fog (0.7.0)
|
5
|
-
builder
|
6
|
-
excon (>= 0.5.5)
|
7
|
-
formatador (>= 0.1.1)
|
8
|
-
json
|
9
|
-
mime-types
|
10
|
-
net-ssh (>= 2.0.23)
|
11
|
-
nokogiri (>= 1.4.4)
|
12
|
-
ruby-hmac
|
13
|
-
|
14
|
-
GEM
|
15
|
-
remote: http://rubygems.org/
|
16
|
-
specs:
|
17
|
-
builder (3.0.0)
|
18
|
-
excon (0.5.6)
|
19
|
-
ffi (0.6.3)
|
20
|
-
rake (>= 0.8.7)
|
21
|
-
formatador (0.1.1)
|
22
|
-
json (1.5.1)
|
23
|
-
mime-types (1.16)
|
24
|
-
net-ssh (2.1.0)
|
25
|
-
nokogiri (1.4.4)
|
26
|
-
rake (0.8.7)
|
27
|
-
rspec (1.3.1)
|
28
|
-
ruby-hmac (0.4.0)
|
29
|
-
shindo (0.3.3)
|
30
|
-
formatador (>= 0.1.1)
|
31
|
-
virtualbox (0.8.3)
|
32
|
-
ffi (~> 0.6.3)
|
33
|
-
|
34
|
-
PLATFORMS
|
35
|
-
ruby
|
36
|
-
|
37
|
-
DEPENDENCIES
|
38
|
-
fog!
|
39
|
-
rake
|
40
|
-
rspec (= 1.3.1)
|
41
|
-
shindo (= 0.3.3)
|
42
|
-
virtualbox (= 0.8.3)
|