mince 2.0.2 → 2.1.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.
- checksums.yaml +7 -0
- data/LICENSE.txt +20 -0
- data/README.md +95 -0
- data/lib/mince/model/persistence.rb +1 -1
- data/lib/mince/version.rb +2 -2
- data/spec/support/shared_examples/{modeL_data_model_example.rb → model_data_model_example.rb} +0 -0
- metadata +26 -47
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9289921e574adca62309c4dba6ee0f15d257bd39
|
4
|
+
data.tar.gz: 0a11a1df9dd21d16ee02843ccb9c062cafb88ada
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 395c89bc97cacc641a4380f0a28c2ffa06761f4f3ee94a31759c1b9a0e65ea4a6244cdc88686c4d9be615cef839298d226dabe87fd4456257f120ca7800a3e99
|
7
|
+
data.tar.gz: c35e8428c60ab564b19fdfce9239bac3fbaa8d0e3cbc15887811ecbe5c836977bad42db3cdf43d6981b6af880ff696aff2fc484b10b014f428c716fd7ba46c53
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2012 Asynchrony
|
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,95 @@
|
|
1
|
+
# What is Mince
|
2
|
+
|
3
|
+
[](https://travis-ci.org/#!/coffeencoke/mince)
|
4
|
+
|
5
|
+
Mince is a ruby gem to provide a light weight ORM to persist data to a variety of databases in ruby apps.
|
6
|
+
|
7
|
+
The motivation behind this is so your application is not tightly tied to a specific database. As your application grows you may need to upgrade to a different database or pull specific models to a different persistence strategy.
|
8
|
+
|
9
|
+
Other ORMs are married to the [Active Record Architecture Pattern](http://en.wikipedia.org/wiki/Active_record_pattern). Although Mince can be used with the Active Record pattern as well, it is designed to be used in more of a [Multitier Architecture Pattern](http://en.wikipedia.org/wiki/Multitier_architecture), where the data layer is separated from the business logic layer in the application.
|
10
|
+
|
11
|
+
*View the [Why Multitier Architecture?](https://github.com/coffeencoke/mince/wiki/Why-multitier-architecture%3F) page for more discussion*
|
12
|
+
|
13
|
+
## Language Dependency
|
14
|
+
|
15
|
+
**Currently only compatible with Ruby 1.9+. Support for Ruby 1.8 to come later.**
|
16
|
+
|
17
|
+
# How to use it
|
18
|
+
|
19
|
+
This library contains the core components to use Mince [supported database interfaces](https://github.com/coffeencoke/mince/wiki/Existing-interfaces). These interfaces can be interchanged, but in this setup example we will be using [HashyDb](https://github.com/coffeencoke/hashy_db), which is an in-memory ruby hash database.
|
20
|
+
|
21
|
+
## Install
|
22
|
+
|
23
|
+
Install `mince` and `hashy_db` gems:
|
24
|
+
|
25
|
+
```bash
|
26
|
+
gem install mince hashy_db
|
27
|
+
```
|
28
|
+
|
29
|
+
## Config
|
30
|
+
|
31
|
+
Use the config class to configure which mince database interface you
|
32
|
+
desire to use:
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
require 'mince'
|
36
|
+
require 'hashy_db'
|
37
|
+
|
38
|
+
Mince::Config.interface = Mince::HashyDb::Interface
|
39
|
+
```
|
40
|
+
|
41
|
+
## Use it
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
# Get the interface
|
45
|
+
interface = Mince::Config.interface
|
46
|
+
|
47
|
+
# Add a book
|
48
|
+
interface.add 'books', title: 'The World In Photographs', publisher: 'National Geographic'
|
49
|
+
|
50
|
+
# Get all books
|
51
|
+
interface.find_all 'books'
|
52
|
+
|
53
|
+
# Replace a book where the record's id is 1
|
54
|
+
# Use the interface's primary_key field because
|
55
|
+
# some databases use non `id` fields for the primary key
|
56
|
+
primary_key = interface.primary_key
|
57
|
+
interface.replace 'books', primary_key => 1, title: 'A World In Photographs', publisher: 'National Geographic'
|
58
|
+
```
|
59
|
+
|
60
|
+
# Deeper Look
|
61
|
+
|
62
|
+
The following pages provide a deeper look into Mince
|
63
|
+
|
64
|
+
Link | Description
|
65
|
+
----|-----
|
66
|
+
[API Docs](http://rdoc.info/github/coffeencoke/mince/master/frames) | API docs for Mince
|
67
|
+
[Existing Interfaces](https://github.com/coffeencoke/mince/wiki/Existing-interfaces) | List of supported database interfaces that can be used with Mince
|
68
|
+
[Usage with Rails](https://github.com/coffeencoke/mince/wiki/Usage-with-rails) | More information on how to use Mince with Rails
|
69
|
+
[Fancy Mixins](https://github.com/coffeencoke/mince/wiki/Fancy-mixins) | We've written a few mixins that provide some standard behavior to your models while using Mince
|
70
|
+
[Development](https://github.com/coffeencoke/mince/wiki/Development) | Help by contributing
|
71
|
+
[Mailing List](https://groups.google.com/forum/?fromgroups#!forum/mince_dev)
|
72
|
+
[Travis CI](https://travis-ci.org/#!/coffeencoke/mince) | Check out the build status of Mince
|
73
|
+
[Why Multitier Architecture?](https://github.com/coffeencoke/mince/wiki/Why-multitier-architecture%3F) | Discussion about why to use multi tier architecture as apposed to others, such as Active Record
|
74
|
+
|
75
|
+
# Contribute
|
76
|
+
|
77
|
+
You can contribute to Mince by doing a number of things. View the [Development](https://github.com/coffeencoke/mince/wiki/Development) page for more details.
|
78
|
+
|
79
|
+
# Contributors
|
80
|
+
|
81
|
+
Name | Twitter | Github
|
82
|
+
-----|----|-----
|
83
|
+
**Matt Simpson** (owner & maintainer) | [@railsgrammer](https://twitter.com/railsgrammer) | [@coffeencoke](https://github.com/coffeencoke/)
|
84
|
+
Jason Mayer | [@farkerhaiku](https://twitter.com/farkerhaiku) | [@farkerhaiku](https://github.com/farkerhaiku)
|
85
|
+
Amos King | [@adkron](https://twitter.com/adkron) | [@adkron](https://github.com/adkron)
|
86
|
+
Ionic Mobile Team | [@asynchrony](https://twitter.com/asynchrony) | [@ionicmobile](https://github.com/ionicmobile)
|
87
|
+
David Czarnecki | [@czarneckid](https://twitter.com/czarneckid) | [@czarneckid](https://github.com/czarneckid)
|
88
|
+
Kenny Ortmann | [@yairgo](https://twitter.com/yairgo) | [@yairgo](https://github.com/yairgo)
|
89
|
+
Helena Converse | [@n3rdgir1](https://twitter.com/n3rdgir1) | [@n3rdgir1](https://github.com/n3rdgir1)
|
90
|
+
|
91
|
+
If you've been missed on this list, let us know by creating an issue or sending one of us a message.
|
92
|
+
|
93
|
+
# Version 1
|
94
|
+
|
95
|
+
Looking for support for Version 1? Put an issue in, or send one of us a message.
|
@@ -32,7 +32,7 @@ module Mince
|
|
32
32
|
# Saves the object to the data model. Stores if new, updates previous entry if it has already
|
33
33
|
# been saved.
|
34
34
|
def save
|
35
|
-
ensure_no_extra_fields if self.respond_to?(:ensure_no_extra_fields)
|
35
|
+
ensure_no_extra_fields if self.respond_to?(:ensure_no_extra_fields, true)
|
36
36
|
|
37
37
|
if persisted?
|
38
38
|
data_model.update(self)
|
data/lib/mince/version.rb
CHANGED
data/spec/support/shared_examples/{modeL_data_model_example.rb → model_data_model_example.rb}
RENAMED
File without changes
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mince
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
5
|
-
prerelease:
|
4
|
+
version: 2.1.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Matt Simpson
|
@@ -10,12 +9,11 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-29 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: activesupport
|
17
16
|
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
17
|
requirements:
|
20
18
|
- - ~>
|
21
19
|
- !ruby/object:Gem::Version
|
@@ -23,7 +21,6 @@ dependencies:
|
|
23
21
|
type: :runtime
|
24
22
|
prerelease: false
|
25
23
|
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
24
|
requirements:
|
28
25
|
- - ~>
|
29
26
|
- !ruby/object:Gem::Version
|
@@ -31,7 +28,6 @@ dependencies:
|
|
31
28
|
- !ruby/object:Gem::Dependency
|
32
29
|
name: activemodel
|
33
30
|
requirement: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
31
|
requirements:
|
36
32
|
- - ~>
|
37
33
|
- !ruby/object:Gem::Version
|
@@ -39,7 +35,6 @@ dependencies:
|
|
39
35
|
type: :runtime
|
40
36
|
prerelease: false
|
41
37
|
version_requirements: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
38
|
requirements:
|
44
39
|
- - ~>
|
45
40
|
- !ruby/object:Gem::Version
|
@@ -47,7 +42,6 @@ dependencies:
|
|
47
42
|
- !ruby/object:Gem::Dependency
|
48
43
|
name: rake
|
49
44
|
requirement: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
45
|
requirements:
|
52
46
|
- - ~>
|
53
47
|
- !ruby/object:Gem::Version
|
@@ -55,7 +49,6 @@ dependencies:
|
|
55
49
|
type: :development
|
56
50
|
prerelease: false
|
57
51
|
version_requirements: !ruby/object:Gem::Requirement
|
58
|
-
none: false
|
59
52
|
requirements:
|
60
53
|
- - ~>
|
61
54
|
- !ruby/object:Gem::Version
|
@@ -63,7 +56,6 @@ dependencies:
|
|
63
56
|
- !ruby/object:Gem::Dependency
|
64
57
|
name: rspec
|
65
58
|
requirement: !ruby/object:Gem::Requirement
|
66
|
-
none: false
|
67
59
|
requirements:
|
68
60
|
- - ~>
|
69
61
|
- !ruby/object:Gem::Version
|
@@ -71,7 +63,6 @@ dependencies:
|
|
71
63
|
type: :development
|
72
64
|
prerelease: false
|
73
65
|
version_requirements: !ruby/object:Gem::Requirement
|
74
|
-
none: false
|
75
66
|
requirements:
|
76
67
|
- - ~>
|
77
68
|
- !ruby/object:Gem::Version
|
@@ -79,7 +70,6 @@ dependencies:
|
|
79
70
|
- !ruby/object:Gem::Dependency
|
80
71
|
name: guard-rspec
|
81
72
|
requirement: !ruby/object:Gem::Requirement
|
82
|
-
none: false
|
83
73
|
requirements:
|
84
74
|
- - ~>
|
85
75
|
- !ruby/object:Gem::Version
|
@@ -87,7 +77,6 @@ dependencies:
|
|
87
77
|
type: :development
|
88
78
|
prerelease: false
|
89
79
|
version_requirements: !ruby/object:Gem::Requirement
|
90
|
-
none: false
|
91
80
|
requirements:
|
92
81
|
- - ~>
|
93
82
|
- !ruby/object:Gem::Version
|
@@ -95,7 +84,6 @@ dependencies:
|
|
95
84
|
- !ruby/object:Gem::Dependency
|
96
85
|
name: yard
|
97
86
|
requirement: !ruby/object:Gem::Requirement
|
98
|
-
none: false
|
99
87
|
requirements:
|
100
88
|
- - ~>
|
101
89
|
- !ruby/object:Gem::Version
|
@@ -103,7 +91,6 @@ dependencies:
|
|
103
91
|
type: :development
|
104
92
|
prerelease: false
|
105
93
|
version_requirements: !ruby/object:Gem::Requirement
|
106
|
-
none: false
|
107
94
|
requirements:
|
108
95
|
- - ~>
|
109
96
|
- !ruby/object:Gem::Version
|
@@ -111,7 +98,6 @@ dependencies:
|
|
111
98
|
- !ruby/object:Gem::Dependency
|
112
99
|
name: redcarpet
|
113
100
|
requirement: !ruby/object:Gem::Requirement
|
114
|
-
none: false
|
115
101
|
requirements:
|
116
102
|
- - ~>
|
117
103
|
- !ruby/object:Gem::Version
|
@@ -119,7 +105,6 @@ dependencies:
|
|
119
105
|
type: :development
|
120
106
|
prerelease: false
|
121
107
|
version_requirements: !ruby/object:Gem::Requirement
|
122
|
-
none: false
|
123
108
|
requirements:
|
124
109
|
- - ~>
|
125
110
|
- !ruby/object:Gem::Version
|
@@ -127,7 +112,6 @@ dependencies:
|
|
127
112
|
- !ruby/object:Gem::Dependency
|
128
113
|
name: debugger
|
129
114
|
requirement: !ruby/object:Gem::Requirement
|
130
|
-
none: false
|
131
115
|
requirements:
|
132
116
|
- - ~>
|
133
117
|
- !ruby/object:Gem::Version
|
@@ -135,7 +119,6 @@ dependencies:
|
|
135
119
|
type: :development
|
136
120
|
prerelease: false
|
137
121
|
version_requirements: !ruby/object:Gem::Requirement
|
138
|
-
none: false
|
139
122
|
requirements:
|
140
123
|
- - ~>
|
141
124
|
- !ruby/object:Gem::Version
|
@@ -143,7 +126,6 @@ dependencies:
|
|
143
126
|
- !ruby/object:Gem::Dependency
|
144
127
|
name: hashy_db
|
145
128
|
requirement: !ruby/object:Gem::Requirement
|
146
|
-
none: false
|
147
129
|
requirements:
|
148
130
|
- - ~>
|
149
131
|
- !ruby/object:Gem::Version
|
@@ -151,7 +133,6 @@ dependencies:
|
|
151
133
|
type: :development
|
152
134
|
prerelease: false
|
153
135
|
version_requirements: !ruby/object:Gem::Requirement
|
154
|
-
none: false
|
155
136
|
requirements:
|
156
137
|
- - ~>
|
157
138
|
- !ruby/object:Gem::Version
|
@@ -159,7 +140,6 @@ dependencies:
|
|
159
140
|
- !ruby/object:Gem::Dependency
|
160
141
|
name: rb-fsevent
|
161
142
|
requirement: !ruby/object:Gem::Requirement
|
162
|
-
none: false
|
163
143
|
requirements:
|
164
144
|
- - ~>
|
165
145
|
- !ruby/object:Gem::Version
|
@@ -167,74 +147,73 @@ dependencies:
|
|
167
147
|
type: :development
|
168
148
|
prerelease: false
|
169
149
|
version_requirements: !ruby/object:Gem::Requirement
|
170
|
-
none: false
|
171
150
|
requirements:
|
172
151
|
- - ~>
|
173
152
|
- !ruby/object:Gem::Version
|
174
153
|
version: 0.9.0
|
175
|
-
description: Library to interact with
|
154
|
+
description: Library to interact with databases, not tied to rails, and not tied to
|
155
|
+
active record pattern
|
176
156
|
email:
|
177
157
|
- matt@railsgrammer.com
|
178
158
|
executables: []
|
179
159
|
extensions: []
|
180
160
|
extra_rdoc_files: []
|
181
161
|
files:
|
182
|
-
- lib/mince.rb
|
183
162
|
- lib/mince/config.rb
|
184
163
|
- lib/mince/data_model.rb
|
185
|
-
- lib/mince/model.rb
|
186
|
-
- lib/mince/version.rb
|
187
|
-
- lib/mince/shared_examples/interface_example.rb
|
188
164
|
- lib/mince/model/data_model.rb
|
189
165
|
- lib/mince/model/fields.rb
|
190
166
|
- lib/mince/model/finders.rb
|
191
167
|
- lib/mince/model/persistence.rb
|
168
|
+
- lib/mince/model.rb
|
169
|
+
- lib/mince/shared_examples/interface_example.rb
|
170
|
+
- lib/mince/version.rb
|
171
|
+
- lib/mince.rb
|
172
|
+
- LICENSE.txt
|
173
|
+
- README.md
|
192
174
|
- spec/integration/mince_data_model_spec.rb
|
193
175
|
- spec/integration/mince_model_spec.rb
|
194
|
-
- spec/support/shared_examples/
|
176
|
+
- spec/support/shared_examples/model_data_model_example.rb
|
195
177
|
- spec/support/shared_examples/model_finders_example.rb
|
196
|
-
- spec/units/mince/model/data_model_spec.rb
|
197
|
-
- spec/units/mince/model/finders_spec.rb
|
198
178
|
- spec/units/mince/config_spec.rb
|
199
|
-
- spec/units/mince/interface_example_spec.rb
|
200
179
|
- spec/units/mince/data_model_spec.rb
|
180
|
+
- spec/units/mince/interface_example_spec.rb
|
181
|
+
- spec/units/mince/model/data_model_spec.rb
|
182
|
+
- spec/units/mince/model/finders_spec.rb
|
201
183
|
- spec/units/mince/model_spec.rb
|
202
184
|
homepage: https://github.com/coffeencoke/mince
|
203
|
-
licenses:
|
185
|
+
licenses:
|
186
|
+
- MIT
|
187
|
+
metadata: {}
|
204
188
|
post_install_message:
|
205
189
|
rdoc_options: []
|
206
190
|
require_paths:
|
207
191
|
- lib
|
208
192
|
required_ruby_version: !ruby/object:Gem::Requirement
|
209
|
-
none: false
|
210
193
|
requirements:
|
211
|
-
- -
|
194
|
+
- - '>='
|
212
195
|
- !ruby/object:Gem::Version
|
213
196
|
version: 1.9.3
|
214
197
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
215
|
-
none: false
|
216
198
|
requirements:
|
217
|
-
- -
|
199
|
+
- - '>='
|
218
200
|
- !ruby/object:Gem::Version
|
219
201
|
version: '0'
|
220
|
-
segments:
|
221
|
-
- 0
|
222
|
-
hash: 174576690081751794
|
223
202
|
requirements: []
|
224
203
|
rubyforge_project: mince
|
225
|
-
rubygems_version:
|
204
|
+
rubygems_version: 2.0.3
|
226
205
|
signing_key:
|
227
|
-
specification_version:
|
228
|
-
summary:
|
206
|
+
specification_version: 4
|
207
|
+
summary: Ruby library to provide a light weight flexible ORM
|
229
208
|
test_files:
|
230
209
|
- spec/integration/mince_data_model_spec.rb
|
231
210
|
- spec/integration/mince_model_spec.rb
|
232
|
-
- spec/support/shared_examples/
|
211
|
+
- spec/support/shared_examples/model_data_model_example.rb
|
233
212
|
- spec/support/shared_examples/model_finders_example.rb
|
234
|
-
- spec/units/mince/model/data_model_spec.rb
|
235
|
-
- spec/units/mince/model/finders_spec.rb
|
236
213
|
- spec/units/mince/config_spec.rb
|
237
|
-
- spec/units/mince/interface_example_spec.rb
|
238
214
|
- spec/units/mince/data_model_spec.rb
|
215
|
+
- spec/units/mince/interface_example_spec.rb
|
216
|
+
- spec/units/mince/model/data_model_spec.rb
|
217
|
+
- spec/units/mince/model/finders_spec.rb
|
239
218
|
- spec/units/mince/model_spec.rb
|
240
219
|
has_rdoc: true
|