mongoid_upk 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.rvmrc +83 -0
- data/Gemfile +17 -0
- data/Gemfile.lock +73 -0
- data/LICENSE +7 -0
- data/README.md +84 -0
- data/Rakefile +35 -0
- data/lib/mongoid_upk.rb +48 -0
- data/lib/mongoid_upk/version.rb +6 -0
- data/mongoid_upk.gemspec +77 -0
- data/spec/mongoid_upk_spec.rb +39 -0
- data/spec/spec_helper.rb +21 -0
- metadata +171 -0
data/.rvmrc
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
# This is an RVM Project .rvmrc file, used to automatically load the ruby
|
4
|
+
# development environment upon cd'ing into the directory
|
5
|
+
|
6
|
+
# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
|
7
|
+
# Only full ruby name is supported here, for short names use:
|
8
|
+
# echo "rvm use 1.9.3" > .rvmrc
|
9
|
+
environment_id="ruby-1.9.3-p0@mongoid_upk"
|
10
|
+
|
11
|
+
#
|
12
|
+
# Uncomment the following lines if you want to verify rvm version per project
|
13
|
+
#
|
14
|
+
# rvmrc_rvm_version="1.10.2" # 1.10.1 seams as a safe start
|
15
|
+
# eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
|
16
|
+
# echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
|
17
|
+
# return 1
|
18
|
+
# }
|
19
|
+
#
|
20
|
+
|
21
|
+
#
|
22
|
+
# Uncomment following line if you want options to be set only for given project.
|
23
|
+
#
|
24
|
+
# PROJECT_JRUBY_OPTS=( --1.9 )
|
25
|
+
#
|
26
|
+
# The variable PROJECT_JRUBY_OPTS requires the following to be run in shell:
|
27
|
+
#
|
28
|
+
# chmod +x ${rvm_path}/hooks/after_use_jruby_opts
|
29
|
+
#
|
30
|
+
|
31
|
+
#
|
32
|
+
# First we attempt to load the desired environment directly from the environment
|
33
|
+
# file. This is very fast and efficient compared to running through the entire
|
34
|
+
# CLI and selector. If you want feedback on which environment was used then
|
35
|
+
# insert the word 'use' after --create as this triggers verbose mode.
|
36
|
+
#
|
37
|
+
if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
|
38
|
+
&& -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
|
39
|
+
then
|
40
|
+
\. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
|
41
|
+
|
42
|
+
if [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]]
|
43
|
+
then
|
44
|
+
. "${rvm_path:-$HOME/.rvm}/hooks/after_use"
|
45
|
+
fi
|
46
|
+
else
|
47
|
+
# If the environment file has not yet been created, use the RVM CLI to select.
|
48
|
+
if ! rvm --create use "$environment_id"
|
49
|
+
then
|
50
|
+
echo "Failed to create RVM environment '${environment_id}'."
|
51
|
+
return 1
|
52
|
+
fi
|
53
|
+
fi
|
54
|
+
|
55
|
+
#
|
56
|
+
# If you use an RVM gemset file to install a list of gems (*.gems), you can have
|
57
|
+
# it be automatically loaded. Uncomment the following and adjust the filename if
|
58
|
+
# necessary.
|
59
|
+
#
|
60
|
+
# filename=".gems"
|
61
|
+
# if [[ -s "$filename" ]]
|
62
|
+
# then
|
63
|
+
# rvm gemset import "$filename" | grep -v already | grep -v listed | grep -v complete | sed '/^$/d'
|
64
|
+
# fi
|
65
|
+
|
66
|
+
# If you use bundler, this might be useful to you:
|
67
|
+
# if [[ -s Gemfile ]] && ! command -v bundle >/dev/null
|
68
|
+
# then
|
69
|
+
# printf "%b" "The rubygem 'bundler' is not installed. Installing it now.\n"
|
70
|
+
# gem install bundler
|
71
|
+
# fi
|
72
|
+
# if [[ -s Gemfile ]] && command -v bundle
|
73
|
+
# then
|
74
|
+
# bundle install
|
75
|
+
# fi
|
76
|
+
|
77
|
+
if [[ $- == *i* ]] # check for interactive shells
|
78
|
+
then
|
79
|
+
echo "Using: $(tput setaf 2)$GEM_HOME$(tput sgr0)" # show the user the ruby and gemset they are using in green
|
80
|
+
else
|
81
|
+
echo "Using: $GEM_HOME" # don't use colors in interactive shells
|
82
|
+
fi
|
83
|
+
|
data/Gemfile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
source "https://rubygems.org"
|
3
|
+
|
4
|
+
gem "bson_ext"
|
5
|
+
gem "mongoid"
|
6
|
+
gem "uuid"
|
7
|
+
gem "activesupport"
|
8
|
+
|
9
|
+
group :development, :test do
|
10
|
+
gem "rake"
|
11
|
+
gem "rspec"
|
12
|
+
gem "database_cleaner"
|
13
|
+
gem "jeweler"
|
14
|
+
|
15
|
+
gem "pry"
|
16
|
+
gem "pry-doc"
|
17
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
GEM
|
2
|
+
remote: https://rubygems.org/
|
3
|
+
specs:
|
4
|
+
activemodel (3.2.1)
|
5
|
+
activesupport (= 3.2.1)
|
6
|
+
builder (~> 3.0.0)
|
7
|
+
activesupport (3.2.1)
|
8
|
+
i18n (~> 0.6)
|
9
|
+
multi_json (~> 1.0)
|
10
|
+
bson (1.5.2)
|
11
|
+
bson_ext (1.5.2)
|
12
|
+
bson (= 1.5.2)
|
13
|
+
builder (3.0.0)
|
14
|
+
coderay (1.0.5)
|
15
|
+
database_cleaner (0.7.1)
|
16
|
+
diff-lcs (1.1.3)
|
17
|
+
git (1.2.5)
|
18
|
+
i18n (0.6.0)
|
19
|
+
jeweler (1.8.3)
|
20
|
+
bundler (~> 1.0)
|
21
|
+
git (>= 1.2.5)
|
22
|
+
rake
|
23
|
+
rdoc
|
24
|
+
json (1.6.5)
|
25
|
+
macaddr (1.5.0)
|
26
|
+
systemu (>= 2.4.0)
|
27
|
+
method_source (0.7.0)
|
28
|
+
mongo (1.5.2)
|
29
|
+
bson (= 1.5.2)
|
30
|
+
mongoid (2.4.3)
|
31
|
+
activemodel (~> 3.1)
|
32
|
+
mongo (~> 1.3)
|
33
|
+
tzinfo (~> 0.3.22)
|
34
|
+
multi_json (1.0.4)
|
35
|
+
pry (0.9.8.1)
|
36
|
+
coderay (~> 1.0.5)
|
37
|
+
method_source (~> 0.7)
|
38
|
+
slop (>= 2.4.3, < 3)
|
39
|
+
pry-doc (0.4.0)
|
40
|
+
pry (>= 0.9.0)
|
41
|
+
yard (~> 0.7.4)
|
42
|
+
rake (0.9.2.2)
|
43
|
+
rdoc (3.12)
|
44
|
+
json (~> 1.4)
|
45
|
+
rspec (2.8.0)
|
46
|
+
rspec-core (~> 2.8.0)
|
47
|
+
rspec-expectations (~> 2.8.0)
|
48
|
+
rspec-mocks (~> 2.8.0)
|
49
|
+
rspec-core (2.8.0)
|
50
|
+
rspec-expectations (2.8.0)
|
51
|
+
diff-lcs (~> 1.1.2)
|
52
|
+
rspec-mocks (2.8.0)
|
53
|
+
slop (2.4.3)
|
54
|
+
systemu (2.4.2)
|
55
|
+
tzinfo (0.3.31)
|
56
|
+
uuid (2.3.5)
|
57
|
+
macaddr (~> 1.0)
|
58
|
+
yard (0.7.5)
|
59
|
+
|
60
|
+
PLATFORMS
|
61
|
+
ruby
|
62
|
+
|
63
|
+
DEPENDENCIES
|
64
|
+
activesupport
|
65
|
+
bson_ext
|
66
|
+
database_cleaner
|
67
|
+
jeweler
|
68
|
+
mongoid
|
69
|
+
pry
|
70
|
+
pry-doc
|
71
|
+
rake
|
72
|
+
rspec
|
73
|
+
uuid
|
data/LICENSE
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
Copyright (c) 2012 Christoph 'asaaki' Grabo
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
4
|
+
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
6
|
+
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# Mongoid::UPK
|
2
|
+
|
3
|
+
Mongoid::UPK generates more unique `_id` by using UUID.
|
4
|
+
|
5
|
+
UPK stands for "unique primary key" or "uuid primary key".
|
6
|
+
|
7
|
+
## Install
|
8
|
+
|
9
|
+
```bash
|
10
|
+
gem install mongoid_upk
|
11
|
+
```
|
12
|
+
|
13
|
+
**Gemfile**
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
gem "mongoid_upk"
|
17
|
+
```
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
class MyModel
|
23
|
+
include Mongoid::Document
|
24
|
+
include Mongoid::UPK
|
25
|
+
end
|
26
|
+
```
|
27
|
+
|
28
|
+
Will automatically use `UUID` ([uuid gem](https://github.com/assaf/uuid) by assaf), `:compact` mode per default.
|
29
|
+
|
30
|
+
**Explicit definition**
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
class MyModel
|
34
|
+
include Mongoid::Document
|
35
|
+
include Mongoid::UPK
|
36
|
+
uuid_pk
|
37
|
+
end
|
38
|
+
```
|
39
|
+
|
40
|
+
Same as above.
|
41
|
+
|
42
|
+
**Pretty UUID**
|
43
|
+
|
44
|
+
```ruby
|
45
|
+
class MyModel
|
46
|
+
include Mongoid::Document
|
47
|
+
include Mongoid::UPK
|
48
|
+
pretty_uuid_pk
|
49
|
+
end
|
50
|
+
```
|
51
|
+
|
52
|
+
Almost same as above but with hyphens in it.
|
53
|
+
(Example: `c1b457b0-3214-012f-316d-10e6baa29f2c`)
|
54
|
+
|
55
|
+
**Mixed ID**
|
56
|
+
|
57
|
+
```ruby
|
58
|
+
class MyModel
|
59
|
+
include Mongoid::Document
|
60
|
+
include Mongoid::UPK
|
61
|
+
bson_uuid_pk
|
62
|
+
end
|
63
|
+
```
|
64
|
+
|
65
|
+
Very long `_id` with both BSON::ObjectId **and** UUID.
|
66
|
+
(Example: `4f2e55a2ee911332c4000001-95faf560320f012f315510e6baa29f2c`)
|
67
|
+
|
68
|
+
## Motivation
|
69
|
+
|
70
|
+
While writing very fast to MongoDB it is possible to take an BSON::ObjectId twice.
|
71
|
+
This will lead to big troubles because you never know which document will be returned.
|
72
|
+
|
73
|
+
This gem utilizes the `key` method and overwrites the automatically given default id with the choosen generator on save.
|
74
|
+
So the real id can be read first after a successful save (I don't want to hack deeper here, because saves are more important than getting a unique id on instance initialization).
|
75
|
+
|
76
|
+
UUID is in most cases more reliable, especially if the app instances are set up correctly (and/or running on different machines).
|
77
|
+
|
78
|
+
Read more about the [UUID gem and how to set up your project (e.g. using unicorn or other threaded webservers)](https://github.com/assaf/uuid).
|
79
|
+
|
80
|
+
## License
|
81
|
+
|
82
|
+
MIT/X11
|
83
|
+
|
84
|
+
2012 — [Christoph 'asaaki' Grabo](https://github.com/asaaki)
|
data/Rakefile
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
|
3
|
+
|
4
|
+
require "rubygems"
|
5
|
+
require "bundler"
|
6
|
+
begin
|
7
|
+
Bundler.setup(:default, :development)
|
8
|
+
rescue Bundler::BundlerError => e
|
9
|
+
$stderr.puts e.message
|
10
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
11
|
+
exit e.status_code
|
12
|
+
end
|
13
|
+
require "rake"
|
14
|
+
require "jeweler"
|
15
|
+
require "rspec/core"
|
16
|
+
require "rspec/core/rake_task"
|
17
|
+
require "mongoid_upk/version"
|
18
|
+
|
19
|
+
Jeweler::Tasks.new do |gem|
|
20
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
21
|
+
gem.name = "mongoid_upk"
|
22
|
+
gem.version = Mongoid::UPK::VERSION
|
23
|
+
gem.homepage = "http://github.com/asaaki/mongoid_upk"
|
24
|
+
gem.license = "MIT"
|
25
|
+
gem.summary = %Q{Mongoid::UPK generates more unique `_id`}
|
26
|
+
gem.description = %Q{Mongoid::UPK generates more unique `_id` by using UUID.}
|
27
|
+
gem.email = "chris@dinarrr.com"
|
28
|
+
gem.authors = ["Christoph Grabo"]
|
29
|
+
# dependencies defined in Gemfile
|
30
|
+
end
|
31
|
+
Jeweler::RubygemsDotOrgTasks.new
|
32
|
+
|
33
|
+
RSpec::Core::RakeTask.new(:spec)
|
34
|
+
|
35
|
+
task :default => :spec
|
data/lib/mongoid_upk.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require "uuid"
|
3
|
+
|
4
|
+
module Mongoid
|
5
|
+
module UPK
|
6
|
+
|
7
|
+
class MissingDependency < StandardError
|
8
|
+
end
|
9
|
+
|
10
|
+
extend ActiveSupport::Concern
|
11
|
+
|
12
|
+
included do
|
13
|
+
unless self.ancestors.include?(Mongoid::Document)
|
14
|
+
raise MissingDependency, "You must include Mongoid::Document BEFORE Mongoid::UPK"
|
15
|
+
end
|
16
|
+
uuid_pk
|
17
|
+
end
|
18
|
+
|
19
|
+
module ClassMethods
|
20
|
+
|
21
|
+
# UUID compact (32 digits)
|
22
|
+
def uuid_pk
|
23
|
+
key :_id do |origin_bson_id|
|
24
|
+
uuid = UUID.new
|
25
|
+
"#{uuid.generate(:compact)}"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# UUID with hyphens (36 digits)
|
30
|
+
def pretty_uuid_pk
|
31
|
+
key :_id do |origin_bson_id|
|
32
|
+
uuid = UUID.new
|
33
|
+
"#{uuid.generate}"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# BSON::ObjectId + UUID
|
38
|
+
def bson_uuid_pk
|
39
|
+
key :_id do |origin_bson_id|
|
40
|
+
uuid = UUID.new
|
41
|
+
"#{origin_bson_id}-#{uuid.generate(:compact)}"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
end
|
data/mongoid_upk.gemspec
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "mongoid_upk"
|
8
|
+
s.version = "0.0.2"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Christoph Grabo"]
|
12
|
+
s.date = "2012-02-05"
|
13
|
+
s.description = "Mongoid::UPK generates more unique `_id` by using UUID."
|
14
|
+
s.email = "chris@dinarrr.com"
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.md"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".rvmrc",
|
21
|
+
"Gemfile",
|
22
|
+
"Gemfile.lock",
|
23
|
+
"LICENSE",
|
24
|
+
"README.md",
|
25
|
+
"Rakefile",
|
26
|
+
"lib/mongoid_upk.rb",
|
27
|
+
"lib/mongoid_upk/version.rb",
|
28
|
+
"mongoid_upk.gemspec",
|
29
|
+
"spec/mongoid_upk_spec.rb",
|
30
|
+
"spec/spec_helper.rb"
|
31
|
+
]
|
32
|
+
s.homepage = "http://github.com/asaaki/mongoid_upk"
|
33
|
+
s.licenses = ["MIT"]
|
34
|
+
s.require_paths = ["lib"]
|
35
|
+
s.rubygems_version = "1.8.15"
|
36
|
+
s.summary = "Mongoid::UPK generates more unique `_id`"
|
37
|
+
|
38
|
+
if s.respond_to? :specification_version then
|
39
|
+
s.specification_version = 3
|
40
|
+
|
41
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
42
|
+
s.add_runtime_dependency(%q<bson_ext>, [">= 0"])
|
43
|
+
s.add_runtime_dependency(%q<mongoid>, [">= 0"])
|
44
|
+
s.add_runtime_dependency(%q<uuid>, [">= 0"])
|
45
|
+
s.add_runtime_dependency(%q<activesupport>, [">= 0"])
|
46
|
+
s.add_development_dependency(%q<rake>, [">= 0"])
|
47
|
+
s.add_development_dependency(%q<rspec>, [">= 0"])
|
48
|
+
s.add_development_dependency(%q<database_cleaner>, [">= 0"])
|
49
|
+
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
50
|
+
s.add_development_dependency(%q<pry>, [">= 0"])
|
51
|
+
s.add_development_dependency(%q<pry-doc>, [">= 0"])
|
52
|
+
else
|
53
|
+
s.add_dependency(%q<bson_ext>, [">= 0"])
|
54
|
+
s.add_dependency(%q<mongoid>, [">= 0"])
|
55
|
+
s.add_dependency(%q<uuid>, [">= 0"])
|
56
|
+
s.add_dependency(%q<activesupport>, [">= 0"])
|
57
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
58
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
59
|
+
s.add_dependency(%q<database_cleaner>, [">= 0"])
|
60
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
61
|
+
s.add_dependency(%q<pry>, [">= 0"])
|
62
|
+
s.add_dependency(%q<pry-doc>, [">= 0"])
|
63
|
+
end
|
64
|
+
else
|
65
|
+
s.add_dependency(%q<bson_ext>, [">= 0"])
|
66
|
+
s.add_dependency(%q<mongoid>, [">= 0"])
|
67
|
+
s.add_dependency(%q<uuid>, [">= 0"])
|
68
|
+
s.add_dependency(%q<activesupport>, [">= 0"])
|
69
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
70
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
71
|
+
s.add_dependency(%q<database_cleaner>, [">= 0"])
|
72
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
73
|
+
s.add_dependency(%q<pry>, [">= 0"])
|
74
|
+
s.add_dependency(%q<pry-doc>, [">= 0"])
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
3
|
+
|
4
|
+
class TestDoc
|
5
|
+
include Mongoid::Document
|
6
|
+
include Mongoid::UPK
|
7
|
+
|
8
|
+
field :name
|
9
|
+
end
|
10
|
+
|
11
|
+
describe Mongoid::UPK do
|
12
|
+
it "automatic uuid generator" do
|
13
|
+
td = TestDoc.new
|
14
|
+
old_id = td._id
|
15
|
+
td.save and td.reload
|
16
|
+
td._id.should_not == old_id
|
17
|
+
end
|
18
|
+
|
19
|
+
it "bson id + uuid" do
|
20
|
+
class TestDoc2 < TestDoc
|
21
|
+
bson_uuid_pk
|
22
|
+
end
|
23
|
+
|
24
|
+
td = TestDoc2.new
|
25
|
+
old_id = td._id
|
26
|
+
td.save and td.reload
|
27
|
+
td._id.should_not == old_id
|
28
|
+
td._id.should =~ /#{old_id}/
|
29
|
+
end
|
30
|
+
|
31
|
+
it "raises error if dependency not met" do
|
32
|
+
expect {
|
33
|
+
class FailTest
|
34
|
+
include Mongoid::UPK
|
35
|
+
end
|
36
|
+
}.to raise_error(Mongoid::UPK::MissingDependency)
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift(File.expand_path("../../lib",__FILE__))
|
4
|
+
|
5
|
+
require "database_cleaner"
|
6
|
+
require "mongoid"
|
7
|
+
require "mongoid_upk"
|
8
|
+
|
9
|
+
RSpec.configure do |config|
|
10
|
+
config.before(:suite) do
|
11
|
+
DatabaseCleaner.strategy = :truncation
|
12
|
+
end
|
13
|
+
|
14
|
+
config.after(:each) do
|
15
|
+
DatabaseCleaner.clean
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
Mongoid.configure do |config|
|
20
|
+
config.master = Mongo::Connection.new.db("mongoid_upk_test")
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,171 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mongoid_upk
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Christoph Grabo
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-02-05 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bson_ext
|
16
|
+
requirement: &7357340 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *7357340
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: mongoid
|
27
|
+
requirement: &7356860 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *7356860
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: uuid
|
38
|
+
requirement: &7356380 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *7356380
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: activesupport
|
49
|
+
requirement: &7355900 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :runtime
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *7355900
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: rake
|
60
|
+
requirement: &7355420 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *7355420
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: &7354940 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *7354940
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: database_cleaner
|
82
|
+
requirement: &7354460 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *7354460
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: jeweler
|
93
|
+
requirement: &7353980 !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
type: :development
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: *7353980
|
102
|
+
- !ruby/object:Gem::Dependency
|
103
|
+
name: pry
|
104
|
+
requirement: &7353500 !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: *7353500
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: pry-doc
|
115
|
+
requirement: &7369420 !ruby/object:Gem::Requirement
|
116
|
+
none: false
|
117
|
+
requirements:
|
118
|
+
- - ! '>='
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
type: :development
|
122
|
+
prerelease: false
|
123
|
+
version_requirements: *7369420
|
124
|
+
description: Mongoid::UPK generates more unique `_id` by using UUID.
|
125
|
+
email: chris@dinarrr.com
|
126
|
+
executables: []
|
127
|
+
extensions: []
|
128
|
+
extra_rdoc_files:
|
129
|
+
- LICENSE
|
130
|
+
- README.md
|
131
|
+
files:
|
132
|
+
- .rvmrc
|
133
|
+
- Gemfile
|
134
|
+
- Gemfile.lock
|
135
|
+
- LICENSE
|
136
|
+
- README.md
|
137
|
+
- Rakefile
|
138
|
+
- lib/mongoid_upk.rb
|
139
|
+
- lib/mongoid_upk/version.rb
|
140
|
+
- mongoid_upk.gemspec
|
141
|
+
- spec/mongoid_upk_spec.rb
|
142
|
+
- spec/spec_helper.rb
|
143
|
+
homepage: http://github.com/asaaki/mongoid_upk
|
144
|
+
licenses:
|
145
|
+
- MIT
|
146
|
+
post_install_message:
|
147
|
+
rdoc_options: []
|
148
|
+
require_paths:
|
149
|
+
- lib
|
150
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
151
|
+
none: false
|
152
|
+
requirements:
|
153
|
+
- - ! '>='
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: '0'
|
156
|
+
segments:
|
157
|
+
- 0
|
158
|
+
hash: 762031412242489430
|
159
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
160
|
+
none: false
|
161
|
+
requirements:
|
162
|
+
- - ! '>='
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: '0'
|
165
|
+
requirements: []
|
166
|
+
rubyforge_project:
|
167
|
+
rubygems_version: 1.8.15
|
168
|
+
signing_key:
|
169
|
+
specification_version: 3
|
170
|
+
summary: Mongoid::UPK generates more unique `_id`
|
171
|
+
test_files: []
|