relaxo-model 0.17.1 → 0.17.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/relaxo/model/version.rb +1 -1
- data/spec/relaxo/model/attribute_spec.rb +1 -1
- data/spec/relaxo/model/model_context.rb +1 -1
- metadata +48 -36
- data/.gitignore +0 -12
- data/.rspec +0 -4
- data/.travis.yml +0 -20
- data/Gemfile +0 -11
- data/README.md +0 -119
- data/Rakefile +0 -17
- data/relaxo-model.gemspec +0 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76ee0fe261863b66948d14dbb488758149f2e5f13fcbd422f7734bd36997f2f4
|
4
|
+
data.tar.gz: 7c03bdd20c4075b211be89ab7ae531702450c54e066bce7eecb966d64eccbbb5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f693733a825e2e4571b048ac4af7396c5268ee6fb86467518c040cd44b673a7c2f782f4b6733eb2002186432906af5297e92af85585206c3357b6756ec2c3f9c
|
7
|
+
data.tar.gz: af576f5cbe754244eaf31a1f9300fa9f3b52aeeec4dd41b6912f2665028c49ee5b8550d5c571c956d7a0ea099b040ed51ba88fa2c212f33c9050d36d242ec3bb
|
data/lib/relaxo/model/version.rb
CHANGED
@@ -29,7 +29,7 @@ class Aggregate
|
|
29
29
|
end
|
30
30
|
|
31
31
|
RSpec.describe Relaxo::Model::Document do
|
32
|
-
let(:database_path) {
|
32
|
+
let(:database_path) {'tmp/attributes'}
|
33
33
|
let(:database) {Relaxo.connect(database_path)}
|
34
34
|
|
35
35
|
let(:document_path) {'test/document.json'}
|
metadata
CHANGED
@@ -1,45 +1,45 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaxo-model
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.17.
|
4
|
+
version: 0.17.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05-
|
11
|
+
date: 2020-05-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: msgpack
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
26
|
+
version: '1.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: relaxo
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '1.
|
33
|
+
version: '1.5'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '1.
|
40
|
+
version: '1.5'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: bake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name: bundler
|
56
|
+
name: bake-bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
@@ -67,21 +67,35 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: bake-modernize
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: bundler
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
81
88
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
98
|
+
name: covered
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
101
|
- - ">="
|
@@ -94,21 +108,26 @@ dependencies:
|
|
94
108
|
- - ">="
|
95
109
|
- !ruby/object:Gem::Version
|
96
110
|
version: '0'
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
-
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rspec
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '3.4'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '3.4'
|
125
|
+
description:
|
126
|
+
email:
|
102
127
|
executables: []
|
103
128
|
extensions: []
|
104
129
|
extra_rdoc_files: []
|
105
130
|
files:
|
106
|
-
- ".gitignore"
|
107
|
-
- ".rspec"
|
108
|
-
- ".travis.yml"
|
109
|
-
- Gemfile
|
110
|
-
- README.md
|
111
|
-
- Rakefile
|
112
131
|
- lib/relaxo/model.rb
|
113
132
|
- lib/relaxo/model/base.rb
|
114
133
|
- lib/relaxo/model/component.rb
|
@@ -123,7 +142,6 @@ files:
|
|
123
142
|
- lib/relaxo/model/properties/uuid.rb
|
124
143
|
- lib/relaxo/model/recordset.rb
|
125
144
|
- lib/relaxo/model/version.rb
|
126
|
-
- relaxo-model.gemspec
|
127
145
|
- spec/relaxo/model/attribute_spec.rb
|
128
146
|
- spec/relaxo/model/document_spec.rb
|
129
147
|
- spec/relaxo/model/model_context.rb
|
@@ -152,11 +170,5 @@ requirements: []
|
|
152
170
|
rubygems_version: 3.1.2
|
153
171
|
signing_key:
|
154
172
|
specification_version: 4
|
155
|
-
summary: A model layer for
|
156
|
-
test_files:
|
157
|
-
- spec/relaxo/model/attribute_spec.rb
|
158
|
-
- spec/relaxo/model/document_spec.rb
|
159
|
-
- spec/relaxo/model/model_context.rb
|
160
|
-
- spec/relaxo/model/properties/bcrypt_spec.rb
|
161
|
-
- spec/relaxo/model/recordset_spec.rb
|
162
|
-
- spec/spec_helper.rb
|
173
|
+
summary: A model layer for the relaxo document database.
|
174
|
+
test_files: []
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/.travis.yml
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
dist: xenial
|
3
|
-
cache: bundler
|
4
|
-
|
5
|
-
matrix:
|
6
|
-
include:
|
7
|
-
- rvm: 2.4
|
8
|
-
- rvm: 2.5
|
9
|
-
- rvm: 2.6
|
10
|
-
- rvm: 2.6
|
11
|
-
env: COVERAGE=PartialSummary,Coveralls
|
12
|
-
- rvm: truffleruby
|
13
|
-
- rvm: ruby-head
|
14
|
-
- rvm: 2.6
|
15
|
-
os: osx
|
16
|
-
allow_failures:
|
17
|
-
- rvm: truffleruby
|
18
|
-
- rvm: ruby-head
|
19
|
-
- rvm: jruby-head
|
20
|
-
- rvm: truffleruby
|
data/Gemfile
DELETED
data/README.md
DELETED
@@ -1,119 +0,0 @@
|
|
1
|
-
# Relaxo Model
|
2
|
-
|
3
|
-
Relaxo Model provides a framework for business logic on top of Relaxo, a document data store built on top of git. While it supports some traditional relational style patterns, it is primary focus is to model business processes and logic at the document level.
|
4
|
-
|
5
|
-
[![Build Status](https://secure.travis-ci.org/ioquatix/relaxo-model.svg)](http://travis-ci.org/ioquatix/relaxo-model)
|
6
|
-
[![Code Climate](https://codeclimate.com/github/ioquatix/relaxo-model.svg)](https://codeclimate.com/github/ioquatix/relaxo-model)
|
7
|
-
[![Coverage Status](https://coveralls.io/repos/ioquatix/relaxo-model/badge.svg)](https://coveralls.io/r/ioquatix/relaxo-model)
|
8
|
-
|
9
|
-
## Basic Usage
|
10
|
-
|
11
|
-
Here is a simple example of a traditional ORM style model:
|
12
|
-
|
13
|
-
```ruby
|
14
|
-
require 'relaxo/model'
|
15
|
-
|
16
|
-
database = Relaxo.connect("test")
|
17
|
-
|
18
|
-
trees = [
|
19
|
-
{:name => 'Hinoki', :planted => Date.parse("2013/11/17")},
|
20
|
-
{:name => 'Keyaki', :planted => Date.parse("2016/9/24")}
|
21
|
-
]
|
22
|
-
|
23
|
-
class Tree
|
24
|
-
include Relaxo::Model
|
25
|
-
|
26
|
-
property :id, UUID
|
27
|
-
property :name
|
28
|
-
property :planted, Attribute[Date]
|
29
|
-
|
30
|
-
view :all, [:type], index: [:id]
|
31
|
-
end
|
32
|
-
|
33
|
-
database.commit(message: "Create trees") do |changeset|
|
34
|
-
trees.each do |tree|
|
35
|
-
Tree.insert(changeset, tree)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
database.current do |dataset|
|
40
|
-
Tree.all(dataset).each do |tree|
|
41
|
-
puts "A #{tree.name} was planted on #{tree.planted.to_s}."
|
42
|
-
|
43
|
-
# Expected output:
|
44
|
-
# A Hinoki was planted on 2013-11-17.
|
45
|
-
# A Keyaki was planted on 2016-09-24.
|
46
|
-
end
|
47
|
-
end
|
48
|
-
```
|
49
|
-
|
50
|
-
### Non-UUID Primary Key
|
51
|
-
|
52
|
-
```ruby
|
53
|
-
#!/usr/bin/env ruby
|
54
|
-
|
55
|
-
gem 'relaxo'
|
56
|
-
|
57
|
-
require 'relaxo/model'
|
58
|
-
|
59
|
-
database = Relaxo.connect("test")
|
60
|
-
|
61
|
-
trees = [
|
62
|
-
{:name => 'Hinoki', :planted => Date.parse("2013/11/17")},
|
63
|
-
{:name => 'Keyaki', :planted => Date.parse("2016/9/24")}
|
64
|
-
]
|
65
|
-
|
66
|
-
class Tree
|
67
|
-
include Relaxo::Model
|
68
|
-
|
69
|
-
property :name
|
70
|
-
property :planted, Attribute[Date]
|
71
|
-
|
72
|
-
view :all, [:type], index: [:name]
|
73
|
-
end
|
74
|
-
|
75
|
-
database.commit(message: "Create trees") do |changeset|
|
76
|
-
trees.each do |tree|
|
77
|
-
Tree.insert(changeset, tree)
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
database.current do |dataset|
|
82
|
-
trees.each do |tree|
|
83
|
-
object = Tree.fetch_all(dataset, name: tree[:name])
|
84
|
-
puts object
|
85
|
-
end
|
86
|
-
end
|
87
|
-
```
|
88
|
-
|
89
|
-
## Contributing
|
90
|
-
|
91
|
-
1. Fork it
|
92
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
93
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
94
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
95
|
-
5. Create new Pull Request
|
96
|
-
|
97
|
-
## License
|
98
|
-
|
99
|
-
Released under the MIT license.
|
100
|
-
|
101
|
-
Copyright, 2017, by [Samuel G. D. Williams](http://www.codeotaku.com/samuel-williams).
|
102
|
-
|
103
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
104
|
-
of this software and associated documentation files (the "Software"), to deal
|
105
|
-
in the Software without restriction, including without limitation the rights
|
106
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
107
|
-
copies of the Software, and to permit persons to whom the Software is
|
108
|
-
furnished to do so, subject to the following conditions:
|
109
|
-
|
110
|
-
The above copyright notice and this permission notice shall be included in
|
111
|
-
all copies or substantial portions of the Software.
|
112
|
-
|
113
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
114
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
115
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
116
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
117
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
118
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
119
|
-
THE SOFTWARE.
|
data/Rakefile
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
2
|
-
require "rspec/core/rake_task"
|
3
|
-
|
4
|
-
# For RSpec
|
5
|
-
RSpec::Core::RakeTask.new(:spec)
|
6
|
-
|
7
|
-
task :console do
|
8
|
-
require 'pry'
|
9
|
-
|
10
|
-
require_relative 'lib/relaxo/model'
|
11
|
-
|
12
|
-
DB = Relaxo.connect(File.join(__dir__, 'testdb'))
|
13
|
-
|
14
|
-
Pry.start
|
15
|
-
end
|
16
|
-
|
17
|
-
task :default => :spec
|
data/relaxo-model.gemspec
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
|
2
|
-
require_relative 'lib/relaxo/model/version'
|
3
|
-
|
4
|
-
Gem::Specification.new do |spec|
|
5
|
-
spec.name = "relaxo-model"
|
6
|
-
spec.version = Relaxo::Model::VERSION
|
7
|
-
spec.authors = ["Samuel Williams"]
|
8
|
-
spec.email = ["samuel.williams@oriontransfer.co.nz"]
|
9
|
-
spec.description = <<-EOF
|
10
|
-
Relaxo Model provides a framework for business logic on top of
|
11
|
-
Relaxo. While it supports some traditional ORM style patterns, it is
|
12
|
-
primary focus is to model business processes and logic.
|
13
|
-
EOF
|
14
|
-
spec.summary = "A model layer for CouchDB with minimal global state."
|
15
|
-
spec.homepage = "http://www.codeotaku.com/projects/relaxo/model"
|
16
|
-
spec.license = "MIT"
|
17
|
-
|
18
|
-
spec.files = `git ls-files`.split($/)
|
19
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
20
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
21
|
-
spec.require_paths = ["lib"]
|
22
|
-
|
23
|
-
spec.add_dependency("relaxo", "~> 1.5")
|
24
|
-
spec.add_dependency("msgpack", "~> 1.0")
|
25
|
-
|
26
|
-
spec.add_development_dependency "covered"
|
27
|
-
spec.add_development_dependency "bundler"
|
28
|
-
spec.add_development_dependency "rspec", "~> 3.4.0"
|
29
|
-
spec.add_development_dependency "rake"
|
30
|
-
end
|