ahoward-helene 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +274 -0
- data/helene.gemspec +26 -0
- data/lib/helene.rb +113 -0
- data/lib/helene/attempt.rb +46 -0
- data/lib/helene/aws.rb +50 -0
- data/lib/helene/config.rb +147 -0
- data/lib/helene/content_type.rb +15 -0
- data/lib/helene/content_type.yml +661 -0
- data/lib/helene/error.rb +12 -0
- data/lib/helene/logging.rb +55 -0
- data/lib/helene/objectpool.rb +220 -0
- data/lib/helene/rails.rb +21 -0
- data/lib/helene/rightscale/acf/right_acf_interface.rb +379 -0
- data/lib/helene/rightscale/awsbase/benchmark_fix.rb +39 -0
- data/lib/helene/rightscale/awsbase/right_awsbase.rb +803 -0
- data/lib/helene/rightscale/awsbase/support.rb +111 -0
- data/lib/helene/rightscale/ec2/right_ec2.rb +1737 -0
- data/lib/helene/rightscale/net_fix.rb +160 -0
- data/lib/helene/rightscale/right_aws.rb +71 -0
- data/lib/helene/rightscale/right_http_connection.rb +507 -0
- data/lib/helene/rightscale/s3/right_s3.rb +1094 -0
- data/lib/helene/rightscale/s3/right_s3_interface.rb +1180 -0
- data/lib/helene/rightscale/sdb/active_sdb.rb +930 -0
- data/lib/helene/rightscale/sdb/right_sdb_interface.rb +696 -0
- data/lib/helene/rightscale/sqs/right_sqs.rb +388 -0
- data/lib/helene/rightscale/sqs/right_sqs_gen2.rb +286 -0
- data/lib/helene/rightscale/sqs/right_sqs_gen2_interface.rb +444 -0
- data/lib/helene/rightscale/sqs/right_sqs_interface.rb +596 -0
- data/lib/helene/s3.rb +34 -0
- data/lib/helene/s3/bucket.rb +379 -0
- data/lib/helene/s3/grantee.rb +134 -0
- data/lib/helene/s3/key.rb +162 -0
- data/lib/helene/s3/owner.rb +16 -0
- data/lib/helene/sdb.rb +9 -0
- data/lib/helene/sdb/base.rb +1204 -0
- data/lib/helene/sdb/base/associations.rb +481 -0
- data/lib/helene/sdb/base/attributes.rb +90 -0
- data/lib/helene/sdb/base/connection.rb +20 -0
- data/lib/helene/sdb/base/error.rb +20 -0
- data/lib/helene/sdb/base/hooks.rb +82 -0
- data/lib/helene/sdb/base/literal.rb +52 -0
- data/lib/helene/sdb/base/logging.rb +23 -0
- data/lib/helene/sdb/base/transactions.rb +53 -0
- data/lib/helene/sdb/base/type.rb +137 -0
- data/lib/helene/sdb/base/types.rb +123 -0
- data/lib/helene/sdb/base/validations.rb +256 -0
- data/lib/helene/sdb/cast.rb +114 -0
- data/lib/helene/sdb/connection.rb +36 -0
- data/lib/helene/sdb/error.rb +5 -0
- data/lib/helene/sdb/interface.rb +412 -0
- data/lib/helene/sdb/sentinel.rb +15 -0
- data/lib/helene/sleepcycle.rb +29 -0
- data/lib/helene/superhash.rb +297 -0
- data/lib/helene/util.rb +132 -0
- data/test/auth.rb +31 -0
- data/test/helper.rb +98 -0
- data/test/integration/begin.rb +0 -0
- data/test/integration/ensure.rb +8 -0
- data/test/integration/s3/bucket.rb +106 -0
- data/test/integration/sdb/associations.rb +45 -0
- data/test/integration/sdb/creating.rb +13 -0
- data/test/integration/sdb/emptiness.rb +56 -0
- data/test/integration/sdb/hooks.rb +19 -0
- data/test/integration/sdb/limits.rb +27 -0
- data/test/integration/sdb/saving.rb +21 -0
- data/test/integration/sdb/selecting.rb +39 -0
- data/test/integration/sdb/types.rb +31 -0
- data/test/integration/sdb/validations.rb +60 -0
- data/test/integration/setup.rb +27 -0
- data/test/integration/teardown.rb +21 -0
- data/test/loader.rb +39 -0
- metadata +139 -0
@@ -0,0 +1,31 @@
|
|
1
|
+
testing Helene::Sdb::Base do
|
2
|
+
|
3
|
+
context 'types' do
|
4
|
+
setup do
|
5
|
+
@a = model(:a) do
|
6
|
+
attribute :x, :text
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
perform = 'be able to represent text fields > 1024'
|
11
|
+
should perform do
|
12
|
+
text = '*' * ((1024 * 9) + 3)
|
13
|
+
a = assert{ @a.create! :x => text }
|
14
|
+
assert{ a.x==text }
|
15
|
+
eventually_assert(perform){ a.reload; a.x==text }
|
16
|
+
|
17
|
+
text = 'abc' + text + 'xyz'
|
18
|
+
a = assert{ @a.create! :x => text }
|
19
|
+
assert{ a.x==text }
|
20
|
+
assert{ a.x.first(3)=='abc' }
|
21
|
+
assert{ a.x.last(3)=='xyz' }
|
22
|
+
eventually_assert(perform){
|
23
|
+
a.reload;
|
24
|
+
a.x==text
|
25
|
+
a.x.first(3)=='abc'
|
26
|
+
a.x.last(3)=='xyz'
|
27
|
+
}
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
testing Helene::Sdb::Base do
|
2
|
+
|
3
|
+
context "validations" do
|
4
|
+
context ":on => :create" do
|
5
|
+
setup do
|
6
|
+
@a = model(:a) do
|
7
|
+
attribute :mode, :string
|
8
|
+
validates_format_of :mode, :with => /\Acreate\z/, :on => :create
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
should "only be checked for creation" do
|
13
|
+
a = assert{ @a.new(:mode => "bad") }
|
14
|
+
assert{ !a.valid? }
|
15
|
+
a.mode = "create"
|
16
|
+
assert{ a.save! }
|
17
|
+
a.mode = "update"
|
18
|
+
assert{ a.valid? }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
context ":on => :update" do
|
23
|
+
setup do
|
24
|
+
@a = model(:a) do
|
25
|
+
attribute :mode, :string
|
26
|
+
validates_format_of :mode, :with => /\Aupdate\z/, :on => :update
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
should "only be checked for updates" do
|
31
|
+
a = assert{ @a.new(:mode => "create") }
|
32
|
+
assert{ a.save! }
|
33
|
+
assert{ !a.valid? }
|
34
|
+
a.mode = "update"
|
35
|
+
assert{ a.valid? }
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
context ":on => :save" do
|
40
|
+
setup do
|
41
|
+
@a = model(:a) do
|
42
|
+
attribute :mode, :string
|
43
|
+
validates_format_of :mode, :with => /\Asave\z/, :on => :save
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
should "always be checked" do
|
48
|
+
a = assert{ @a.new(:mode => "bad") }
|
49
|
+
assert{ !a.valid? }
|
50
|
+
a.mode = "save"
|
51
|
+
assert{ a.save! }
|
52
|
+
a.mode = "update"
|
53
|
+
assert{ !a.valid? }
|
54
|
+
a.mode = "save"
|
55
|
+
assert{ a.valid? }
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
|
2
|
+
if test(?e, $test_integration_setup_guard)
|
3
|
+
|
4
|
+
puts
|
5
|
+
puts '*** setup has already run ***'
|
6
|
+
puts
|
7
|
+
|
8
|
+
else
|
9
|
+
|
10
|
+
testing 'setup' do
|
11
|
+
|
12
|
+
context('migrating') do
|
13
|
+
should('allow some basic models to be migrated') do
|
14
|
+
models.threadify do |model|
|
15
|
+
assert_nothing_raised do
|
16
|
+
model.delete_domain rescue nil
|
17
|
+
model.create_domain
|
18
|
+
end
|
19
|
+
end
|
20
|
+
require 'time'
|
21
|
+
open($test_integration_setup_guard, 'w'){|fd| fd.puts Time.now.iso8601(2)}
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
|
2
|
+
if true # test(?e, $test_integration_setup_guard)
|
3
|
+
|
4
|
+
testing 'teardown' do
|
5
|
+
|
6
|
+
should('nuke domains for all test models') do
|
7
|
+
models.threadify do |model|
|
8
|
+
model.delete_domain rescue nil
|
9
|
+
end
|
10
|
+
File.unlink($test_integration_setup_guard) rescue nil
|
11
|
+
assert !test(?e, $test_integration_setup_guard)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
else
|
16
|
+
|
17
|
+
puts
|
18
|
+
puts '*** nothing to teardown ***'
|
19
|
+
puts
|
20
|
+
|
21
|
+
end
|
data/test/loader.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# sets up the required environment for running tests
|
2
|
+
#
|
3
|
+
$src_dir = File.expand_path(File.dirname(File.dirname(__FILE__)))
|
4
|
+
$lib_dir = File.join($src_dir, 'lib')
|
5
|
+
$test_dir = File.join($src_dir, 'test')
|
6
|
+
$test_lib_dir = File.join($src_dir, 'test', 'lib')
|
7
|
+
$test_data_dir = File.join($src_dir, 'test', 'data')
|
8
|
+
$test_unit_dir = File.join($test_dir, 'unit')
|
9
|
+
$test_unit_lib_dir = File.join($test_unit_dir, 'lib')
|
10
|
+
$test_integration_dir = File.join($test_dir, 'integration')
|
11
|
+
$test_integration_lib_dir = File.join($test_integration_dir, 'lib')
|
12
|
+
$test_config_file = File.join($test_dir, 'config.yml')
|
13
|
+
|
14
|
+
$test_integration_setup_guard = File.join($test_integration_dir, '.guard')
|
15
|
+
$test_log = File.join($test_dir, 'log')
|
16
|
+
|
17
|
+
$load_path = [$lib_dir, $test_dir, $test_lib_dir]
|
18
|
+
$load_path.each{|load_path| $LOAD_PATH.unshift(load_path)}
|
19
|
+
ENV['RUBYLIB'] = $LOAD_PATH.join(File::PATH_SEPARATOR)
|
20
|
+
|
21
|
+
Dir.chdir($src_dir)
|
22
|
+
|
23
|
+
require 'test/unit'
|
24
|
+
|
25
|
+
begin
|
26
|
+
require 'rubygems'
|
27
|
+
rescue LoadError
|
28
|
+
nil
|
29
|
+
end
|
30
|
+
|
31
|
+
require 'shoulda'
|
32
|
+
|
33
|
+
require File.join($lib_dir, 'helene')
|
34
|
+
require File.join($test_dir, 'helper')
|
35
|
+
|
36
|
+
Helene.logger = $test_log
|
37
|
+
|
38
|
+
STDOUT.sync = true
|
39
|
+
STDERR.sync = true
|
metadata
ADDED
@@ -0,0 +1,139 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ahoward-helene
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ara T. Howard
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-05-16 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description:
|
17
|
+
email: ara.t.howard@gmail.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files: []
|
23
|
+
|
24
|
+
files:
|
25
|
+
- helene.gemspec
|
26
|
+
- lib
|
27
|
+
- lib/helene
|
28
|
+
- lib/helene/attempt.rb
|
29
|
+
- lib/helene/aws.rb
|
30
|
+
- lib/helene/config.rb
|
31
|
+
- lib/helene/content_type.rb
|
32
|
+
- lib/helene/content_type.yml
|
33
|
+
- lib/helene/error.rb
|
34
|
+
- lib/helene/logging.rb
|
35
|
+
- lib/helene/objectpool.rb
|
36
|
+
- lib/helene/rails.rb
|
37
|
+
- lib/helene/rightscale
|
38
|
+
- lib/helene/rightscale/acf
|
39
|
+
- lib/helene/rightscale/acf/right_acf_interface.rb
|
40
|
+
- lib/helene/rightscale/awsbase
|
41
|
+
- lib/helene/rightscale/awsbase/benchmark_fix.rb
|
42
|
+
- lib/helene/rightscale/awsbase/right_awsbase.rb
|
43
|
+
- lib/helene/rightscale/awsbase/support.rb
|
44
|
+
- lib/helene/rightscale/ec2
|
45
|
+
- lib/helene/rightscale/ec2/right_ec2.rb
|
46
|
+
- lib/helene/rightscale/net_fix.rb
|
47
|
+
- lib/helene/rightscale/right_aws.rb
|
48
|
+
- lib/helene/rightscale/right_http_connection.rb
|
49
|
+
- lib/helene/rightscale/s3
|
50
|
+
- lib/helene/rightscale/s3/right_s3.rb
|
51
|
+
- lib/helene/rightscale/s3/right_s3_interface.rb
|
52
|
+
- lib/helene/rightscale/sdb
|
53
|
+
- lib/helene/rightscale/sdb/active_sdb.rb
|
54
|
+
- lib/helene/rightscale/sdb/right_sdb_interface.rb
|
55
|
+
- lib/helene/rightscale/sqs
|
56
|
+
- lib/helene/rightscale/sqs/right_sqs.rb
|
57
|
+
- lib/helene/rightscale/sqs/right_sqs_gen2.rb
|
58
|
+
- lib/helene/rightscale/sqs/right_sqs_gen2_interface.rb
|
59
|
+
- lib/helene/rightscale/sqs/right_sqs_interface.rb
|
60
|
+
- lib/helene/s3
|
61
|
+
- lib/helene/s3/bucket.rb
|
62
|
+
- lib/helene/s3/grantee.rb
|
63
|
+
- lib/helene/s3/key.rb
|
64
|
+
- lib/helene/s3/owner.rb
|
65
|
+
- lib/helene/s3.rb
|
66
|
+
- lib/helene/sdb
|
67
|
+
- lib/helene/sdb/base
|
68
|
+
- lib/helene/sdb/base/associations.rb
|
69
|
+
- lib/helene/sdb/base/attributes.rb
|
70
|
+
- lib/helene/sdb/base/connection.rb
|
71
|
+
- lib/helene/sdb/base/error.rb
|
72
|
+
- lib/helene/sdb/base/hooks.rb
|
73
|
+
- lib/helene/sdb/base/literal.rb
|
74
|
+
- lib/helene/sdb/base/logging.rb
|
75
|
+
- lib/helene/sdb/base/transactions.rb
|
76
|
+
- lib/helene/sdb/base/type.rb
|
77
|
+
- lib/helene/sdb/base/types.rb
|
78
|
+
- lib/helene/sdb/base/validations.rb
|
79
|
+
- lib/helene/sdb/base.rb
|
80
|
+
- lib/helene/sdb/cast.rb
|
81
|
+
- lib/helene/sdb/connection.rb
|
82
|
+
- lib/helene/sdb/error.rb
|
83
|
+
- lib/helene/sdb/interface.rb
|
84
|
+
- lib/helene/sdb/sentinel.rb
|
85
|
+
- lib/helene/sdb.rb
|
86
|
+
- lib/helene/sleepcycle.rb
|
87
|
+
- lib/helene/superhash.rb
|
88
|
+
- lib/helene/util.rb
|
89
|
+
- lib/helene.rb
|
90
|
+
- Rakefile
|
91
|
+
- test
|
92
|
+
- test/auth.rb
|
93
|
+
- test/helper.rb
|
94
|
+
- test/integration
|
95
|
+
- test/integration/begin.rb
|
96
|
+
- test/integration/ensure.rb
|
97
|
+
- test/integration/s3
|
98
|
+
- test/integration/s3/bucket.rb
|
99
|
+
- test/integration/sdb
|
100
|
+
- test/integration/sdb/associations.rb
|
101
|
+
- test/integration/sdb/creating.rb
|
102
|
+
- test/integration/sdb/emptiness.rb
|
103
|
+
- test/integration/sdb/hooks.rb
|
104
|
+
- test/integration/sdb/limits.rb
|
105
|
+
- test/integration/sdb/saving.rb
|
106
|
+
- test/integration/sdb/selecting.rb
|
107
|
+
- test/integration/sdb/types.rb
|
108
|
+
- test/integration/sdb/validations.rb
|
109
|
+
- test/integration/setup.rb
|
110
|
+
- test/integration/teardown.rb
|
111
|
+
- test/loader.rb
|
112
|
+
has_rdoc: true
|
113
|
+
homepage: http://github.com/ahoward/helene/tree/master
|
114
|
+
post_install_message:
|
115
|
+
rdoc_options: []
|
116
|
+
|
117
|
+
require_paths:
|
118
|
+
- lib
|
119
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: "0"
|
124
|
+
version:
|
125
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - ">="
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: "0"
|
130
|
+
version:
|
131
|
+
requirements: []
|
132
|
+
|
133
|
+
rubyforge_project: codeforpeople
|
134
|
+
rubygems_version: 1.2.0
|
135
|
+
signing_key:
|
136
|
+
specification_version: 2
|
137
|
+
summary: helene
|
138
|
+
test_files: []
|
139
|
+
|