stackflame 0.2.1 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rack/stackflame.rb +1 -1
- data/lib/stackflame/version.rb +1 -1
- data/lib/stackflame.rb +17 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 09decf06f288a007ae0a0e9515e2438b7ca12f53
|
4
|
+
data.tar.gz: b34a3c59dd3ea8f5ed3834111a82c7f391f2fe3b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ee395945da832382f203c509c6ea94e5ec49254bb37cd3a7bc3884e46e0b7a8b688881c2a669b46e3792ddad15f5205df9088791836de0a5d82d8b3b09db840
|
7
|
+
data.tar.gz: 92351229fe1e8c106551312d9e22de39b5917dcd3e6032420a3d08f74edda6eda2cdcf7108c2dc9322fc0e3d0bc375d451251102599e89bb4e96113abec87dee
|
data/lib/rack/stackflame.rb
CHANGED
data/lib/stackflame/version.rb
CHANGED
data/lib/stackflame.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require "stackflame/version"
|
2
2
|
require "rack/stackflame"
|
3
3
|
require "stackprof"
|
4
|
+
require "uri"
|
4
5
|
|
5
6
|
class Stackflame
|
6
7
|
DEFAULT_OPTIONS = {
|
@@ -24,20 +25,31 @@ class Stackflame
|
|
24
25
|
end
|
25
26
|
end
|
26
27
|
|
27
|
-
def open_flamegraph
|
28
|
+
def open_flamegraph(params = {})
|
29
|
+
params = params.merge(data: temp_js_path)
|
28
30
|
if system("which osascript > /dev/null")
|
29
31
|
# NOTE: `open` can't open path with query string
|
30
|
-
`osascript -e 'open location "#{flamegraph_path}"'`
|
32
|
+
`osascript -e 'open location "#{flamegraph_path(params)}"'`
|
31
33
|
else
|
32
|
-
puts "This OS is not supported. Please open: #{flamegraph_path}"
|
34
|
+
puts "This OS is not supported. Please open: #{flamegraph_path(params)}"
|
33
35
|
end
|
34
36
|
end
|
35
37
|
|
36
38
|
private
|
37
39
|
|
38
|
-
def flamegraph_path
|
40
|
+
def flamegraph_path(params)
|
39
41
|
viewer_path = File.expand_path('../../vendor/viewer.html', __FILE__)
|
40
|
-
"file://#{viewer_path}
|
42
|
+
"file://#{viewer_path}#{to_query(params)}"
|
43
|
+
end
|
44
|
+
|
45
|
+
def to_query(params)
|
46
|
+
return '' if params.size == 0
|
47
|
+
|
48
|
+
queries = []
|
49
|
+
params.each do |key, value|
|
50
|
+
queries << "#{URI.escape(key.to_s)}=#{URI.escape(value.to_s)}"
|
51
|
+
end
|
52
|
+
"?#{queries.join('&')}"
|
41
53
|
end
|
42
54
|
|
43
55
|
def temp_js_path
|