ez-core 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +16 -0
- data/Gemfile +3 -2
- data/README.md +9 -0
- data/Rakefile +5 -3
- data/bin/console +4 -3
- data/ez-core.gemspec +11 -11
- data/lib/ez/configurator.rb +4 -2
- data/lib/ez/core.rb +2 -4
- data/lib/ez/core/version.rb +3 -1
- data/lib/ez/items/link.rb +2 -0
- data/lib/ez/registry.rb +4 -3
- data/lib/ez/registry/record.rb +2 -0
- data/lib/ez/registry/store.rb +2 -0
- metadata +33 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 86d5274de43b3f7946c94a9a47401b45096cdcd32da91176b6faf434ede711cb
|
4
|
+
data.tar.gz: b19a80fd69edb817a01462b4cbcb28d8dc1461fa09dc9d943e68c65a30eb68a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28a757d17ddb0b40ed05eabd8b600d25c83160113419f8365db254d219358334678a6bb8c2bcf1d87e8976f55b43939dec315aebffd6eb6e92476ea86becb1a5
|
7
|
+
data.tar.gz: 431275b1098ce211815b7475233a1e2a834e12ba5e4ce32e8a24003a1ff4c60d3e3d0f92bfe71e22fae343cfe28c1a0c00597f52473cbf918e4dcda7cff8cf02
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.5
|
3
|
+
Exclude:
|
4
|
+
- Guardfile
|
5
|
+
- config.ru
|
6
|
+
|
7
|
+
Style/Documentation:
|
8
|
+
Enabled: false
|
9
|
+
|
10
|
+
Metrics/LineLength:
|
11
|
+
Max: 120
|
12
|
+
|
13
|
+
Metrics/BlockLength:
|
14
|
+
ExcludedMethods: [
|
15
|
+
'describe', 'context', 'it', 'let', 'before', 'after', 'aggregate_failures'
|
16
|
+
]
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -20,6 +20,8 @@ Heavily inspired by [dry-rb](http://dry-rb.org/), but for rails.
|
|
20
20
|
|
21
21
|
Simple pluggable configuration for using in any module:
|
22
22
|
```ruby
|
23
|
+
require 'ez/configurator'
|
24
|
+
|
23
25
|
module MyEngine
|
24
26
|
include Ez::Configurator
|
25
27
|
end
|
@@ -38,6 +40,8 @@ MyEngine.config.your_value # => 'new value'
|
|
38
40
|
Registry store for keep all knowledge in one place.
|
39
41
|
Use for store any values across different engines:
|
40
42
|
```ruby
|
43
|
+
require 'ez/registry'
|
44
|
+
|
41
45
|
Ez::Registry.in :my_registry, by: MyEngine do |registry|
|
42
46
|
registry.add :first_value
|
43
47
|
registry.add :second_value
|
@@ -55,6 +59,11 @@ Ez::Registry.store(:my_registry) # =>
|
|
55
59
|
# ]
|
56
60
|
```
|
57
61
|
|
62
|
+
All data stores in Recorc#data and you can use `.data` registry method for easy access
|
63
|
+
```ruby
|
64
|
+
Ez::Registry.data(:my_registry) # => [ :first_value, :second_value, :third_value ]
|
65
|
+
```
|
66
|
+
|
58
67
|
### Examples:
|
59
68
|
- Dependency inversion
|
60
69
|
- Extend feature list
|
data/Rakefile
CHANGED
data/bin/console
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
|
-
require
|
4
|
-
require
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'ez/core'
|
5
6
|
|
6
7
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
8
|
# with your gem easier. You can also use a different console, if you like.
|
@@ -10,5 +11,5 @@ require "ez/core"
|
|
10
11
|
# require "pry"
|
11
12
|
# Pry.start
|
12
13
|
|
13
|
-
require
|
14
|
+
require 'irb'
|
14
15
|
IRB.start(__FILE__)
|
data/ez-core.gemspec
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
5
|
require 'ez/core/version'
|
5
6
|
|
@@ -9,22 +10,21 @@ Gem::Specification.new do |s|
|
|
9
10
|
s.authors = ['Volodya Sveredyuk']
|
10
11
|
s.email = ['sveredyuk@gmail.com']
|
11
12
|
|
12
|
-
s.summary = 'Core module for easy Rails apps
|
13
|
-
s.description = 'Core module for easy Rails apps
|
13
|
+
s.summary = 'Core module for easy Rails apps via EzEngines'
|
14
|
+
s.description = 'Core module for easy Rails apps via EzEngines'
|
14
15
|
s.homepage = 'https://github.com/ez-engines'
|
15
16
|
s.license = 'MIT'
|
16
17
|
|
17
|
-
s.files
|
18
|
+
s.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
19
|
f.match(%r{^(test|spec|features)/})
|
19
20
|
end
|
20
21
|
|
21
|
-
s.bindir = 'exe'
|
22
|
-
s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
22
|
s.require_paths = ['lib']
|
24
23
|
|
25
|
-
s.add_development_dependency 'bundler',
|
26
|
-
s.add_development_dependency '
|
27
|
-
s.add_development_dependency 'rspec', '~> 3.0'
|
28
|
-
s.add_development_dependency 'guard-rspec'
|
24
|
+
s.add_development_dependency 'bundler', '~> 1.15'
|
25
|
+
s.add_development_dependency 'guard-rspec', '~> 4.7'
|
29
26
|
s.add_development_dependency 'pry'
|
27
|
+
s.add_development_dependency 'rake', '~> 10.0'
|
28
|
+
s.add_development_dependency 'rspec', '~> 3.0'
|
29
|
+
s.add_development_dependency 'rubocop'
|
30
30
|
end
|
data/lib/ez/configurator.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'ostruct'
|
2
4
|
|
3
5
|
module Ez
|
@@ -9,8 +11,8 @@ module Ez
|
|
9
11
|
module Engine
|
10
12
|
class Store < OpenStruct; end
|
11
13
|
|
12
|
-
def configure
|
13
|
-
|
14
|
+
def configure
|
15
|
+
yield(config)
|
14
16
|
end
|
15
17
|
|
16
18
|
def config
|
data/lib/ez/core.rb
CHANGED
data/lib/ez/core/version.rb
CHANGED
data/lib/ez/items/link.rb
CHANGED
data/lib/ez/registry.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'singleton'
|
2
4
|
|
3
5
|
require 'ez/registry/store'
|
@@ -8,8 +10,7 @@ module Ez
|
|
8
10
|
include Singleton
|
9
11
|
|
10
12
|
class << self
|
11
|
-
def in(key, by
|
12
|
-
|
13
|
+
def in(key, by:)
|
13
14
|
get_or_initialize_store_by(key)
|
14
15
|
|
15
16
|
add!(yield(Registry::Store.new), to: store[key], by: by)
|
@@ -35,7 +36,7 @@ module Ez
|
|
35
36
|
store[key] || store[key] = Registry::Store.new
|
36
37
|
end
|
37
38
|
|
38
|
-
def add!(*collection, to
|
39
|
+
def add!(*collection, to:, by:)
|
39
40
|
collection.flatten.each do |record|
|
40
41
|
record.by = by
|
41
42
|
to.push(record)
|
data/lib/ez/registry/record.rb
CHANGED
data/lib/ez/registry/store.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ez-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Volodya Sveredyuk
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -25,49 +25,63 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.15'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: guard-rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '4.7'
|
34
34
|
type: :development
|
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: '
|
40
|
+
version: '4.7'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: pry
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
59
|
- - "~>"
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
61
|
+
version: '10.0'
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
66
|
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
68
|
+
version: '10.0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
70
|
+
name: rspec
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
|
-
- - "
|
73
|
+
- - "~>"
|
60
74
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
75
|
+
version: '3.0'
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
|
-
- - "
|
80
|
+
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
82
|
+
version: '3.0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
84
|
+
name: rubocop
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
87
|
- - ">="
|
@@ -80,7 +94,7 @@ dependencies:
|
|
80
94
|
- - ">="
|
81
95
|
- !ruby/object:Gem::Version
|
82
96
|
version: '0'
|
83
|
-
description: Core module for easy Rails apps
|
97
|
+
description: Core module for easy Rails apps via EzEngines
|
84
98
|
email:
|
85
99
|
- sveredyuk@gmail.com
|
86
100
|
executables: []
|
@@ -89,6 +103,7 @@ extra_rdoc_files: []
|
|
89
103
|
files:
|
90
104
|
- ".gitignore"
|
91
105
|
- ".rspec"
|
106
|
+
- ".rubocop.yml"
|
92
107
|
- ".travis.yml"
|
93
108
|
- CODE_OF_CONDUCT.md
|
94
109
|
- Gemfile
|
@@ -126,8 +141,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
141
|
version: '0'
|
127
142
|
requirements: []
|
128
143
|
rubyforge_project:
|
129
|
-
rubygems_version: 2.
|
144
|
+
rubygems_version: 2.7.7
|
130
145
|
signing_key:
|
131
146
|
specification_version: 4
|
132
|
-
summary: Core module for easy Rails apps
|
147
|
+
summary: Core module for easy Rails apps via EzEngines
|
133
148
|
test_files: []
|