smart_initializer 0.3.1 → 0.7.0

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: fd0eb76f680e74b4b2eb404eb72df5181d13135bcba2c4eb105a7ae663d068f9
4
- data.tar.gz: 0a532548173e17b18135d2b3a2748430330b0e28467fc483f434e463f6f6f862
3
+ metadata.gz: 84aa6ce59c1c73432c01015a595c6a20c2e11344d2d6464aa63920c288f3b51f
4
+ data.tar.gz: '0819287ddbd9cfc21fac709a848205230036dd2b724df4568ed90b36bbd0316e'
5
5
  SHA512:
6
- metadata.gz: fc77143a0cfd9e90553059444eb38bb527aae5afc2f543eafb0a9525171ca45c2506d0826170e14f2a9a284c05ec43d6f9f024d14ea288f664b4ea962219f9f4
7
- data.tar.gz: 1b889ee6f9d801cede43a624a6f800bf3b2341f874395870426522025ee5fd8bbbbd40a01940cf087e40f696cb2b87282739ebe72ddd34b9845b37c01c7c207b
6
+ metadata.gz: e6b1f6664ae3e519b4fe516e565b959987f459d145d0f5de4a7d26e8b9d32ed103567eb11d7d050ef1b3d7ad2fa05e430223060f7638552dfe24edd3d8999644
7
+ data.tar.gz: 7ee572ea83d433095f1fd3a27a127543eb22fbbafde515e052e6d1a3360914c828a8dd983f8659501a7fbca08499cec11a34a18e4c43ac9702acd39af5235663
data/.rubocop.yml CHANGED
@@ -5,15 +5,22 @@ inherit_gem:
5
5
  - lib/rubocop.rspec.yml
6
6
 
7
7
  AllCops:
8
- TargetRubyVersion: 2.7.1
8
+ TargetRubyVersion: 3.0.0
9
+ NewCops: enable
9
10
  Include:
10
11
  - lib/**/*.rb
11
12
  - spec/**/*.rb
12
13
  - Gemfile
13
14
  - Rakefile
14
15
  - smart_initializer.gemspec
16
+ - gemfiles/*.gemfile
15
17
  - bin/console
16
18
 
17
19
  # NOTE: It is not suitable for infrastracture-level frameworks
18
20
  Metrics/ParameterLists:
19
21
  Enabled: false
22
+
23
+ # NOTE: It is ok to use empty blocks in specs (inside simple test cases)
24
+ Lint/EmptyBlock:
25
+ Exclude:
26
+ - spec/**/*.rb
data/CHANGELOG.md CHANGED
@@ -1,9 +1,35 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## [0.7.0] - 2021-06-23
5
+ ## Added
6
+ - `strict_options` config option for non-strict checking of passed options;
7
+
8
+ ## [0.6.0] - 2021-06-23
9
+ ## Added
10
+ - Validation messages for incorrect attribute types;
11
+
12
+ ## [0.5.0] - 2021-01-18
13
+ ## Changed
14
+ - Updated `smart_types` dependency (`~> 0.4.0`) to guarantee **Ruby@3** compatibility;
15
+ - Updated development dependencies;
16
+
17
+ ## [0.4.0] - 2021-01-18
18
+ ### Added
19
+ - Support for **Ruby 3**;
20
+
21
+ ### Changed
22
+ - Moved from `TravisCI` to nothing (todo: migrate to `GitHub Actions`).
23
+ Temporary: we must run test cases locally.
24
+ - Updated development dependencies;
25
+
26
+ ## [0.3.2] - 2020-07-12
27
+ ### Fixed
28
+ - Deeply inherited entities lose their `__initializer_settings__` entitiy;
29
+
4
30
  ## [0.3.1] - 2020-07-12
5
31
  ### Fixed
6
- - Deeply inherited entities lose class attribute definers;
32
+ - Deeply inherited entities lose their class attribute definers;
7
33
 
8
34
  ## [0.3.0] - 2020-07-11
9
35
  ### Added
data/Gemfile.lock CHANGED
@@ -1,100 +1,110 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- smart_initializer (0.3.0)
4
+ smart_initializer (0.6.1)
5
5
  qonfig (~> 0.24)
6
- smart_engine (~> 0.7)
7
- smart_types (~> 0.1.0)
6
+ smart_engine (~> 0.11)
7
+ smart_types (~> 0.4)
8
8
 
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- activesupport (6.0.3.2)
12
+ activesupport (6.1.2)
13
13
  concurrent-ruby (~> 1.0, >= 1.0.2)
