rawk_log 2.2.1 → 2.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -79,7 +79,11 @@ module RawkLog
79
79
  end
80
80
 
81
81
  def is_id?(word)
82
- word =~ /^((\d+)|([\dA-F\-]{36}))$/i
82
+ word =~ /^((\d+(-.*)?)|([\dA-F\-]{36}))$/i
83
+ end
84
+
85
+ def is_filename?(word)
86
+ word =~ /\.[a-z]{1,5}\d?$/i
83
87
  end
84
88
 
85
89
  def build_stats
@@ -153,6 +157,7 @@ module RawkLog
153
157
  end
154
158
  keywords
155
159
  end
160
+ keywords[-1] = '{filename}' if ! keywords.empty? and is_filename?(keywords[-1])
156
161
  k = "/#{keywords.join("/")}"
157
162
  end
158
163
  end
data/lib/rawk_log/stat.rb CHANGED
@@ -4,8 +4,8 @@ module RawkLog
4
4
 
5
5
  DEFAULT_LABEL_SIZE = 30
6
6
 
7
- HEADER = "Count Sum Max Median Avg Min Std"
8
- HEADER_NEW_LOG_FORMAT = "Count Sum(s) Max Median Avg Min Std"
7
+ HEADER = "Count Sum Max Median Avg Min Std"
8
+ HEADER_NEW_LOG_FORMAT = "Count Sum(s) Max Median Avg Min Std"
9
9
 
10
10
  def initialize(key)
11
11
  @key=key
@@ -76,9 +76,9 @@ module RawkLog
76
76
  def to_s(label_size = DEFAULT_LABEL_SIZE)
77
77
  if count > 0
78
78
  if @new_log_format
79
- sprintf("%*s %6d %7.2f %7d %7d %7d %7d %7d",-label_size, key,count,(sum.to_f/1000),max,median,average,min,standard_deviation)
79
+ sprintf("%*s %6d %9.2f %7d %7d %7d %7d %7d",-label_size, key,count,(sum.to_f/1000),max,median,average,min,standard_deviation)
80
80
  else
81
- sprintf("%*s %6d %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f",-label_size,key,count,sum,max,median,average,min,standard_deviation)
81
+ sprintf("%*s %6d %9.2f %7.2f %7.2f %7.2f %7.2f %7.2f",-label_size,key,count,sum,max,median,average,min,standard_deviation)
82
82
  end
83
83
  else
84
84
  sprintf("%*s %6d",-label_size,key,0)
@@ -1,3 +1,3 @@
1
1
  module RawkLog
2
- VERSION = "2.2.1"
2
+ VERSION = "2.2.2"
3
3
  end
@@ -26,5 +26,5 @@ Rendering items/index
26
26
  Completed in 5ms (View: 2, DB: 0) | 200 OK [http://0.0.0.0/items]
27
27
 
28
28
  Processing DocumentController#download (for 12.13.14.15 at 2012-12-13 11:49:03) [GET]
29
- Completed in 936ms (View: 1, DB: 31) | 200 OK [http://www.example.com/document/download/96164/Form 6 - Occupancy permit-2034-20156 / Unit 1.docx]
29
+ Completed in 936ms (View: 1, DB: 31) | 200 OK [http://www.example.com/document/download/96164/Form 6 - Occupancy permit-2034-20156 - Unit 1.docx]
30
30
 
data/test/rails23_test.rb CHANGED
@@ -30,6 +30,14 @@ class Rails23Test < Test::Unit::TestCase
30
30
  assert_match(/^\/items\s+5\s+0\.06/, @output)
31
31
  end
32
32
 
33
+ def test_recognises_ids_and_filenames
34
+ assert_match(/^\/document\/download\/{ID}\/{filename}/, @output)
35
+ end
36
+
37
+ def test_sums_entries
38
+ assert_match(/^\/items\s+5\s+0\.06/, @output)
39
+ end
40
+
33
41
  def test_exit_status
34
42
  assert_equal(0, @exit_status)
35
43
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rawk_log
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: