relaxo-model 0.15.0 → 0.17.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3cbc234be302f92a6d89bbafcffe86dc4fb23f15e7b842a0c2709fe3c58a379d
4
- data.tar.gz: b0359010d799ac743b272b0504fc856b6291ee995d6f6b99f948fa6639d842a8
3
+ metadata.gz: 2f9a147ad023213a3a98ec44faf9893f09e8fd1cabbebeaa13f6d499dcd0f73a
4
+ data.tar.gz: a92a1cd906a27b04556d326a74305a1c94f8b1f04fa30216bcc63d97230685b6
5
5
  SHA512:
6
- metadata.gz: 8a5e23de5cd12df58993661cc1a5c5961407f0113468113aefa09f1e8cf2e5a695e9c1e4d629e7c943646169d69766e3ac79909ee30f37a8776fae8eabc9f7d3
7
- data.tar.gz: ea6431cf52b2b0225e47e2c2137c3a2346748593fbbec988c31715c84d8bfe3ad861cc9c486c5364dae944fc6b31c522ec125c268f2dac7cc270ec46e602d1b0
6
+ metadata.gz: bfc0059b36c22d21c497816ceff1eec5d7cb8ed3e0b8f2c046188ead5a5e9e4a307332699290b69476c08f757d17ac8b8578e5eb740c6f6cfdbf2b4196e7329b
7
+ data.tar.gz: 39c4da5c519955e5e5187dc358a648c57a1438ae3e2fb7841572c96c2afded168b460b206f94badb0198cef6f7fee0c389ec5a622a1ff8c7ab86635cca7e253f
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2012 Samuel G. D. Williams. <http://www.oriontransfer.co.nz>
1
+ # Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the "Software"), to deal
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2012 Samuel G. D. Williams. <http://www.oriontransfer.co.nz>
1
+ # Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the "Software"), to deal
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2012 Samuel G. D. Williams. <http://www.oriontransfer.co.nz>
1
+ # Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the "Software"), to deal
@@ -54,7 +54,12 @@ module Relaxo
54
54
  # Attributes that have been changed or de-serialized from the dataset:
55
55
  attr :changed
56
56
 
57
- def reload
57
+ def changed?(key)
58
+ @changed.include?(key)
59
+ end
60
+
61
+ def reload(dataset = @dataset)
62
+ @dataset = dataset
58
63
  @changed.clear
59
64
  self.load_object
60
65
  end
@@ -105,11 +110,11 @@ module Relaxo
105
110
  end
106
111
  end
107
112
 
108
- def validate
113
+ def validate(changeset)
109
114
  # Do nothing :)
110
115
  end
111
116
 
112
- def to_hash
117
+ def to_h
113
118
  @attributes
114
119
  end
115
120
 
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2012 Samuel G. D. Williams. <http://www.oriontransfer.co.nz>
1
+ # Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the "Software"), to deal
@@ -24,7 +24,7 @@ require 'msgpack'
24
24
 
25
25
  module Relaxo
26
26
  module Model
27
- class ValidationError < StandardError
27
+ class ValidationFailure < StandardError
28
28
  def initialize(document, errors)
29
29
  @document = document
30
30
  @errors = errors
@@ -79,7 +79,7 @@ module Relaxo
79
79
  # Fetch a record or create a model object from a hash of attributes.
80
80
  def fetch(dataset, path = nil, **attributes)
81
81
  if path and object = dataset.read(path)
82
- instance = self.new(dataset, object, attributes)
82
+ instance = self.new(dataset, object, **attributes)
83
83
 
84
84
  instance.load_object
85
85
 
@@ -100,10 +100,6 @@ module Relaxo
100
100
  @object != nil
101
101
  end
102
102
 
103
- def changed? key
104
- @changed.include? key.to_s
105
- end
106
-
107
103
  def type
108
104
  @attributes[:type]
109
105
  end
@@ -147,7 +143,7 @@ module Relaxo
147
143
 
148
144
  self.class.keys.each do |name, key|
149
145
  # @attributes is not modified until we call self.dump (which flattens @attributes into @changes). When we generate paths, we want to ensure these are done based on the non-mutable state of the object.
150
- yield key.object_path(self, @attributes)
146
+ yield key.object_path(self, **@attributes)
151
147
  end
152
148
  end
153
149
 
@@ -157,7 +153,7 @@ module Relaxo
157
153
 
158
154
  before_save
159
155
 
160
- if errors = self.validate
156
+ if errors = self.validate(dataset)
161
157
  return errors
162
158
  end
163
159
 
@@ -191,7 +187,7 @@ module Relaxo
191
187
  result = self.save(dataset)
192
188
 
193
189
  if result != true
194
- raise ValidationErrors.new(result)
190
+ raise ValidationFailure.new(self, result)
195
191
  end
196
192
 
