simple_command 0.1.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +23 -0
- data/README.md +2 -2
- data/lib/simple_command/errors.rb +1 -1
- data/lib/simple_command/utils.rb +14 -0
- data/lib/simple_command/version.rb +1 -1
- data/lib/simple_command.rb +3 -2
- data/simple_command.gemspec +3 -3
- data/spec/simple_command/errors_spec.rb +18 -6
- metadata +17 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0bfe8377a98ac9d816954e6060c6fb39b0e0c6a8817a1f14ccc3695ff1f38711
|
4
|
+
data.tar.gz: f7ffdea8cec0b7988a8b4b71977986d1a0b2aa9ac5c2219ac9fd490c114c8b41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11cde61466a2c6fea1c40cee0f358e3e299ea9bc3e98653fd9a8bafc414f5475a24bd3fa26537d1c7c86be8774f26d703e2aef44c6a325b441b7b9e9eb143be6
|
7
|
+
data.tar.gz: 03c2d3b58075237aa7e56d2a72dd4b7faafa5f7b7b13dd76fcc919b034e9eecd581c3099f9ce1aa4ba4efe91074699b2622f8e9be19bc1838edad7f282030c5b
|
@@ -0,0 +1,23 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on: [push, pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
test:
|
7
|
+
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
|
10
|
+
strategy:
|
11
|
+
fail-fast: false
|
12
|
+
matrix:
|
13
|
+
ruby: ["2.6", "2.7", "3.0", "3.1", ruby-head, jruby-9.3, jruby-head]
|
14
|
+
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v2
|
17
|
+
- name: Set up Ruby
|
18
|
+
uses: ruby/setup-ruby@v1
|
19
|
+
with:
|
20
|
+
bundler-cache: true # 'bundle install' and cache gems
|
21
|
+
ruby-version: ${{ matrix.ruby }}
|
22
|
+
- name: Run tests
|
23
|
+
run: bundle exec rake
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
[![Code Climate](https://codeclimate.com/github/nebulab/simple_command/badges/gpa.svg)](https://codeclimate.com/github/nebulab/simple_command)
|
2
|
-
|
2
|
+
![CI](https://github.com/nebulab/simple_command/actions/workflows/ci.yml/badge.svg)
|
3
3
|
|
4
4
|
# SimpleCommand
|
5
5
|
|
@@ -7,7 +7,7 @@ A simple, standardized way to build and use _Service Objects_ (aka _Commands_) i
|
|
7
7
|
|
8
8
|
## Requirements
|
9
9
|
|
10
|
-
* Ruby 2.
|
10
|
+
* Ruby 2.6+
|
11
11
|
|
12
12
|
## Installation
|
13
13
|
|
data/lib/simple_command.rb
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
require 'simple_command/version'
|
2
|
+
require 'simple_command/utils'
|
2
3
|
require 'simple_command/errors'
|
3
4
|
|
4
5
|
module SimpleCommand
|
5
6
|
attr_reader :result
|
6
7
|
|
7
8
|
module ClassMethods
|
8
|
-
def call(*args)
|
9
|
-
new(*args).call
|
9
|
+
def call(*args, **kwargs)
|
10
|
+
new(*args, **kwargs).call
|
10
11
|
end
|
11
12
|
end
|
12
13
|
|
data/simple_command.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'simple_command/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.required_ruby_version = '>= 2.
|
7
|
+
s.required_ruby_version = '>= 2.6'
|
8
8
|
s.name = 'simple_command'
|
9
9
|
s.version = SimpleCommand::VERSION
|
10
10
|
s.authors = ['Andrea Pavoni']
|
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.test_files = s.files.grep(/^(test|spec|features)\//)
|
20
20
|
s.require_paths = ['lib']
|
21
21
|
|
22
|
-
s.add_development_dependency 'bundler'
|
23
|
-
s.add_development_dependency 'rake'
|
22
|
+
s.add_development_dependency 'bundler'
|
23
|
+
s.add_development_dependency 'rake'
|
24
24
|
s.add_development_dependency 'rspec', '~> 3.1'
|
25
25
|
end
|
@@ -19,21 +19,33 @@ describe SimpleCommand::Errors do
|
|
19
19
|
end
|
20
20
|
|
21
21
|
describe '#add_multiple_errors' do
|
22
|
-
|
23
|
-
{
|
22
|
+
it 'populates itself with the added errors' do
|
23
|
+
errors_list = {
|
24
24
|
some_error: ['some error description'],
|
25
25
|
another_error: ['another error description']
|
26
26
|
}
|
27
|
-
end
|
28
27
|
|
29
|
-
before do
|
30
28
|
errors.add_multiple_errors errors_list
|
31
|
-
end
|
32
29
|
|
33
|
-
it 'populates itself with the added errors' do
|
34
30
|
expect(errors[:some_error]).to eq(errors_list[:some_error])
|
35
31
|
expect(errors[:another_error]).to eq(errors_list[:another_error])
|
36
32
|
end
|
33
|
+
|
34
|
+
it 'copies errors from another SimpleCommand::Errors object' do
|
35
|
+
command_errors = SimpleCommand::Errors.new
|
36
|
+
command_errors.add :some_error, "was found"
|
37
|
+
command_errors.add :some_error, "happened again"
|
38
|
+
|
39
|
+
errors.add_multiple_errors command_errors
|
40
|
+
|
41
|
+
expect(errors[:some_error]).to eq(["was found", "happened again"])
|
42
|
+
end
|
43
|
+
|
44
|
+
it "ignores nil values" do
|
45
|
+
errors.add_multiple_errors({:foo => nil})
|
46
|
+
|
47
|
+
expect(errors[:foo]).to eq nil
|
48
|
+
end
|
37
49
|
end
|
38
50
|
|
39
51
|
describe '#each' do
|
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_command
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrea Pavoni
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0'
|
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: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -59,6 +59,7 @@ executables: []
|
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
|
+
- ".github/workflows/ci.yml"
|
62
63
|
- ".gitignore"
|
63
64
|
- ".rspec"
|
64
65
|
- ".rubocop.yml"
|
@@ -69,6 +70,7 @@ files:
|
|
69
70
|
- Rakefile
|
70
71
|
- lib/simple_command.rb
|
71
72
|
- lib/simple_command/errors.rb
|
73
|
+
- lib/simple_command/utils.rb
|
72
74
|
- lib/simple_command/version.rb
|
73
75
|
- simple_command.gemspec
|
74
76
|
- spec/factories/missed_call_command.rb
|
@@ -80,7 +82,7 @@ homepage: http://github.com/nebulab/simple_command
|
|
80
82
|
licenses:
|
81
83
|
- MIT
|
82
84
|
metadata: {}
|
83
|
-
post_install_message:
|
85
|
+
post_install_message:
|
84
86
|
rdoc_options: []
|
85
87
|
require_paths:
|
86
88
|
- lib
|
@@ -88,15 +90,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
88
90
|
requirements:
|
89
91
|
- - ">="
|
90
92
|
- !ruby/object:Gem::Version
|
91
|
-
version: '2.
|
93
|
+
version: '2.6'
|
92
94
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
95
|
requirements:
|
94
96
|
- - ">="
|
95
97
|
- !ruby/object:Gem::Version
|
96
98
|
version: '0'
|
97
99
|
requirements: []
|
98
|
-
rubygems_version: 3.
|
99
|
-
signing_key:
|
100
|
+
rubygems_version: 3.2.20
|
101
|
+
signing_key:
|
100
102
|
specification_version: 4
|
101
103
|
summary: Easy way to build and manage commands (service objects)
|
102
104
|
test_files:
|