Class: QUnited::RakeTask
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- QUnited::RakeTask
- Includes:
- Rake::DSL
- Defined in:
- lib/qunited/rake_task.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Name of task.
-
#source_files ⇒ Object
Array of JavaScript source files (and any dependencies).
-
#source_files_pattern ⇒ Object
Glob pattern to match JavaScript source files (and any dependencies).
-
#test_files ⇒ Object
Array of QUnit test files.
-
#test_files_pattern ⇒ Object
Glob pattern to match QUnit test files.
-
#verbose ⇒ Object
Use verbose output.
Instance Method Summary collapse
-
#initialize(*args) {|_self| ... } ⇒ RakeTask
constructor
A new instance of RakeTask.
Constructor Details
#initialize(*args) {|_self| ... } ⇒ RakeTask
Returns a new instance of RakeTask.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/qunited/rake_task.rb', line 42 def initialize(*args) @name = args.shift || :qunited yield self if block_given? desc('Run QUnit JavaScript tests') unless ::Rake.application.last_comment task name do RakeFileUtils.send(:verbose, verbose) do if source_files_to_include.empty? msg = "No JavaScript source files specified" msg << " with pattern #{source_files_pattern}" if source_files_pattern puts msg elsif test_files_to_run.empty? puts "No QUnit test files matching #{test_files_pattern} could be found" else begin puts command if verbose success = system(command) rescue end raise "#{command} failed" unless success end end end end |
Instance Attribute Details
#name ⇒ Object
Name of task.
default:
:qunited
9 10 11 |
# File 'lib/qunited/rake_task.rb', line 9 def name @name end |
#source_files ⇒ Object
Array of JavaScript source files (and any dependencies). These will be loaded in order before loading the QUnit tests.
23 24 25 |
# File 'lib/qunited/rake_task.rb', line 23 def source_files @source_files end |
#source_files_pattern ⇒ Object
Glob pattern to match JavaScript source files (and any dependencies). Note that the order will be indeterminate so if your JavaScript files must be included in a particular order you will have to use source_files=(files_array).
If an array of files is set with source_files=(files_array) then this will be ignored.
default (unless source_files array is set):
'app/assets/javascripts/**/*.js'
19 20 21 |
# File 'lib/qunited/rake_task.rb', line 19 def source_files_pattern @source_files_pattern end |
#test_files ⇒ Object
Array of QUnit test files.
34 35 36 |
# File 'lib/qunited/rake_task.rb', line 34 def test_files @test_files end |
#test_files_pattern ⇒ Object
Glob pattern to match QUnit test files.
If an array of test files is set with test_files=(files) then this will be ignored.
default:
'test/javascripts/**/*.js'
31 32 33 |
# File 'lib/qunited/rake_task.rb', line 31 def test_files_pattern @test_files_pattern end |
#verbose ⇒ Object
Use verbose output. If this is true, the task will print the QUnited command to stdout.
default:
true
40 41 42 |
# File 'lib/qunited/rake_task.rb', line 40 def verbose @verbose end |