14
- i18n (>= 0.7, < 2)
15
- minitest (~> 5.1)
16
- tzinfo (~> 1.1)
17
- zeitwerk (~> 2.2, >= 2.2.2)
18
- armitage-rubocop (0.87.1.2)
19
- rubocop (= 0.87.1)
20
- rubocop-performance (= 1.7.0)
21
- rubocop-rails (= 2.6.0)
14
+ i18n (>= 1.6, < 2)
15
+ minitest (>= 5.1)
16
+ tzinfo (~> 2.0)
17
+ zeitwerk (~> 2.3)
18
+ armitage-rubocop (1.8.1)
19
+ rubocop (= 1.8.1)
20
+ rubocop-performance (= 1.9.2)
21
+ rubocop-rails (= 2.9.1)
22
22
  rubocop-rake (= 0.5.1)
23
- rubocop-rspec (= 1.42.0)
24
- ast (2.4.1)
25
- concurrent-ruby (1.1.6)
23
+ rubocop-rspec (= 2.1.0)
24
+ ast (2.4.2)
25
+ coderay (1.1.3)
26
+ concurrent-ruby (1.1.8)
26
27
  diff-lcs (1.4.4)
27
- docile (1.3.2)
28
- i18n (1.8.3)
28
+ docile (1.3.5)
29
+ i18n (1.8.8)
29
30
  concurrent-ruby (~> 1.0)
30
- minitest (5.14.1)
31
- parallel (1.19.2)
32
- parser (2.7.1.4)
31
+ method_source (1.0.0)
32
+ minitest (5.14.3)
33
+ parallel (1.20.1)
34
+ parser (3.0.0.0)
33
35
  ast (~> 2.4.1)
34
- qonfig (0.24.1)
36
+ pry (0.14.0)
37
+ coderay (~> 1.1)
38
+ method_source (~> 1.0)
39
+ qonfig (0.25.0)
35
40
  rack (2.2.3)
36
41
  rainbow (3.0.0)
37
- rake (13.0.1)
38
- regexp_parser (1.7.1)
42
+ rake (13.0.3)
43
+ regexp_parser (2.0.3)
39
44
  rexml (3.2.4)
40
- rspec (3.9.0)
41
- rspec-core (~> 3.9.0)
42
- rspec-expectations (~> 3.9.0)
43
- rspec-mocks (~> 3.9.0)
44
- rspec-core (3.9.2)
45
- rspec-support (~> 3.9.3)
46
- rspec-expectations (3.9.2)
45
+ rspec (3.10.0)
46
+ rspec-core (~> 3.10.0)
47
+ rspec-expectations (~> 3.10.0)
48
+ rspec-mocks (~> 3.10.0)
49
+ rspec-core (3.10.1)
50
+ rspec-support (~> 3.10.0)
51
+ rspec-expectations (3.10.1)
47
52
  diff-lcs (>= 1.2.0, < 2.0)
48
- rspec-support (~> 3.9.0)
49
- rspec-mocks (3.9.1)
53
+ rspec-support (~> 3.10.0)
54
+ rspec-mocks (3.10.2)
50
55
  diff-lcs (>= 1.2.0, < 2.0)
51
- rspec-support (~> 3.9.0)
52
- rspec-support (3.9.3)
53
- rubocop (0.87.1)
56
+ rspec-support (~> 3.10.0)
57
+ rspec-support (3.10.2)
58
+ rubocop (1.8.1)
54
59
  parallel (~> 1.10)
55
- parser (>= 2.7.1.1)
60
+ parser (>= 3.0.0.0)
56
61
  rainbow (>= 2.2.2, < 4.0)
57
- regexp_parser (>= 1.7)
62
+ regexp_parser (>= 1.8, < 3.0)
58
63
  rexml
59
- rubocop-ast (>= 0.1.0, < 1.0)
64
+ rubocop-ast (>= 1.2.0, < 2.0)
60
65
  ruby-progressbar (~> 1.7)
61
- unicode-display_width (>= 1.4.0, < 2.0)
62
- rubocop-ast (0.1.0)
63
- parser (>= 2.7.0.1)
64
- rubocop-performance (1.7.0)
65
- rubocop (>= 0.82.0)
66
- rubocop-rails (2.6.0)
66
+ unicode-display_width (>= 1.4.0, < 3.0)
67
+ rubocop-ast (1.4.1)
68
+ parser (>= 2.7.1.5)
69
+ rubocop-performance (1.9.2)
70
+ rubocop (>= 0.90.0, < 2.0)
71
+ rubocop-ast (>= 0.4.0)
72
+ rubocop-rails (2.9.1)
67
73
  activesupport (>= 4.2.0)
