stackprof-webnav 0.0.2 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +2 -0
  3. data/.travis.yml +4 -0
  4. data/Gemfile +2 -0
  5. data/Procfile +1 -0
  6. data/README.md +27 -16
  7. data/Rakefile +24 -0
  8. data/bin/stackprof-webnav +8 -10
  9. data/lib/stackprof-webnav/dump.rb +41 -0
  10. data/lib/stackprof-webnav/presenter.rb +2 -1
  11. data/lib/stackprof-webnav/public/css/application.css +7 -0
  12. data/lib/stackprof-webnav/{css → public/css}/code.css +0 -0
  13. data/lib/stackprof-webnav/{css → public/css}/foundation.min.css +0 -0
  14. data/lib/stackprof-webnav/{css → public/css}/normalize.css +0 -0
  15. data/lib/stackprof-webnav/public/flamegraph.js +983 -0
  16. data/lib/stackprof-webnav/server.rb +109 -35
  17. data/lib/stackprof-webnav/version.rb +1 -1
  18. data/lib/stackprof-webnav/views/error.haml +8 -0
  19. data/lib/stackprof-webnav/views/file.haml +7 -4
  20. data/lib/stackprof-webnav/views/flamegraph.haml +77 -0
  21. data/lib/stackprof-webnav/views/graph.haml +4 -0
  22. data/lib/stackprof-webnav/views/index.haml +18 -0
  23. data/lib/stackprof-webnav/views/invalid_dump.haml +4 -0
  24. data/lib/stackprof-webnav/views/layout.haml +5 -4
  25. data/lib/stackprof-webnav/views/method.haml +11 -8
  26. data/lib/stackprof-webnav/views/overview.haml +17 -3
  27. data/screenshots/callgraph.png +0 -0
  28. data/screenshots/directory.png +0 -0
  29. data/screenshots/file.png +0 -0
  30. data/screenshots/flamegraph.png +0 -0
  31. data/screenshots/method.png +0 -0
  32. data/screenshots/overview.png +0 -0
  33. data/spec/fixtures/test-raw.dump +0 -0
  34. data/spec/fixtures/test.dump +0 -0
  35. data/spec/helpers.rb +17 -0
  36. data/spec/integration_spec.rb +79 -0
  37. data/spec/spec_helper.rb +15 -0
  38. data/stackprof-webnav.gemspec +8 -4
  39. metadata +104 -25
  40. data/lib/stackprof-webnav/css/application.css +0 -13
  41. data/screenshots/main.png +0 -0
@@ -0,0 +1,79 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe "integration tests" do
4
+ let(:app) { build_app }
5
+ let(:presenter) { build_presenter(fixture_path("test.dump")) }
6
+ let(:response) { app.last_response }
7
+
8
+ after(:each) do
9
+ Dir.glob("spec/fixtures/*.flames.json").each {|file| File.delete(file) }
10
+ Dir.glob("spec/fixtures/*.digraph.dot").each {|file| File.delete(file) }
11
+ Dir.glob("spec/fixtures/*.graph.png").each {|file| File.delete(file) }
12
+ end
13
+
14
+ describe "index" do
15
+ it "lists the files in a folder" do
16
+ app = build_app(directory: "spec/fixtures")
17
+ app.get "/"
18
+ expect(app.last_response.body).to include("test.dump")
19
+ end
20
+
21
+ it "redirects to overview if path is specified" do
22
+ app = build_app(filepath: fixture_path("test.dump"))
23
+ app.get "/"
24
+ app.follow_redirect!
25
+ expect(app.last_response.body).to include("Dummy")
26
+ end
27
+ end
28
+
29
+ it "does not crash on unknown requests" do
30
+ app.get "/favicon.ico"
31
+ expect(response.status).to eq(404)
32
+ end
33
+
34
+ describe "overview" do
35
+ it "works with a valid dump" do
36
+ app.get "/overview", dump: fixture_path("test.dump")
37
+
38
+ frame = presenter.overview_frames.first
39
+ expect(response.body).to include(frame[:method])
40
+ end
41
+
42
+ it "communicates that flamegraph is not available for dump" do
43
+ app.get "/overview", dump: fixture_path("test.dump")
44
+ end
45
+
46
+ it "does not crash if selected file is not a dump" do
47
+ app.get "/overview", dump: "Rakefile"
48
+ expect(response.body).to include("Unable to open")
49
+ end
50
+ end
51
+
52
+ it "is able to generate flames.json file" do
53
+ app.get "/flames.json", dump: fixture_path("test-raw.dump")
54
+ expect(response.body).to include("flamegraph")
55
+ end
56
+
57
+ it "is able to render graph" do
58
+ app.get "/graph.png", dump: fixture_path("test.dump")
59
+ expect(response.get_header("Content-Type")).to eq("image/png")
60
+ expect(response.body.size).to_not eq(0)
61
+ end
62
+
63
+ it "method page renders information about a method" do
64
+ frame = presenter.overview_frames.first
65
+ app.get "/method", dump: fixture_path("test.dump"), name: frame[:method]
66
+ expect(response.body).to include("Callers")
67
+ end
68
+
69
+ it "does not crash on a file page" do
70
+ frame = presenter.overview_frames.first
71
+ method_info = presenter.method_info frame[:method]
72
+
73
+ expect {
74
+ app.get "/file",
75
+ dump: fixture_path("test.dump"),
76
+ path: method_info.first[:location]
77
+ }.to_not raise_error
78
+ end
79
+ end
@@ -0,0 +1,15 @@
1
+ ENV['APP_ENV'] = 'test'
2
+ $LOAD_PATH.unshift File.join(Dir.pwd, "lib")
3
+
4
+ require "stackprof-webnav"
5
+ require "rspec"
6
+ require_relative 'helpers'
7
+
8
+ RSpec.configure do |config|
9
+ config.include Helpers
10
+ config.backtrace_exclusion_patterns << /.gem/
11
+
12
+ config.after(:each) do
13
+ StackProf::Webnav::Server.cmd_options = {}
14
+ end
15
+ end
@@ -21,10 +21,14 @@ Gem::Specification.new do |spec|
21
21
  spec.bindir = 'bin'
