Permalink
Browse files

Update gemspec and tests

  • Loading branch information...
1 parent cd23e3b commit 8334714d1c5e9167c545ee102515f1e1a39f60af @bhb committed Jul 24, 2011
View
2 Rakefile
@@ -10,7 +10,7 @@ begin
gem.email = 'ben@bbrinck.com'
gem.homepage = 'http://github.com/bhb/rack-perftools_profiler'
gem.authors = ['Ben Brinckerhoff']
- gem.add_dependency 'perftools.rb', '~> 0.5'
+ gem.add_dependency 'perftools.rb', '~> 0.5.6'
gem.add_dependency 'rack', '~> 1.0'
gem.add_dependency('open4', '~> 1.0')
gem.add_development_dependency 'rack', '~> 1.1'
View
2 lib/rack/perftools_profiler/profiler_middleware.rb
@@ -61,7 +61,7 @@ def headers(printer, body)
'Content-Type' => PRINTER_CONTENT_TYPE[printer],
'Content-Length' => content_length(body)
}
- if printer ==:raw
+ if printer==:pdf || printer ==:raw
filetype = printer
filename='profile_data'
headers['Content-Disposition'] = %(attachment; filename="#{filename}.#{filetype}")
View
9 rack-perftools_profiler.gemspec
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Ben Brinckerhoff"]
- s.date = %q{2011-06-02}
+ s.date = %q{2011-07-24}
s.description = %q{Middleware for profiling Rack-compatible apps using perftools.rb}
s.email = %q{ben@bbrinck.com}
s.extra_rdoc_files = [
@@ -33,6 +33,7 @@ Gem::Specification.new do |s|
"lib/rack/perftools_profiler/start_profiling.rb",
"lib/rack/perftools_profiler/stop_profiling.rb",
"lib/rack/perftools_profiler/utils.rb",
+ "rack-perftools_profiler-0.4.1.gem",
"rack-perftools_profiler.gemspec",
"test/multiple_request_profiling_test.rb",
"test/rack-perftools-profiler_test.rb",
@@ -48,22 +49,22 @@ Gem::Specification.new do |s|
s.specification_version = 3
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
- s.add_runtime_dependency(%q<perftools.rb>, ["~> 0.5"])
+ s.add_runtime_dependency(%q<perftools.rb>, ["~> 0.5.6"])
s.add_runtime_dependency(%q<rack>, ["~> 1.0"])
s.add_runtime_dependency(%q<open4>, ["~> 1.0"])
s.add_development_dependency(%q<rack>, ["~> 1.1"])
s.add_development_dependency(%q<shoulda>, ["~> 2.10"])
s.add_development_dependency(%q<mocha>, ["~> 0.9"])
else
- s.add_dependency(%q<perftools.rb>, ["~> 0.5"])
+ s.add_dependency(%q<perftools.rb>, ["~> 0.5.6"])
s.add_dependency(%q<rack>, ["~> 1.0"])
s.add_dependency(%q<open4>, ["~> 1.0"])
s.add_dependency(%q<rack>, ["~> 1.1"])
s.add_dependency(%q<shoulda>, ["~> 2.10"])
s.add_dependency(%q<mocha>, ["~> 0.9"])
end
else
- s.add_dependency(%q<perftools.rb>, ["~> 0.5"])
+ s.add_dependency(%q<perftools.rb>, ["~> 0.5.6"])
s.add_dependency(%q<rack>, ["~> 1.0"])
s.add_dependency(%q<open4>, ["~> 1.0"])
s.add_dependency(%q<rack>, ["~> 1.1"])
View
4 test/multiple_request_profiling_test.rb
@@ -158,7 +158,7 @@ def profile_requests(profiled_app, requests, options = {})
should "call pprof.rb using 'bundle' command if bundler is set" do
status = stub_everything(:exitstatus => 0)
profiled_app = Rack::PerftoolsProfiler.new(@app, :bundler => true)
- Open4.expects(:popen4).with('bundle', 'exec', 'pprof.rb', '--text', '/tmp/rack_perftools_profiler.prof').returns(status)
+ Open4.expects(:popen4).with('bundle', 'exec', 'pprof.rb', '--text', regexp_matches(/rack_perftools_profiler\.prof$/)).returns(status)
profile(profiled_app)
end
@@ -181,7 +181,7 @@ def profile_requests(profiled_app, requests, options = {})
status = stub_everything(:exitstatus => 0)
profiled_app = Rack::PerftoolsProfiler.new(@app)
custom_env = Rack::MockRequest.env_for('/method1', :params => 'profile=true&nodefraction=160')
- Open4.expects(:popen4).with('pprof.rb', '--text', '--nodefraction=160', '/tmp/rack_perftools_profiler.prof').returns(status)
+ Open4.expects(:popen4).with('pprof.rb', '--text', '--nodefraction=160', regexp_matches(/rack_perftools_profiler\.prof$/)).returns(status)
profiled_app.call(custom_env)
end
end
View
4 test/single_request_profiling_test.rb
@@ -105,7 +105,7 @@ def setup
should "call pprof.rb using 'bundle' command if bundler is set" do
status = stub_everything(:exitstatus => 0)
profiled_app = Rack::PerftoolsProfiler.new(@app, :bundler => true)
- Open4.expects(:popen4).with('bundle', 'exec', 'pprof.rb', '--text', '/tmp/rack_perftools_profiler.prof').returns(status)
+ Open4.expects(:popen4).with('bundle', 'exec', 'pprof.rb', '--text', regexp_matches(/rack_perftools_profiler\.prof$/)).returns(status)
profiled_app.call(@profiled_request_env)
end
@@ -128,7 +128,7 @@ def setup
status = stub_everything(:exitstatus => 0)
profiled_app = Rack::PerftoolsProfiler.new(@app)
custom_env = Rack::MockRequest.env_for('/method1', :params => 'profile=true&nodecount=160')
- Open4.expects(:popen4).with('pprof.rb', '--text', '--nodecount=160', '/tmp/rack_perftools_profiler.prof').returns(status)
+ Open4.expects(:popen4).with('pprof.rb', '--text', '--nodecount=160', regexp_matches(/rack_perftools_profiler\.prof$/)).returns(status)
profiled_app.call(custom_env)
end
end

0 comments on commit 8334714

Please sign in to comment.