68
74
  rack (>= 1.1)
69
- rubocop (>= 0.82.0)
75
+ rubocop (>= 0.90.0, < 2.0)
70
76
  rubocop-rake (0.5.1)
71
77
  rubocop
72
- rubocop-rspec (1.42.0)
73
- rubocop (>= 0.87.0)
74
- ruby-progressbar (1.10.1)
75
- simplecov (0.18.5)
78
+ rubocop-rspec (2.1.0)
79
+ rubocop (~> 1.0)
80
+ rubocop-ast (>= 1.1.0)
81
+ ruby-progressbar (1.11.0)
82
+ simplecov (0.21.2)
76
83
  docile (~> 1.1)
77
84
  simplecov-html (~> 0.11)
78
- simplecov-html (0.12.2)
79
- smart_engine (0.7.0)
80
- smart_types (0.1.0)
81
- smart_engine (~> 0.6)
82
- thread_safe (0.3.6)
83
- tzinfo (1.2.7)
84
- thread_safe (~> 0.1)
85
- unicode-display_width (1.7.0)
86
- zeitwerk (2.3.1)
85
+ simplecov_json_formatter (~> 0.1)
86
+ simplecov-html (0.12.3)
87
+ simplecov_json_formatter (0.1.2)
88
+ smart_engine (0.11.0)
89
+ smart_types (0.4.0)
90
+ smart_engine (~> 0.11)
91
+ tzinfo (2.0.4)
92
+ concurrent-ruby (~> 1.0)
93
+ unicode-display_width (2.0.0)
94
+ zeitwerk (2.4.2)
87
95
 
88
96
  PLATFORMS
89
- ruby
97
+ x86_64-darwin-19
98
+ x86_64-darwin-20
90
99
 
91
100
  DEPENDENCIES
92
- armitage-rubocop (~> 0.87)
93
- bundler (~> 2.1)
101
+ armitage-rubocop (~> 1.7)
102
+ bundler (~> 2.2)
103
+ pry (~> 0.14)
94
104
  rake (~> 13.0)
95
- rspec (~> 3.9)
96
- simplecov (~> 0.18)
105
+ rspec (~> 3.10)
106
+ simplecov (~> 0.21)
97
107
  smart_initializer!
98
108
 
99
109
  BUNDLED WITH
100
- 2.1.4
110
+ 2.2.19
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2020 Rustam Ibragimov
3
+ Copyright (c) 2020-2021 Rustam Ibragimov
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # SmartCore::Initializer &middot; [![Gem Version](https://badge.fury.io/rb/smart_initializer.svg)](https://badge.fury.io/rb/smart_initializer) [![Build Status](https://travis-ci.org/smart-rb/smart_initializer.svg?branch=master)](https://travis-ci.org/smart-rb/smart_initializer)
1
+ # SmartCore::Initializer &middot; [![Gem Version](https://badge.fury.io/rb/smart_initializer.svg)](https://badge.fury.io/rb/smart_initializer)
2
2
 
3
3
  A simple and convenient way to declare complex constructors with a support for various commonly used type systems.
4
4
  (**in active development**).
