dynamoid 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.document +5 -0
- data/.gitignore +67 -0
- data/.rspec +2 -0
- data/.travis.yml +15 -0
- data/CHANGELOG.md +20 -2
- data/Gemfile +3 -1
- data/{README.markdown → README.md} +30 -6
- data/Rakefile +17 -20
- data/dynamoid.gemspec +45 -68
- data/lib/dynamoid.rb +20 -18
- data/lib/dynamoid/adapter.rb +11 -2
- data/lib/dynamoid/adapter_plugin/aws_sdk_v2.rb +313 -48
- data/lib/dynamoid/associations/association.rb +11 -0
- data/lib/dynamoid/associations/many_association.rb +4 -2
- data/lib/dynamoid/associations/single_association.rb +1 -1
- data/lib/dynamoid/components.rb +1 -0
- data/lib/dynamoid/config.rb +3 -0
- data/lib/dynamoid/criteria/chain.rb +12 -10
- data/lib/dynamoid/document.rb +5 -3
- data/lib/dynamoid/errors.rb +17 -3
- data/lib/dynamoid/fields.rb +19 -5
- data/lib/dynamoid/finders.rb +65 -0
- data/lib/dynamoid/indexes.rb +273 -0
- data/lib/dynamoid/persistence.rb +14 -3
- data/lib/dynamoid/validations.rb +27 -0
- data/lib/dynamoid/version.rb +3 -0
- metadata +41 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 79a156ccd69a903440d15d65b4eeb89f5f875d9e
|
4
|
+
data.tar.gz: f4cfabc262d301f92bed990a217f188ac7956c8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f3d1a4e7fad25f44a098c1cbcfbe5807ddc49f6558835b1411c4abe1171f51980b653b3391eab0d761d37650d38e0cca428dfa5e078d5f58688e95e1f023961
|
7
|
+
data.tar.gz: fae777d74e2b1477ae8c688491ad48b2a6f8f0fd4c2dc2b229a40970ceae1aeaa54fd9fc8a490534fc1013db877eb3a4abe23ffbadd8fbe674d7c3f9a1af9984
|
data/.document
ADDED
data/.gitignore
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
.project
|
2
|
+
|
3
|
+
# rcov generated
|
4
|
+
coverage
|
5
|
+
|
6
|
+
# rdoc generated
|
7
|
+
rdoc
|
8
|
+
|
9
|
+
# yardoc generated
|
10
|
+
.yardoc
|
11
|
+
/_yardoc/
|
12
|
+
|
13
|
+
# bundler
|
14
|
+
/.bundle/
|
15
|
+
|
16
|
+
# jeweler generated
|
17
|
+
/pkg/
|
18
|
+
|
19
|
+
# Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
|
20
|
+
#
|
21
|
+
# * Create a file at ~/.gitignore
|
22
|
+
# * Include files you want ignored
|
23
|
+
# * Run: git config --global core.excludesfile ~/.gitignore
|
24
|
+
#
|
25
|
+
# After doing this, these files will be ignored in all your git projects,
|
26
|
+
# saving you from having to 'pollute' every project you touch with them
|
27
|
+
#
|
28
|
+
# Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
|
29
|
+
#
|
30
|
+
# For MacOS:
|
31
|
+
#
|
32
|
+
#.DS_Store
|
33
|
+
|
34
|
+
# For TextMate
|
35
|
+
#*.tmproj
|
36
|
+
#tmtags
|
37
|
+
|
38
|
+
# For emacs:
|
39
|
+
#*~
|
40
|
+
#\#*
|
41
|
+
#.\#*
|
42
|
+
|
43
|
+
# For vim:
|
44
|
+
#*.swp
|
45
|
+
|
46
|
+
# For redcar:
|
47
|
+
#.redcar
|
48
|
+
|
49
|
+
# For rubinius:
|
50
|
+
#*.rbc
|
51
|
+
|
52
|
+
# for RVM
|
53
|
+
.rvmrc
|
54
|
+
|
55
|
+
# For RubyMine:
|
56
|
+
/.idea/
|
57
|
+
|
58
|
+
# For Ctags
|
59
|
+
.gemtags
|
60
|
+
.tags
|
61
|
+
.tags_sorted_by_file
|
62
|
+
|
63
|
+
/Gemfile.lock
|
64
|
+
/doc/
|
65
|
+
/spec/reports/
|
66
|
+
/tmp/
|
67
|
+
/spec/DynamoDBLocal-latest/
|
data/.rspec
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
language: ruby
|
2
|
+
rvm:
|
3
|
+
- ruby-2.0.0-p648
|
4
|
+
- ruby-2.1.10
|
5
|
+
- ruby-2.2.5
|
6
|
+
- ruby-2.3.1
|
7
|
+
- jruby-9.1.4.0
|
8
|
+
before_install: gem install bundler -v 1.12.5
|
9
|
+
install:
|
10
|
+
- wget http://dynamodb-local.s3-website-us-west-2.amazonaws.com/dynamodb_local_latest.zip --quiet -O spec/dynamodb_temp.zip
|
11
|
+
- unzip -qq spec/dynamodb_temp.zip -d spec/DynamoDBLocal-latest
|
12
|
+
- rm spec/dynamodb_temp.zip
|
13
|
+
script:
|
14
|
+
- bundle install
|
15
|
+
- bundle exec rake unattended_spec
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,25 @@
|
|
1
|
+
# 1.2.0
|
2
|
+
|
3
|
+
* Add create_table_syncronously, and sync: option to regular create_table (@pboling)
|
4
|
+
* make required for tables created with secondary indexes
|
5
|
+
* Expose and fix truncate method on adapter (#52, @pcorpet)
|
6
|
+
* Enable saving without updating timestamps (#58, @cignoir)
|
7
|
+
* Fix projected attributes by checking for :include (#56, @yoshida_tetsuhiro)
|
8
|
+
* Make behavior of association where method closer to AR by cloning instead of modifying (#51, @pcorpet)
|
9
|
+
* Add boolean field presence validator (#50, @pcorpet)
|
10
|
+
* Add association build method (#49, @pcorpet)
|
11
|
+
* Fix association create method (#47, #48, @pcorpet)
|
12
|
+
* Support range_between (#42, @ayemos)
|
13
|
+
* Fix problems with range query (#42, @ayemos)
|
14
|
+
* Don't prefix table names when namespace is nil (#40, @brenden)
|
15
|
+
* Added basic secondary index support (#34, @sumocoder)
|
16
|
+
* Fix query attribute behavior for booleans (#35, @amirmanji)
|
17
|
+
* Ignore unknown fields on model initialize (PR #33, @sumocoder)
|
18
|
+
|
1
19
|
# 1.1.0
|
2
20
|
|
3
|
-
* Added support for optimistic locking on delete (PR #29, sumocoder)
|
4
|
-
* upgrade concurrent-ruby requirement to 1.0 (PR #31, keithmgould)
|
21
|
+
* Added support for optimistic locking on delete (PR #29, @sumocoder)
|
22
|
+
* upgrade concurrent-ruby requirement to 1.0 (PR #31, @keithmgould)
|
5
23
|
|
6
24
|
# 1.0.0
|
7
25
|
|
data/Gemfile
CHANGED
@@ -56,10 +56,10 @@ Then you need to initialize Dynamoid config to get it going. Put code similar to
|
|
56
56
|
```ruby
|
57
57
|
Dynamoid.configure do |config|
|
58
58
|
config.adapter = 'aws_sdk_v2' # This adapter establishes a connection to the DynamoDB servers using Amazon's own AWS gem.
|
59
|
-
config.namespace = "dynamoid_app_development" # To namespace tables created by Dynamoid from other tables you might have.
|
59
|
+
config.namespace = "dynamoid_app_development" # To namespace tables created by Dynamoid from other tables you might have. Set to nil to avoid namespacing.
|
60
60
|
config.warn_on_scan = true # Output a warning to the logger when you perform a scan rather than a query on a table.
|
61
|
-
config.read_capacity =
|
62
|
-
config.write_capacity =
|
61
|
+
config.read_capacity = 5 # Read capacity for your tables
|
62
|
+
config.write_capacity = 5 # Write capacity for your tables
|
63
63
|
config.endpoint = 'http://localhost:3000' # [Optional]. If provided, it communicates with the DB listening at the endpoint. This is useful for testing with [Amazon Local DB] (http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Tools.DynamoDBLocal.html).
|
64
64
|
end
|
65
65
|
|
@@ -86,7 +86,7 @@ Dynamoid has some sensible defaults for you when you create a new table, includi
|
|
86
86
|
class User
|
87
87
|
include Dynamoid::Document
|
88
88
|
|
89
|
-
table :name => :awesome_users, :key => :user_id, :read_capacity =>
|
89
|
+
table :name => :awesome_users, :key => :user_id, :read_capacity => 5, :write_capacity => 5
|
90
90
|
end
|
91
91
|
```
|
92
92
|
|
@@ -356,12 +356,36 @@ Also, without contributors the project wouldn't be nearly as awesome. So many th
|
|
356
356
|
* [Jason Dew](https://github.com/jasondew)
|
357
357
|
* [Luis Arias](https://github.com/luisantonioa)
|
358
358
|
* [Stefan Neculai](https://github.com/stefanneculai)
|
359
|
-
* [Philip White](https://github.com/philipmw)
|
359
|
+
* [Philip White](https://github.com/philipmw) *
|
360
360
|
* [Peeyush Kumar](https://github.com/peeyush1234)
|
361
|
+
* [Sumanth Ravipati](https://github.com/sumocoder)
|
362
|
+
* [Pascal Corpet](https://github.com/pcorpet)
|
363
|
+
* [Brian Glusman](https://github.com/bglusman) *
|
364
|
+
* [Peter Boling](https://github.com/pboling) *
|
365
|
+
|
366
|
+
\* Current Maintianers
|
361
367
|
|
362
368
|
## Running the tests
|
363
369
|
|
364
|
-
Running the tests is fairly simple.
|
370
|
+
Running the tests is fairly simple. You should have an instance of DynamoDB running locally. Follow this steps to be able to run the tests:
|
371
|
+
|
372
|
+
* First download and unpack the latest version of DynamoDB.
|
373
|
+
|
374
|
+
```shell
|
375
|
+
bin/setup
|
376
|
+
```
|
377
|
+
|
378
|
+
* Start the local instance of DynamoDB to listen in ***8000*** port
|
379
|
+
|
380
|
+
```shell
|
381
|
+
bin/start_dynamodblocal
|
382
|
+
```
|
383
|
+
|
384
|
+
* and lastly, use `rake` to run the tests.
|
385
|
+
|
386
|
+
```shell
|
387
|
+
rake
|
388
|
+
```
|
365
389
|
|
366
390
|
[![Build Status](https://travis-ci.org/Dynamoid/Dynamoid.svg)](https://travis-ci.org/Dynamoid/Dynamoid)
|
367
391
|
[![Coverage Status](https://coveralls.io/repos/Dynamoid/Dynamoid/badge.svg?branch=master&service=github)](https://coveralls.io/github/Dynamoid/Dynamoid?branch=master)
|
data/Rakefile
CHANGED
@@ -1,7 +1,5 @@
|
|
1
|
-
|
1
|
+
require "bundler/gem_tasks"
|
2
2
|
|
3
|
-
require 'rubygems'
|
4
|
-
require 'bundler'
|
5
3
|
begin
|
6
4
|
Bundler.setup(:default, :development)
|
7
5
|
rescue Bundler::BundlerError => e
|
@@ -9,47 +7,46 @@ rescue Bundler::BundlerError => e
|
|
9
7
|
$stderr.puts "Run `bundle install` to install missing gems"
|
10
8
|
exit e.status_code
|
11
9
|
end
|
12
|
-
require 'rake'
|
13
10
|
|
14
|
-
require
|
15
|
-
require
|
11
|
+
require "rake"
|
12
|
+
require "rspec/core/rake_task"
|
16
13
|
RSpec::Core::RakeTask.new(:spec) do |spec|
|
17
|
-
spec.pattern = FileList[
|
14
|
+
spec.pattern = FileList["spec/**/*_spec.rb"]
|
18
15
|
end
|
19
16
|
|
20
17
|
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
21
|
-
spec.pattern =
|
18
|
+
spec.pattern = "spec/**/*_spec.rb"
|
22
19
|
spec.rcov = true
|
23
20
|
end
|
24
21
|
|
25
22
|
desc "Start DynamoDBLocal, run tests, clean up"
|
26
23
|
task :unattended_spec do |t|
|
27
|
-
|
28
|
-
if system(
|
29
|
-
puts
|
24
|
+
|
25
|
+
if system("bin/start_dynamodblocal")
|
26
|
+
puts "DynamoDBLocal started; proceeding with specs."
|
30
27
|
else
|
31
|
-
raise
|
28
|
+
raise "Unable to start DynamoDBLocal. Cannot run unattended specs."
|
32
29
|
end
|
33
30
|
|
34
31
|
#Cleanup
|
35
32
|
at_exit do
|
36
|
-
unless system(
|
37
|
-
$stderr.puts
|
33
|
+
unless system("bin/stop_dynamodblocal")
|
34
|
+
$stderr.puts "Unable to cleanly stop DynamoDBLocal."
|
38
35
|
end
|
39
36
|
end
|
40
|
-
|
37
|
+
|
41
38
|
Rake::Task["spec"].invoke
|
42
39
|
end
|
43
40
|
|
44
|
-
require
|
41
|
+
require "yard"
|
45
42
|
YARD::Rake::YardocTask.new do |t|
|
46
|
-
t.files = [
|
47
|
-
t.options = [
|
43
|
+
t.files = ["lib/**/*.rb", "README", "LICENSE"] # optional
|
44
|
+
t.options = ["-m", "markdown"] # optional
|
48
45
|
end
|
49
46
|
|
50
|
-
desc
|
47
|
+
desc "Publish documentation to gh-pages"
|
51
48
|
task :publish do
|
52
|
-
Rake::Task[
|
49
|
+
Rake::Task["yard"].invoke
|
53
50
|
`git add .`
|
54
51
|
`git commit -m 'Regenerated documentation'`
|
55
52
|
`git checkout gh-pages`
|
data/dynamoid.gemspec
CHANGED
@@ -1,75 +1,52 @@
|
|
1
|
-
#
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "dynamoid/version"
|
2
5
|
|
3
|
-
Gem::Specification.new do |
|
4
|
-
|
5
|
-
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "dynamoid"
|
8
|
+
spec.version = Dynamoid::VERSION
|
6
9
|
|
7
10
|
# Keep in sync with README
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
11
|
+
spec.authors = [
|
12
|
+
"Josh Symonds",
|
13
|
+
"Logan Bowers",
|
14
|
+
"Craig Heneveld",
|
15
|
+
"Anatha Kumaran",
|
16
|
+
"Jason Dew",
|
17
|
+
"Luis Arias",
|
18
|
+
"Stefan Neculai",
|
19
|
+
"Philip White",
|
20
|
+
"Peeyush Kumar",
|
21
|
+
"Sumanth Ravipati",
|
22
|
+
"Pascal Corpet",
|
23
|
+
"Brian Glusman",
|
24
|
+
"Peter Boling"
|
18
25
|
]
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
26
|
+
spec.email = ["peter.boling@gmail.com", "brian@stellaservice.com"]
|
27
|
+
|
28
|
+
spec.description = "Dynamoid is an ORM for Amazon's DynamoDB that supports offline development, associations, querying, and everything else you'd expect from an ActiveRecord-style replacement."
|
29
|
+
spec.summary = "Dynamoid is an ORM for Amazon's DynamoDB"
|
30
|
+
spec.extra_rdoc_files = [
|
31
|
+
"LICENSE.txt",
|
32
|
+
"README.md"
|
23
33
|
]
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
Rakefile
|
31
|
-
dynamoid.gemspec
|
32
|
-
lib/dynamoid.rb
|
33
|
-
lib/dynamoid/adapter.rb
|
34
|
-
lib/dynamoid/adapter_plugin/aws_sdk_v2.rb
|
35
|
-
lib/dynamoid/associations.rb
|
36
|
-
lib/dynamoid/associations/association.rb
|
37
|
-
lib/dynamoid/associations/belongs_to.rb
|
38
|
-
lib/dynamoid/associations/has_and_belongs_to_many.rb
|
39
|
-
lib/dynamoid/associations/has_many.rb
|
40
|
-
lib/dynamoid/associations/has_one.rb
|
41
|
-
lib/dynamoid/associations/many_association.rb
|
42
|
-
lib/dynamoid/associations/single_association.rb
|
43
|
-
lib/dynamoid/components.rb
|
44
|
-
lib/dynamoid/config.rb
|
45
|
-
lib/dynamoid/config/options.rb
|
46
|
-
lib/dynamoid/criteria.rb
|
47
|
-
lib/dynamoid/criteria/chain.rb
|
48
|
-
lib/dynamoid/dirty.rb
|
49
|
-
lib/dynamoid/document.rb
|
50
|
-
lib/dynamoid/errors.rb
|
51
|
-
lib/dynamoid/fields.rb
|
52
|
-
lib/dynamoid/finders.rb
|
53
|
-
lib/dynamoid/identity_map.rb
|
54
|
-
lib/dynamoid/middleware/identity_map.rb
|
55
|
-
lib/dynamoid/persistence.rb
|
56
|
-
lib/dynamoid/validations.rb
|
57
|
-
)
|
58
|
-
s.homepage = "http://github.com/Dynamoid/Dynamoid"
|
59
|
-
s.licenses = ["MIT"]
|
60
|
-
s.require_paths = ["lib"]
|
61
|
-
s.rubygems_version = "1.8.24"
|
62
|
-
s.summary = "Dynamoid is an ORM for Amazon's DynamoDB"
|
34
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(bin|test|spec|features)/}) }
|
35
|
+
spec.homepage = "http://github.com/Dynamoid/Dynamoid"
|
36
|
+
spec.licenses = ["MIT"]
|
37
|
+
spec.bindir = "exe"
|
38
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
39
|
+
spec.require_paths = ["lib"]
|
63
40
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
41
|
+
spec.add_runtime_dependency(%q<activemodel>, ["~> 4"])
|
42
|
+
spec.add_runtime_dependency(%q<aws-sdk-resources>, ["~> 2"])
|
43
|
+
spec.add_runtime_dependency(%q<concurrent-ruby>, [">= 1.0"])
|
44
|
+
spec.add_development_dependency(%q<rake>, [">= 10"])
|
45
|
+
spec.add_development_dependency(%q<bundler>, ["~> 1.12"])
|
46
|
+
spec.add_development_dependency(%q<rspec>, [">= 3"])
|
47
|
+
spec.add_development_dependency(%q<yard>, [">= 0"])
|
48
|
+
spec.add_development_dependency(%q<github-markup>, [">= 0"])
|
49
|
+
spec.add_development_dependency(%q<pry>, [">= 0"])
|
50
|
+
spec.add_development_dependency(%q<coveralls>, [">= 0"])
|
51
|
+
spec.add_development_dependency(%q<rspec-retry>, [">= 0"])
|
74
52
|
end
|
75
|
-
|
data/lib/dynamoid.rb
CHANGED
@@ -3,27 +3,29 @@ require "time"
|
|
3
3
|
require "securerandom"
|
4
4
|
require "active_support"
|
5
5
|
require "active_support/core_ext"
|
6
|
-
require
|
6
|
+
require "active_support/json"
|
7
7
|
require "active_support/inflector"
|
8
8
|
require "active_support/lazy_load_hooks"
|
9
9
|
require "active_support/time_with_zone"
|
10
10
|
require "active_model"
|
11
11
|
|
12
|
-
require
|
13
|
-
require
|
14
|
-
require
|
15
|
-
require
|
16
|
-
require
|
17
|
-
require
|
18
|
-
require
|
19
|
-
require
|
20
|
-
require
|
21
|
-
require
|
22
|
-
require
|
23
|
-
require
|
24
|
-
require
|
25
|
-
|
26
|
-
require
|
12
|
+
require "dynamoid/version"
|
13
|
+
require "dynamoid/errors"
|
14
|
+
require "dynamoid/fields"
|
15
|
+
require "dynamoid/indexes"
|
16
|
+
require "dynamoid/associations"
|
17
|
+
require "dynamoid/persistence"
|
18
|
+
require "dynamoid/dirty"
|
19
|
+
require "dynamoid/validations"
|
20
|
+
require "dynamoid/criteria"
|
21
|
+
require "dynamoid/finders"
|
22
|
+
require "dynamoid/identity_map"
|
23
|
+
require "dynamoid/config"
|
24
|
+
require "dynamoid/components"
|
25
|
+
require "dynamoid/document"
|
26
|
+
require "dynamoid/adapter"
|
27
|
+
|
28
|
+
require "dynamoid/middleware/identity_map"
|
27
29
|
|
28
30
|
module Dynamoid
|
29
31
|
extend self
|
@@ -34,11 +36,11 @@ module Dynamoid
|
|
34
36
|
block_given? ? yield(Dynamoid::Config) : Dynamoid::Config
|
35
37
|
end
|
36
38
|
alias :config :configure
|
37
|
-
|
39
|
+
|
38
40
|
def logger
|
39
41
|
Dynamoid::Config.logger
|
40
42
|
end
|
41
|
-
|
43
|
+
|
42
44
|
def included_models
|
43
45
|
@included_models ||= []
|
44
46
|
end
|