Class: Stendhal::RakeTask
- Defined in:
- lib/stendhal/rake_task.rb
Overview
Mostly taken from rspec-core Rake task
Instance Attribute Summary collapse
-
#fail_on_error ⇒ Object
Whether or not to fail Rake when an error occurs (typically when examples fail).
-
#failure_message ⇒ Object
A message to print to stderr when there are failures.
-
#gemfile ⇒ Object
Name of Gemfile to use.
-
#name ⇒ Object
Name of task.
-
#ruby_opts ⇒ Object
Command line options to pass to ruby.
-
#skip_bundler ⇒ Object
By default, if there is a Gemfile, the generated command will include ‘bundle exec’.
-
#stendhal_path ⇒ Object
Path to stendhal.
-
#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.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/stendhal/rake_task.rb', line 59 def initialize(*args) @name = args.shift || :spec @ruby_opts = nil @skip_bundler = false @verbose, @fail_on_error = true, true @gemfile = 'Gemfile' yield self if block_given? @stendhal_path ||= 'stendhal' desc("Run Stendhal code examples") unless ::Rake.application.last_comment task name do RakeFileUtils.send(:verbose, verbose) do begin ruby(stendhal_command) rescue puts if raise("ruby #{stendhal_command} failed") if fail_on_error end end end end |
Instance Attribute Details
#fail_on_error ⇒ Object
Whether or not to fail Rake when an error occurs (typically when examples fail).
default:
true
35 36 37 |
# File 'lib/stendhal/rake_task.rb', line 35 def fail_on_error @fail_on_error end |
#failure_message ⇒ Object
A message to print to stderr when there are failures.
38 39 40 |
# File 'lib/stendhal/rake_task.rb', line 38 def @failure_message end |
#gemfile ⇒ Object
Name of Gemfile to use
default:
Gemfile
29 30 31 |
# File 'lib/stendhal/rake_task.rb', line 29 def gemfile @gemfile end |
#name ⇒ Object
Name of task.
default:
:spec
15 16 17 |
# File 'lib/stendhal/rake_task.rb', line 15 def name @name end |
#ruby_opts ⇒ Object
Command line options to pass to ruby.
default:
nil
51 52 53 |
# File 'lib/stendhal/rake_task.rb', line 51 def ruby_opts @ruby_opts end |
#skip_bundler ⇒ Object
By default, if there is a Gemfile, the generated command will include ‘bundle exec’. Set this to true to ignore the presence of a Gemfile, and not add ‘bundle exec’ to the command.
default:
false
23 24 25 |
# File 'lib/stendhal/rake_task.rb', line 23 def skip_bundler @skip_bundler end |
#stendhal_path ⇒ Object
Path to stendhal
default:
'stendhal'
57 58 59 |
# File 'lib/stendhal/rake_task.rb', line 57 def stendhal_path @stendhal_path end |
#verbose ⇒ Object
Use verbose output. If this is set to true, the task will print the executed spec command to stdout.
default:
true
45 46 47 |
# File 'lib/stendhal/rake_task.rb', line 45 def verbose @verbose end |