Class: Specjour::Loader
- Inherits:
-
Object
- Object
- Specjour::Loader
- Defined in:
- lib/specjour/loader.rb
Constant Summary
Constants included from Protocol
Protocol::TERMINATOR, Protocol::TERMINATOR_REGEXP
Instance Attribute Summary collapse
-
#printer_uri ⇒ Object
readonly
Returns the value of attribute printer_uri.
-
#project_path ⇒ Object
readonly
Returns the value of attribute project_path.
-
#quiet ⇒ Object
readonly
Returns the value of attribute quiet.
-
#task ⇒ Object
readonly
Returns the value of attribute task.
-
#test_paths ⇒ Object
readonly
Returns the value of attribute test_paths.
-
#worker_pids ⇒ Object
readonly
Returns the value of attribute worker_pids.
-
#worker_size ⇒ Object
readonly
Returns the value of attribute worker_size.
Instance Method Summary collapse
- #feature_files ⇒ Object
-
#initialize(options = {}) ⇒ Loader
constructor
A new instance of Loader.
- #spec_files ⇒ Object
- #start ⇒ Object
Methods included from Fork
Methods included from Protocol
Constructor Details
#initialize(options = {}) ⇒ Loader
Returns a new instance of Loader.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/specjour/loader.rb', line 8 def initialize( = {}) @options = @printer_uri = [:printer_uri] @test_paths = [:test_paths] @worker_size = [:worker_size] @task = [:task] @quiet = [:quiet] @project_path = [:project_path] @worker_pids = [] Dir.chdir project_path Specjour.load_custom_hooks end |
Instance Attribute Details
#printer_uri ⇒ Object (readonly)
Returns the value of attribute printer_uri.
6 7 8 |
# File 'lib/specjour/loader.rb', line 6 def printer_uri @printer_uri end |
#project_path ⇒ Object (readonly)
Returns the value of attribute project_path.
6 7 8 |
# File 'lib/specjour/loader.rb', line 6 def project_path @project_path end |
#quiet ⇒ Object (readonly)
Returns the value of attribute quiet.
6 7 8 |
# File 'lib/specjour/loader.rb', line 6 def quiet @quiet end |
#task ⇒ Object (readonly)
Returns the value of attribute task.
6 7 8 |
# File 'lib/specjour/loader.rb', line 6 def task @task end |
#test_paths ⇒ Object (readonly)
Returns the value of attribute test_paths.
6 7 8 |
# File 'lib/specjour/loader.rb', line 6 def test_paths @test_paths end |
#worker_pids ⇒ Object (readonly)
Returns the value of attribute worker_pids.
6 7 8 |
# File 'lib/specjour/loader.rb', line 6 def worker_pids @worker_pids end |
#worker_size ⇒ Object (readonly)
Returns the value of attribute worker_size.
6 7 8 |
# File 'lib/specjour/loader.rb', line 6 def worker_size @worker_size end |
Instance Method Details
#feature_files ⇒ Object
48 49 50 51 52 53 54 55 56 |
# File 'lib/specjour/loader.rb', line 48 def feature_files @feature_files ||= file_collector(feature_paths) do |path| if path == project_path Dir["features/**/*.feature"] else Dir["**/*.feature"] end end end |
#spec_files ⇒ Object
38 39 40 41 42 43 44 45 46 |
# File 'lib/specjour/loader.rb', line 38 def spec_files @spec_files ||= file_collector(spec_paths) do |path| if path == project_path Dir["spec/**/*_spec.rb"] else Dir["**/*_spec.rb"] end end end |
#start ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/specjour/loader.rb', line 21 def start load_app Configuration.after_load.call (1..worker_size).each do |index| worker_pids << fork do Worker.new( :number => index, :printer_uri => printer_uri, :quiet => quiet ).send(task) end end Process.waitall ensure kill_worker_processes end |