peek-moped 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 369c744aee19789cf792762afa4fac026e5ba2dc
4
- data.tar.gz: 36ca6957eaba5af6e0fa375830b03236ef5b5f9e
3
+ metadata.gz: 16afba790704ccf8ea686a6bda3730ab0f46cc28
4
+ data.tar.gz: 3d23cd27ebfc284231d4d3c6484b4826fb2e2fba
5
5
  SHA512:
6
- metadata.gz: 2146688d83c31c693cd1e84cc2814f090109c83bf3c8c0c1519b19d983fd3784ad5ba3baedcf29741b6fd8c61f6ea0976aebf4f384aa390f21a7d436b2caceed
7
- data.tar.gz: b7a40c9aad76f2b646dce34f1030f9989a97158fd08a90dfd865baa56c78676543bb5a0c2e8e129b6275cfee453523b18cf5723de2b328ab5337f3856b95c123
6
+ metadata.gz: 9f184e562257ca7782c9beca93d32cbe49f7dfacee9b81e57f0483ca89e5b86a3025fa4bfb567ecfe2d9afad6a53594566aa5bb04024841f7c48d799379f8892
7
+ data.tar.gz: 66018e2664b1e0e9fa5a5bad36789d42778c36fa2a13c34d0d4d6dfbba14d634a5936a89f4343c8642fac25b7071d4cdcde80f16cbbf9077f791b8d2dca9a556
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # 1.0.2
2
+
3
+ - Write ObjectId in mongodb query format (previously was in binary)
4
+ - Replace $cmd on proper command name which sending to Mongo
5
+ - Colorize and write system DB in collection names
6
+
1
7
  # 1.0.1
2
8
 
3
9
  - Clearify collection names
data/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Take a peek into the Mongoid and Moped commands made within your Rails application.
4
4
 
5
+ ![Preview](/screenshot.png)
6
+
5
7
  Things this peek view provides:
6
8
 
7
9
  - Total number of Mongo commands called during the request
@@ -21,7 +21,7 @@
21
21
  font-weight: bold;
22
22
  }
23
23
  .peek-moped-query-details, .peek-moped-query-stack {
24
- display: none;
24
+ display: none;
25
25
  }
26
26
  .peek-moped-query-opened {
27
27
  background-color: #FFFFE0;
@@ -40,6 +40,10 @@
40
40
  position:absolute;
41
41
  background-color: #ffffff;
42
42
  }
43
+ .peek-moped-system-db {
44
+ font-style: italic;
45
+ color: darkred;
46
+ }
43
47
  </style>
44
48
  <div id="moped_queries_log">
45
49
  <table cellpadding="3" id="peek-moped-table">
@@ -55,9 +59,11 @@
55
59
  <% code_desc = view.op_code_info cmd.op_code %>
56
60
  <span class="peek-moped-code" title="<%= code_desc[1] %>"><%= code_desc[0] %></span>
57
61
  <a href="#" onclick="$(this).closest('div').toggleClass('peek-moped-query-opened'); return false;">
58
- <%= view.cmd_collection_name cmd %>
62
+ <%= raw view.cmd_collection_name cmd %>
59
63
  </a>
60
- <div class="peek-moped-query-details"><%= cmd.to_yaml %></div>
64
+ <div class="peek-moped-query-details"><%=
65
+ cmd.to_yaml.gsub(/\!ruby\/object\:Moped\:\:BSON\:\:ObjectId\s*raw_data:.*\n\s*([^\n]*)/) {|capture| "ObjectId(\"#{$1.unpack("m")[0].unpack("H*")[0].force_encoding(Moped::BSON::UTF8_ENCODING)}\")"}
66
+ %></div>
61
67
  <div class="peek-moped-query-stack"><b>APP STACK:</b><%= "\n#{row[3].join("\n")}" %></div>
62
68
  </div>
63
69
  <% end %>
@@ -55,17 +55,35 @@ module Peek
55
55
  end
56
56
 
57
57
  def cmd_collection_name cmd
58
+ if %w(admin config local).include? cmd.database
59
+ name = "<span class=\"peek-moped-system-db\">#{cmd.database}</span>."
60
+ else
61
+ name = ''
62
+ end
63
+
58
64
  if cmd.collection == '$cmd'
59
65
  if cmd.selector.has_key? :getlasterror
60
- 'getLastError()'
66
+ name << 'getLastError()'
61
67
  elsif cmd.selector.has_key? :count
62
- "#{cmd.selector[:count]}.count()"
68
+ name << "#{cmd.selector[:count]}.count()"
69
+ elsif cmd.selector.has_key? :aggregate
70
+ name << "#{cmd.selector[:aggregate]}.aggregate(#{cmd.selector[:pipeline].map{|p| p.keys}.flatten.join(', ')})"
71
+ elsif cmd.selector.has_key? :mapreduce
72
+ name << "#{cmd.selector[:mapreduce]}.mapReduce(#{cmd.selector[:out].to_s})"
73
+ elsif cmd.selector.has_key? :findAndModify
74
+ name << "#{cmd.selector[:findAndModify]}.findAndModify()"
75
+ elsif cmd.selector.has_key? :geoNear
76
+ name << "#{cmd.selector[:geoNear]}.geoNear()"
77
+ elsif cmd.selector.has_key? :ismaster
78
+ name << "isMaster()"
63
79
  else
64
- '$cmd'
80
+ name << '$cmd'
65
81
  end
66
82
  else
67
- cmd.collection
83
+ name << cmd.collection
68
84
  end
85
+
86
+ name
69
87
  end
70
88
 
71
89
  def formatted_duration
@@ -1,5 +1,5 @@
1
1
  module Peek
2
2
  module Moped
3
- VERSION = '1.0.1'
3
+ VERSION = '1.0.2'
4
4
  end
5
5
  end
data/screenshot.png ADDED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: peek-moped
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Chertorogov
@@ -72,6 +72,7 @@ files:
72
72
  - lib/peek-moped/version.rb
73
73
  - lib/peek/views/moped.rb
74
74
  - peek-moped.gemspec
75
+ - screenshot.png
75
76
  homepage: https://github.com/nodkz/peek-moped
76
77
  licenses: []
77
78
  metadata: {}