opera 0.1.1 → 0.1.2

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: ddec540f131cd319f959558c3d844a49eecda07a3bf188ffac9e44d7ed006fb0
4
- data.tar.gz: d5c4049462a5483be58dc72a4258cb160bb9769db6427ed532cb34a34f8e73d5
3
+ metadata.gz: 9012fc7c78d543bde97172bb8504d8835fbdc051c9842498544c7c86669638c9
4
+ data.tar.gz: 78021a04133da9fbacb96275c369337213a08822c710f325ce6d78b04970db37
5
5
  SHA512:
6
- metadata.gz: 76a0c821bded96e65352d0b7780089f7e88086e7726cb6fd6fee17886ebb8da70ef5136a6575b2bda1bf2380edc24fb4c0bc4b382aa6185f7c299dfde2638c99
7
- data.tar.gz: 71a465970f9d2cb2f8fb9d4911b3892be0893d3a0b5c6d572d682405d24b45dbe2082e87fe9ba63bc78f67706feb1dc907eb20dcce160b67057f4af661dc81ad
6
+ metadata.gz: fd9778459fceeda84e49684a18d11ef82b3ba593824c568bee8bce2cd92d311f8020cd128e3274da6d09ace98890ccb1b69eec778e63cf87a9352c24fea3c3e5
7
+ data.tar.gz: 879bd00727c7554e5fda0620564fccefbcd4da64ca25e04216d259df1c94d5f289df9c3506a82f262288b53f2c1cb6b2131789a641f0a57e33ddf23a438f278d
data/Dockerfile ADDED
@@ -0,0 +1,20 @@
1
+ FROM ruby:2.7.1
2
+
3
+ MAINTAINER ProFinda Developers <dev@profinda.com>
4
+
5
+ ENV LANG C.UTF-8
6
+ ENV LC_ALL C.UTF-8
7
+
8
+ RUN apt-get update -y && \
9
+ apt-get install -y cmake \
10
+ build-essential
11
+
12
+ ENV APP_HOME /usr/src/app
13
+ RUN mkdir -p $APP_HOME
14
+ WORKDIR $APP_HOME
15
+
16
+ COPY . $APP_HOME
17
+
18
+ RUN bundle install -j 8
19
+
20
+ COPY . $APP_HOME
data/Gemfile CHANGED
@@ -8,4 +8,5 @@ gem 'rspec', '~> 3.0'
8
8
 
9
9
  group :test, :development do
10
10
  gem 'dry-validation'
11
+ gem 'pry-byebug', require: false
11
12
  end