22
22
  spec.executables << 'stackprof-webnav'
23
23
 
24
- spec.add_dependency "nyny", "~> 3.4"
25
- spec.add_dependency "haml", "~> 4.0"
26
- spec.add_dependency "stackprof", "~> 0.2"
27
- spec.add_dependency "sprockets-nyny", "0.0.3"
24
+ spec.add_dependency "sinatra", "~> 2.0.7"
25
+ spec.add_dependency "haml", "~> 5.1.2"
26
+ spec.add_dependency "stackprof", ">= 0.2.13"
27
+ spec.add_dependency "better_errors", "~> 1.1.0"
28
+ spec.add_dependency "ruby-graphviz", "~> 1.2.4"
29
+ spec.add_dependency "sinatra-contrib", "~> 2.0.5"
28
30
  spec.add_development_dependency "bundler", "~> 1.5"
29
31
  spec.add_development_dependency "rake", "~> 10.1"
32
+ spec.add_development_dependency "rspec", "~> 3.9.0"
33
+ spec.add_development_dependency "rack-test", "~> 1.1.0"
30
34
  end
metadata CHANGED
@@ -1,71 +1,99 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stackprof-webnav
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrei Lisnic
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-05 00:00:00.000000000 Z
11
+ date: 2020-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: nyny
14
+ name: sinatra
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '3.4'
19
+ version: 2.0.7
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '3.4'
26
+ version: 2.0.7
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: haml
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '4.0'
33
+ version: 5.1.2
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '4.0'
40
+ version: 5.1.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: stackprof
43
43
  requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 0.2.13
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 0.2.13
55
+ - !ruby/object:Gem::Dependency
56
+ name: better_errors
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 1.1.0
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
44
65
  requirements:
45
66
  - - "~>"
46
67
  - !ruby/object:Gem::Version
47
- version: '0.2'
68
+ version: 1.1.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: ruby-graphviz
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 1.2.4
48
76
  type: :runtime
49
77
  prerelease: false
50
78
  version_requirements: !ruby/object:Gem::Requirement
51
79
  requirements:
52
80
  - - "~>"
53
81
  - !ruby/object:Gem::Version
54
- version: '0.2'
82
+ version: 1.2.4
55
83
  - !ruby/object:Gem::Dependency
56
- name: sprockets-nyny
84
+ name: sinatra-contrib
57
85
  requirement: !ruby/object:Gem::Requirement
58
86
  requirements:
59
- - - '='
87
+ - - "~>"
60
88
  - !ruby/object:Gem::Version
61
- version: 0.0.3
89
+ version: 2.0.5
62
90
  type: :runtime
63
91
  prerelease: false
64
92
  version_requirements: !ruby/object:Gem::Requirement
65
93
  requirements:
