rack-perftools_profiler 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +4 -6
- data/VERSION +1 -1
- data/lib/rack/perftools_profiler/profiler.rb +7 -4
- data/test/rack-perftools-profiler_test.rb +1 -1
- metadata +3 -3
data/README.rdoc
CHANGED
@@ -32,15 +32,13 @@ For Rails 2, add the following to config/environment.rb
|
|
32
32
|
require 'rack/perftools_profiler'
|
33
33
|
config.middleware.use Rack::PerftoolsProfiler, :default_printer => 'gif'
|
34
34
|
|
35
|
-
For Rails 3
|
35
|
+
For Rails 3, add the following to your Gemfile
|
36
36
|
|
37
|
-
|
37
|
+
gem 'rack-perftools_profiler', '~> 0.1', :require => 'rack/perftools_profiler'
|
38
38
|
|
39
|
-
and
|
39
|
+
and add the following to config/application.rb
|
40
40
|
|
41
|
-
:bundler => true
|
42
|
-
|
43
|
-
when configuring the middleware.
|
41
|
+
config.middleware.use Rack::PerftoolsProfiler, :default_printer => 'gif', :bundler => true
|
44
42
|
|
45
43
|
For Sinatra, call 'use' inside a configure block, like so:
|
46
44
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
@@ -77,10 +77,12 @@ module Rack::PerftoolsProfiler
|
|
77
77
|
cmd = "pprof.rb #{args} #{PROFILING_DATA_FILE}"
|
78
78
|
cmd = "bundle exec " + cmd if @bundler
|
79
79
|
stdout, stderr, status = Dir.chdir(@gemfile_dir) { run(cmd) }
|
80
|
-
if
|
81
|
-
[printer, stdout]
|
82
|
-
else
|
80
|
+
if status!=0
|
83
81
|
raise ProfilingError.new("Running the command '#{cmd}' exited with status #{status}", stderr)
|
82
|
+
elsif stdout.length == 0 && stderr.length > 0
|
83
|
+
raise ProfilingError.new("Running the command '#{cmd}' failed to generate a file", stderr)
|
84
|
+
else
|
85
|
+
[printer, stdout]
|
84
86
|
end
|
85
87
|
else
|
86
88
|
[:none, nil]
|
@@ -90,7 +92,8 @@ module Rack::PerftoolsProfiler
|
|
90
92
|
private
|
91
93
|
|
92
94
|
def run(command)
|
93
|
-
out = err =
|
95
|
+
out = err = ""
|
96
|
+
pid = nil
|
94
97
|
status = Open4.popen4(command) do |pid, stdin, stdout, stderr|
|
95
98
|
stdin.close
|
96
99
|
pid = pid
|
@@ -405,7 +405,7 @@ class RackPerftoolsProfilerTest < Test::Unit::TestCase
|
|
405
405
|
|
406
406
|
context "when in bundler mode" do
|
407
407
|
|
408
|
-
should "call pprof.rb using 'bundle' command if
|
408
|
+
should "call pprof.rb using 'bundle' command if bundler is set" do
|
409
409
|
status = stub_everything(:exitstatus => 0)
|
410
410
|
profiled_app = Rack::PerftoolsProfiler.new(@app, :bundler => true)
|
411
411
|
Open4.expects(:popen4).with(regexp_matches(/^bundle exec pprof\.rb/)).returns(status)
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 1
|
9
|
+
version: 0.1.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Ben Brinckerhoff
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-10-11 00:00:00 -06:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|