opera 0.4.1 → 0.5.0
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/.rubocop.yml +1223 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +45 -1
- data/README.md +180 -77
- data/Rakefile +5 -3
- data/bin/console +4 -3
- data/lib/opera/errors.rb +1 -0
- data/lib/opera/operation/attributes_dsl.rb +16 -7
- data/lib/opera/operation/base.rb +7 -6
- data/lib/opera/operation/builder.rb +2 -2
- data/lib/opera/operation/config.rb +1 -1
- data/lib/opera/operation/executor.rb +3 -3
- data/lib/opera/operation/instructions/executors/operations.rb +1 -1
- data/lib/opera/operation/instructions/executors/within.rb +23 -0
- data/lib/opera/operation.rb +1 -1
- data/lib/opera/version.rb +1 -1
- data/opera.gemspec +12 -10
- metadata +4 -3
- data/lib/opera/operation/instructions/executors/benchmark.rb +0 -26
|
@@ -42,7 +42,7 @@ module Opera
|
|
|
42
42
|
def add_results(instruction, results)
|
|
43
43
|
add_instruction_output(instruction, results.map(&:output))
|
|
44
44
|
execution = result.executions.pop
|
|
45
|
-
result.add_execution(execution => results.map(&:executions))
|
|
45
|
+
result.add_execution(execution => results.map(&:executions)) unless production_mode?
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
def raise_error
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Opera
|
|
4
|
+
module Operation
|
|
5
|
+
module Instructions
|
|
6
|
+
module Executors
|
|
7
|
+
class Within < Executor
|
|
8
|
+
def call(instruction)
|
|
9
|
+
wrapper_method = instruction[:label]
|
|
10
|
+
nested_instructions = instruction[:instructions]
|
|
11
|
+
|
|
12
|
+
raise ArgumentError, 'within requires a method name' unless wrapper_method
|
|
13
|
+
raise ArgumentError, 'within requires a block with at least one instruction' if nested_instructions.nil?
|
|
14
|
+
|
|
15
|
+
operation.send(wrapper_method) do
|
|
16
|
+
super
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
data/lib/opera/operation.rb
CHANGED
|
@@ -9,12 +9,12 @@ require 'opera/operation/result'
|
|
|
9
9
|
require 'opera/operation/config'
|
|
10
10
|
require 'opera/operation/instructions/executors/success'
|
|
11
11
|
require 'opera/operation/instructions/executors/transaction'
|
|
12
|
-
require 'opera/operation/instructions/executors/benchmark'
|
|
13
12
|
require 'opera/operation/instructions/executors/finish_if'
|
|
14
13
|
require 'opera/operation/instructions/executors/validate'
|
|
15
14
|
require 'opera/operation/instructions/executors/operation'
|
|
16
15
|
require 'opera/operation/instructions/executors/operations'
|
|
17
16
|
require 'opera/operation/instructions/executors/step'
|
|
17
|
+
require 'opera/operation/instructions/executors/within'
|
|
18
18
|
|
|
19
19
|
module Opera
|
|
20
20
|
module Operation
|
data/lib/opera/version.rb
CHANGED
data/opera.gemspec
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require_relative 'lib/opera/version'
|
|
2
4
|
|
|
3
5
|
Gem::Specification.new do |spec|
|
|
4
|
-
spec.name
|
|
5
|
-
spec.version
|
|
6
|
-
spec.authors
|
|
7
|
-
spec.email
|
|
6
|
+
spec.name = 'opera'
|
|
7
|
+
spec.version = Opera::VERSION
|
|
8
|
+
spec.authors = ['ProFinda Development Team']
|
|
9
|
+
spec.email = ['dev@profinda.com']
|
|
8
10
|
|
|
9
|
-
spec.summary
|
|
10
|
-
spec.homepage
|
|
11
|
-
spec.license
|
|
11
|
+
spec.summary = 'Use simple DSL language to keep your Operations clean and maintainable'
|
|
12
|
+
spec.homepage = 'https://github.com/Profinda/opera'
|
|
13
|
+
spec.license = 'MIT'
|
|
12
14
|
spec.required_ruby_version = Gem::Requirement.new('>= 3.1.0')
|
|
13
15
|
|
|
14
16
|
spec.metadata['homepage_uri'] = spec.homepage
|
|
@@ -17,11 +19,11 @@ Gem::Specification.new do |spec|
|
|
|
17
19
|
|
|
18
20
|
# Specify which files should be added to the gem when it is released.
|
|
19
21
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
20
|
-
spec.files
|
|
22
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
|
21
23
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
22
24
|
end
|
|
23
|
-
spec.bindir
|
|
24
|
-
spec.executables
|
|
25
|
+
spec.bindir = 'exe'
|
|
26
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
25
27
|
spec.require_paths = ['lib']
|
|
26
28
|
|
|
27
29
|
spec.add_development_dependency 'dry-validation', '>= 1.0'
|
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.
|
|
4
|
+
version: 0.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- ProFinda Development Team
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-04-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: dry-validation
|
|
@@ -63,6 +63,7 @@ files:
|
|
|
63
63
|
- ".github/workflows/specs.yml"
|
|
64
64
|
- ".gitignore"
|
|
65
65
|
- ".rspec"
|
|
66
|
+
- ".rubocop.yml"
|
|
66
67
|
- ".travis.yml"
|
|
67
68
|
- CHANGELOG.md
|
|
68
69
|
- CODE_OF_CONDUCT.md
|
|
@@ -83,7 +84,6 @@ files:
|
|
|
83
84
|
- lib/opera/operation/builder.rb
|
|
84
85
|
- lib/opera/operation/config.rb
|
|
85
86
|
- lib/opera/operation/executor.rb
|
|
86
|
-
- lib/opera/operation/instructions/executors/benchmark.rb
|
|
87
87
|
- lib/opera/operation/instructions/executors/finish_if.rb
|
|
88
88
|
- lib/opera/operation/instructions/executors/operation.rb
|
|
89
89
|
- lib/opera/operation/instructions/executors/operations.rb
|
|
@@ -91,6 +91,7 @@ files:
|
|
|
91
91
|
- lib/opera/operation/instructions/executors/success.rb
|
|
92
92
|
- lib/opera/operation/instructions/executors/transaction.rb
|
|
93
93
|
- lib/opera/operation/instructions/executors/validate.rb
|
|
94
|
+
- lib/opera/operation/instructions/executors/within.rb
|
|
94
95
|
- lib/opera/operation/instrumentation.rb
|
|
95
96
|
- lib/opera/operation/result.rb
|
|
96
97
|
- lib/opera/version.rb
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Opera
|
|
4
|
-
module Operation
|
|
5
|
-
module Instructions
|
|
6
|
-
module Executors
|
|
7
|
-
class Benchmark < Executor
|
|
8
|
-
def call(instruction)
|
|
9
|
-
benchmark = ::Benchmark.measure do
|
|
10
|
-
instruction[:kind] = :step
|
|
11
|
-
super
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
result.add_information(benchmark_key(instruction) => { real: benchmark.real, total: benchmark.total })
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
private
|
|
18
|
-
|
|
19
|
-
def benchmark_key(instruction)
|
|
20
|
-
instruction[:method] || instruction[:label] || instruction[:instructions].map { |e| e[:method] }.join('-').to_sym
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|