exel 1.4.0 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +5 -5
  2. data/.codeclimate.yml +4 -4
  3. data/.rubocop.yml +20 -12
  4. data/.rubocop_airbnb.yml +2 -0
  5. data/.travis.yml +17 -4
  6. data/Gemfile +1 -2
  7. data/Gemfile.lock +64 -60
  8. data/README.md +1 -1
  9. data/Rakefile +1 -0
  10. data/exel.gemspec +4 -4
  11. data/lib/exel.rb +1 -0
  12. data/lib/exel/ast_node.rb +2 -1
  13. data/lib/exel/context.rb +2 -1
  14. data/lib/exel/deferred_context_value.rb +1 -0
  15. data/lib/exel/error/job_termination.rb +1 -0
  16. data/lib/exel/events.rb +1 -0
  17. data/lib/exel/instruction.rb +2 -1
  18. data/lib/exel/instruction_node.rb +1 -0
  19. data/lib/exel/job.rb +6 -4
  20. data/lib/exel/listen_instruction.rb +1 -0
  21. data/lib/exel/logging.rb +1 -0
  22. data/lib/exel/logging/logger_wrapper.rb +4 -1
  23. data/lib/exel/logging_helper.rb +1 -0
  24. data/lib/exel/middleware/chain.rb +1 -0
  25. data/lib/exel/middleware/logging.rb +1 -1
  26. data/lib/exel/null_instruction.rb +1 -0
  27. data/lib/exel/processor_helper.rb +1 -0
  28. data/lib/exel/processors/run_processor.rb +1 -0
  29. data/lib/exel/processors/split_processor.rb +2 -1
  30. data/lib/exel/providers/local_file_provider.rb +2 -1
  31. data/lib/exel/providers/threaded_async_provider.rb +1 -0
  32. data/lib/exel/sequence_node.rb +1 -0
  33. data/lib/exel/value.rb +1 -0
  34. data/lib/exel/version.rb +2 -1
  35. data/spec/exel/ast_node_spec.rb +42 -42
  36. data/spec/exel/context_spec.rb +76 -77
  37. data/spec/exel/deferred_context_value_spec.rb +41 -42
  38. data/spec/exel/events_spec.rb +65 -65
  39. data/spec/exel/instruction_node_spec.rb +16 -16
  40. data/spec/exel/instruction_spec.rb +46 -45
  41. data/spec/exel/job_spec.rb +94 -91
  42. data/spec/exel/listen_instruction_spec.rb +10 -10
  43. data/spec/exel/logging/logger_wrapper_spec.rb +67 -69
  44. data/spec/exel/logging_helper_spec.rb +15 -16
  45. data/spec/exel/logging_spec.rb +56 -56
  46. data/spec/exel/middleware/chain_spec.rb +51 -53
  47. data/spec/exel/middleware/logging_spec.rb +21 -23
  48. data/spec/exel/middleware_spec.rb +49 -50
  49. data/spec/exel/null_instruction_spec.rb +3 -4
  50. data/spec/exel/processors/async_processor_spec.rb +16 -18
  51. data/spec/exel/processors/run_processor_spec.rb +9 -11
  52. data/spec/exel/processors/split_processor_spec.rb +91 -93
  53. data/spec/exel/providers/local_file_provider_spec.rb +25 -28
  54. data/spec/exel/providers/threaded_async_provider_spec.rb +36 -38
  55. data/spec/exel/sequence_node_spec.rb +11 -11
  56. data/spec/exel/value_spec.rb +32 -33
  57. data/spec/exel_spec.rb +8 -7
  58. data/spec/integration/integration_spec.rb +2 -1
  59. data/spec/spec_helper.rb +3 -2
  60. data/spec/support/integration_test_classes.rb +3 -1
  61. metadata +16 -30
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 298395fd3c976be0043f2b3834c60da0a8a04a7b
4
- data.tar.gz: 637b4947a4098049c0778311372f6ff5ad5fd556
2
+ SHA256:
3
+ metadata.gz: d6f13f47962fc1df5ff720757b50fa151d1662f64fd3ce57a4cb3d7feeb8d6fd
4
+ data.tar.gz: 5d3ff9f75bf80727e7d98f83166267259472ed57a18aaaa860d6210098d6ebeb
5
5
  SHA512:
6
- metadata.gz: 0962b4d5a42d1636d8701457af0e0cca956c9137b0c678ff1656f421f97e58c36c38f18a096ab9e60a31efcf76346de177dea5f6a9b522946b47813e9897aee0
7
- data.tar.gz: 4829d5aef81952163fc7572ecf0f51227ce411672ce50b57007490509fb56f73376cc3ff9a007b6830e802874117701308486ae1ee934beb2c86f7bd1a6f33db
6
+ metadata.gz: 22fe9e83f165cd1d5840e18c469d6adaf086ac12eb6c8c134c6224505da20a9ccd2313470560b684ee23ea22dfc828ee1082c2d020418fc6ac7a12fa8bf63767
7
+ data.tar.gz: 274d1750e588dfb03635cf0a614b11852e590567f6938c30a299b096c5bf01d4270f10f52db927fb35d96da86530274ee0fe188b0cbb779077318c908ec09a0e
@@ -4,13 +4,13 @@ engines:
4
4
  enabled: true
5
5
  config:
6
6
  languages:
7
- - ruby
7
+ - ruby
8
8
  fixme:
9
9
  enabled: true
10
10
  rubocop:
11
- enabled: true
11
+ enabled: false
12
12
  ratings:
13
13
  paths:
14
- - "**.rb"
14
+ - "**.rb"
15
15
  exclude_paths:
