Skip to content
Browse files

Extract task_runner code into its own file.

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

0 comments on commit 10568b9

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