mongoid-colors 0.2 → 0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mongoid-colors/colorizer.rb +18 -5
- data/lib/mongoid-colors/version.rb +1 -1
- metadata +4 -4
@@ -33,10 +33,9 @@ module MongoidColors::Colorizer
|
|
33
33
|
end
|
34
34
|
|
35
35
|
line << case m[:operation]
|
36
|
-
when
|
37
|
-
when
|
38
|
-
|
39
|
-
else m[:operation].to_s
|
36
|
+
when /(QUERY|COUNT)/ then "#{m[:operation]} ".colorize(:green)
|
37
|
+
when /(INSERT|UPDATE|MODIFY)/ then "#{m[:operation]} ".red
|
38
|
+
else "#{m[:operation]} "
|
40
39
|
end
|
41
40
|
|
42
41
|
line << CodeRay.scan(m[:query], :ruby).term
|
@@ -51,7 +50,21 @@ module MongoidColors::Colorizer
|
|
51
50
|
when /^MONGODB (.*)\['(.*)'\]\.(.*)$/
|
52
51
|
{:database => $1, :collection => $2, :query => $3}
|
53
52
|
when /^ *MOPED: (\S+:\S+) (\S+) +database=(\S+)( collection=(\S+))? (.*[^)])( \((.*)ms\))?$/
|
54
|
-
{:host => $1, :operation => $2, :database => $3, :collection => $5, :query => $6, :duration => $8}
|
53
|
+
res = {:host => $1, :operation => $2, :database => $3, :collection => $5, :query => $6, :duration => $8}
|
54
|
+
if res[:operation] == 'COMMAND'
|
55
|
+
command = eval(res[:query])
|
56
|
+
if command[:count]
|
57
|
+
res[:operation] = 'COUNT'
|
58
|
+
res[:collection] = command.delete(:count)
|
59
|
+
res[:query] = command.inspect
|
60
|
+
end
|
61
|
+
if command[:findAndModify]
|
62
|
+
res[:operation] = 'FIND AND MODIFY'
|
63
|
+
res[:collection] = command.delete(:findAndModify)
|
64
|
+
res[:query] = command.inspect
|
65
|
+
end
|
66
|
+
end
|
67
|
+
res
|
55
68
|
when /which could negatively impact client-side performance/
|
56
69
|
when /COMMAND.*getlasterror/
|
57
70
|
:ignore
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid-colors
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.3'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
12
|
+
date: 2013-02-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mongoid
|
@@ -66,9 +66,9 @@ executables: []
|
|
66
66
|
extensions: []
|
67
67
|
extra_rdoc_files: []
|
68
68
|
files:
|
69
|
-
- lib/mongoid-colors.rb
|
70
69
|
- lib/mongoid-colors/colorizer.rb
|
71
70
|
- lib/mongoid-colors/version.rb
|
71
|
+
- lib/mongoid-colors.rb
|
72
72
|
- README.md
|
73
73
|
homepage: http://github.com/nviennot/rspec-console
|
74
74
|
licenses: []
|
@@ -90,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
90
|
version: '0'
|
91
91
|
requirements: []
|
92
92
|
rubyforge_project:
|
93
|
-
rubygems_version: 1.8.
|
93
|
+
rubygems_version: 1.8.23
|
94
94
|
signing_key:
|
95
95
|
specification_version: 3
|
96
96
|
summary: Colorize your Mongoid traces
|