Class: Hydra::Task
- Inherits:
-
Object
- Object
- Hydra::Task
- Defined in:
- lib/hydra/tasks.rb
Overview
Hydra Task Common attributes and methods
Direct Known Subclasses
Instance Attribute Summary collapse
-
#autosort ⇒ Object
Automatically sort files using their historical runtimes.
-
#config ⇒ Object
Path to the hydra config file.
-
#files ⇒ Object
Files to test.
-
#listeners ⇒ Object
Event listeners.
-
#name ⇒ Object
Name of the task.
-
#serial ⇒ Object
Set to true if you want to run this task only on the local machine with one runner.
-
#verbose ⇒ Object
True if you want to see Hydra’s message traces.
Instance Method Summary collapse
-
#add_files(pattern) ⇒ Object
Add files to test by passing in a string to be run through Dir.glob.
-
#find_config_file ⇒ Object
Search for the hydra config file.
Instance Attribute Details
#autosort ⇒ Object
Automatically sort files using their historical runtimes. Defaults to true To disable:
t.autosort = false
26 27 28 |
# File 'lib/hydra/tasks.rb', line 26 def autosort @autosort end |
#config ⇒ Object
Path to the hydra config file. If not set, it will check ‘hydra.yml’ and ‘config/hydra.yml’
20 21 22 |
# File 'lib/hydra/tasks.rb', line 20 def config @config end |
#files ⇒ Object
Files to test. You can add files manually via:
t.files << [file1, file2, etc]
Or you can use the add_files method
13 14 15 |
# File 'lib/hydra/tasks.rb', line 13 def files @files end |
#listeners ⇒ Object
32 33 34 |
# File 'lib/hydra/tasks.rb', line 32 def listeners @listeners end |
#name ⇒ Object
Name of the task. Default ‘hydra’
6 7 8 |
# File 'lib/hydra/tasks.rb', line 6 def name @name end |
#serial ⇒ Object
Set to true if you want to run this task only on the local machine with one runner. A “Safe Mode” for some test files that may not play nice with others.
37 38 39 |
# File 'lib/hydra/tasks.rb', line 37 def serial @serial end |
#verbose ⇒ Object
True if you want to see Hydra’s message traces
16 17 18 |
# File 'lib/hydra/tasks.rb', line 16 def verbose @verbose end |
Instance Method Details
#add_files(pattern) ⇒ Object
Add files to test by passing in a string to be run through Dir.glob. For example:
t.add_files 'test/units/*.rb'
53 54 55 |
# File 'lib/hydra/tasks.rb', line 53 def add_files(pattern) @files += Dir.glob(pattern) end |
#find_config_file ⇒ Object
Search for the hydra config file
41 42 43 44 45 46 47 |
# File 'lib/hydra/tasks.rb', line 41 def find_config_file @config ||= 'hydra.yml' return @config if File.exists?(@config) @config = File.join('config', 'hydra.yml') return @config if File.exists?(@config) @config = nil end |