66
- - - '='
94
+ - - "~>"
67
95
  - !ruby/object:Gem::Version
68
- version: 0.0.3
96
+ version: 2.0.5
69
97
  - !ruby/object:Gem::Dependency
70
98
  name: bundler
71
99
  requirement: !ruby/object:Gem::Requirement
@@ -94,6 +122,34 @@ dependencies:
94
122
  - - "~>"
95
123
  - !ruby/object:Gem::Version
96
124
  version: '10.1'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rspec
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: 3.9.0
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: 3.9.0
139
+ - !ruby/object:Gem::Dependency
140
+ name: rack-test
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: 1.1.0
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: 1.1.0
97
153
  description: Provides the ability to analyze StackProf dumps
98
154
  email:
99
155
  - andrei.lisnic@gmail.com
@@ -103,32 +159,50 @@ extensions: []
103
159
  extra_rdoc_files: []
104
160
  files:
105
161
  - ".gitignore"
162
+ - ".travis.yml"
106
163
  - Gemfile
164
+ - Gemfile.lock
107
165
  - LICENSE.txt
166
+ - Procfile
108
167
  - README.md
109
168
  - Rakefile
110
169
  - bin/stackprof-webnav
111
170
  - lib/stackprof-webnav.rb
112
- - lib/stackprof-webnav/css/application.css
113
- - lib/stackprof-webnav/css/code.css
114
- - lib/stackprof-webnav/css/foundation.min.css
115
- - lib/stackprof-webnav/css/normalize.css
171
+ - lib/stackprof-webnav/dump.rb
116
172
  - lib/stackprof-webnav/presenter.rb
173
+ - lib/stackprof-webnav/public/css/application.css
174
+ - lib/stackprof-webnav/public/css/code.css
175
+ - lib/stackprof-webnav/public/css/foundation.min.css
176
+ - lib/stackprof-webnav/public/css/normalize.css
177
+ - lib/stackprof-webnav/public/flamegraph.js
117
178
  - lib/stackprof-webnav/server.rb
118
179
  - lib/stackprof-webnav/version.rb
180
+ - lib/stackprof-webnav/views/error.haml
119
181
  - lib/stackprof-webnav/views/file.haml
182
+ - lib/stackprof-webnav/views/flamegraph.haml
183
+ - lib/stackprof-webnav/views/graph.haml
184
+ - lib/stackprof-webnav/views/index.haml
185
+ - lib/stackprof-webnav/views/invalid_dump.haml
120
186
  - lib/stackprof-webnav/views/layout.haml
121
187
  - lib/stackprof-webnav/views/method.haml
122
188
  - lib/stackprof-webnav/views/overview.haml
189
+ - screenshots/callgraph.png
190
+ - screenshots/directory.png
123
191
  - screenshots/file.png
124
- - screenshots/main.png
192
+ - screenshots/flamegraph.png
125
193
  - screenshots/method.png
194
+ - screenshots/overview.png
195
+ - spec/fixtures/test-raw.dump
196
+ - spec/fixtures/test.dump
197
+ - spec/helpers.rb
198
+ - spec/integration_spec.rb
199
+ - spec/spec_helper.rb
126
200
  - stackprof-webnav.gemspec
127
201
  homepage: https://github.com/alisnic/stackprof-webnav
128
202
  licenses:
129
203
  - MIT
130
204
  metadata: {}
131
- post_install_message:
205
+ post_install_message:
132
206
  rdoc_options: []
133
207
  require_paths:
134
208
  - lib
@@ -143,9 +217,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
217
  - !ruby/object:Gem::Version
144
218
  version: '0'
145
219
  requirements: []
146
- rubyforge_project:
147
- rubygems_version: 2.2.2
148
- signing_key:
220
+ rubyforge_project:
221
+ rubygems_version: 2.7.6.2
222
+ signing_key:
149
223
  specification_version: 4
150
224
  summary: View stackprof dumps in a web UI
151
- test_files: []
225
+ test_files:
226
+ - spec/fixtures/test-raw.dump
227
+ - spec/fixtures/test.dump
228
+ - spec/helpers.rb
229
+ - spec/integration_spec.rb
230
+ - spec/spec_helper.rb
@@ -1,13 +0,0 @@
1
- /*
2
- = require normalize
3
- = require foundation.min
4
- = require code
5
- */
6
-
7
- table {
8
- width: 100%;
9
- }
10
-
11
- pre code {
12
- color: black;
13
- }
Binary file