197
193
  return self
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2012 Samuel G. D. Williams. <http://www.oriontransfer.co.nz>
1
+ # Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the "Software"), to deal
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2012 Samuel G. D. Williams. <http://www.oriontransfer.co.nz>
1
+ # Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the "Software"), to deal
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2012 Samuel G. D. Williams. <http://www.oriontransfer.co.nz>
1
+ # Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the "Software"), to deal
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2012 Samuel G. D. Williams. <http://www.oriontransfer.co.nz>
1
+ # Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the "Software"), to deal
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2012 Samuel G. D. Williams. <http://www.oriontransfer.co.nz>
1
+ # Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the "Software"), to deal
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2012 Samuel G. D. Williams. <http://www.oriontransfer.co.nz>
1
+ # Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the "Software"), to deal
@@ -1,4 +1,4 @@
1
- # Copyright, 2017, by Samuel G. D. Williams. <http://www.oriontransfer.co.nz>
1
+ # Copyright, 2017, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the "Software"), to deal
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2012 Samuel G. D. Williams. <http://www.oriontransfer.co.nz>
1
+ # Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the "Software"), to deal
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Relaxo
22
22
  module Model
23
- VERSION = "0.15.0"
23
+ VERSION = "0.17.3"
24
24
  end
25
25
  end
@@ -1,3 +1,22 @@
1
+ # Copyright, 2019, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
1
20
 
2
21
  require 'relaxo/model'
3
22
 
@@ -10,7 +29,7 @@ class Aggregate
10
29
  end
11
30
 
12
31
  RSpec.describe Relaxo::Model::Document do
13
- let(:database_path) {File.join(__dir__, 'test')}
32
+ let(:database_path) {'tmp/attributes'}
14
33
  let(:database) {Relaxo.connect(database_path)}
15
34
 
16
35
  let(:document_path) {'test/document.json'}
@@ -23,6 +42,8 @@ RSpec.describe Relaxo::Model::Document do
23
42
  hash_value: {x: 10, y: 20}
24
43
  )
25
44
 
45
+ expect(model).to be_changed(:array_value)
46
+
26
47
  database.commit(message: "Adding test model") do |dataset|
27
48
  model.save(dataset)
28
49
  end
@@ -1,3 +1,22 @@
1
+ # Copyright, 2019, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
1
20
 
2
21
  require_relative 'model_context'
3
22
 
@@ -1,6 +1,24 @@
1
+ # Copyright, 2019, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
1
20
 
2
21
  require 'relaxo/model'
3
-
4
22
  require 'relaxo/model/properties/bcrypt'
5
23
 
6
24
  class Invoice
@@ -54,7 +72,7 @@ class User
54
72
  end
55
73
 
56
74
  RSpec.shared_context "model" do
57
- let(:database_path) {File.join(__dir__, 'test')}
75
+ let(:database_path) {'tmp/model'}
58
76
  let(:database) {Relaxo.connect(database_path)}
59
77
 
60
78
  let(:document_path) {'test/document.json'}
@@ -1,3 +1,22 @@
1
+ # Copyright, 2019, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
1
20
 
2
21
  require_relative '../model_context'
3
22
 
@@ -1,3 +1,22 @@
1
+ # Copyright, 2019, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
1
20
 
2
21
  require_relative 'model_context'
3
22
 
@@ -0,0 +1,31 @@
1
+ # Copyright, 2019, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ require "bundler/setup"
22
+ require "covered/rspec"
23
+
24
+ RSpec.configure do |config|
25
+ # Enable flags like --only-failures and --next-failure
26
+ config.example_status_persistence_file_path = ".rspec_status"
27
+
28
+ config.expect_with :rspec do |c|
29
+ c.syntax = :expect
30
+ end
31
+ end
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaxo-model
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 0.17.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-30 00:00:00.000000000 Z
11
+ date: 2020-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: relaxo
14
+ name: msgpack
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
@@ -25,49 +25,77 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: msgpack
28
+ name: relaxo
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.0'
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.0'
40
+ version: '1.5'
41
41
  - !ruby/object:Gem::Dependency
42
- name: bundler
42
+ name: bake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '1.3'
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '1.3'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: rspec
56
+ name: bake-bundler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: 3.4.0
61
+ version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: bake-modernize
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
67
81
  - !ruby/object:Gem::Version
68
- version: 3.4.0
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: bundler
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::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'
69
97
  - !ruby/object:Gem::Dependency
70
- name: rake
98
+ name: covered
71
99
  requirement: !ruby/object:Gem::Requirement
72
100
  requirements:
73
101
  - - ">="
@@ -80,21 +108,26 @@ dependencies:
80
108
  - - ">="
81
109
  - !ruby/object:Gem::Version
82
110
  version: '0'
83
- description: "\t\tRelaxo Model provides a framework for business logic on top of\n\t\tRelaxo.
84
- While it supports some traditional ORM style patterns, it is\n\t\tprimary focus
85
- is to model business processes and logic.\n"
86
- email:
87
- - samuel.williams@oriontransfer.co.nz
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:
88
127
  executables: []
89
128
  extensions: []