@@ -30,7 +30,8 @@ require 'smart_core/initializer'
30
30
  - [Initialization extension](#initialization-extension)
31
31
  - [Plugins](#plugins)
32
32
  - [thy-types](#plugin-thy-types)
33
- - [How to run tests](#how-to-run-tests)
33
+ - [Roadmap](#roadmap)
34
+ - [Build](#build)
34
35
 
35
36
  ---
36
37
 
@@ -155,11 +156,13 @@ user.__attributes__ # => { first_name: 'Rustam', second_name: 'Ibragimov', age:
155
156
  - you can read config values via `[]` or `.config.settings` or `.config[key]`;
156
157
  - setitngs:
157
158
  - `default_type_system` - default type system (`smart_types` by default);
159
+ - `strict_options` - raise an error when got unknown options if true (`true` by default);
158
160
 
159
161
  ```ruby
160
162
  # configure:
161
163
  SmartCore::Initializer::Configuration.configure do |config|
162
164
  config.default_type_system = :smart_types # default setting value
165
+ config.strict_options = true # default setting value
163
166
  end
164
167
  ```
165
168
 
@@ -286,7 +289,19 @@ User.new(123, 'test', { admin: true, age: 22 })
286
289
 
287
290
  ---
288
291
 
289
- ## How to run tests
292
+ ## Roadmap
293
+
294
+ - (in development) Attribue Definition DSL
295
+ - Support for specifying the attribute accessor type (`read_only` parameter);
296
+ - Support for attribute aliasing (`as` parameter);
297
+ - Migrate from `TravisCI` to `GitHub Actions`;
298
+ - Extract `Type Interop` system to `smart_type-system`;
299
+
300
+ ---
301
+
302
+ ## Build
303
+
304
+ ### Tests Running
290
305
 
291
306
  - with plugin tests:
292
307
 
@@ -306,6 +321,20 @@ bin/rspec -n
306
321
  bin/rspec -h
307
322
  ```
308
323
 
324
+ ### Code Style Checking
325
+
326
+ - without auto-correction:
327
+
328
+ ```shell
329
+ bundle exec rake rubocop
330
+ ```
331
+
332
+ - with auto-correction:
333
+
334
+ ```shell
335
+ bundle exec rake rubocop -A
336
+ ```
337
+
309
338
  ---
310
339
 
311
340
  ## Contributing
data/bin/console CHANGED
@@ -2,7 +2,7 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require 'bundler/setup'
5
- require 'smart_core/initializer'
5
+ require 'smart_core'
6
6
 
7
- require 'irb'
8
- IRB.start(__FILE__)
7
+ require 'pry'
8
+ Pry.start
@@ -1,102 +1,111 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- smart_initializer (0.3.0)
4
+ smart_initializer (0.5.0)
5
5
  qonfig (~> 0.24)
6
- smart_engine (~> 0.7)
7
- smart_types (~> 0.1.0)
6
+ smart_engine (~> 0.11)
7
+ smart_types (~> 0.4)
8
8
 
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- activesupport (6.0.3.2)
12
+ activesupport (6.1.1)
13
13
  concurrent-ruby (~> 1.0, >= 1.0.2)
14
- i18n (>= 0.7, < 2)
15
- minitest (~> 5.1)
16
- tzinfo (~> 1.1)
17
- zeitwerk (~> 2.2, >= 2.2.2)
18
- armitage-rubocop (0.87.1.2)
19
- rubocop (= 0.87.1)
20
- rubocop-performance (= 1.7.0)
21
- rubocop-rails (= 2.6.0)
14
+ i18n (>= 1.6, < 2)
15
+ minitest (>= 5.1)
16
+ tzinfo (~> 2.0)
17
+ zeitwerk (~> 2.3)
18
+ armitage-rubocop (1.7.0.1)
19
+ rubocop (= 1.7.0)
20
+ rubocop-performance (= 1.9.1)
21
+ rubocop-rails (= 2.9.1)
22
22
  rubocop-rake (= 0.5.1)
23
- rubocop-rspec (= 1.42.0)
23
+ rubocop-rspec (= 2.1.0)
24
24
  ast (2.4.1)
25
- concurrent-ruby (1.1.6)
26
- diff-lcs (1.3)
27
- docile (1.3.2)
28
- i18n (1.8.3)
25
+ coderay (1.1.3)
26
+ concurrent-ruby (1.1.7)
27
+ diff-lcs (1.4.4)
28
+ docile (1.3.5)
29
+ i18n (1.8.7)
29
30
  concurrent-ruby (~> 1.0)
30
- minitest (5.14.1)
31
- parallel (1.19.2)
32
- parser (2.7.1.4)
31
+ method_source (1.0.0)
32
+ minitest (5.14.3)
33
+ parallel (1.20.1)
34
+ parser (3.0.0.0)
33
35
  ast (~> 2.4.1)
34
- qonfig (0.24.1)
36
+ pry (0.13.1)
37
+ coderay (~> 1.1)
38
+ method_source (~> 1.0)
39
+ qonfig (0.25.0)
35
40
  rack (2.2.3)
36
41
  rainbow (3.0.0)
37
- rake (13.0.1)
38
- regexp_parser (1.7.1)
42
+ rake (13.0.3)
43
+ regexp_parser (2.0.3)
39
44
  rexml (3.2.4)
40
- rspec (3.9.0)
41
- rspec-core (~> 3.9.0)
42
- rspec-expectations (~> 3.9.0)
43
- rspec-mocks (~> 3.9.0)
44
- rspec-core (3.9.2)
45
- rspec-support (~> 3.9.3)
46
- rspec-expectations (3.9.2)
45
+ rspec (3.10.0)
46
+ rspec-core (~> 3.10.0)
47
+ rspec-expectations (~> 3.10.0)
48
+ rspec-mocks (~> 3.10.0)
49
+ rspec-core (3.10.1)
50
+ rspec-support (~> 3.10.0)
51
+ rspec-expectations (3.10.1)
47
52
  diff-lcs (>= 1.2.0, < 2.0)
48
- rspec-support (~> 3.9.0)
49
- rspec-mocks (3.9.1)
53
+ rspec-support (~> 3.10.0)
54
+ rspec-mocks (3.10.1)
50
55
  diff-lcs (>= 1.2.0, < 2.0)
51
- rspec-support (~> 3.9.0)
52
- rspec-support (3.9.3)
53
- rubocop (0.87.1)
56
+ rspec-support (~> 3.10.0)
57
+ rspec-support (3.10.1)
58
+ rubocop (1.7.0)
54
59
  parallel (~> 1.10)
55
- parser (>= 2.7.1.1)
60
+ parser (>= 2.7.1.5)
56
61
  rainbow (>= 2.2.2, < 4.0)
57
- regexp_parser (>= 1.7)
62
+ regexp_parser (>= 1.8, < 3.0)
58
63
  rexml
59
- rubocop-ast (>= 0.1.0, < 1.0)
64
+ rubocop-ast (>= 1.2.0, < 2.0)
60
65
  ruby-progressbar (~> 1.7)
61
66
  unicode-display_width (>= 1.4.0, < 2.0)
62
- rubocop-ast (0.1.0)
63
- parser (>= 2.7.0.1)
64
- rubocop-performance (1.7.0)
65
- rubocop (>= 0.82.0)
66
- rubocop-rails (2.6.0)
67
+ rubocop-ast (1.4.0)
68
+ parser (>= 2.7.1.5)
69
+ rubocop-performance (1.9.1)
70
+ rubocop (>= 0.90.0, < 2.0)
71
+ rubocop-ast (>= 0.4.0)
72
+ rubocop-rails (2.9.1)
67
73
  activesupport (>= 4.2.0)
68
74
  rack (>= 1.1)
69
- rubocop (>= 0.82.0)
75
+ rubocop (>= 0.90.0, < 2.0)
70
76
  rubocop-rake (0.5.1)
71
77
  rubocop
72
- rubocop-rspec (1.42.0)
73
- rubocop (>= 0.87.0)
74
- ruby-progressbar (1.10.1)
75
- simplecov (0.18.5)
78
+ rubocop-rspec (2.1.0)
79
+ rubocop (~> 1.0)
80
+ rubocop-ast (>= 1.1.0)
81
+ ruby-progressbar (1.11.0)
82
+ simplecov (0.21.2)
76
83
  docile (~> 1.1)
77
84
  simplecov-html (~> 0.11)
78
- simplecov-html (0.12.2)
79
- smart_engine (0.7.0)
80
- smart_types (0.1.0)
81
- smart_engine (~> 0.6)
82
- thread_safe (0.3.6)
85
+ simplecov_json_formatter (~> 0.1)
86
+ simplecov-html (0.12.3)
87
+ simplecov_json_formatter (0.1.2)
88
+ smart_engine (0.11.0)
89
+ smart_types (0.4.0)
90
+ smart_engine (~> 0.11)
83
91
  thy (0.1.4)
84
- tzinfo (1.2.7)
85
- thread_safe (~> 0.1)
92
+ tzinfo (2.0.4)
93
+ concurrent-ruby (~> 1.0)
86
94
  unicode-display_width (1.7.0)
87
- zeitwerk (2.3.1)
95
+ zeitwerk (2.4.2)
88
96
 
89
97
  PLATFORMS
90
- ruby
98
+ x86_64-darwin-20
91
99
 
92
100
  DEPENDENCIES
93
- armitage-rubocop (~> 0.87)
94
- bundler (~> 2.1)
101
+ armitage-rubocop (~> 1.7)
102
+ bundler (~> 2.2)
103
+ pry (~> 0.13)
95
104
  rake (~> 13.0)
96
- rspec (~> 3.9)
97
- simplecov (~> 0.18)
105
+ rspec (~> 3.10)
106
+ simplecov (~> 0.21)
98
107
  smart_initializer!
99
108
  thy (~> 0.1.4)
100
109
 
101
110
  BUNDLED WITH
102
- 2.1.4
111
+ 2.2.3