fog 0.3.24 → 0.3.25

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fog (0.3.24)
4
+ fog (0.3.25)
5
5
  builder
6
6
  excon (>= 0.2.4)
7
7
  formatador (>= 0.0.16)
@@ -129,8 +129,7 @@ Enjoy, and let me know what I can do to continue improving fog!
129
129
  * Follow {@fog}[http://twitter.com/fog] and/or {@geemus}[http://twitter.com/geemus] on Twitter
130
130
  * Discuss in irc on the {#ruby-fog}[irc://irc.freenode.net/ruby-fog] channel on Freenode
131
131
  * Discuss via email on the {mailing list}[http://groups.google.com/group/ruby-fog] (note: release notes appear on this list)
132
- * See upcoming work in the {tracker}[http://www.pivotaltracker.com/projects/54635]
133
- * Report bugs in {issues}[http://github.com/geemus/fog/issues]
132
+ * Report bugs or find stuff to work on in {issues}[http://github.com/geemus/fog/issues]
134
133
  * Learn about {contributing}[http://github.com/geemus/fog/wiki/contributor-guide] or find more info about the {Providers}[http://github.com/geemus/fog/wiki/Providers] (including some todo items)
135
134
  * See what already uses fog and add your own stuff to {the list}[http://wiki.github.com/geemus/fog/in-the-wild]
136
135
 
@@ -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.3.24'
11
- s.date = '2010-11-22'
10
+ s.version = '0.3.25'
11
+ s.date = '2010-11-23'
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
@@ -18,7 +18,7 @@ module Fog
18
18
  @mocking = false
19
19
 
20
20
  unless const_defined?(:VERSION)
21
- VERSION = '0.3.24'
21
+ VERSION = '0.3.25'
22
22
  end
23
23
 
24
24
  module Mock
@@ -65,7 +65,7 @@ module Fog
65
65
  end
66
66
 
67
67
  def path
68
- connection.path_to(::File.join(directory.key, key))
68
+ connection.path_to(::File.join(directory.key, CGI.escape(key)))
69
69
  end
70
70
 
71
71
  end
@@ -20,7 +20,7 @@ module Fog
20
20
  path = file_path(key)
21
21
  {
22
22
  :content_length => ::File.size(path),
23
- :key => key,
23
+ :key => CGI.unescape(key),
24
24
  :last_modified => ::File.mtime(path)
25
25
  }
26
26
  end
@@ -32,7 +32,7 @@ module Fog
32
32
 
33
33
  def get(key, &block)
34
34
  requires :directory
35
- path = file_path(key)
35
+ path = file_path(CGI.escape(key))
36
36
  if ::File.exists?(path)
37
37
  data = {
38
38
  :content_length => ::File.size(path),
@@ -53,6 +53,20 @@ module Fog
53
53
  end
54
54
  end
55
55
 
56
+ def head(key)
57
+ requires :directory
58
+ path = file_path(CGI.escape(key))
59
+ if ::File.exists?(path)
60
+ new({
61
+ :content_length => ::File.size(path),
62
+ :key => key,
63
+ :last_modified => ::File.mtime(path)
64
+ })
65
+ else
66
+ nil
67
+ end
68
+ end
69
+
56
70
  def new(attributes = {})
57
71
  requires :directory
58
72
  super({ :directory => directory }.merge!(attributes))
@@ -40,7 +40,7 @@ module Fog
40
40
  requires :key
41
41
  @public_url ||= begin
42
42
  begin response = connection.cdn.head_container(key)
43
- response.headers['X-CDN-URI']
43
+ response.headers['X-CDN-Enabled'] == 'True' && response.headers['X-CDN-URI']
44
44
  rescue Fog::Service::NotFound
45
45
  nil
46
46
  end
@@ -51,7 +51,10 @@ module Fog
51
51
  requires :key
52
52
  connection.put_container(key)
53
53
  if @public
54
- @public_url = connection.cdn.put_container(key).headers['X-CDN-URI']
54
+ @public_url = connection.cdn.put_container(key, 'X-CDN-Enabled' => 'True').headers['X-CDN-URI']
55
+ else
56
+ connection.cdn.put_container(key, 'X-CDN-Enabled' => 'False')
57
+ @public_url = nil
55
58
  end
56
59
  true
57
60
  end
@@ -49,12 +49,12 @@ module Fog
49
49
 
50
50
  def get_url(key, expires)
51
51
  requires :directory
52
- connection.get_object_url(directory.name, key, expires)
52
+ connection.get_object_url(directory.key, key, expires)
53
53
  end
54
54
 
55
55
  def head(key, options = {})
56
56
  requires :directory
57
- data = connection.head_object(directory.name, key, options)
57
+ data = connection.head_object(directory.key, key)
58
58
  file_data = data.headers.merge({
59
59
  :key => key
60
60
  })
@@ -28,6 +28,14 @@ if ENV["FOG_MOCK"] == "true"
28
28
  Fog.mock!
29
29
  end
30
30
 
31
+ # check to see which credentials are available and add others to the skipped tags list
32
+ all_providers = ['aws', 'bluebox', 'brightbox', 'gogrid', 'google', 'linode', 'local', 'newservers', 'rackspace', 'slicehost', 'terremark']
33
+ available_providers = Fog.providers.map {|provider| provider.to_s.downcase}
34
+ for provider in (all_providers - available_providers)
35
+ Formatador.display_line("[yellow]Skipping tests for [bold]#{provider}[/] [yellow]due to lacking credentials (add some to '~/.fog' to run them)[/]")
36
+ Thread.current[:tags] << ('-' << provider)
37
+ end
38
+
31
39
  # Boolean hax
32
40
  module Fog
33
41
  module Boolean
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 24
9
- version: 0.3.24
8
+ - 25
9
+ version: 0.3.25
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-11-22 00:00:00 -08:00
17
+ date: 2010-11-23 00:00:00 -08:00
18
18
  default_executable: fog
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency