exel 1.4.0 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.codeclimate.yml +4 -4
- data/.rubocop.yml +20 -12
- data/.rubocop_airbnb.yml +2 -0
- data/.travis.yml +17 -4
- data/Gemfile +1 -2
- data/Gemfile.lock +64 -60
- data/README.md +1 -1
- data/Rakefile +1 -0
- data/exel.gemspec +4 -4
- data/lib/exel.rb +1 -0
- data/lib/exel/ast_node.rb +2 -1
- data/lib/exel/context.rb +2 -1
- data/lib/exel/deferred_context_value.rb +1 -0
- data/lib/exel/error/job_termination.rb +1 -0
- data/lib/exel/events.rb +1 -0
- data/lib/exel/instruction.rb +2 -1
- data/lib/exel/instruction_node.rb +1 -0
- data/lib/exel/job.rb +6 -4
- data/lib/exel/listen_instruction.rb +1 -0
- data/lib/exel/logging.rb +1 -0
- data/lib/exel/logging/logger_wrapper.rb +4 -1
- data/lib/exel/logging_helper.rb +1 -0
- data/lib/exel/middleware/chain.rb +1 -0
- data/lib/exel/middleware/logging.rb +1 -1
- data/lib/exel/null_instruction.rb +1 -0
- data/lib/exel/processor_helper.rb +1 -0
- data/lib/exel/processors/run_processor.rb +1 -0
- data/lib/exel/processors/split_processor.rb +2 -1
- data/lib/exel/providers/local_file_provider.rb +2 -1
- data/lib/exel/providers/threaded_async_provider.rb +1 -0
- data/lib/exel/sequence_node.rb +1 -0
- data/lib/exel/value.rb +1 -0
- data/lib/exel/version.rb +2 -1
- data/spec/exel/ast_node_spec.rb +42 -42
- data/spec/exel/context_spec.rb +76 -77
- data/spec/exel/deferred_context_value_spec.rb +41 -42
- data/spec/exel/events_spec.rb +65 -65
- data/spec/exel/instruction_node_spec.rb +16 -16
- data/spec/exel/instruction_spec.rb +46 -45
- data/spec/exel/job_spec.rb +94 -91
- data/spec/exel/listen_instruction_spec.rb +10 -10
- data/spec/exel/logging/logger_wrapper_spec.rb +67 -69
- data/spec/exel/logging_helper_spec.rb +15 -16
- data/spec/exel/logging_spec.rb +56 -56
- data/spec/exel/middleware/chain_spec.rb +51 -53
- data/spec/exel/middleware/logging_spec.rb +21 -23
- data/spec/exel/middleware_spec.rb +49 -50
- data/spec/exel/null_instruction_spec.rb +3 -4
- data/spec/exel/processors/async_processor_spec.rb +16 -18
- data/spec/exel/processors/run_processor_spec.rb +9 -11
- data/spec/exel/processors/split_processor_spec.rb +91 -93
- data/spec/exel/providers/local_file_provider_spec.rb +25 -28
- data/spec/exel/providers/threaded_async_provider_spec.rb +36 -38
- data/spec/exel/sequence_node_spec.rb +11 -11
- data/spec/exel/value_spec.rb +32 -33
- data/spec/exel_spec.rb +8 -7
- data/spec/integration/integration_spec.rb +2 -1
- data/spec/spec_helper.rb +3 -2
- data/spec/support/integration_test_classes.rb +3 -1
- metadata +16 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d6f13f47962fc1df5ff720757b50fa151d1662f64fd3ce57a4cb3d7feeb8d6fd
|
4
|
+
data.tar.gz: 5d3ff9f75bf80727e7d98f83166267259472ed57a18aaaa860d6210098d6ebeb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22fe9e83f165cd1d5840e18c469d6adaf086ac12eb6c8c134c6224505da20a9ccd2313470560b684ee23ea22dfc828ee1082c2d020418fc6ac7a12fa8bf63767
|
7
|
+
data.tar.gz: 274d1750e588dfb03635cf0a614b11852e590567f6938c30a299b096c5bf01d4270f10f52db927fb35d96da86530274ee0fe188b0cbb779077318c908ec09a0e
|
data/.codeclimate.yml
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,23 +1,31 @@
|
|
1
|
-
|
2
|
-
-
|
3
|
-
|
4
|
-
inherit_from: .rubocop_todo.yml
|
1
|
+
inherit_from:
|
2
|
+
- .rubocop_airbnb.yml
|
3
|
+
- .rubocop_todo.yml
|
5
4
|
|
6
5
|
AllCops:
|
7
|
-
TargetRubyVersion: 2.
|
6
|
+
TargetRubyVersion: 2.7
|
8
7
|
DisplayCopNames: true
|
9
8
|
DisplayStyleGuide: true
|
10
9
|
|
11
|
-
|
12
|
-
|
10
|
+
Airbnb/OptArgParameters:
|
11
|
+
Exclude:
|
12
|
+
- "lib/exel/processor_helper.rb"
|
13
|
+
- "lib/exel/logging/logger_wrapper.rb"
|
14
|
+
- "lib/exel/processors/*.rb"
|
15
|
+
- "lib/exel/error/job_termination.rb"
|
16
|
+
|
17
|
+
Layout/DotPosition:
|
18
|
+
EnforcedStyle: leading
|
13
19
|
|
14
|
-
|
20
|
+
Layout/IndentFirstArrayElement:
|
21
|
+
IndentationWidth: 4
|
22
|
+
|
23
|
+
Layout/MultilineMethodCallIndentation:
|
15
24
|
EnforcedStyle: indented
|
16
25
|
IndentationWidth: 4
|
17
26
|
|
18
|
-
|
27
|
+
Layout/SpaceInsideHashLiteralBraces:
|
19
28
|
EnforcedStyle: no_space
|
20
29
|
|
21
|
-
Metrics/
|
22
|
-
|
23
|
-
- 'spec/**/*'
|
30
|
+
Metrics/LineLength:
|
31
|
+
Max: 120
|
data/.rubocop_airbnb.yml
ADDED
data/.travis.yml
CHANGED
@@ -1,10 +1,23 @@
|
|
1
|
+
env:
|
2
|
+
global:
|
3
|
+
- CC_TEST_REPORTER_ID=29a10c062e6416be84441296b1ec7b212f9c01a252e78b3e3df02cd9fb076abe
|
4
|
+
|
1
5
|
language: ruby
|
6
|
+
|
7
|
+
before_script:
|
8
|
+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
9
|
+
- chmod +x ./cc-test-reporter
|
10
|
+
- ./cc-test-reporter before-build
|
11
|
+
|
2
12
|
script: bundle exec rspec
|
13
|
+
|
14
|
+
after_script:
|
15
|
+
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
16
|
+
|
3
17
|
rvm:
|
4
|
-
- 2.
|
5
|
-
- 2.
|
6
|
-
|
7
|
-
- 2.5
|
18
|
+
- 2.6
|
19
|
+
- 2.7
|
20
|
+
|
8
21
|
notifications:
|
9
22
|
email:
|
10
23
|
recipients:
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,21 +1,19 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
exel (1.
|
4
|
+
exel (1.5.1)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
9
|
ast (2.4.0)
|
10
|
-
byebug (
|
11
|
-
codeclimate-test-reporter (0.6.0)
|
12
|
-
simplecov (>= 0.7.1, < 1.0.0)
|
10
|
+
byebug (11.1.3)
|
13
11
|
coderay (1.1.2)
|
14
12
|
diff-lcs (1.3)
|
15
|
-
docile (1.3.
|
16
|
-
ffi (1.
|
13
|
+
docile (1.3.2)
|
14
|
+
ffi (1.12.2)
|
17
15
|
formatador (0.2.5)
|
18
|
-
guard (2.
|
16
|
+
guard (2.16.2)
|
19
17
|
formatador (>= 0.2.4)
|
20
18
|
listen (>= 2.7, < 4.0)
|
21
19
|
lumberjack (>= 1.0.12, < 2.0)
|
@@ -32,83 +30,89 @@ GEM
|
|
32
30
|
guard-rubocop (1.3.0)
|
33
31
|
guard (~> 2.0)
|
34
32
|
rubocop (~> 0.20)
|
35
|
-
|
36
|
-
listen (3.1
|
37
|
-
rb-fsevent (~> 0.
|
38
|
-
rb-inotify (~> 0.9, >= 0.9.
|
39
|
-
|
40
|
-
|
41
|
-
method_source (0.9.0)
|
33
|
+
jaro_winkler (1.5.4)
|
34
|
+
listen (3.2.1)
|
35
|
+
rb-fsevent (~> 0.10, >= 0.10.3)
|
36
|
+
rb-inotify (~> 0.9, >= 0.9.10)
|
37
|
+
lumberjack (1.2.4)
|
38
|
+
method_source (1.0.0)
|
42
39
|
nenv (0.3.0)
|
43
|
-
notiffany (0.1.
|
40
|
+
notiffany (0.1.3)
|
44
41
|
nenv (~> 0.1)
|
45
42
|
shellany (~> 0.0)
|
46
|
-
|
43
|
+
parallel (1.19.1)
|
44
|
+
parser (2.7.1.1)
|
47
45
|
ast (~> 2.4.0)
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
rainbow (
|
56
|
-
|
57
|
-
rake (10.5.0)
|
46
|
+
pry (0.13.1)
|
47
|
+
coderay (~> 1.1)
|
48
|
+
method_source (~> 1.0)
|
49
|
+
pry-byebug (3.9.0)
|
50
|
+
byebug (~> 11.0)
|
51
|
+
pry (~> 0.13.0)
|
52
|
+
rack (2.2.2)
|
53
|
+
rainbow (3.0.0)
|
54
|
+
rake (13.0.1)
|
58
55
|
rb-fsevent (0.10.3)
|
59
|
-
rb-inotify (0.
|
60
|
-
ffi (
|
61
|
-
rspec (3.
|
62
|
-
rspec-core (~> 3.
|
63
|
-
rspec-expectations (~> 3.
|
64
|
-
rspec-mocks (~> 3.
|
65
|
-
rspec-core (3.
|
66
|
-
rspec-support (~> 3.
|
67
|
-
rspec-expectations (3.
|
56
|
+
rb-inotify (0.10.1)
|
57
|
+
ffi (~> 1.0)
|
58
|
+
rspec (3.9.0)
|
59
|
+
rspec-core (~> 3.9.0)
|
60
|
+
rspec-expectations (~> 3.9.0)
|
61
|
+
rspec-mocks (~> 3.9.0)
|
62
|
+
rspec-core (3.9.1)
|
63
|
+
rspec-support (~> 3.9.1)
|
64
|
+
rspec-expectations (3.9.1)
|
68
65
|
diff-lcs (>= 1.2.0, < 2.0)
|
69
|
-
rspec-support (~> 3.
|
70
|
-
rspec-mocks (3.
|
66
|
+
rspec-support (~> 3.9.0)
|
67
|
+
rspec-mocks (3.9.1)
|
71
68
|
diff-lcs (>= 1.2.0, < 2.0)
|
72
|
-
rspec-support (~> 3.
|
73
|
-
rspec-support (3.
|
74
|
-
rubocop (0.
|
75
|
-
|
76
|
-
|
77
|
-
|
69
|
+
rspec-support (~> 3.9.0)
|
70
|
+
rspec-support (3.9.2)
|
71
|
+
rubocop (0.76.0)
|
72
|
+
jaro_winkler (~> 1.5.1)
|
73
|
+
parallel (~> 1.10)
|
74
|
+
parser (>= 2.6)
|
75
|
+
rainbow (>= 2.2.2, < 4.0)
|
78
76
|
ruby-progressbar (~> 1.7)
|
79
|
-
unicode-display_width (
|
80
|
-
rubocop-
|
81
|
-
rubocop (
|
82
|
-
|
83
|
-
|
77
|
+
unicode-display_width (>= 1.4.0, < 1.7)
|
78
|
+
rubocop-airbnb (3.0.2)
|
79
|
+
rubocop (~> 0.76.0)
|
80
|
+
rubocop-performance (~> 1.5.0)
|
81
|
+
rubocop-rails (~> 2.3.2)
|
82
|
+
rubocop-rspec (~> 1.30.0)
|
83
|
+
rubocop-performance (1.5.2)
|
84
|
+
rubocop (>= 0.71.0)
|
85
|
+
rubocop-rails (2.3.2)
|
86
|
+
rack (>= 1.1)
|
87
|
+
rubocop (>= 0.72.0)
|
88
|
+
rubocop-rspec (1.30.1)
|
89
|
+
rubocop (>= 0.60.0)
|
90
|
+
ruby-progressbar (1.10.1)
|
84
91
|
shellany (0.0.1)
|
85
|
-
simplecov (0.
|
92
|
+
simplecov (0.18.5)
|
86
93
|
docile (~> 1.1)
|
87
|
-
|
88
|
-
|
89
|
-
simplecov-html (0.10.2)
|
94
|
+
simplecov-html (~> 0.11)
|
95
|
+
simplecov-html (0.12.2)
|
90
96
|
terminal-notifier (1.6.3)
|
91
97
|
terminal-notifier-guard (1.7.0)
|
92
|
-
thor (0.
|
93
|
-
unicode-display_width (1.
|
98
|
+
thor (1.0.1)
|
99
|
+
unicode-display_width (1.6.1)
|
94
100
|
|
95
101
|
PLATFORMS
|
96
102
|
ruby
|
97
103
|
|
98
104
|
DEPENDENCIES
|
99
|
-
bundler (~> 1.6)
|
100
|
-
codeclimate-test-reporter (= 0.6.0)
|
101
105
|
exel!
|
102
106
|
guard (~> 2)
|
103
107
|
guard-rspec (~> 4)
|
104
108
|
guard-rubocop (~> 1)
|
105
109
|
pry-byebug
|
106
|
-
rake (~>
|
110
|
+
rake (~> 13)
|
107
111
|
rspec (~> 3)
|
108
|
-
rubocop (~>
|
109
|
-
|
112
|
+
rubocop-airbnb (~> 3.0)
|
113
|
+
simplecov (~> 0.17)
|
110
114
|
terminal-notifier (~> 1.6.0)
|
111
115
|
terminal-notifier-guard (~> 1.7.0)
|
112
116
|
|
113
117
|
BUNDLED WITH
|
114
|
-
1.
|
118
|
+
2.1.4
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
[![Gem Version](https://badge.fury.io/rb/exel.svg)](https://badge.fury.io/rb/exel)
|
3
3
|
[![Code Climate](https://codeclimate.com/github/47colborne/exel/badges/gpa.svg)](https://codeclimate.com/github/47colborne/exel)
|
4
4
|
[![Test Coverage](https://codeclimate.com/github/47colborne/exel/badges/coverage.svg)](https://codeclimate.com/github/47colborne/exel/coverage)
|
5
|
-
[![Build Status](https://
|
5
|
+
[![Build Status](https://travis-ci.org/47colborne/exel.svg?branch=master)](https://travis-ci.org/47colborne/exel)
|
6
6
|
[![Documentation](http://img.shields.io/badge/docs-rdoc.info-blue.svg)](http://www.rubydoc.info/github/47colborne/exel/master)
|
7
7
|
|
8
8
|
EXEL is the Elastic eXEcution Language, a simple Ruby DSL for creating processing jobs that can be run on a single machine, or scaled up to run on dozens of machines with no changes to the job itself. To run a job on more than one machine, simply install EXEL async and remote provider gems to integrate with your preferred platforms. The currently implemented providers so far are:
|
data/Rakefile
CHANGED
data/exel.gemspec
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
# frozen_string_literal: true
|
3
|
+
|
3
4
|
lib = File.expand_path('../lib', __FILE__)
|
4
5
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
6
|
require 'exel/version'
|
@@ -19,15 +20,14 @@ Gem::Specification.new do |spec|
|
|
19
20
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
21
|
spec.require_paths = ['lib']
|
21
22
|
|
22
|
-
spec.add_development_dependency '
|
23
|
-
spec.add_development_dependency 'rake', '~> 10'
|
23
|
+
spec.add_development_dependency 'rake', '~> 13'
|
24
24
|
spec.add_development_dependency 'rspec', '~> 3'
|
25
|
+
spec.add_development_dependency 'simplecov', '~> 0.17'
|
25
26
|
spec.add_development_dependency 'guard', '~> 2'
|
26
27
|
spec.add_development_dependency 'guard-rspec', '~> 4'
|
27
28
|
spec.add_development_dependency 'guard-rubocop', '~> 1'
|
28
29
|
spec.add_development_dependency 'terminal-notifier', '~> 1.6.0'
|
29
30
|
spec.add_development_dependency 'terminal-notifier-guard', '~> 1.7.0'
|
30
|
-
spec.add_development_dependency 'rubocop', '~>
|
31
|
-
spec.add_development_dependency 'rubocop-rspec-focused', '~> 0'
|
31
|
+
spec.add_development_dependency 'rubocop-airbnb', '~> 3.0'
|
32
32
|
spec.add_development_dependency 'pry-byebug'
|
33
33
|
end
|
data/lib/exel.rb
CHANGED
data/lib/exel/ast_node.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module EXEL
|
3
4
|
# An abstract class that serves as the parent class of nodes in the AST
|
4
5
|
class ASTNode
|
5
6
|
attr_reader :instruction, :children
|
6
7
|
|
7
|
-
def initialize(instruction, children
|
8
|
+
def initialize(instruction, children: [])
|
8
9
|
@instruction = instruction
|
9
10
|
@children = children
|
10
11
|
end
|
data/lib/exel/context.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'tempfile'
|
3
4
|
require 'securerandom'
|
4
5
|
|
@@ -34,7 +35,7 @@ module EXEL
|
|
34
35
|
file = EXEL::Value.localize(uri)
|
35
36
|
|
36
37
|
begin
|
37
|
-
context = Marshal.load(file.read)
|
38
|
+
context = Marshal.load(file.read) # rubocop:disable Airbnb/UnsafeYamlMarshal
|
38
39
|
ensure
|
39
40
|
file.close
|
40
41
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module EXEL
|
3
4
|
# When +context+ is referenced in a job definition, an instance of +DeferredContextValue+ will be put in its place.
|
4
5
|
# At runtime, the first time a +DeferredContextValue+ is read via {EXEL::Context#[]}, it will be replaced by the value
|
data/lib/exel/events.rb
CHANGED
data/lib/exel/instruction.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module EXEL
|
3
4
|
# Represents one step to be executed in the processing of a job
|
4
5
|
class Instruction
|
5
|
-
def initialize(processor_class, args, subtree
|
6
|
+
def initialize(processor_class, args, subtree: nil)
|
6
7
|
@processor_class = processor_class
|
7
8
|
@args = args || {}
|
8
9
|
@subtree = subtree
|
data/lib/exel/job.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module EXEL
|
3
4
|
# The +Job+ module provides the main interface for defining and running EXEL jobs
|
4
5
|
module Job
|
@@ -26,7 +27,8 @@ module EXEL
|
|
26
27
|
# @raise If no job has been registered with the given name
|
27
28
|
def run(dsl_code_or_name, context = {})
|
28
29
|
context = EXEL::Context.new(context) if context.instance_of?(Hash)
|
29
|
-
|
30
|
+
ast = parse(dsl_code_or_name)
|
31
|
+
ast ? ast.start(context) : raise(%(Job "#{dsl_code_or_name}" not found))
|
30
32
|
context
|
31
33
|
end
|
32
34
|
|
@@ -92,9 +94,9 @@ module EXEL
|
|
92
94
|
block.nil? ? nil : Parser.parse(block)
|
93
95
|
end
|
94
96
|
|
95
|
-
def add_instruction_node(processor,
|
96
|
-
instruction = EXEL::Instruction.new(processor, args,
|
97
|
-
node =
|
97
|
+
def add_instruction_node(processor, subtree, args = {})
|
98
|
+
instruction = EXEL::Instruction.new(processor, args, subtree: subtree)
|
99
|
+
node = subtree.nil? ? InstructionNode.new(instruction) : InstructionNode.new(instruction, children: [subtree])
|
98
100
|
@ast.add_child(node)
|
99
101
|
end
|
100
102
|
end
|