rudy 0.2.4 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/storable.rb CHANGED
@@ -12,6 +12,7 @@ require 'fileutils'
12
12
  # Storable.field method which tells Storable the order and
13
13
  # name.
14
14
  class Storable
15
+ VERSION = 2
15
16
  NICE_TIME_FORMAT = "%Y-%m-%d@%H:%M:%S".freeze unless defined? NICE_TIME_FORMAT
16
17
  SUPPORTED_FORMATS = %w{tsv csv yaml json}.freeze unless defined? SUPPORTED_FORMATS
17
18
 
@@ -109,25 +110,29 @@ class Storable
109
110
  fnames = field_names
110
111
  fnames.each_with_index do |key,index|
111
112
 
112
-
113
+ stored_value = from[key] || from[key.to_s] # support for symbol keys and string keys
113
114
 
114
115
  # TODO: Correct this horrible implementation (sorry, me. It's just one of those days.)
115
116
 
116
- if field_types[index] == Time
117
- value = Time.parse(from[key].to_s)
118
- elsif field_types[index] == DateTime
119
- value = DateTime.parse(from[key].to_s)
120
- elsif field_types[index] == TrueClass
121
- value = (from[key].to_s == "true")
122
- elsif field_types[index] == Float
123
- value = from[key].to_f
124
- elsif field_types[index] == Integer
125
- value = from[key].to_i
126
- elsif field_types[index] == Array
127
- (value ||= []) << from[key]
117
+ if field_types[index] == Array
118
+ ((value ||= []) << stored_value).flatten
128
119
  else
129
- value = from[key] || from[key.to_s] # support for symbol keys and string keys
130
- value = value.first if value.is_a?(Array) && value.size == 1 # I
120
+ # SimpleDB stores attribute shit as lists of values
121
+ value = stored_value.first if stored_value.is_a?(Array) && stored_value.size == 1
122
+
123
+ if field_types[index] == Time
124
+ value = Time.parse(value)
125
+ elsif field_types[index] == DateTime
126
+ value = DateTime.parse(value)
127
+ elsif field_types[index] == TrueClass
128
+ value = (value.to_s == "true")
129
+ elsif field_types[index] == Float
130
+ value = value.to_f
131
+ elsif field_types[index] == Integer
132
+ value = value.to_i
133
+ else
134
+ value = value.first if value.is_a?(Array) && value.size == 1 # I
135
+ end
131
136
  end
132
137
 
133
138
  me.send("#{key}=", value) if self.method_defined?("#{key}=")
data/rudy.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  @spec = Gem::Specification.new do |s|
2
2
  s.name = "rudy"
3
- s.version = "0.2.4"
3
+ s.version = "0.3.0"
4
4
  s.summary = "Rudy is a handy staging and deployment tool for Amazon EC2."
5
5
  s.description = "Rudy is a handy staging and deployment tool for Amazon EC2."
6
6
  s.author = "Delano Mandelbaum"
@@ -15,6 +15,10 @@
15
15
  README.rdoc
16
16
  Rakefile
17
17
  bin/rudy
18
+ lib/aws_sdb.rb
19
+ lib/aws_sdb/error.rb
20
+ lib/aws_sdb/service.rb
21
+ lib/console.rb
18
22
  lib/drydock.rb
19
23
  lib/rudy.rb
20
24
  lib/rudy/aws.rb
@@ -32,7 +36,10 @@
32
36
  lib/rudy/command/metadata.rb
33
37
  lib/rudy/command/stage.rb
34
38
  lib/rudy/command/volumes.rb
39
+ lib/rudy/metadata.rb
40
+ lib/rudy/metadata/backup.rb
35
41
  lib/rudy/metadata/disk.rb
42
+ lib/rudy/metadata/ec2startup.rb
36
43
  lib/rudy/metadata/environment.rb
37
44
  lib/rudy/scm/svn.rb
38
45
  lib/rudy/utils.rb
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rudy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Delano Mandelbaum
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-02-24 00:00:00 -05:00
12
+ date: 2009-02-25 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -28,6 +28,10 @@ files:
28
28
  - README.rdoc
29
29
  - Rakefile
30
30
  - bin/rudy
31
+ - lib/aws_sdb.rb
32
+ - lib/aws_sdb/error.rb
33
+ - lib/aws_sdb/service.rb
34
+ - lib/console.rb
31
35
  - lib/drydock.rb
32
36
  - lib/rudy.rb
33
37
  - lib/rudy/aws.rb
@@ -45,7 +49,10 @@ files:
45
49
  - lib/rudy/command/metadata.rb
46
50
  - lib/rudy/command/stage.rb
47
51
  - lib/rudy/command/volumes.rb
52
+ - lib/rudy/metadata.rb
53
+ - lib/rudy/metadata/backup.rb
48
54
  - lib/rudy/metadata/disk.rb
55
+ - lib/rudy/metadata/ec2startup.rb
49
56
  - lib/rudy/metadata/environment.rb
50
57
  - lib/rudy/scm/svn.rb
51
58
  - lib/rudy/utils.rb