dm-adapter-simpledb 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README CHANGED
@@ -62,6 +62,8 @@ http://github.com/devver/dm-adapter-simpledb/
62
62
  * Support of normalized 1:1 table:domain schemes that works with associations
63
63
  * Sharding
64
64
  * Support BatchPutAttributes
65
+ * Silence SSL warnings
66
+ See http://pivotallabs.com/users/carl/blog/articles/1079-standup-blog-11-24-2009-model-validations-without-backing-store-associations-to-array-and-ssl-with-aws
65
67
 
66
68
  == Usage
67
69
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0
1
+ 1.2.0
@@ -24,6 +24,7 @@ module DataMapper
24
24
  @sdb_options[:domain] = options.fetch(:domain) {
25
25
  options[:path].to_s.gsub(%r{(^/+)|(/+$)},"") # remove slashes
26
26
  }
27
+ @sdb_options[:create_domain] = options.fetch(:create_domain) { false }
27
28
  # We do not expect to be saving any nils in future, because now we
28
29
  # represent null values by removing the attributes. The representation
29
30
  # here is chosen on the basis of it being unlikely to match any strings
@@ -35,6 +36,10 @@ module DataMapper
35
36
  @consistency_policy =
36
37
  normalised_options.fetch(:wait_for_consistency) { false }
37
38
  @sdb = options.fetch(:sdb_interface) { nil }
39
+ if @sdb_options[:create_domain] && !domains.include?(@sdb_options[:domain])
40
+ @sdb_options[:logger].info "Creating domain #{domain}"
41
+ @sdb.create_domain(@sdb_options[:domain])
42
+ end
38
43
  end
39
44
 
40
45
  def create(resources)
@@ -146,6 +151,17 @@ module DataMapper
146
151
  end until tokens.include?(@current_consistency_token)
147
152
  end
148
153
 
154
+ def domains
155
+ result = []
156
+ token = nil
157
+ begin
158
+ response = sdb.list_domains(nil, token)
159
+ result.concat(response[:domains])
160
+ token = response[:next_token]
161
+ end while(token)
162
+ result
163
+ end
164
+
149
165
  private
150
166
  # Returns the domain for the model
151
167
  def domain
@@ -45,7 +45,7 @@ module DmAdapterSimpledb
45
45
  #return original value, they could have put strings in the system not
46
46
  #using the adapter or previous versions that are larger than chunk size,
47
47
  #but less than 1024
48
- value
48
+ value.to_s
49
49
  end
50
50
  end
51
51
 
@@ -68,6 +68,7 @@ module DmAdapterSimpledb
68
68
  @simpledb_attributes = attrs_to_update
69
69
  @deletable_attributes = attrs_to_delete
70
70
  @item_name = item_name_for_resource(hash_or_resource)
71
+ @model = hash_or_resource.model
71
72
  when Hash
72
73
  hash = hash_or_resource
73
74
  @item_name = hash.keys.first
@@ -142,10 +143,16 @@ module DmAdapterSimpledb
142
143
  # Returns the "Table" this record belongs to. SimpleDB has no concept of
143
144
  # tables, but we fake it with metadata.
144
145
  def table
145
- Table.name_from_metadata(metadata) ||
146
+ table_name_from_model || Table.name_from_metadata(metadata) ||
146
147
  storage_name
147
148
  end
148
149
 
150
+ def table_name_from_model(repository=DataMapper.repository.name)
151
+ if defined?(@model) && @model
152
+ @model.storage_name(repository)
153
+ end
154
+ end
155
+
149
156
  def metadata
150
157
  simpledb_attributes[METADATA_KEY]
151
158
  end
@@ -224,4 +224,5 @@ EOF
224
224
  attributes["__dm_metadata"].should include("table:projects")
225
225
  end
226
226
  end
227
+
227
228
  end
@@ -235,6 +235,7 @@ describe DmAdapterSimpledb::Record do
235
235
  @resource_class = Class.new do
236
236
  include DataMapper::Resource
237
237
  storage_names[:default] = "books"
238
+ storage_names[:backup] = "tomes"
238
239
 
239
240
  property :author, String, :key => true
240
241
  property :date, Date
@@ -310,6 +311,13 @@ describe DmAdapterSimpledb::Record do
310
311
  end
311
312
 
312
313
  end
314
+
315
+ it "should take repo into account when determining table name" do
316
+ DataMapper.repository(:backup) do
317
+ @it.table.should be == "tomes"
318
+ end
319
+ end
320
+
313
321
  end
314
322
 
315
323
  describe "given a saved datamapper resource" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dm-adapter-simpledb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Boles
@@ -13,7 +13,7 @@ autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
15
 
16
- date: 2009-11-24 00:00:00 -05:00
16
+ date: 2010-01-13 00:00:00 -05:00
17
17
  default_executable:
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
@@ -110,7 +110,6 @@ files:
110
110
  - Rakefile
111
111
  - VERSION
112
112
  - aws_config.sample
113
- - dm-adapter-simpledb.gemspec
114
113
  - lib/dm-adapter-simpledb.rb
115
114
  - lib/dm-adapter-simpledb/adapters/simpledb_adapter.rb
116
115
  - lib/dm-adapter-simpledb/chunked_string.rb