16
- - spec/**/*
16
+ - spec/**/*
@@ -1,23 +1,31 @@
1
- require:
2
- - rubocop/rspec/focused
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.3
6
+ TargetRubyVersion: 2.7
8
7
  DisplayCopNames: true
9
8
  DisplayStyleGuide: true
10
9
 
11
- Metrics/LineLength:
12
- Max: 120
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
- Style/MultilineMethodCallIndentation:
20
+ Layout/IndentFirstArrayElement:
21
+ IndentationWidth: 4
22
+
23
+ Layout/MultilineMethodCallIndentation:
15
24
  EnforcedStyle: indented
16
25
  IndentationWidth: 4
17
26
 
18
- Style/SpaceInsideHashLiteralBraces:
27
+ Layout/SpaceInsideHashLiteralBraces:
19
28
  EnforcedStyle: no_space
20
29
 
21
- Metrics/ModuleLength:
22
- Exclude:
23
- - 'spec/**/*'
30
+ Metrics/LineLength:
31
+ Max: 120
@@ -0,0 +1,2 @@
1
+ require:
2
+ - rubocop-airbnb
@@ -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.2
5
- - 2.3
6
- - 2.4
7
- - 2.5
18
+ - 2.6
19
+ - 2.7
20
+
8
21
  notifications:
9
22
  email:
10
23
  recipients:
data/Gemfile CHANGED
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  source 'https://rubygems.org'
3
4
 
4
5
  # Specify your gem's dependencies in exel.gemspec
5
6
  gemspec
6
-
7
- gem 'codeclimate-test-reporter', '0.6.0', group: :test, require: nil
@@ -1,21 +1,19 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- exel (1.4.0)
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 (10.0.2)
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.1)
16
- ffi (1.9.23)
13
+ docile (1.3.2)
14
+ ffi (1.12.2)
17
15
  formatador (0.2.5)
18
- guard (2.14.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
- json (2.1.0)
36
- listen (3.1.5)
37
- rb-fsevent (~> 0.9, >= 0.9.4)
38
- rb-inotify (~> 0.9, >= 0.9.7)
39
- ruby_dep (~> 1.2)
40
- lumberjack (1.0.13)
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.1)
40
+ notiffany (0.1.3)
44
41
  nenv (~> 0.1)
45
42
  shellany (~> 0.0)
46
- parser (2.5.1.0)
43
+ parallel (1.19.1)
44
+ parser (2.7.1.1)
47
45
  ast (~> 2.4.0)
48
- powerpack (0.1.1)
49
- pry (0.11.3)
50
- coderay (~> 1.1.0)
51
- method_source (~> 0.9.0)
52
- pry-byebug (3.6.0)
53
- byebug (~> 10.0)
54
- pry (~> 0.10)
55
- rainbow (2.2.2)
56
- rake
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.9.10)
60
- ffi (>= 0.5.0, < 2)
61
- rspec (3.7.0)
62
- rspec-core (~> 3.7.0)
63
- rspec-expectations (~> 3.7.0)
64
- rspec-mocks (~> 3.7.0)
65
- rspec-core (3.7.1)
66
- rspec-support (~> 3.7.0)
67
- rspec-expectations (3.7.0)
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.7.0)
70
- rspec-mocks (3.7.0)
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.7.0)
73
- rspec-support (3.7.1)
74
- rubocop (0.45.0)
75
- parser (>= 2.3.1.1, < 3.0)
76
- powerpack (~> 0.1)
77
- rainbow (>= 1.99.1, < 3.0)
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 (~> 1.0, >= 1.0.1)
80
- rubocop-rspec-focused (0.1.0)
81
- rubocop (>= 0.37)
82
- ruby-progressbar (1.9.0)
83
- ruby_dep (1.5.0)
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.16.1)
92
+ simplecov (0.18.5)
86
93
  docile (~> 1.1)
87
- json (>= 1.8, < 3)
88
- simplecov-html (~> 0.10.0)
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.20.0)
93
- unicode-display_width (1.3.3)
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 (~> 10)
110
+ rake (~> 13)
107
111
  rspec (~> 3)
108
- rubocop (~> 0.45.0)
109
- rubocop-rspec-focused (~> 0)
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.16.2
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://snap-ci.com/47colborne/exel/branch/master/build_image)](https://snap-ci.com/47colborne/exel/branch/master)
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
@@ -1,2 +1,3 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'bundler/gem_tasks'
@@ -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 'bundler', '~> 1.6'
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', '~> 0.45.0'
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
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'exel/version'
3
4
  require 'exel/logging'
4
5
  require 'ostruct'
@@ -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
@@ -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
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # rubocop:disable Lint/InheritException
3
4
  module EXEL
4
5
  module Error
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module EXEL
3
4
  # Provides methods for registering and triggering event listeners
4
5
  module Events
@@ -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 = nil)
6
+ def initialize(processor_class, args, subtree: nil)
6
7
  @processor_class = processor_class
7
8
  @args = args || {}
8
9
  @subtree = subtree
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require_relative './ast_node'
3
4
 
4
5
  module EXEL
@@ -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
- (ast = parse(dsl_code_or_name)) ? ast.start(context) : raise(%(Job "#{dsl_code_or_name}" not found))
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, sub_tree, args = {})
96
- instruction = EXEL::Instruction.new(processor, args, sub_tree)
97
- node = sub_tree.nil? ? InstructionNode.new(instruction) : InstructionNode.new(instruction, [sub_tree])
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
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require_relative 'events'
3
4
 
4
5
  module EXEL
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'logger'
3
4
 
4
5
  module EXEL