data/Gemfile.lock CHANGED
@@ -1,11 +1,13 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- opera (0.1.1)
4
+ opera (0.1.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
+ byebug (11.1.3)
10
+ coderay (1.1.3)
9
11
  concurrent-ruby (1.1.7)
10
12
  diff-lcs (1.4.4)
11
13
  dry-configurable (0.11.6)
@@ -15,28 +17,44 @@ GEM
15
17
  dry-container (0.7.2)
16
18
  concurrent-ruby (~> 1.0)
17
19
  dry-configurable (~> 0.1, >= 0.1.3)
18
- dry-core (0.4.9)
20
+ dry-core (0.5.0)
19
21
  concurrent-ruby (~> 1.0)
20
22
  dry-equalizer (0.3.0)
21
23
  dry-inflector (0.2.0)
22
- dry-logic (0.6.1)
24
+ dry-initializer (3.0.4)
25
+ dry-logic (1.0.8)
23
26
  concurrent-ruby (~> 1.0)
24
27
  dry-core (~> 0.2)
25
28
  dry-equalizer (~> 0.2)
26
- dry-types (0.14.0)
29
+ dry-schema (1.5.6)
30
+ concurrent-ruby (~> 1.0)
31
+ dry-configurable (~> 0.8, >= 0.8.3)
32
+ dry-core (~> 0.4)
33
+ dry-equalizer (~> 0.2)
34
+ dry-initializer (~> 3.0)
35
+ dry-logic (~> 1.0)
36
+ dry-types (~> 1.4)
37
+ dry-types (1.4.0)
27
38
  concurrent-ruby (~> 1.0)
28
39
  dry-container (~> 0.3)
29
40
  dry-core (~> 0.4, >= 0.4.4)
30
- dry-equalizer (~> 0.2)
41
+ dry-equalizer (~> 0.3)
31
42
  dry-inflector (~> 0.1, >= 0.1.2)
32
- dry-logic (~> 0.5, >= 0.5)
33
- dry-validation (0.13.0)
43
+ dry-logic (~> 1.0, >= 1.0.2)
44
+ dry-validation (1.6.0)
34
45
  concurrent-ruby (~> 1.0)
35
- dry-configurable (~> 0.1, >= 0.1.3)
36
- dry-core (~> 0.2, >= 0.2.1)
46
+ dry-container (~> 0.7, >= 0.7.1)
47
+ dry-core (~> 0.4)
37
48
  dry-equalizer (~> 0.2)
38
- dry-logic (~> 0.5, >= 0.5.0)
39
- dry-types (~> 0.14, >= 0.14)
49
+ dry-initializer (~> 3.0)
50
+ dry-schema (~> 1.5, >= 1.5.2)
51
+ method_source (1.0.0)
52
+ pry (0.13.1)
53
+ coderay (~> 1.1)
54
+ method_source (~> 1.0)
55
+ pry-byebug (3.9.0)
56
+ byebug (~> 11.0)
57
+ pry (~> 0.13.0)
40
58
  rake (12.3.3)
41
59
  rspec (3.9.0)
42
60
  rspec-core (~> 3.9.0)
@@ -58,6 +76,7 @@ PLATFORMS
58
76
  DEPENDENCIES
59
77
  dry-validation
60
78
  opera!
79
+ pry-byebug
61
80
  rake (~> 12.0)
62
81
  rspec (~> 3.0)
63
82
 
data/README.md CHANGED
@@ -31,7 +31,7 @@ Simply initialise the configuration and chose what method you want to use to rep
31
31
  Opera::Operation::Config.configure do |config|
32
32
  config.transaction_class = ActiveRecord::Base
33
33
  config.transaction_method = :transaction
34
- config.reporter = if defined?(Rollbar) then Rollbar else Rails.logger
34
+ config.reporter = defined?(Rollbar) ? Rollbar : Rails.logger
35
35
  end
36
36
  ```
37
37
 
@@ -0,0 +1,7 @@
1
+ version: '3.1'
2
+
3
+ services:
4
+ app:
5
+ build: .
6
+ volumes:
7
+ - .:/usr/src/app
@@ -8,6 +8,7 @@ module Opera
8
8
  def call(instruction)
9
9
  instruction[:kind] = :step
10
10
  operation_result = super
11
+ save_information(operation_result)
11
12
 
12
13
  if operation_result.success?
13
14
  add_instruction_output(instruction, operation_result.output)
@@ -18,6 +19,14 @@ module Opera
18
19
  result.add_exceptions(operation_result.exceptions)
19
20
  end
20
21
  end
22
+
23
+ private
24
+
25
+ def save_information(operation_result)
26
+ return unless operation_result.respond_to?(:information)
27
+
28
+ result.add_information(operation_result.information)
29
+ end
21
30
  end
22
31
  end
23
32
  end
@@ -14,7 +14,8 @@ module Opera
14
14
  def evaluate_instruction(instruction)
15
15
  instruction[:kind] = :step
16
16
  dry_result = super
17
- add_instruction_output(instruction, dry_result.output)
17
+
18
+ add_instruction_output(instruction, dry_result.to_h)
18
19
  result.add_errors(dry_result.errors) unless dry_result.success?
19
20
  end
20
21
  end
@@ -10,6 +10,8 @@ module Opera
10
10
 
11
11
  attr_accessor :output # Final object returned if success?
12
12
 
13
+ alias to_h output
14
+
13
15
  def initialize(output: nil, errors: {})
14
16
  @errors = errors
15
17
  @exceptions = {}
@@ -43,7 +45,7 @@ module Opera
43
45
  # rubocop:enable Metrics/MethodLength
44
46
 
45
47
  def add_errors(errors)
46
- errors.each_pair do |key, value|
48
+ errors.to_h.each_pair do |key, value|
47
49
  add_error(key, value)
48
50
  end
49
51
  end
data/lib/opera/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Opera
2
- VERSION = "0.1.1"
2
+ VERSION = '0.1.2'
3
3
  end
data/opera.gemspec CHANGED
@@ -4,16 +4,16 @@ Gem::Specification.new do |spec|
4
4
  spec.name = 'opera'
5
5
  spec.version = Opera::VERSION
6
6
  spec.authors = ['ProFinda Development Team']
7
- spec.email = ['francisco.ruiz@profinda.com']
7
+ spec.email = ['dev@profinda.com']
8
8
 
9
9
  spec.summary = 'Use simple DSL language to keep your Operations clean and maintainable'
10
10
  spec.homepage = 'https://github.com/Profinda/opera'
11
11
  spec.license = 'MIT'
12
12
  spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
13
13
 
14
- spec.metadata["homepage_uri"] = spec.homepage
15
- spec.metadata["source_code_uri"] = spec.homepage
16
- spec.metadata["changelog_uri"] = 'https://github.com/Profinda/opera/blob/master/CHANGELOG.md'
14
+ spec.metadata['homepage_uri'] = spec.homepage
15
+ spec.metadata['source_code_uri'] = spec.homepage
16
+ spec.metadata['changelog_uri'] = 'https://github.com/Profinda/opera/blob/master/CHANGELOG.md'
17
17
 
18
18
  # Specify which files should be added to the gem when it is released.
19
19
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
24
24
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
25
25
  spec.require_paths = ['lib']
26
26
 
27
- spec.add_development_dependency 'dry-validation'
27
+ spec.add_development_dependency 'dry-validation', '>= 1.0'
28
28
  spec.add_development_dependency 'rake'
29
29
  spec.add_development_dependency 'rspec'
30
30
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opera
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - ProFinda Development Team
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-09-14 00:00:00.000000000 Z
11
+ date: 2021-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-validation
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '1.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: '0'
26
+ version: '1.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -52,9 +52,9 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- description:
55
+ description:
56
56
  email:
57
- - francisco.ruiz@profinda.com
57
+ - dev@profinda.com
58
58
  executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
@@ -64,6 +64,7 @@ files:
64
64
  - ".travis.yml"
65
65
  - CHANGELOG.md
66
66
  - CODE_OF_CONDUCT.md
67
+ - Dockerfile
67
68
  - Gemfile
68
69
  - Gemfile.lock
69
70
  - LICENSE.txt
@@ -71,6 +72,7 @@ files:
71
72
  - Rakefile
72
73
  - bin/console
73
74
  - bin/setup
75
+ - docker-compose.yml
74
76
  - lib/opera.rb
75
77
  - lib/opera/errors.rb
76
78
  - lib/opera/operation.rb
@@ -96,7 +98,7 @@ metadata:
96
98
  homepage_uri: https://github.com/Profinda/opera
97
99
  source_code_uri: https://github.com/Profinda/opera
98
100
  changelog_uri: https://github.com/Profinda/opera/blob/master/CHANGELOG.md
99
- post_install_message:
101
+ post_install_message:
100
102
  rdoc_options: []
101
103
  require_paths:
102
104
  - lib
@@ -112,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
114
  version: '0'
113
115
  requirements: []
114
116
  rubygems_version: 3.1.2
115
- signing_key:
117
+ signing_key:
116
118
  specification_version: 4
117
119
  summary: Use simple DSL language to keep your Operations clean and maintainable
118
120
  test_files: []