Class: Hydra::ProfileTask

Inherits:
Task
  • Object
show all
Defined in:
lib/hydra/tasks.rb

Overview

Define a test task that uses hydra to profile your test files

Hydra::ProfileTask.new('hydra:prof') do |t|
  t.add_files 'test/unit/**/*_test.rb'
  t.add_files 'test/functional/**/*_test.rb'
  t.add_files 'test/integration/**/*_test.rb'
  t.generate_html = true # defaults to false
  t.generate_text = true # defaults to true
end

Instance Attribute Summary collapse

Attributes inherited from Task

#autosort, #config, #environment, #files, #listeners, #name, #options, #runner_log_file, #serial, #show_time, #verbose

Instance Method Summary collapse

Methods inherited from Task

#add_files, #find_config_file

Constructor Details

#initialize(name = 'hydra:profile') {|_self| ... } ⇒ ProfileTask

Create a new Hydra ProfileTask

Yields:

  • (_self)

Yield Parameters:


164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# File 'lib/hydra/tasks.rb', line 164

def initialize(name = 'hydra:profile')
  @name = name
  @files = []
  @verbose = false
  @generate_html = false
  @generate_text = true

  yield self if block_given?

  # Ensure we override rspec's at_exit
  require 'hydra/spec/autorun_override'

  @config = find_config_file

  @opts = {
    :verbose => @verbose,
    :files => @files
  }
  define
end

Instance Attribute Details

#generate_htmlObject

boolean: generate html output from ruby-prof


159
160
161
# File 'lib/hydra/tasks.rb', line 159

def generate_html
  @generate_html
end

#generate_textObject

boolean: generate text output from ruby-prof


161
162
163
# File 'lib/hydra/tasks.rb', line 161

def generate_text
  @generate_text
end