stackprof-webnav 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Procfile +1 -0
- data/bin/stackprof-webnav +18 -2
- data/lib/stackprof-webnav/presenter.rb +5 -1
- data/lib/stackprof-webnav/server.rb +13 -17
- data/lib/stackprof-webnav/version.rb +1 -1
- data/lib/stackprof-webnav/views/listing.haml +4 -2
- data/stackprof-webnav.gemspec +1 -1
- metadata +9 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a028c26df794a0965aacea7e0b72f9f9625f7744
|
4
|
+
data.tar.gz: 6515dbbb40cd176241d12288702a45922709c792
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd4e134ae7984043cdfd8cb3cde03175eb2d93ba54c040c554211478caed5f843f30008ee9c550fe444f9612fd2db58f3ee65f83ea9054ea6715088f6f820c3f
|
7
|
+
data.tar.gz: d83332d8ef03cf1e65a442fb4df4ed02ef409f54985b663a3791a55e9340f9d772132a7fac743f881c345bbbf77ebc0c3106581c8c445923dfe50f257df81018
|
data/Procfile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
web: bundle exec stackprof-webnav -b <url_to_S3_bucket> -p $PORT
|
data/bin/stackprof-webnav
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'optparse'
|
3
3
|
require 'stackprof-webnav'
|
4
|
+
require 'sprockets'
|
5
|
+
require 'rack'
|
4
6
|
|
5
7
|
options = {
|
6
8
|
:port => 9292
|
@@ -15,9 +17,23 @@ parser = OptionParser.new(ARGV) do |o|
|
|
15
17
|
end
|
16
18
|
|
17
19
|
parser.parse!
|
18
|
-
parser.abort(parser.help) unless [:filepath, :uri, :bucket].any? {|key| options.key?(key)}
|
20
|
+
parser.abort(parser.help) unless [:filepath, :uri, :bucket].any? {|key| options.key?(key)}
|
19
21
|
|
20
22
|
server = StackProf::Webnav::Server
|
21
23
|
server.cmd_options = options
|
22
24
|
|
23
|
-
|
25
|
+
builder = Rack::Builder.new do
|
26
|
+
map '/' do
|
27
|
+
run server.new
|
28
|
+
end
|
29
|
+
|
30
|
+
map '/assets' do
|
31
|
+
environment = Sprockets::Environment.new
|
32
|
+
environment.append_path File.expand_path("../../lib/stackprof-webnav/css", __FILE__)
|
33
|
+
run environment
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
puts File.expand_path("../lib/stackprof-webnav/css", __FILE__)
|
38
|
+
|
39
|
+
Rack::Handler.get('webrick').run builder, :Port => options[:port]
|
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'better_errors'
|
2
2
|
require 'stringio'
|
3
3
|
require 'rexml/document'
|
4
|
+
require 'action_view'
|
5
|
+
include ActionView::Helpers::NumberHelper
|
4
6
|
|
5
7
|
module StackProf
|
6
8
|
module Webnav
|
@@ -35,6 +37,7 @@ module StackProf
|
|
35
37
|
end
|
36
38
|
|
37
39
|
def listing_dumps
|
40
|
+
Server.report_dump_listing += "/" unless Server.report_dump_listing.end_with?("/")
|
38
41
|
xml_data = Net::HTTP.get(URI.parse(Server.report_dump_listing))
|
39
42
|
if xml_data
|
40
43
|
doc = REXML::Document.new(xml_data)
|
@@ -42,7 +45,8 @@ module StackProf
|
|
42
45
|
doc.elements.each('ListBucketResult/Contents') do |ele|
|
43
46
|
dumps << {
|
44
47
|
:key => ele.elements["Key"].text,
|
45
|
-
:date => ele.elements["LastModified"].text,
|
48
|
+
:date => ele.elements["LastModified"].text,
|
49
|
+
:size => number_with_delimiter(ele.elements["Size"].text.to_i),
|
46
50
|
:uri => Server.report_dump_listing + ele.elements["Key"].text
|
47
51
|
}
|
48
52
|
end
|
@@ -1,26 +1,22 @@
|
|
1
1
|
require 'nyny'
|
2
2
|
require 'haml'
|
3
3
|
require "stackprof"
|
4
|
-
require 'sprockets/nyny'
|
5
4
|
require 'net/http'
|
6
5
|
require_relative 'presenter'
|
7
6
|
|
8
7
|
module StackProf
|
9
8
|
module Webnav
|
10
9
|
class Server < NYNY::App
|
11
|
-
register Sprockets::NYNY
|
12
|
-
config.assets.paths << File.join(__dir__, 'css')
|
13
|
-
|
14
10
|
class << self
|
15
|
-
attr_accessor :cmd_options, :report_dump_path, :report_dump_uri, :report_dump_listing
|
11
|
+
attr_accessor :cmd_options, :report_dump_path, :report_dump_uri, :report_dump_listing
|
16
12
|
|
17
13
|
def presenter regenerate=false
|
18
14
|
return @presenter unless regenerate || @presenter.nil?
|
19
15
|
process_options
|
20
16
|
if self.report_dump_path || self.report_dump_uri
|
21
17
|
report_contents = if report_dump_path.nil?
|
22
|
-
Net::HTTP.get(URI.parse(report_dump_uri))
|
23
|
-
else
|
18
|
+
Net::HTTP.get(URI.parse(report_dump_uri))
|
19
|
+
else
|
24
20
|
File.open(report_dump_path).read
|
25
21
|
end
|
26
22
|
report = StackProf::Report.new(Marshal.load(report_contents))
|
@@ -30,15 +26,15 @@ module StackProf
|
|
30
26
|
|
31
27
|
private
|
32
28
|
def process_options
|
33
|
-
if cmd_options[:filepath]
|
34
|
-
self.report_dump_path = cmd_options[:filepath]
|
35
|
-
elsif cmd_options[:uri]
|
36
|
-
self.report_dump_uri = cmd_options[:uri]
|
29
|
+
if cmd_options[:filepath]
|
30
|
+
self.report_dump_path = cmd_options[:filepath]
|
31
|
+
elsif cmd_options[:uri]
|
32
|
+
self.report_dump_uri = cmd_options[:uri]
|
37
33
|
elsif cmd_options[:bucket]
|
38
34
|
self.report_dump_listing = cmd_options[:bucket]
|
39
|
-
end
|
35
|
+
end
|
40
36
|
end
|
41
|
-
|
37
|
+
|
42
38
|
end
|
43
39
|
|
44
40
|
helpers do
|
@@ -62,7 +58,7 @@ module StackProf
|
|
62
58
|
def file_url path
|
63
59
|
"/file?path=#{URI.escape(path)}"
|
64
60
|
end
|
65
|
-
|
61
|
+
|
66
62
|
def overview_url path
|
67
63
|
"/overview?path=#{URI.escape(path)}"
|
68
64
|
end
|
@@ -71,7 +67,7 @@ module StackProf
|
|
71
67
|
get '/' do
|
72
68
|
presenter
|
73
69
|
if Server.report_dump_listing
|
74
|
-
redirect_to '/listing'
|
70
|
+
redirect_to '/listing'
|
75
71
|
else
|
76
72
|
redirect_to '/overview'
|
77
73
|
end
|
@@ -91,9 +87,9 @@ module StackProf
|
|
91
87
|
get '/listing' do
|
92
88
|
@file = Server.report_dump_listing
|
93
89
|
@action = "listing"
|
94
|
-
@dumps = presenter.listing_dumps
|
90
|
+
@dumps = presenter.listing_dumps
|
95
91
|
render_with_layout :listing
|
96
|
-
end
|
92
|
+
end
|
97
93
|
|
98
94
|
get '/method' do
|
99
95
|
@action = params[:name]
|
@@ -9,13 +9,15 @@
|
|
9
9
|
%thead
|
10
10
|
%th Key
|
11
11
|
%th Date
|
12
|
-
%th
|
12
|
+
%th Size
|
13
|
+
%th Dump
|
13
14
|
|
14
|
-
%tbody
|
15
|
+
%tbody
|
15
16
|
- @dumps.each do |dump|
|
16
17
|
%tr
|
17
18
|
%td= dump[:key]
|
18
19
|
%td= dump[:date]
|
20
|
+
%td= dump[:size]
|
19
21
|
%td
|
20
22
|
%a{:href => overview_url(dump[:uri])}
|
21
23
|
= dump[:uri]
|
data/stackprof-webnav.gemspec
CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_dependency "nyny", "~> 3.4"
|
25
25
|
spec.add_dependency "haml", "~> 4.0"
|
26
26
|
spec.add_dependency "stackprof", "~> 0.2"
|
27
|
-
spec.add_dependency
|
27
|
+
spec.add_dependency 'sprockets', '~> 2.12.2'
|
28
28
|
spec.add_development_dependency "bundler", "~> 1.5"
|
29
29
|
spec.add_development_dependency "rake", "~> 10.1"
|
30
30
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stackprof-webnav
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrei Lisnic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nyny
|
@@ -53,19 +53,19 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0.2'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name: sprockets
|
56
|
+
name: sprockets
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 2.12.2
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 2.12.2
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: bundler
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -104,7 +104,9 @@ extra_rdoc_files: []
|
|
104
104
|
files:
|
105
105
|
- ".gitignore"
|
106
106
|
- Gemfile
|
107
|
+
- Gemfile.lock
|
107
108
|
- LICENSE.txt
|
109
|
+
- Procfile
|
108
110
|
- README.md
|
109
111
|
- Rakefile
|
110
112
|
- bin/stackprof-webnav
|