Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Extract task_runner code into its own file.

  • Loading branch information...
commit 10568b928c8ad6d35abc2dc71f98c57c5b017113 1 parent 796ec54
Xavier Shay xaviershay authored
18 lib/cane.rb
@@ -8,24 +8,6 @@ def run(*args)
8 8 end
9 9 module_function :run
10 10
11   - def task_runner(opts)
12   - if opts[:parallel]
13   - Parallel
14   - else
15   - SimpleTaskRunner
16   - end
17   - end
18   - module_function :task_runner
19   -
20   - # Mirrors the Parallel gem's interface but does not provide any parralleism.
21   - # This is faster for smaller tasks since it doesn't incur any overhead for
22   - # creating new processes and communicating between them.
23   - class SimpleTaskRunner
24   - def self.map(enumerable, &block)
25   - enumerable.map(&block)
26   - end
27   - end
28   -
29 11 # Orchestrates the running of checks per the provided configuration, and
30 12 # hands the result to a formatter for display. This is the core of the
31 13 # application, but for the actual entry point see `Cane::CLI`.
1  lib/cane/abc_check.rb
@@ -2,6 +2,7 @@
2 2 require 'set'
3 3
4 4 require 'cane/file'
  5 +require 'cane/task_runner'
5 6
6 7 module Cane
7 8
2  lib/cane/doc_check.rb
... ... @@ -1,5 +1,5 @@
1 1 require 'cane/file'
2   -require 'cane'
  2 +require 'cane/task_runner'
3 3
4 4 module Cane
5 5
1  lib/cane/style_check.rb
... ... @@ -1,6 +1,7 @@
1 1 require 'set'
2 2
3 3 require 'cane/file'
  4 +require 'cane/task_runner'
4 5
5 6 module Cane
6 7
19 lib/cane/task_runner.rb
... ... @@ -0,0 +1,19 @@
  1 +module Cane
  2 + def task_runner(opts)
  3 + if opts[:parallel]
  4 + Parallel
  5 + else
  6 + SimpleTaskRunner
  7 + end
  8 + end
  9 + module_function :task_runner
  10 +
  11 + # Mirrors the Parallel gem's interface but does not provide any parralleism.
  12 + # This is faster for smaller tasks since it doesn't incur any overhead for
  13 + # creating new processes and communicating between them.
  14 + class SimpleTaskRunner
  15 + def self.map(enumerable, &block)
  16 + enumerable.map(&block)
  17 + end
  18 + end
  19 +end
1  spec/cane_spec.rb
@@ -3,6 +3,7 @@
3 3 require 'cane/cli'
4 4
5 5 require 'cane/rake_task'
  6 +require 'cane/task_runner'
6 7
7 8 # Acceptance tests
8 9 describe 'The cane application' do

0 comments on commit 10568b9

Please sign in to comment.
Something went wrong with that request. Please try again.