Class: PerfCheck
- Inherits:
-
Object
- Object
- PerfCheck
- Defined in:
- lib/perf_check.rb,
lib/perf_check/git.rb,
lib/perf_check/server.rb,
lib/perf_check/railtie.rb,
lib/perf_check/test_case.rb
Defined Under Namespace
Classes: Git, Railtie, Server, TestCase
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
-
#server ⇒ Object
Returns the value of attribute server.
-
#test_cases ⇒ Object
Returns the value of attribute test_cases.
Class Method Summary collapse
Instance Method Summary collapse
- #add_test_case(route) ⇒ Object
-
#initialize ⇒ PerfCheck
constructor
A new instance of PerfCheck.
- #run ⇒ Object
Constructor Details
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
10 11 12 |
# File 'lib/perf_check.rb', line 10 def @options end |
#server ⇒ Object
Returns the value of attribute server.
10 11 12 |
# File 'lib/perf_check.rb', line 10 def server @server end |
#test_cases ⇒ Object
Returns the value of attribute test_cases.
10 11 12 |
# File 'lib/perf_check.rb', line 10 def test_cases @test_cases end |
Class Method Details
.app_root ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/perf_check.rb', line 12 def self.app_root @app_root ||= begin dir = Dir.pwd until dir == '/' || File.exist?("#{dir}/config/application.rb") dir = File.dirname(dir) end unless File.exist?("#{dir}/config/application.rb") abort("perf_check should be run from a rails directory") end dir end end |
Instance Method Details
#add_test_case(route) ⇒ Object
33 34 35 |
# File 'lib/perf_check.rb', line 33 def add_test_case(route) test_cases.push(TestCase.new(route.sub(/^([^\/])/, '/\1'))) end |
#run ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/perf_check.rb', line 37 def run trigger_before_start_callbacks profile_requests if .reference Git.stash_if_needed Git.checkout_reference(.reference) test_cases.each{ |x| x.switch_to_reference_context } profile_requests end end |