pilfer 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -188,8 +188,8 @@ the given regular expression.
188
188
 
189
189
  ```ruby
190
190
  matcher = %r{^#{Regexp.escape(Rails.root.to_s)}/(app|config|lib|vendor/plugin)}
191
- use Pilfer::Middleware, :profiler => profiler,
192
- :files_matching => matcher
191
+ use Pilfer::Middleware, :profiler => profiler,
192
+ :file_matcher => matcher
193
193
  ```
194
194
 
195
195
  You almost certainly don't want to profile _every_ request. Provide a block to
@@ -207,7 +207,7 @@ The Rack environment is available to allow profiling on demand.
207
207
  ```ruby
208
208
  # Profile requests containing the query string ?profile=true
209
209
  use Pilfer::Middleware, :profiler => profiler do |env|
210
- env.query_string.include? 'profile=true'
210
+ env["QUERY_STRING"].include? 'profile=true'
211
211
  end
212
212
 
213
213
  # Profile requests containing a header whose value matches a secret
@@ -11,6 +11,7 @@ module Pilfer
11
11
  @uri = URI.parse(uri)
12
12
  @token = token
13
13
  @async = options[:async] || true
14
+ @on_error = options[:on_error] || lambda { |ex| $stdout.puts "Pilfer::Server Exception: #{ex.class}: #{ex.message}:\n#{ex.backtrace.join("\n\t")}" }
14
15
  end
15
16
 
16
17
  def write(profile_data, profile_start, description, options = {})
@@ -57,7 +58,7 @@ module Pilfer
57
58
  response.error!
58
59
  end
59
60
  rescue Exception => ex
60
- $stdout.puts ex.message, ex.backtrace
61
+ @on_error.call(ex)
61
62
  end
62
63
 
63
64
  def file_sources_for_profile(profile_data)
@@ -74,10 +75,10 @@ class RbLineProfFormat
74
75
  files = profile_data.each_with_object({}) do |(file, lines), files|
75
76
  profile_lines = lines[1..-1].
76
77
  each_with_index.
77
- each_with_object({}) do |(data, number), lines|
78
+ each_with_object({}) do |(data, number), inner_lines|
78
79
  next unless data.any? {|datum| datum > 0 }
79
80
  wall_time, cpu_time, calls = data
80
- lines[number] = { 'wall_time' => wall_time,
81
+ inner_lines[number] = { 'wall_time' => wall_time,
81
82
  'cpu_time' => cpu_time,
82
83
  'calls' => calls }
83
84
  end
@@ -1,3 +1,3 @@
1
1
  module Pilfer
2
- VERSION = '1.0.1'
2
+ VERSION = '1.0.2'
3
3
  end
metadata CHANGED
@@ -1,57 +1,64 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: pilfer
3
- version: !ruby/object:Gem::Version
4
- version: 1.0.1
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 1
7
+ - 0
8
+ - 2
9
+ version: 1.0.2
5
10
  platform: ruby
6
- authors:
11
+ authors:
7
12
  - Eric Lindvall
8
13
  - Larry Marburger
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2013-05-13 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
17
+
18
+ date: 2013-06-05 00:00:00 -07:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ prerelease: false
23
+ type: :runtime
15
24
  name: rblineprof
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
25
+ version_requirements: &id001 !ruby/object:Gem::Requirement
26
+ requirements:
18
27
  - - ~>
19
- - !ruby/object:Gem::Version
28
+ - !ruby/object:Gem::Version
29
+ segments:
30
+ - 0
31
+ - 3
32
+ - 2
20
33
  version: 0.3.2
21
- type: :runtime
34
+ requirement: *id001
35
+ - !ruby/object:Gem::Dependency
22
36
  prerelease: false
23
- version_requirements: !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ~>
26
- - !ruby/object:Gem::Version
27
- version: 0.3.2
28
- - !ruby/object:Gem::Dependency
29
- name: bundler
30
- requirement: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - ~>
33
- - !ruby/object:Gem::Version
34
- version: '1.0'
35
37
  type: :development
36
- prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
38
+ name: bundler
39
+ version_requirements: &id002 !ruby/object:Gem::Requirement
40
+ requirements:
39
41
  - - ~>
40
- - !ruby/object:Gem::Version
41
- version: '1.0'
42
- description: pilfer uses rblineprof to measure how long each line of code takes to
43
- execute and the number of times it was called.
44
- email:
42
+ - !ruby/object:Gem::Version
43
+ segments:
44
+ - 1
45
+ - 0
46
+ version: "1.0"
47
+ requirement: *id002
48
+ description: pilfer uses rblineprof to measure how long each line of code takes to execute and the number of times it was called.
49
+ email:
45
50
  - eric@sevenscale.com
46
51
  - larry@marburger.cc
47
52
  executables: []
53
+
48
54
  extensions: []
55
+
49
56
  extra_rdoc_files: []
50
- files:
57
+
58
+ files:
51
59
  - Gemfile
52
60
  - LICENSE
53
61
  - README.md
54
- - pilfer.gemspec
55
62
  - lib/pilfer/logger.rb
56
63
  - lib/pilfer/middleware.rb
57
64
  - lib/pilfer/profile.rb
@@ -69,31 +76,39 @@ files:
69
76
  - spec/pilfer/profiler_spec.rb
70
77
  - script/package
71
78
  - script/release
79
+ has_rdoc: true
72
80
  homepage: https://github.com/eric/pilfer
73
- licenses:
81
+ licenses:
74
82
  - MIT
75
- metadata: {}
76
83
  post_install_message:
77
84
  rdoc_options: []
78
- require_paths:
85
+
86
+ require_paths:
79
87
  - lib
80
- required_ruby_version: !ruby/object:Gem::Requirement
81
- requirements:
82
- - - ! '>='
83
- - !ruby/object:Gem::Version
84
- version: '0'
85
- required_rubygems_version: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ! '>='
88
- - !ruby/object:Gem::Version
88
+ required_ruby_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ segments:
93
+ - 0
94
+ version: "0"
95
+ required_rubygems_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ segments:
100
+ - 1
101
+ - 3
102
+ - 6
89
103
  version: 1.3.6
90
104
  requirements: []
105
+
91
106
  rubyforge_project:
92
- rubygems_version: 2.0.3
107
+ rubygems_version: 1.3.6
93
108
  signing_key:
94
- specification_version: 4
109
+ specification_version: 3
95
110
  summary: line-profiler for ruby and rack
96
- test_files:
111
+ test_files:
97
112
  - spec/files/hello.rb
98
113
  - spec/files/test.rb
99
114
  - spec/helper.rb
checksums.yaml DELETED
@@ -1,15 +0,0 @@
1
- ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- MjNmY2MxMWQ3ZTU2ZmFhNzBjZTBhMDhhZmVhNjVmZGIwN2MyNDZmNA==
5
- data.tar.gz: !binary |-
6
- Nzg5ZDAzNTYyMGFhYzM2NjgyZjMxMDdmNWQ1ZGY3OWEwMGJjZWM5ZQ==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- YjZjMWRkYTRlNTRmODlmNjkxYzQ3ZmE5ZjY4MDEwZTZlY2Q1NmQ5MTExNzA3
10
- YTMzNTc2OGUwODUxOTg0M2E0ZGJmYzRmMjZkMTFjYzg5N2Q5MDg3MTY3MGFm
11
- MjA3MDJkYTM5NTU2MTU2YzdlNDQ3Y2ZjMWQ5OGJmNWQ3ZWY2ZjA=
12
- data.tar.gz: !binary |-
13
- ZGZiNTVmZDk3OWI1YTI4OTUzZDJjZTIxMTVkNWUyNDMzZjQxYjAzNTg3OWQz
14
- YWFmMDkyN2Q4NWQxYTdmNTllZTUyOTljNTIxOWI0NTdjYTQ5Yjg0Mjg3MDhk
15
- YzE5NTQ0YzMwMjhjMmZmMTlkOWM2ODA0NWVjM2ZkNjFiNmZkNDQ=
@@ -1,29 +0,0 @@
1
- lib = File.expand_path('../lib', __FILE__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require 'pilfer/version'
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = 'pilfer'
7
- spec.version = Pilfer::VERSION
8
- spec.authors = ['Eric Lindvall', 'Larry Marburger']
9
- spec.email = ['eric@sevenscale.com', 'larry@marburger.cc']
10
- spec.homepage = 'https://github.com/eric/pilfer'
11
- spec.license = 'MIT'
12
-
13
- spec.summary = 'line-profiler for ruby and rack'
14
- spec.description = 'pilfer uses rblineprof to measure how long each line ' +
15
- 'of code takes to execute and the number of times it ' +
16
- 'was called.'
17
-
18
- spec.files = %w(Gemfile LICENSE README.md)
19
- spec.files << 'pilfer.gemspec'
20
- spec.files += Dir.glob('lib/**/*.rb')
21
- spec.files += Dir.glob('spec/**/*.rb')
22
- spec.files += Dir.glob('script/*')
23
- spec.test_files = Dir.glob('spec/**/*.rb')
24
-
25
- spec.add_dependency 'rblineprof', '~> 0.3.2'
26
- spec.add_development_dependency 'bundler', '~> 1.0'
27
-
28
- spec.required_rubygems_version = '>= 1.3.6'
29
- end