90
129
  extra_rdoc_files: []
91
130
  files:
92
- - ".gitignore"
93
- - ".simplecov"
94
- - ".travis.yml"
95
- - Gemfile
96
- - README.md
97
- - Rakefile
98
131
  - lib/relaxo/model.rb
99
132
  - lib/relaxo/model/base.rb
100
133
  - lib/relaxo/model/component.rb
@@ -109,12 +142,12 @@ files:
109
142
  - lib/relaxo/model/properties/uuid.rb
110
143
  - lib/relaxo/model/recordset.rb
111
144
  - lib/relaxo/model/version.rb
112
- - relaxo-model.gemspec
113
145
  - spec/relaxo/model/attribute_spec.rb
114
146
  - spec/relaxo/model/document_spec.rb
115
147
  - spec/relaxo/model/model_context.rb
116
148
  - spec/relaxo/model/properties/bcrypt_spec.rb
117
149
  - spec/relaxo/model/recordset_spec.rb
150
+ - spec/spec_helper.rb
118
151
  homepage: http://www.codeotaku.com/projects/relaxo/model
119
152
  licenses:
120
153
  - MIT
@@ -134,14 +167,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
167
  - !ruby/object:Gem::Version
135
168
  version: '0'
136
169
  requirements: []
137
- rubyforge_project:
138
- rubygems_version: 2.7.6
170
+ rubygems_version: 3.1.2
139
171
  signing_key:
140
172
  specification_version: 4
141
- summary: A model layer for CouchDB with minimal global state.
142
- test_files:
143
- - spec/relaxo/model/attribute_spec.rb
144
- - spec/relaxo/model/document_spec.rb
145
- - spec/relaxo/model/model_context.rb
146
- - spec/relaxo/model/properties/bcrypt_spec.rb
147
- - spec/relaxo/model/recordset_spec.rb
173
+ summary: A model layer for the relaxo document database.
174
+ test_files: []
data/.gitignore DELETED
@@ -1,18 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- spec/relaxo/model/test
16
- test/tmp
17
- test/version_tmp
18
- tmp
data/.simplecov DELETED
@@ -1,9 +0,0 @@
1
-
2
- SimpleCov.start do
3
- add_filter "/spec/"
4
- end
5
-
6
- if ENV['TRAVIS']
7
- require 'coveralls'
8
- Coveralls.wear!
9
- end
@@ -1,17 +0,0 @@
1
- language: ruby
2
- sudo: false
3
- before_install:
4
- # For testing purposes:
5
- - git config --global user.name "Samuel Williams"
6
- - git config --global user.email "samuel@oriontransfer.net"
7
- rvm:
8
- - 2.1.8
9
- - 2.2.4
10
- - 2.3.1
11
- - 2.4.0
12
- - rbx-2
13
- env: COVERAGE=true
14
- matrix:
15
- allow_failures:
16
- - rvm: ruby-head
17
- - rvm: "rbx-2"
data/Gemfile DELETED
@@ -1,16 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in relaxo-model.gemspec
4
- gemspec
5
-
6
- gem 'rugged', git: 'git://github.com/libgit2/rugged.git', submodules: true
7
-
8
- group :development do
9
- gem "pry"
10
- gem "bcrypt"
11
- end
12
-
13
- group :test do
14
- gem 'simplecov'
15
- gem 'coveralls', require: false
16
- end
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,18 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:spec) do |task|
5
- task.rspec_opts = ["--require", "simplecov"] if ENV['COVERAGE']
6
- end
7
-
8
- task :default => :spec
9
-
10
- task :console do
11
- require 'pry'
12
-
13
- require_relative 'lib/relaxo/model'
14
-
15
- DB = Relaxo.connect(File.join(__dir__, 'testdb'))
16
-
17
- Pry.start
18
- end
@@ -1,31 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'relaxo/model/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "relaxo-model"
8
- spec.version = Relaxo::Model::VERSION
9
- spec.authors = ["Samuel Williams"]
10
- spec.email = ["samuel.williams@oriontransfer.co.nz"]
11
- spec.description = <<-EOF
12
- Relaxo Model provides a framework for business logic on top of
13
- Relaxo. While it supports some traditional ORM style patterns, it is
14
- primary focus is to model business processes and logic.
15
- EOF
16
- spec.summary = "A model layer for CouchDB with minimal global state."
17
- spec.homepage = "http://www.codeotaku.com/projects/relaxo/model"
18
- spec.license = "MIT"
19
-
20
- spec.files = `git ls-files`.split($/)
21
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
22
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
23
- spec.require_paths = ["lib"]
24
-
25
- spec.add_dependency("relaxo", "~> 1.0")
26
- spec.add_dependency("msgpack", "~> 1.0")
27
-
28
- spec.add_development_dependency "bundler", "~> 1.3"
29
- spec.add_development_dependency "rspec", "~> 3.4.0"
30
- spec.add_development_dependency "rake"
31
- end