relaxo 0.4.6 → 0.4.7

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
  SHA1:
3
- metadata.gz: 9e6c02feb308c631c2fd94b56f377faa51c912eb
4
- data.tar.gz: 28d754e42bb951740a67bbd434843040669c64dd
3
+ metadata.gz: 1bd62c00d2fd57e6f6e9bcc39ced85062f777125
4
+ data.tar.gz: 3ca923d3f102f4ffb22c7cae9cd8a9e1b10a81ca
5
5
  SHA512:
6
- metadata.gz: 63a3a123c7e53afaf78fea848c7774f4d6363adedca1df785411ba50c3776edfe741a0b3addcac3a8d17943e35013a0a6758554664f8594bb80c3db55eb2d118
7
- data.tar.gz: 68456b24f209d5b3715c7ca4f66604387c15a04e72d2dd7969e328b13d57f98cffdcc5bdfe27c98743d0822c40959235dd5f571272b1a66f05ce017bfa71a7e4
6
+ metadata.gz: c93d34f9b6f6d7de7f720e272a66b1dbf50e8f42a4b45fa2526c08aad4db290e16c0ae9b37aecd4164c476ae5836e5eba32b569b43f583a171026ebc71b5ccbb
7
+ data.tar.gz: 9f6fa956df6cc287a0308a176376824d9e64e9a1fa3e87b7de33999c4c31826a929d699a3cce229d59a0b365637bf4efebee21284ef334ba4cc9da9c840e68e5
@@ -0,0 +1,49 @@
1
+ # Copyright, 2016, 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 'yaml'
22
+
23
+ module Relaxo
24
+ class Schema
25
+ def initialize(document)
26
+ @document = document
27
+ end
28
+
29
+ def self.load_file(schema_path)
30
+ self.new(YAML.load_file(schema_path))
31
+ end
32
+
33
+ def id
34
+ @document[ID]
35
+ end
36
+
37
+ def migrate(db)
38
+ if db.id?(self.id)
39
+ if existing_document = GeoZone::DB.get(self.id)
40
+ @document[Relaxo::REV] = existing_document[Relaxo::REV]
41
+ end
42
+ end
43
+
44
+ if existing_document != @document
45
+ db.save(@document)
46
+ end
47
+ end
48
+ end
49
+ end
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Relaxo
22
- VERSION = "0.4.6"
22
+ VERSION = "0.4.7"
23
23
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaxo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.6
4
+ version: 0.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-10 00:00:00.000000000 Z
11
+ date: 2016-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -105,6 +105,7 @@ files:
105
105
  - lib/relaxo/connection.rb
106
106
  - lib/relaxo/database.rb
107
107
  - lib/relaxo/json.rb
108
+ - lib/relaxo/schema.rb
108
109
  - lib/relaxo/transaction.rb
109
110
  - lib/relaxo/version.rb
110
111
  - relaxo.gemspec