fog 0.1.10 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,7 +7,7 @@ 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.1.10'
10
+ s.version = '0.2.0'
11
11
  s.date = '2010-06-18'
12
12
  s.rubyforge_project = 'fog'
13
13
 
data/lib/fog.rb CHANGED
@@ -38,7 +38,7 @@ require 'fog/vcloud'
38
38
  module Fog
39
39
 
40
40
  unless const_defined?(:VERSION)
41
- VERSION = '0.1.10'
41
+ VERSION = '0.2.0'
42
42
  end
43
43
 
44
44
  module Mock
@@ -36,12 +36,7 @@ module Fog
36
36
  end
37
37
  end
38
38
  directory.files.merge_attributes(options)
39
- files = data['Contents']
40
- while data['IsTruncated']
41
- data = connection.get_bucket(key, options.merge!('marker' => files.last['Key'])).body
42
- files.concat(data['Contents'])
43
- end
44
- directory.files.load(files)
39
+ directory.files.load(data['Contents'])
45
40
  directory
46
41
  rescue Excon::Errors::NotFound
47
42
  nil
@@ -24,3 +24,64 @@ module Fog
24
24
  end
25
25
  end
26
26
  end
27
+
28
+ module Fog
29
+ class ToHashDocument < Nokogiri::XML::SAX::Document
30
+
31
+ def initialize
32
+ @stack = []
33
+ end
34
+
35
+ def characters(string)
36
+ @value ||= ''
37
+ @value << string.strip
38
+ end
39
+
40
+ def end_element(name)
41
+ last = @stack.pop
42
+ if last.empty? && @value.empty?
43
+ @stack.last[name.to_sym] = ''
44
+ elsif !@value.empty?
45
+ @stack.last[name.to_sym] = @value
46
+ end
47
+ @value = ''
48
+ end
49
+
50
+ def body
51
+ @stack.first
52
+ end
53
+
54
+ def start_element(name, attributes = [])
55
+ @value = ''
56
+ parsed_attributes = {}
57
+ until attributes.empty?
58
+ if attributes.first.is_a?(Array)
59
+ key, value = attributes.shift
60
+ else
61
+ key, value = attributes.shift, attributes.shift
62
+ end
63
+ parsed_attributes[key.gsub(':','_').to_sym] = value
64
+ end
65
+ if @stack.last.is_a?(Array)
66
+ @stack.last << {name.to_sym => parsed_attributes}
67
+ else
68
+ data = if @stack.empty?
69
+ @stack.push(parsed_attributes)
70
+ parsed_attributes
71
+ elsif @stack.last[name.to_sym]
72
+ unless @stack.last[name.to_sym].is_a?(Array)
73
+ @stack.last[name.to_sym] = [@stack.last[name.to_sym]]
74
+ end
75
+ @stack.last[name.to_sym] << parsed_attributes
76
+ @stack.last[name.to_sym].last
77
+ else
78
+ @stack.last[name.to_sym] = {}
79
+ @stack.last[name.to_sym].merge!(parsed_attributes)
80
+ @stack.last[name.to_sym]
81
+ end
82
+ @stack.push(data)
83
+ end
84
+ end
85
+
86
+ end
87
+ end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 1
8
- - 10
9
- version: 0.1.10
7
+ - 2
8
+ - 0
9
+ version: 0.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - geemus (Wesley Beary)