double_agent 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ == Release 0.2.3 (July 14, 2012) ==
2
+
3
+ * Handle exceptions on encoding errors
4
+
1
5
  == Release 0.2.2 (November 1, 2011) ==
2
6
 
3
7
  * Detect Firefox on Android (Fennec)
@@ -1,3 +1,4 @@
1
+ require 'double_agent/version'
1
2
  require 'double_agent/parser'
2
3
  require 'double_agent/resources'
3
4
  require 'double_agent/stats'
@@ -80,15 +80,23 @@ module DoubleAgent
80
80
  entries = []
81
81
 
82
82
  # Define the parse lambda
83
- parse = (match or ignore) \
84
- ? lambda { |line| entries << Entry.new(line) unless (match and line !~ match) or (ignore and line =~ ignore) } \
85
- : lambda { |line| entries << Entry.new(line) }
83
+ parse = if match or ignore
84
+ lambda { |line|
85
+ begin
86
+ entries << Entry.new(line) unless (match and line !~ match) or (ignore and line =~ ignore)
87
+ rescue ArgumentError => e
88
+ $stderr.puts "#{e.message}: #{line}"
89
+ end
90
+ }
91
+ else
92
+ lambda { |line| entries << Entry.new(line) }
93
+ end
86
94
 
87
95
  # Define the read lambda
88
96
  read = lambda do |f|
89
97
  zipped = f =~ /\.gz\Z/i
90
98
  return unless ZLIB or not zipped
91
- File.open(f, 'r') do |file|
99
+ File.open(f, 'r:UTF-8') do |file|
92
100
  handle = zipped ? Zlib::GzipReader.new(file) : file
93
101
  #handle.each_line &parse # A little slower, but may be more memory efficient
94
102
  handle.readlines.each &parse
@@ -0,0 +1,4 @@
1
+ module DoubleAgent
2
+ # Version number
3
+ VERSION = '0.2.3'
4
+ end
data/lib/double_agent.rb CHANGED
@@ -1,2 +1,3 @@
1
+ require 'double_agent/version'
1
2
  require 'double_agent/parser'
2
3
  require 'double_agent/resources'
metadata CHANGED
@@ -1,82 +1,65 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: double_agent
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 2
8
- - 2
9
- version: 0.2.2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.3
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Jordan Hollinger
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2011-11-01 00:00:00 -04:00
18
- default_executable:
12
+ date: 2011-11-01 00:00:00.000000000 Z
19
13
  dependencies: []
20
-
21
14
  description: Browser User Agent string parser with resources, stats, and a log reader
22
15
  email: jordan@jordanhollinger.com
23
16
  executables: []
24
-
25
17
  extensions: []
26
-
27
- extra_rdoc_files:
18
+ extra_rdoc_files:
28
19
  - README.rdoc
29
20
  - CHANGELOG
30
- files:
21
+ files:
31
22
  - lib/double_agent.rb
32
23
  - lib/double_agent/all.rb
33
- - lib/double_agent/logs.rb
34
24
  - lib/double_agent/resources.rb
35
- - lib/double_agent/stats.rb
25
+ - lib/double_agent/version.rb
26
+ - lib/double_agent/logs.rb
36
27
  - lib/double_agent/parser.rb
28
+ - lib/double_agent/stats.rb
37
29
  - data/browsers.yml
38
30
  - data/oses.yml
39
- - spec/spec_helper.rb
40
- - spec/data/httpd.access.log.1.gz
41
- - spec/data/httpd.access.log
42
- - spec/stats_spec.rb
43
31
  - spec/resources_spec.rb
44
32
  - spec/data_spec.rb
33
+ - spec/spec_helper.rb
45
34
  - spec/parser_spec.rb
35
+ - spec/stats_spec.rb
36
+ - spec/data/httpd.access.log.1.gz
37
+ - spec/data/httpd.access.log
46
38
  - README.rdoc
47
39
  - LICENSE
48
40
  - CHANGELOG
49
- has_rdoc: true
50
41
  homepage: http://github.com/jhollinger/double_agent
51
42
  licenses: []
52
-
53
43
  post_install_message:
54
44
  rdoc_options: []
55
-
56
- require_paths:
45
+ require_paths:
57
46
  - lib
58
- required_ruby_version: !ruby/object:Gem::Requirement
47
+ required_ruby_version: !ruby/object:Gem::Requirement
59
48
  none: false
60
- requirements:
61
- - - ">="
62
- - !ruby/object:Gem::Version
63
- segments:
64
- - 0
65
- version: "0"
66
- required_rubygems_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ! '>='
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
54
  none: false
68
- requirements:
69
- - - ">="
70
- - !ruby/object:Gem::Version
71
- segments:
72
- - 0
73
- version: "0"
55
+ requirements:
56
+ - - ! '>='
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
74
59
  requirements: []
75
-
76
60
  rubyforge_project:
77
- rubygems_version: 1.3.7
61
+ rubygems_version: 1.8.21
78
62
  signing_key:
79
63
  specification_version: 3
80
64
  summary: Browser User Agent string parser
81
65
  test_files: []
82
-