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, #files, #listeners, #name, #serial, #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:



133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/hydra/tasks.rb', line 133

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



128
129
130
# File 'lib/hydra/tasks.rb', line 128

def generate_html
  @generate_html
end

#generate_textObject

boolean: generate text output from ruby-prof



130
131
132
# File 'lib/hydra/tasks.rb', line 130

def generate_text
  @generate_text
end