@@ -1,119 +0,0 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = %q{dm-adapter-simpledb}
8
- s.version = "1.1.0"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Jeremy Boles", "Edward Ocampo-Gooding", "Dan Mayer", "Thomas Olausson", "Avdi Grimm"]
12
- s.date = %q{2009-11-24}
13
- s.description = %q{A DataMapper adapter for Amazon's SimpleDB service.
14
-
15
- Features:
16
- * Uses the RightAWS gem for efficient SimpleDB operations.
17
- * Full set of CRUD operations
18
- * Supports all DataMapper query predicates.
19
- * Can translate many queries into efficient native SELECT operations.
20
- * Migrations
21
- * DataMapper identity map support for record caching
22
- * Lazy-loaded attributes
23
- * DataMapper Serial property support via UUIDs.
24
- * Array properties
25
- * Basic aggregation support (Model.count("..."))
26
- * String "chunking" permits attributes to exceed the 1024-byte limit
27
-
28
- Note: as of version 1.0.0, this gem supports supports the DataMapper 0.10.*
29
- series and breaks backwards compatibility with DataMapper 0.9.*.
30
- }
31
- s.email = %q{devs@devver.net}
32
- s.extra_rdoc_files = [
33
- "README"
34
- ]
35
- s.files = [
36
- ".autotest",
37
- ".gitignore",
38
- "History.txt",
39
- "README",
40
- "Rakefile",
41
- "VERSION",
42
- "aws_config.sample",
43
- "dm-adapter-simpledb.gemspec",
44
- "lib/dm-adapter-simpledb.rb",
45
- "lib/dm-adapter-simpledb/adapters/simpledb_adapter.rb",
46
- "lib/dm-adapter-simpledb/chunked_string.rb",
47
- "lib/dm-adapter-simpledb/migrations/simpledb_adapter.rb",
48
- "lib/dm-adapter-simpledb/rake.rb",
49
- "lib/dm-adapter-simpledb/record.rb",
50
- "lib/dm-adapter-simpledb/sdb_array.rb",
51
- "lib/dm-adapter-simpledb/table.rb",
52
- "lib/dm-adapter-simpledb/utils.rb",
53
- "lib/simpledb_adapter.rb",
54
- "scripts/simple_benchmark.rb",
55
- "spec/integration/associations_spec.rb",
56
- "spec/integration/compliance_spec.rb",
57
- "spec/integration/date_spec.rb",
58
- "spec/integration/limit_and_order_spec.rb",
59
- "spec/integration/migrations_spec.rb",
60
- "spec/integration/multiple_records_spec.rb",
61
- "spec/integration/nils_spec.rb",
62
- "spec/integration/sdb_array_spec.rb",
63
- "spec/integration/simpledb_adapter_spec.rb",
64
- "spec/integration/spec_helper.rb",
65
- "spec/spec.opts",
66
- "spec/unit/record_spec.rb",
67
- "spec/unit/simpledb_adapter_spec.rb",
68
- "spec/unit/unit_spec_helper.rb"
69
- ]
70
- s.homepage = %q{http://github.com/devver/dm-adapter-simpledb}
71
- s.rdoc_options = ["--charset=UTF-8"]
72
- s.require_paths = ["lib"]
73
- s.rubygems_version = %q{1.3.5}
74
- s.summary = %q{DataMapper adapter for Amazon SimpleDB}
75
- s.test_files = [
76
- "spec/integration/nils_spec.rb",
77
- "spec/integration/limit_and_order_spec.rb",
78
- "spec/integration/compliance_spec.rb",
79
- "spec/integration/simpledb_adapter_spec.rb",
80
- "spec/integration/date_spec.rb",
81
- "spec/integration/sdb_array_spec.rb",
82
- "spec/integration/migrations_spec.rb",
83
- "spec/integration/spec_helper.rb",
84
- "spec/integration/multiple_records_spec.rb",
85
- "spec/integration/associations_spec.rb",
86
- "spec/unit/simpledb_adapter_spec.rb",
87
- "spec/unit/unit_spec_helper.rb",
88
- "spec/unit/record_spec.rb"
89
- ]
90
-
91
- if s.respond_to? :specification_version then
92
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
93
- s.specification_version = 3
94
-
95
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
96
- s.add_runtime_dependency(%q<dm-core>, ["~> 0.10.0"])
97
- s.add_runtime_dependency(%q<dm-aggregates>, ["~> 0.10.0"])
98
- s.add_runtime_dependency(%q<dm-migrations>, ["~> 0.10.0"])
99
- s.add_runtime_dependency(%q<dm-types>, ["~> 0.10.0"])
100
- s.add_runtime_dependency(%q<uuidtools>, ["~> 2.0"])
101
- s.add_runtime_dependency(%q<right_aws>, ["~> 1.10"])
102
- else
103
- s.add_dependency(%q<dm-core>, ["~> 0.10.0"])
104
- s.add_dependency(%q<dm-aggregates>, ["~> 0.10.0"])
105
- s.add_dependency(%q<dm-migrations>, ["~> 0.10.0"])
106
- s.add_dependency(%q<dm-types>, ["~> 0.10.0"])
107
- s.add_dependency(%q<uuidtools>, ["~> 2.0"])
108
- s.add_dependency(%q<right_aws>, ["~> 1.10"])
109
- end
110
- else
111
- s.add_dependency(%q<dm-core>, ["~> 0.10.0"])
112
- s.add_dependency(%q<dm-aggregates>, ["~> 0.10.0"])
113
- s.add_dependency(%q<dm-migrations>, ["~> 0.10.0"])
114
- s.add_dependency(%q<dm-types>, ["~> 0.10.0"])
115
- s.add_dependency(%q<uuidtools>, ["~> 2.0"])
116
- s.add_dependency(%q<right_aws>, ["~> 1.10"])
117
- end
118
- end
119
-