mm_uses_no_id 0.0.1

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/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ .project
7
+ Gemfile.lock
8
+ InstalledFiles
9
+ _yardoc
10
+ coverage
11
+ doc/
12
+ lib/bundler/man
13
+ pkg
14
+ rdoc
15
+ spec/reports
16
+ test/tmp
17
+ test/version_tmp
18
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'http://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in mm_uses_no_id.gemspec
4
+ gemspec
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 [name of plugin creator]
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,33 @@
1
+
2
+ mm_uses_no_id plugin
3
+ ============
4
+
5
+ Embedded models that use this plugin don't have an id field by default. This can save on storage space if the id isn't needed.
6
+
7
+ Requirements
8
+ ============
9
+
10
+ - MongoMapper 0.10.1 or greater
11
+
12
+ Installation
13
+ =======
14
+
15
+ Add this to your Gemfile if using Bundler: `gem 'mm_uses_no_id'`
16
+
17
+ Or install the gem from the command line: `gem install mm_uses_no_id`
18
+
19
+ Usage
20
+ =======
21
+
22
+ Use the MongoMapper `plugin` method to add MmUsesNoId to your model, for example:
23
+
24
+ ```
25
+ class Person
26
+ include MongoMapper::EmbeddedDocument
27
+ plugin MmUsesNoId
28
+
29
+ key :name, String
30
+ end
31
+ ```
32
+
33
+ Copyright (c) 2011 PeepAll Ltd, released under the MIT license
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require 'bundler/gem_tasks'
@@ -0,0 +1,19 @@
1
+ require "mm_uses_no_id/version"
2
+ require 'active_support/concern'
3
+
4
+ module MmUsesNoId
5
+ extend ActiveSupport::Concern
6
+
7
+ included do
8
+ @keys.delete('_id')
9
+
10
+ end
11
+
12
+ module ClassMethods
13
+
14
+ end
15
+
16
+ module InstanceMethods
17
+
18
+ end
19
+ end
@@ -0,0 +1,3 @@
1
+ module MmUsesNoId
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/mm_uses_no_id/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Jonathan Chambers"]
6
+ gem.email = ["j.chambers@gmx.net"]
7
+ gem.description = %q{MongoMapper plugin that removes ID field from EmbeddedDocuments}
8
+ gem.summary = %q{id-less embedded docs for MM}
9
+ gem.homepage = 'https://github.com/jmchambers/mm_uses_no_id'
10
+
11
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
12
+ gem.files = `git ls-files`.split("\n")
13
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
14
+ gem.name = "mm_uses_no_id"
15
+ gem.require_paths = ['lib']
16
+ gem.version = MmUsesNoId::VERSION
17
+ gem.license = 'MIT'
18
+
19
+ gem.add_development_dependency "rspec", "~> 2.7"
20
+ gem.add_development_dependency "bson_ext", "~> 1.5.0"
21
+ gem.add_dependency "mongo_mapper", "~> 0.10.1"
22
+
23
+ end
@@ -0,0 +1,33 @@
1
+ require File.expand_path('../../lib/mm_uses_no_id', __FILE__)
2
+
3
+ describe MmUsesNoId do
4
+
5
+ before(:all) do
6
+ require 'mongo_mapper'
7
+
8
+ class Group
9
+ include MongoMapper::Document
10
+ many :people, :class_name => 'Person'
11
+ end
12
+
13
+ class Person
14
+ include MongoMapper::EmbeddedDocument
15
+ plugin MmUsesNoId
16
+
17
+ key :name
18
+ key :age
19
+ end
20
+
21
+ @group = Group.new
22
+ @person = Person.new(name: 'Jon', age: 33)
23
+ end
24
+
25
+ it "a new embedded document should have no _id field" do
26
+ @person.attributes.keys.should_not include('_id')
27
+ end
28
+
29
+ it "it should be possible to embed an id-less document inside a regular document" do
30
+ @group.people << @person
31
+ @group.people.should include(@person)
32
+ end
33
+ end
metadata ADDED
@@ -0,0 +1,116 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mm_uses_no_id
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ version: 0.0.1
10
+ platform: ruby
11
+ authors:
12
+ - Jonathan Chambers
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2011-12-05 00:00:00 +00:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: rspec
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 2
30
+ - 7
31
+ version: "2.7"
32
+ type: :development
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: bson_ext
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ~>
41
+ - !ruby/object:Gem::Version
42
+ segments:
43
+ - 1
44
+ - 5
45
+ - 0
46
+ version: 1.5.0
47
+ type: :development
48
+ version_requirements: *id002
49
+ - !ruby/object:Gem::Dependency
50
+ name: mongo_mapper
51
+ prerelease: false
52
+ requirement: &id003 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ~>
56
+ - !ruby/object:Gem::Version
57
+ segments:
58
+ - 0
59
+ - 10
60
+ - 1
61
+ version: 0.10.1
62
+ type: :runtime
63
+ version_requirements: *id003
64
+ description: MongoMapper plugin that removes ID field from EmbeddedDocuments
65
+ email:
66
+ - j.chambers@gmx.net
67
+ executables: []
68
+
69
+ extensions: []
70
+
71
+ extra_rdoc_files: []
72
+
73
+ files:
74
+ - .gitignore
75
+ - Gemfile
76
+ - MIT-LICENSE
77
+ - README.md
78
+ - Rakefile
79
+ - lib/mm_uses_no_id.rb
80
+ - lib/mm_uses_no_id/version.rb
81
+ - mm_uses_no_id.gemspec
82
+ - spec/mm_uses_no_id_spec.rb
83
+ has_rdoc: true
84
+ homepage: https://github.com/jmchambers/mm_uses_no_id
85
+ licenses:
86
+ - MIT
87
+ post_install_message:
88
+ rdoc_options: []
89
+
90
+ require_paths:
91
+ - lib
92
+ required_ruby_version: !ruby/object:Gem::Requirement
93
+ none: false
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ segments:
98
+ - 0
99
+ version: "0"
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ none: false
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ segments:
106
+ - 0
107
+ version: "0"
108
+ requirements: []
109
+
110
+ rubyforge_project:
111
+ rubygems_version: 1.3.7
112
+ signing_key:
113
+ specification_version: 3
114
+ summary: id-less embedded docs for MM
115
+ test_files: []
116
+