lotus-model 0.5.1 → 0.5.2
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 +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/lotus/model/adapters/null_adapter.rb +3 -1
- data/lib/lotus/model/adapters/sql/command.rb +6 -0
- data/lib/lotus/model/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e991dd7e68e0f41b03ab108f7245fb27b0a0127d
|
4
|
+
data.tar.gz: 729d719cbfbb7f1fafa05d76ca3fd7354ab9dca3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50a86645f4d9263ea03e243ae7bd410ea68130ccd7f953d37f72d8ca458726e2ef4f5a368e482e3e9271f53196003f532e412d29b5756d7604c5d7f922a58f76
|
7
|
+
data.tar.gz: 0c3d1fa8a8f143975ac3a2bcc23b1c7c86928503c8ee8fd41c815666dc2ea0bc023e289ad06a55d801a44794fd5ed7fba6becfcea3bf1c971819779f877f193d
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,13 @@
|
|
1
1
|
# Lotus::Model
|
2
2
|
A persistence layer for Lotus
|
3
3
|
|
4
|
+
## v0.5.2 - 2016-01-19
|
5
|
+
### Changed
|
6
|
+
- [Sean Collins] Improved error message for `Lotus::Model::Adapters::NoAdapterError`
|
7
|
+
|
8
|
+
### Fixed
|
9
|
+
- [Kyle Chong & Trung Lê] Catch Sequel exceptions and re-raise as `Lotus::Model::Error`
|
10
|
+
|
4
11
|
## v0.5.1 - 2016-01-12
|
5
12
|
### Added
|
6
13
|
- [Taylor Finnell] Let `Lotus::Model::Configuration#adapter` to accept arbitrary options (eg. `adapter type: :sql, uri: 'jdbc:...', after_connect: Proc.new { |connection| connection.auto_commit(true) }`)
|
@@ -6,7 +6,9 @@ module Lotus
|
|
6
6
|
# @since 0.2.0
|
7
7
|
class NoAdapterError < Lotus::Model::Error
|
8
8
|
def initialize(method_name)
|
9
|
-
super("Cannot invoke `#{ method_name }' on repository.
|
9
|
+
super("Cannot invoke `#{ method_name }' on repository. "\
|
10
|
+
"Please check if `adapter' and `mapping' are set, "\
|
11
|
+
"and that you call `.load!' on the configuration.")
|
10
12
|
end
|
11
13
|
end
|
12
14
|
|
@@ -31,6 +31,8 @@ module Lotus
|
|
31
31
|
# @since 0.1.0
|
32
32
|
def create(entity)
|
33
33
|
@collection.insert(entity)
|
34
|
+
rescue Sequel::DatabaseError => e
|
35
|
+
raise Lotus::Model::Error.new(e.message)
|
34
36
|
end
|
35
37
|
|
36
38
|
# Updates the corresponding record for the given entity.
|
@@ -43,6 +45,8 @@ module Lotus
|
|
43
45
|
# @since 0.1.0
|
44
46
|
def update(entity)
|
45
47
|
@collection.update(entity)
|
48
|
+
rescue Sequel::DatabaseError => e
|
49
|
+
raise Lotus::Model::Error.new(e.message)
|
46
50
|
end
|
47
51
|
|
48
52
|
# Deletes all the records for the current query.
|
@@ -56,6 +60,8 @@ module Lotus
|
|
56
60
|
# @since 0.1.0
|
57
61
|
def delete
|
58
62
|
@collection.delete
|
63
|
+
rescue Sequel::DatabaseError => e
|
64
|
+
raise Lotus::Model::Error.new(e.message)
|
59
65
|
end
|
60
66
|
|
61
67
|
alias_method :clear, :delete
|
data/lib/lotus/model/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lotus-model
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luca Guidi
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-01-
|
13
|
+
date: 2016-01-19 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: lotus-utils
|