request-log-analyzer 1.9.3 → 1.9.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,7 +13,7 @@ module RequestLogAnalyzer
13
13
 
14
14
  # The current version of request-log-analyzer.
15
15
  # Do not change the value by hand; it will be updated automatically by the gem release script.
16
- VERSION = "1.9.3"
16
+ VERSION = "1.9.4"
17
17
 
18
18
 
19
19
  autoload :Controller, 'request_log_analyzer/controller'
@@ -82,8 +82,8 @@ module RequestLogAnalyzer::FileFormat
82
82
 
83
83
  # Rails > 2.1 completed line example
84
84
  # Completed in 614ms (View: 120, DB: 31) | 200 OK [http://floorplanner.local/demo]
85
- RAILS_22_COMPLETED = /Completed in (\d+)ms \((?:View: (\d+))?(?:, DB: (\d+)\))? \| (\d\d\d).+\[(http.+)\]/
86
-
85
+ RAILS_22_COMPLETED = /Completed in (\d+)ms \((?:View: (\d+))?,?(?:.?DB: (\d+))?\)? \| (\d{3}).+\[(http.+)\]/
86
+
87
87
  # A hash of definitions for all common lines in Rails logs.
88
88
  LINE_DEFINITIONS = {
89
89
  :processing => RequestLogAnalyzer::LineDefinition.new(:processing, :header => true,
@@ -36,8 +36,8 @@ module RequestLogAnalyzer::FileFormat
36
36
  line_definition :completed do |line|
37
37
  line.footer = true
38
38
  line.teaser = /Completed /
39
- line.regexp = /Completed (\d+)? .*in (\d+)ms(?:[^(]*\(Views: ((?:\d|\.)+)ms .* ActiveRecord: ((?:\d|\.)+)ms\))?/
40
-
39
+ line.regexp = /Completed (\d+)? .*in (\d+(?:\.\d+)?)ms(?:[^\(]*\(Views: (\d+(?:\.\d+)?)ms .* ActiveRecord: (\d+(?:\.\d+)?)ms\))?/
40
+
41
41
  line.capture(:status).as(:integer)
42
42
  line.capture(:duration).as(:duration, :unit => :msec)
43
43
  line.capture(:view).as(:duration, :unit => :msec)
@@ -2,8 +2,8 @@ Gem::Specification.new do |s|
2
2
  s.name = "request-log-analyzer"
3
3
 
4
4
  # Do not set the version and date field manually, this is done by the release script
5
- s.version = "1.9.3"
6
- s.date = "2010-10-04"
5
+ s.version = "1.9.4"
6
+ s.date = "2010-10-14"
7
7
 
8
8
  s.rubyforge_project = 'r-l-a'
9
9
 
@@ -28,7 +28,7 @@ Gem::Specification.new do |s|
28
28
  s.requirements << "To use the database inserter, ActiveRecord and an appropriate database adapter are required."
29
29
 
30
30
  s.add_development_dependency('rake')
31
- s.add_development_dependency('rspec')
31
+ s.add_development_dependency('rspec', '~> 2.0')
32
32
 
33
33
  s.add_development_dependency('activerecord')
34
34
  s.add_development_dependency('sqlite3-ruby')
data/spec/lib/helpers.rb CHANGED
@@ -1,4 +1,4 @@
1
- module RequestLogAnalyzer::Spec::Helpers
1
+ module RequestLogAnalyzer::RSpec::Helpers
2
2
 
3
3
  # Create or return a new TestingFormat
4
4
  def testing_format
data/spec/lib/macros.rb CHANGED
@@ -1,4 +1,4 @@
1
- module RequestLogAnalyzer::Spec::Macros
1
+ module RequestLogAnalyzer::RSpec::Macros
2
2
 
3
3
  def test_databases
4
4
  require 'yaml'
data/spec/lib/matchers.rb CHANGED
@@ -1,4 +1,4 @@
1
- module RequestLogAnalyzer::Spec::Matchers
1
+ module RequestLogAnalyzer::RSpec::Matchers
2
2
 
3
3
  class HasLineDefinition
4
4
 
data/spec/lib/mocks.rb CHANGED
@@ -1,4 +1,4 @@
1
- module RequestLogAnalyzer::Spec::Mocks
1
+ module RequestLogAnalyzer::RSpec::Mocks
2
2
 
3
3
  def mock_source
4
4
  source = mock('RequestLogAnalyzer::Source::Base')
data/spec/spec_helper.rb CHANGED
@@ -1,11 +1,10 @@
1
- $:.reject! { |e| e.include? 'TextMate' }
2
- $: << File.join(File.dirname(__FILE__), '..', 'lib')
1
+ $LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
3
2
 
4
3
  require 'rubygems'
5
- require 'spec/autorun'
4
+ require 'rspec'
6
5
  require 'request_log_analyzer'
7
6
 
8
- module RequestLogAnalyzer::Spec
7
+ module RequestLogAnalyzer::RSpec
9
8
  end
10
9
 
11
10
  # Include all files in the spec_helper directory
@@ -15,10 +14,10 @@ end
15
14
 
16
15
  Dir.mkdir("#{File.dirname(__FILE__)}/../tmp") unless File.exist?("#{File.dirname(__FILE__)}/../tmp")
17
16
 
18
- Spec::Runner.configure do |config|
19
- config.include RequestLogAnalyzer::Spec::Matchers
20
- config.include RequestLogAnalyzer::Spec::Mocks
21
- config.include RequestLogAnalyzer::Spec::Helpers
17
+ RSpec.configure do |config|
18
+ config.include RequestLogAnalyzer::RSpec::Matchers
19
+ config.include RequestLogAnalyzer::RSpec::Mocks
20
+ config.include RequestLogAnalyzer::RSpec::Helpers
22
21
 
23
- config.extend RequestLogAnalyzer::Spec::Macros
22
+ config.extend RequestLogAnalyzer::RSpec::Macros
24
23
  end
@@ -32,6 +32,12 @@ describe RequestLogAnalyzer::FileFormat::Rails do
32
32
  @file_format.should parse_line(line).as(:completed).and_capture(
33
33
  :duration => 0.170, :status => 200)
34
34
  end
35
+
36
+ it "should parse :completed lines correctly when ActiveRecord is not mentioned" do
37
+ line = 'Completed 200 OK in 364ms (Views: 31.4ms)'
38
+ @file_format.should parse_line(line).as(:completed).and_capture(:duration => 0.364, :status => 200)
39
+ end
40
+
35
41
 
36
42
  it "should pase :failure lines correctly" do
37
43
  line = "ActionView::Template::Error (undefined local variable or method `field' for #<Class>) on line #3 of /Users/willem/Code/warehouse/app/views/queries/execute.csv.erb:"
@@ -79,6 +79,11 @@ describe RequestLogAnalyzer::FileFormat::Rails do
79
79
  line = prefix + 'Completed in 597ms (View: 298 | 200 OK [http://shapado.com]'
80
80
  @rails.should parse_line(line).as(:completed).and_capture(:duration => 0.597, :db => nil, :view => 0.298, :status => 200, :url => 'http://shapado.com')
81
81
  end
82
+
83
+ it "should parse a Rails 2.2 style :completed line without view" do
84
+ line = prefix + "Completed in 148ms (DB: 0) | 302 Found [http://iwp-sod.hargray.org/login]"
85
+ @rails.should parse_line(line).as(:completed).and_capture(:duration => 0.148, :db => 0.0, :view => nil, :status => 302, :url => 'http://iwp-sod.hargray.org/login')
86
+ end
82
87
 
83
88
  it "should parse a :failure line with exception correctly" do
84
89
  line = prefix + "NoMethodError (undefined method `update_domain_account' for nil:NilClass):"
@@ -71,23 +71,23 @@ module GithubGem
71
71
 
72
72
  # Defines RSpec tasks
73
73
  def define_rspec_tasks!
74
- require 'spec/rake/spectask'
74
+ require 'rspec/core/rake_task'
75
75
 
76
76
  namespace(:spec) do
77
77
  desc "Verify all RSpec examples for #{gemspec.name}"
78
- Spec::Rake::SpecTask.new(:basic) do |t|
79
- t.spec_files = FileList[spec_pattern]
78
+ RSpec::Core::RakeTask.new(:basic) do |t|
79
+ t.pattern = spec_pattern
80
80
  end
81
81
 
82
82
  desc "Verify all RSpec examples for #{gemspec.name} and output specdoc"
83
- Spec::Rake::SpecTask.new(:specdoc) do |t|
84
- t.spec_files = FileList[spec_pattern]
85
- t.spec_opts << '--format' << 'specdoc' << '--color'
83
+ RSpec::Core::RakeTask.new(:specdoc) do |t|
84
+ t.pattern = spec_pattern
85
+ t.rspec_opts = ['--format', 'documentation', '--color']
86
86
  end
87
87
 
88
88
  desc "Run RCov on specs for #{gemspec.name}"
89
- Spec::Rake::SpecTask.new(:rcov) do |t|
90
- t.spec_files = FileList[spec_pattern]
89
+ RSpec::Core::RakeTask.new(:rcov) do |t|
90
+ t.pattern = spec_pattern
91
91
  t.rcov = true
92
92
  t.rcov_opts = ['--exclude', '"spec/*,gems/*"', '--rails']
93
93
  end
@@ -271,8 +271,7 @@ module GithubGem
271
271
  # All work is done by the task's dependencies, so just display a release completed message.
272
272
  def release_task
273
273
  puts
274
- puts '------------------------------------------------------------'
275
- puts "Released #{gemspec.name} version #{gemspec.version}"
274
+ puts "Release successful."
276
275
  end
277
276
 
278
277
  private
@@ -332,6 +331,9 @@ module GithubGem
332
331
 
333
332
  # Reload the gemspec so the changes are incorporated
334
333
  load_gemspec!
334
+
335
+ # Also mark the Gemfile.lock file as changed because of the new version.
336
+ modified_files << 'Gemfile.lock' if File.exist?(File.join(root_dir, 'Gemfile.lock'))
335
337
  end
336
338
  end
337
339
 
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: request-log-analyzer
3
3
  version: !ruby/object:Gem::Version
4
- hash: 53
5
4
  prerelease: false
6
5
  segments:
7
6
  - 1
8
7
  - 9
9
- - 3
10
- version: 1.9.3
8
+ - 4
9
+ version: 1.9.4
11
10
  platform: ruby
12
11
  authors:
13
12
  - Willem van Bergen
@@ -16,7 +15,7 @@ autorequire:
16
15
  bindir: bin
17
16
  cert_chain: []
18
17
 
19
- date: 2010-10-04 00:00:00 +02:00
18
+ date: 2010-10-14 00:00:00 +02:00
20
19
  default_executable: request-log-analyzer
21
20
  dependencies:
22
21
  - !ruby/object:Gem::Dependency
@@ -27,7 +26,6 @@ dependencies:
27
26
  requirements:
28
27
  - - ">="
29
28
  - !ruby/object:Gem::Version
30
- hash: 3
31
29
  segments:
32
30
  - 0
33
31
  version: "0"
@@ -39,12 +37,12 @@ dependencies:
39
37
  requirement: &id002 !ruby/object:Gem::Requirement
40
38
  none: false
41
39
  requirements:
42
- - - ">="
40
+ - - ~>
43
41
  - !ruby/object:Gem::Version
44
- hash: 3
45
42
  segments:
43
+ - 2
46
44
  - 0
47
- version: "0"
45
+ version: "2.0"
48
46
  type: :development
49
47
  version_requirements: *id002
50
48
  - !ruby/object:Gem::Dependency
@@ -55,7 +53,6 @@ dependencies:
55
53
  requirements:
56
54
  - - ">="
57
55
  - !ruby/object:Gem::Version
58
- hash: 3
59
56
  segments:
60
57
  - 0
61
58
  version: "0"
@@ -69,7 +66,6 @@ dependencies:
69
66
  requirements:
70
67
  - - ">="
71
68
  - !ruby/object:Gem::Version
72
- hash: 3
73
69
  segments:
74
70
  - 0
75
71
  version: "0"
@@ -243,7 +239,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
243
239
  requirements:
244
240
  - - ">="
245
241
  - !ruby/object:Gem::Version
246
- hash: 3
247
242
  segments:
248
243
  - 0
249
244
  version: "0"
@@ -252,7 +247,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
252
247
  requirements:
253
248
  - - ">="
254
249
  - !ruby/object:Gem::Version
255
- hash: 3
256
250
  segments:
257
251
  - 0
258
252
  version: "0"