rack-webprofiler 0.1.0.pre.alpha1 → 0.1.0.pre.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/README.md +2 -0
- data/lib/rack/templates/assets/css/profiler.css +1 -0
- data/lib/rack/templates/assets/css/rwpt.css +1 -0
- data/lib/rack/templates/assets/sass/_fonts.scss +60 -0
- data/lib/rack/templates/assets/sass/_normalize.scss +4 -0
- data/lib/rack/templates/assets/sass/_variables.scss +11 -0
- data/lib/rack/templates/assets/sass/profiler.scss +186 -0
- data/lib/rack/templates/assets/sass/rwpt.scss +266 -0
- data/lib/rack/templates/panel/_sidebar.erb +36 -0
- data/lib/rack/templates/panel/index.erb +26 -28
- data/lib/rack/templates/panel/layout.erb +23 -7
- data/lib/rack/templates/panel/show.erb +6 -17
- data/lib/rack/templates/profiler.erb +12 -58
- data/lib/rack/web_profiler/auto_configure/rails.rb +1 -1
- data/lib/rack/web_profiler/collector/rack/request_collector.rb +221 -5
- data/lib/rack/web_profiler/collector/ruby_collector.rb +39 -3
- data/lib/rack/web_profiler/collector/sinatra/request_collector.rb +186 -8
- data/lib/rack/web_profiler/collector/sinatra/sinatra_collector.rb +2 -2
- data/lib/rack/web_profiler/collector/time_collector.rb +5 -3
- data/lib/rack/web_profiler/collector.rb +5 -4
- data/lib/rack/web_profiler/collectors.rb +10 -2
- data/lib/rack/web_profiler/controller.rb +25 -4
- data/lib/rack/web_profiler/router.rb +40 -5
- data/lib/rack/web_profiler/version.rb +1 -1
- data/rack-webprofiler.gemspec +7 -2
- metadata +30 -38
- data/.editorconfig +0 -27
- data/.gitignore +0 -11
- data/.rspec +0 -2
- data/.rubocop.yml +0 -34
- data/.travis.yml +0 -23
- data/Gemfile +0 -15
- data/Rakefile +0 -17
- data/bin/ci-prepare +0 -16
- data/bin/console +0 -10
- data/bin/setup +0 -8
- data/examples/README.md +0 -56
- data/examples/rack/config.ru +0 -52
- data/examples/sinatra/app.rb +0 -37
- data/examples/sinatra/config.ru +0 -3
- data/lib/rack/templates/assets/rwpt.css +0 -9
- /data/lib/rack/templates/assets/{rwpt.js → js/rwpt.js} +0 -0
- /data/{.rubocop_todo.yml → lib/rack/templates/assets/js/rwpt.min.js} +0 -0
data/.gitignore
DELETED
data/.rspec
DELETED
data/.rubocop.yml
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
# This is the configuration used to check the rubocop source code.
|
2
|
-
|
3
|
-
inherit_from: .rubocop_todo.yml
|
4
|
-
|
5
|
-
AllCops:
|
6
|
-
TargetRubyVersion: 1.9
|
7
|
-
Exclude:
|
8
|
-
- 'examples/**/*'
|
9
|
-
# - 'tmp/**/*'
|
10
|
-
|
11
|
-
Style/StringLiterals:
|
12
|
-
EnforcedStyle: double_quotes
|
13
|
-
|
14
|
-
Style/StringLiteralsInInterpolation:
|
15
|
-
EnforcedStyle: double_quotes
|
16
|
-
|
17
|
-
Style/IfUnlessModifier:
|
18
|
-
MaxLineLength: 120
|
19
|
-
|
20
|
-
Style/WhileUntilModifier:
|
21
|
-
MaxLineLength: 120
|
22
|
-
|
23
|
-
Metrics/LineLength:
|
24
|
-
Max: 120
|
25
|
-
|
26
|
-
Style/TrailingCommaInLiteral:
|
27
|
-
EnforcedStyleForMultiline: comma
|
28
|
-
|
29
|
-
Style/AlignHash:
|
30
|
-
EnforcedHashRocketStyle: table
|
31
|
-
EnforcedColonStyle: table
|
32
|
-
|
33
|
-
# Style/IndentArray:
|
34
|
-
# EnforcedStyle: align_brackets
|
data/.travis.yml
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
sudo: false
|
2
|
-
language: ruby
|
3
|
-
rvm:
|
4
|
-
- 2.3.1
|
5
|
-
|
6
|
-
install:
|
7
|
-
- bin/ci-prepare
|
8
|
-
|
9
|
-
script:
|
10
|
-
- time bundle exec rake spec
|
11
|
-
- bundle exec bundle-audit update
|
12
|
-
- bundle exec bundle-audit check
|
13
|
-
|
14
|
-
notifications:
|
15
|
-
email:
|
16
|
-
on_success: change
|
17
|
-
on_failure: always
|
18
|
-
webhooks:
|
19
|
-
urls:
|
20
|
-
- secure: X0uF0lUgFuKAPxNWL26+RsP8SYcuxLdRwopuMpkxc0qdP972IrgVLpKnbi02zsnt7IK0LCSiknj3uV6X1aqiRPAeZwOLEScEttuA50qnth3spVFc0UmYRvs9H6OdE2ylc3iBlavptP4TJytJQiPAyfzl8DeLvkTZesPEf5Jkiw+WmGWk+al4zt8Ejq9+vHsYbBk4ty/GzVP5FgruEpmtQG3TibVo5aKRmgvJc6c+HZHkefXBGZwhmhoQpvH3rRUXp/c7c/3K1QJTI0LzO+AAjl5Jh3qP5U5JhblmCaVqFKp0eD7jhym/lTyWSodPDdZ+JoDV8S7EJhoWjMtlW5c1Q9hooax/mjCwmApGXhrMaPPqmlU6l0Io1TYV8f4MLus0WXDf2O62AFe4uD4NvrFAS1tEPx6fEJd8X9chE96h03S+SxM3Ol3d++n6latb3H9dWTN0QM0miOmwdUUKSK6iOMuiFOp1cZoM+AbvyQvMhqAHvZ3SVeL3FCRpqFt7UpFTmVaBmtxSWlByU4raD1yK6LLfJxcPoOWZg2XoqZ5OAu1GWtdE5Xgr9jnnDojMMOlpcCpIydBbhdTe6e/qsg+iVA4HBwxuiKIYbL4mXBXoTcdgwpD/mufaM9NLmJsc9WqO3n+rIkxB+msYgR6lw5Brw0ofCBm7Yw2AL+cZqXs8DzY=
|
21
|
-
on_success: always
|
22
|
-
on_failure: always
|
23
|
-
on_start: never
|
data/Gemfile
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
source "https://rubygems.org"
|
2
|
-
|
3
|
-
# Specify your gem's dependencies in rack-webprofiler.gemspec
|
4
|
-
gemspec
|
5
|
-
|
6
|
-
gem "sinatra"
|
7
|
-
gem "simplecov", require: false
|
8
|
-
gem "rubocop", "~> 0.38.0", require: false
|
9
|
-
gem "bundler-audit"
|
10
|
-
gem "flog"
|
11
|
-
gem "flay"
|
12
|
-
gem "ruby2ruby"
|
13
|
-
gem "yard"
|
14
|
-
gem "shotgun"
|
15
|
-
gem "pry"
|
data/Rakefile
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
2
|
-
require "rubocop/rake_task"
|
3
|
-
require "rspec/core/rake_task"
|
4
|
-
require "yard"
|
5
|
-
|
6
|
-
RSpec::Core::RakeTask.new(:spec)
|
7
|
-
|
8
|
-
YARD::Rake::YardocTask.new do |t|
|
9
|
-
t.files = ["lib/**/*.rb"]
|
10
|
-
t.stats_options = ["--list-undoc"]
|
11
|
-
end
|
12
|
-
|
13
|
-
RuboCop::RakeTask.new do
|
14
|
-
# task.requires << "rubocop-rspec"
|
15
|
-
end
|
16
|
-
|
17
|
-
task default: :spec
|
data/bin/ci-prepare
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
#!/usr/bin/env bash
|
2
|
-
|
3
|
-
gem install bundler --no-ri --no-rdoc
|
4
|
-
|
5
|
-
echo ''
|
6
|
-
echo '------------------------------------------------------------------------------------------'
|
7
|
-
echo "Shell: $SHELL"
|
8
|
-
echo "PATH: $PATH"
|
9
|
-
echo "Ruby path: $(which ruby)"
|
10
|
-
echo "Ruby version: $(ruby -v)"
|
11
|
-
echo "Bundler path: $(which bundle)"
|
12
|
-
echo "Bundler version: $(bundle -v)"
|
13
|
-
echo '------------------------------------------------------------------------------------------'
|
14
|
-
echo ''
|
15
|
-
|
16
|
-
bundle install --retry=3 --jobs $(($(nproc) + 1)) "${FLAGS[@]}"
|
data/bin/console
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "rack/webprofiler"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
require "pry"
|
10
|
-
Pry.start
|
data/bin/setup
DELETED
data/examples/README.md
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
# Examples
|
2
|
-
|
3
|
-
```shell
|
4
|
-
$ rackup rack/config.ru
|
5
|
-
$ rackup sinatra/config.ru
|
6
|
-
```
|
7
|
-
|
8
|
-
|
9
|
-
# How to create a custom collector
|
10
|
-
|
11
|
-
## What is a collector
|
12
|
-
|
13
|
-
A collector is a class who permit retrieve profiler data. And also create a tab and show content into the toolbar.
|
14
|
-
|
15
|
-
## The class
|
16
|
-
|
17
|
-
```ruby
|
18
|
-
class MyCustomCollector
|
19
|
-
include Rack::WebProfiler::Collector::DSL
|
20
|
-
|
21
|
-
collector_name "my_collector" # Technical name of the collector.
|
22
|
-
icon "" # Base64 encoded image for the icon collector.
|
23
|
-
position 0 # Position of the collector in the toolbar.
|
24
|
-
|
25
|
-
# Retrieve the env, the request and the response
|
26
|
-
# to collect the needed information. Then save datas
|
27
|
-
# and show them in the profiler toolbar and panel.
|
28
|
-
collect do |env, request, response|
|
29
|
-
store :version, MyApp::VERSION
|
30
|
-
store :list, ["value1", "value2"]
|
31
|
-
end
|
32
|
-
|
33
|
-
# The path of the collector template.
|
34
|
-
# May be with some options to know if we show the collector
|
35
|
-
# on tab and/or panel.
|
36
|
-
template "../path/to/template.erb"
|
37
|
-
# Or
|
38
|
-
# template __FILE__, type: :DATA
|
39
|
-
|
40
|
-
# To know if the collector must be enabled.
|
41
|
-
# Usefull to load collector only if a gem is installed.
|
42
|
-
is_enabled? -> { defined? MyApp }
|
43
|
-
end
|
44
|
-
```
|
45
|
-
|
46
|
-
And you have to register it
|
47
|
-
|
48
|
-
```ruby
|
49
|
-
Rack::WebProfiler.register_collector MyCustomCollector
|
50
|
-
```
|
51
|
-
|
52
|
-
You could also unregister a collector
|
53
|
-
|
54
|
-
```ruby
|
55
|
-
Rack::WebProfiler.unregister_collector MyCustomCollector
|
56
|
-
```
|
data/examples/rack/config.ru
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
require "bundler/setup"
|
2
|
-
require "rack/webprofiler"
|
3
|
-
require "rack"
|
4
|
-
|
5
|
-
# An example of a custom collector.
|
6
|
-
#
|
7
|
-
# module MyCollector
|
8
|
-
# class Profiler::Collector::TimeCollector
|
9
|
-
# include Rack::WebProfiler::Collector::DSL
|
10
|
-
#
|
11
|
-
# icon ""
|
12
|
-
#
|
13
|
-
# collector_name "my_collector"
|
14
|
-
# position 2
|
15
|
-
#
|
16
|
-
# collect do |request, response|
|
17
|
-
# store :runtime, request.runtime
|
18
|
-
# end
|
19
|
-
#
|
20
|
-
# template "
|
21
|
-
# <% content_for :tab do %>
|
22
|
-
# <%= data[:runtime] %>
|
23
|
-
# <% end %>
|
24
|
-
# "
|
25
|
-
# end
|
26
|
-
# end
|
27
|
-
|
28
|
-
home = lambda { |_env|
|
29
|
-
[200, { "Content-Type" => "text/html" }, [<<-'HTML'
|
30
|
-
<!DOCTYPE html>
|
31
|
-
<html>
|
32
|
-
<head>
|
33
|
-
<meta charset="UTF-8">
|
34
|
-
<title>Rack WebProfiler test</title>
|
35
|
-
</head>
|
36
|
-
|
37
|
-
<body>
|
38
|
-
<p>Hello world!</p>
|
39
|
-
</body>
|
40
|
-
</html>
|
41
|
-
HTML
|
42
|
-
]]
|
43
|
-
}
|
44
|
-
|
45
|
-
builder = Rack::Builder.new do
|
46
|
-
use Rack::WebProfiler, tmp_dir: File.expand_path("../tmp", __FILE__)
|
47
|
-
use Rack::ShowExceptions
|
48
|
-
|
49
|
-
map('/') { run home }
|
50
|
-
end
|
51
|
-
|
52
|
-
run builder
|
data/examples/sinatra/app.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
require "bundler/setup"
|
2
|
-
require "rack/webprofiler"
|
3
|
-
require "rack"
|
4
|
-
require "sinatra"
|
5
|
-
|
6
|
-
class App < Sinatra::Base
|
7
|
-
use Rack::WebProfiler, tmp_dir: File.expand_path("../tmp", __FILE__)
|
8
|
-
|
9
|
-
get "/" do
|
10
|
-
erb "Hello World!", layout: TEMPLATE
|
11
|
-
end
|
12
|
-
|
13
|
-
get "/without_profiler" do
|
14
|
-
erb "Hello World!"
|
15
|
-
end
|
16
|
-
|
17
|
-
get "/500" do
|
18
|
-
"Hello World!" if hello == world
|
19
|
-
erb ""
|
20
|
-
end
|
21
|
-
|
22
|
-
TEMPLATE = <<-HTML
|
23
|
-
<html>
|
24
|
-
<head>
|
25
|
-
<title>Rack WebProfiler test — Sinatra</title>
|
26
|
-
</head>
|
27
|
-
<body>
|
28
|
-
<p>
|
29
|
-
<a href="./">text/html page</a>
|
30
|
-
- <a href="./without_profiler">text/plain page</a>
|
31
|
-
- <a href="./500">500 page</a>
|
32
|
-
</p>
|
33
|
-
<%= yield %>
|
34
|
-
</body>
|
35
|
-
</html>
|
36
|
-
HTML
|
37
|
-
end
|
data/examples/sinatra/config.ru
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */img,legend{border:0}legend,td,th{padding:0}html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,optgroup,strong{font-weight:700}dfn{font-style:italic}h1{font-size:2em;margin:.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{box-sizing:content-box;height:0}pre,textarea{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-appearance:textfield;box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}table{border-collapse:collapse;border-spacing:0}
|
2
|
-
|
3
|
-
#rack-webprofiler {
|
4
|
-
top: 0;
|
5
|
-
}
|
6
|
-
|
7
|
-
body {
|
8
|
-
margin-top: 50px;
|
9
|
-
}
|
File without changes
|
File without changes
|