fish0 0.0.2 → 0.0.3
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/README.md +10 -2
- data/lib/fish0/concerns/base.rb +39 -0
- data/lib/fish0/exceptions.rb +3 -0
- data/lib/fish0/model.rb +6 -0
- data/lib/fish0/repository.rb +3 -8
- data/lib/fish0/version.rb +1 -1
- data/lib/fish0.rb +3 -1
- metadata +19 -3
- data/lib/fish0/record_not_found.rb +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18dc1bb6da6a9dc1e1f0e90a95139a126b168e65
|
4
|
+
data.tar.gz: 7346f345340e2df28e1b5e0bd0f4455db4810520
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a94aec1dff4294f4d67cbd2b92846742cc5c21f57e34cff980ea5a4577faa82c29f8d2762d40bd1826be138149b3c47461fe0fef2a0544271693a2d9a04098f7
|
7
|
+
data.tar.gz: 734e46038abacfa5fd257b7c03d1b918905f64bec6d997798e55b6aa601ed3ca752c5561f73bbb3c882dbcb9abc3b9e3abd93319d1b181ade064c87320629344
|
data/README.md
CHANGED
@@ -1,8 +1,16 @@
|
|
1
1
|
# Fish0
|
2
2
|
|
3
|
-
The fish doesn't think because the fish knows everything.
|
3
|
+
> The fish doesn't think because the fish knows everything.
|
4
4
|
|
5
|
-
Fish0 is the plugin for read-only content websites with MongoDB storage. Works perfect with Rambler&Co CQRS
|
5
|
+
Fish0 is the plugin for read-only content websites with MongoDB storage. Works perfect with Rambler&Co CQRS architecture.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Simply add gem to your `Gemfile`
|
10
|
+
|
11
|
+
````
|
12
|
+
gem 'fish0'
|
13
|
+
````
|
6
14
|
|
7
15
|
## Configuration
|
8
16
|
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Fish0
|
2
|
+
module Concerns
|
3
|
+
module Base
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
included do
|
7
|
+
class << self
|
8
|
+
delegate :all, to: :repository
|
9
|
+
delegate :where, to: :repository
|
10
|
+
delegate :first, to: :repository
|
11
|
+
delegate :last, to: :repository
|
12
|
+
delegate :search, to: :repository
|
13
|
+
delegate :order_by, to: :repository
|
14
|
+
delegate :limit, to: :repository
|
15
|
+
delegate :skip, to: :repository
|
16
|
+
delegate :projection, to: :repository
|
17
|
+
|
18
|
+
def first!
|
19
|
+
first || raise(RecordNotFound, "can't find in #{collection} with #{conditions}")
|
20
|
+
end
|
21
|
+
|
22
|
+
def last!
|
23
|
+
last || raise(RecordNotFound, "can't find in #{collection} with #{conditions}")
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def collection
|
29
|
+
name.tableize
|
30
|
+
end
|
31
|
+
|
32
|
+
def repository
|
33
|
+
Fish0::Repository.new(collection)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/lib/fish0/model.rb
ADDED
data/lib/fish0/repository.rb
CHANGED
@@ -38,8 +38,9 @@ module Fish0
|
|
38
38
|
to_entity.call(element) if element
|
39
39
|
end
|
40
40
|
|
41
|
-
def
|
42
|
-
|
41
|
+
def last
|
42
|
+
element = all.last
|
43
|
+
to_entity.call(element) if element
|
43
44
|
end
|
44
45
|
|
45
46
|
def where(query)
|
@@ -67,12 +68,6 @@ module Fish0
|
|
67
68
|
self
|
68
69
|
end
|
69
70
|
|
70
|
-
def follow_after(item)
|
71
|
-
raise ArgumentError unless item.respond_to?(:published_at)
|
72
|
-
|
73
|
-
order_by(published_at: -1).where(published_at: { '$lt': item.published_at })
|
74
|
-
end
|
75
|
-
|
76
71
|
protected
|
77
72
|
|
78
73
|
def fetch
|
data/lib/fish0/version.rb
CHANGED
data/lib/fish0.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
require 'mongo'
|
2
2
|
require 'fish0/version'
|
3
|
-
require 'fish0/
|
3
|
+
require 'fish0/exceptions'
|
4
4
|
require 'fish0/repository'
|
5
5
|
require 'fish0/paginator'
|
6
6
|
require 'fish0/concerns/cacheable'
|
7
7
|
require 'fish0/concerns/paginatable'
|
8
8
|
require 'fish0/concerns/view_model'
|
9
|
+
require 'fish0/concerns/base'
|
10
|
+
require 'fish0/model'
|
9
11
|
|
10
12
|
module Fish0
|
11
13
|
class << self
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fish0
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitry Zuev
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0.35'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.4'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.4'
|
69
83
|
description: |-
|
70
84
|
Plugin for read-only content websites with MongoDB storage.
|
71
85
|
Works perfect with Rambler&Co CQRS projects
|
@@ -79,11 +93,13 @@ files:
|
|
79
93
|
- README.md
|
80
94
|
- Rakefile
|
81
95
|
- lib/fish0.rb
|
96
|
+
- lib/fish0/concerns/base.rb
|
82
97
|
- lib/fish0/concerns/cacheable.rb
|
83
98
|
- lib/fish0/concerns/paginatable.rb
|
84
99
|
- lib/fish0/concerns/view_model.rb
|
100
|
+
- lib/fish0/exceptions.rb
|
101
|
+
- lib/fish0/model.rb
|
85
102
|
- lib/fish0/paginator.rb
|
86
|
-
- lib/fish0/record_not_found.rb
|
87
103
|
- lib/fish0/repository.rb
|
88
104
|
- lib/fish0/version.rb
|
89
105
|
homepage: https://github.com/rambler-digital-solutions/fish0
|
@@ -106,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
122
|
version: '0'
|
107
123
|
requirements: []
|
108
124
|
rubyforge_project:
|
109
|
-
rubygems_version: 2.
|
125
|
+
rubygems_version: 2.5.1
|
110
126
|
signing_key:
|
111
127
|
specification_version: 4
|
112
128
|
summary: Plugin for read-only content websites
|