gui_debugger 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{LICENSE.txt → MIT-LICENSE} +1 -3
- data/{README.md → README.rdoc} +2 -4
- data/Rakefile +32 -1
- data/lib/gui_debugger/debug_context.rb +4 -6
- data/lib/gui_debugger/debug_page.rb +2 -6
- data/lib/gui_debugger/gui_debug.rb +0 -7
- data/lib/gui_debugger/middleware.rb +3 -5
- data/lib/gui_debugger/railtie.rb +0 -2
- data/lib/gui_debugger/templates/main.html.erb +48 -68
- data/lib/gui_debugger/version.rb +1 -1
- data/lib/gui_debugger.rb +6 -7
- data/lib/tasks/gui_debugger_tasks.rake +4 -0
- metadata +50 -14
- data/.gitignore +0 -18
- data/Gemfile +0 -4
- data/gui_debugger.gemspec +0 -29
- data/spec/gui_debugger_spec.rb +0 -7
- data/spec/spec_helper.rb +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2407125f0b0ff8af9b236cde524115bbd3ec4740
|
4
|
+
data.tar.gz: 93186cb28be27860da5b4cfc727d351966d6976f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05e9b9197ea56259a1bc21fcaf709d884ca9d956ef39ecf300a6a8e4286e7b15b4efba95d36d5389c73ab833fe543c0381f4c3333fe345d013b4d4b9764dda67
|
7
|
+
data.tar.gz: 45a5949e68382e861ae9630e9302d39ae65cd1a634719f995daf9b82b3de5291f6a1a46e67bf1ea67cd2b2ab584cf021232d3d2e73dcbe36fe8f017b4f643932
|
data/{LICENSE.txt → MIT-LICENSE}
RENAMED
data/{README.md → README.rdoc}
RENAMED
data/Rakefile
CHANGED
@@ -1 +1,32 @@
|
|
1
|
-
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'GuiDebugger'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
Bundler::GemHelper.install_tasks
|
21
|
+
|
22
|
+
require 'rake/testtask'
|
23
|
+
|
24
|
+
Rake::TestTask.new(:test) do |t|
|
25
|
+
t.libs << 'lib'
|
26
|
+
t.libs << 'test'
|
27
|
+
t.pattern = 'test/**/*_test.rb'
|
28
|
+
t.verbose = false
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
task default: :test
|
@@ -1,5 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
1
|
module GuiDebugger
|
4
2
|
class DebugContext
|
5
3
|
|
@@ -40,8 +38,9 @@ module GuiDebugger
|
|
40
38
|
GuiDebugger.escape str
|
41
39
|
end
|
42
40
|
|
43
|
-
def
|
44
|
-
@callers.map { |stack| {
|
41
|
+
def stack_frames
|
42
|
+
frames = @callers.map.with_index { |stack, index| { path: short_path(stack), index: index } }
|
43
|
+
frames.reject { |frame| frame[:index] == 0 }
|
45
44
|
end
|
46
45
|
|
47
46
|
def full_path(stack)
|
@@ -65,8 +64,7 @@ module GuiDebugger
|
|
65
64
|
|
66
65
|
def send_code(index, code)
|
67
66
|
return "" if code.blank?
|
68
|
-
|
69
|
-
@callers[index.to_i].eval(code).to_s
|
67
|
+
@callers[index.to_i].eval(URI.unescape(code)).to_s
|
70
68
|
end
|
71
69
|
end
|
72
70
|
end
|
@@ -1,5 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
1
|
require 'erubis'
|
4
2
|
|
5
3
|
module GuiDebugger
|
@@ -8,11 +6,9 @@ module GuiDebugger
|
|
8
6
|
File.expand_path("../templates/#{template_name}.html.erb", __FILE__)
|
9
7
|
end
|
10
8
|
|
11
|
-
def self.
|
9
|
+
def self.show
|
12
10
|
text = File.read(template("main"))
|
13
|
-
|
14
|
-
|
15
|
-
[200, { "Content-Type" => "text/html; charset=utf-8" }, [html]]
|
11
|
+
Erubis::Eruby.new(text).evaluate(context: GuiDebugger.debug_context)
|
16
12
|
end
|
17
13
|
end
|
18
14
|
end
|
@@ -1,12 +1,5 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'active_support'
|
4
|
-
require "gui_debugger/debug_context.rb"
|
5
|
-
|
6
1
|
module GuiDebugger
|
7
2
|
module GuiDebug
|
8
|
-
extend ActiveSupport::Concern
|
9
|
-
|
10
3
|
def debug
|
11
4
|
GuiDebugger.debug_context = DebugContext.new(binding, binding.callers)
|
12
5
|
throw :gui_debugger
|
@@ -1,5 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
1
|
module GuiDebugger
|
4
2
|
class Middleware
|
5
3
|
|
@@ -9,14 +7,14 @@ module GuiDebugger
|
|
9
7
|
|
10
8
|
def call(env)
|
11
9
|
if %r{\A/__gui_debugger/(?<method>\w+)(/(?<index>\d+))?(/(?<val>.+))?} =~ env["PATH_INFO"]
|
12
|
-
|
13
|
-
[200, { "Content-Type" => "text/plain; charset=utf-8" }, [JSON.dump({
|
10
|
+
result = GuiDebugger.debug_context.send(method, *[index, val].compact)
|
11
|
+
[200, { "Content-Type" => "text/plain; charset=utf-8" }, [JSON.dump({ result: result })]]
|
14
12
|
else
|
15
13
|
catch(:gui_debugger) do
|
16
14
|
return @app.call(env)
|
17
15
|
end
|
18
16
|
|
19
|
-
DebugPage
|
17
|
+
[200, { "Content-Type" => "text/html; charset=utf-8" }, [DebugPage.show]]
|
20
18
|
end
|
21
19
|
end
|
22
20
|
end
|
data/lib/gui_debugger/railtie.rb
CHANGED
@@ -4,39 +4,30 @@
|
|
4
4
|
<title>DebugPage</title>
|
5
5
|
<meta charset="utf-8">
|
6
6
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
7
|
-
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.
|
8
|
-
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.
|
7
|
+
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
|
8
|
+
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap-theme.min.css">
|
9
9
|
<style>
|
10
|
-
|
11
|
-
padding: 80px
|
10
|
+
article {
|
11
|
+
padding-top: 80px;
|
12
12
|
}
|
13
|
-
|
14
|
-
display: none;
|
15
|
-
}
|
16
|
-
.stack_frame {
|
17
|
-
height: 250px;
|
18
|
-
overflow: auto;
|
19
|
-
}
|
20
|
-
.eval {
|
21
|
-
max-width: 850px;
|
13
|
+
section {
|
22
14
|
margin-bottom: 20px;
|
23
15
|
}
|
24
16
|
.source {
|
25
|
-
height: 350px;
|
26
17
|
overflow: auto;
|
27
18
|
margin-bottom: 10px;
|
28
19
|
}
|
20
|
+
.result {
|
21
|
+
margin-top: 15px;
|
22
|
+
}
|
29
23
|
.variables {
|
30
|
-
height: 400px;
|
31
24
|
overflow: auto;
|
32
25
|
line-height: 10px;
|
33
26
|
}
|
34
27
|
.variables ul li {
|
35
28
|
list-style: none;
|
36
|
-
|
37
|
-
|
38
|
-
height: 250px;
|
39
|
-
overflow: auto;
|
29
|
+
margin-left: -140px;
|
30
|
+
margin-top: -5px;
|
40
31
|
}
|
41
32
|
</style>
|
42
33
|
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.8/angular.min.js"></script>
|
@@ -44,51 +35,40 @@
|
|
44
35
|
</head>
|
45
36
|
<body ng-controller="DebugCtrl">
|
46
37
|
|
47
|
-
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
|
48
|
-
<div class="container">
|
49
|
-
<div class="navbar-header">
|
50
|
-
<a class="navbar-brand" href="#">Debug page</a>
|
51
|
-
</div>
|
52
|
-
</div>
|
53
|
-
</div>
|
54
|
-
|
55
38
|
<div class="container">
|
56
|
-
<
|
57
|
-
|
58
|
-
|
59
|
-
|
39
|
+
<header class="navbar navbar-inverse navbar-fixed-top" role="navigation">
|
40
|
+
<div class="navbar-header">
|
41
|
+
<a class="navbar-brand" href="#">Debug page</a>
|
42
|
+
</div>
|
43
|
+
</header>
|
44
|
+
|
45
|
+
<article class="contents">
|
46
|
+
<section class="row">
|
47
|
+
<div class="col-md-8">
|
48
|
+
<select class="form-control" ng-model="stack_frame_index" ng-change="disp_stack_frame()" ng-options="frame['index'] as frame['path'] for frame in stack_frames"></select>
|
49
|
+
</div>
|
50
|
+
</section>
|
51
|
+
|
52
|
+
<section class="row">
|
53
|
+
<div class="col-md-9">
|
54
|
+
<div class="source" ng-bind-html="source" ng-init="disp_stack_frame()"></div>
|
60
55
|
<form ng-submit="send_code()">
|
61
56
|
<input type="text" ng-model="code" size="80" placeholder="enter code here...">
|
62
57
|
<input class="btn-primary" type="submit" value="send">
|
63
58
|
</form>
|
59
|
+
<div class="result">
|
60
|
+
<pre ng-bind-html="disp" style="white-space: pre;"></pre>
|
61
|
+
</div>
|
64
62
|
</div>
|
65
|
-
<pre class="variables
|
63
|
+
<pre class="variables">
|
66
64
|
<ul>
|
67
|
-
<li
|
65
|
+
<li ng-repeat="val in vals">
|
68
66
|
<a href="" ng-click="instance_variable_get(val)" ng-bind="val"></a>
|
69
67
|
</li>
|
70
68
|
</ul>
|
71
69
|
</pre>
|
72
|
-
</
|
73
|
-
|
74
|
-
<div class="clearfix"></div>
|
75
|
-
|
76
|
-
<div class="row">
|
77
|
-
<div class="col-md-7 result">
|
78
|
-
<pre ng-bind-html="disp" style="white-space: pre;"></pre>
|
79
|
-
</div>
|
80
|
-
|
81
|
-
<div class="list-group col-md-offset-7 stack_frame">
|
82
|
-
<% @context.stack_frame.each_with_index do |stack, index| %>
|
83
|
-
<% next if index == 0 %>
|
84
|
-
<a href="" class="list-group-item" ng-class='{"active":selected_index == <%= index %>}' ng-click="disp_stack_frame('<%= index %>')">
|
85
|
-
<%= stack[:short_path] %>
|
86
|
-
</a>
|
87
|
-
<% end %>
|
88
|
-
</div>
|
89
|
-
</div>
|
90
|
-
|
91
|
-
</div><!-- /.contents -->
|
70
|
+
</section>
|
71
|
+
</article><!-- /.contents -->
|
92
72
|
</div><!-- /.container -->
|
93
73
|
|
94
74
|
<script>
|
@@ -120,37 +100,37 @@
|
|
120
100
|
|
121
101
|
debugApp.controller('DebugCtrl', ['$scope', 'InstanceVal', 'InstanceValList', 'DispStackFrame', 'SendCode', '$sce',
|
122
102
|
function($scope, InstanceVal, InstanceValList, DispStackFrame, SendCode, $sce) {
|
103
|
+
$scope.stack_frames = <%= @context.stack_frames.to_json %>;
|
104
|
+
$scope.stack_frame_index = $scope.stack_frames[0].index;
|
105
|
+
|
123
106
|
$scope.instance_variable_get = function(val) {
|
124
|
-
InstanceVal.query({ index: $scope.
|
125
|
-
$scope.disp = $sce.trustAsHtml(
|
107
|
+
InstanceVal.query({ index: $scope.stack_frame_index, val: val }, function(response) {
|
108
|
+
$scope.disp = $sce.trustAsHtml(response.result);
|
126
109
|
});
|
127
110
|
};
|
128
111
|
|
129
|
-
$scope.disp_stack_frame = function(
|
130
|
-
DispStackFrame.query({ index:
|
131
|
-
$scope.source = $sce.trustAsHtml(
|
112
|
+
$scope.disp_stack_frame = function() {
|
113
|
+
DispStackFrame.query({ index: $scope.stack_frame_index }, function(response) {
|
114
|
+
$scope.source = $sce.trustAsHtml(response.result);
|
132
115
|
});
|
133
|
-
$scope.
|
134
|
-
$scope.instance_variables(index)
|
116
|
+
$scope.instance_variables()
|
135
117
|
};
|
136
118
|
|
137
|
-
$scope.instance_variables = function(
|
138
|
-
InstanceValList.query({ index:
|
139
|
-
$scope.vals =
|
119
|
+
$scope.instance_variables = function() {
|
120
|
+
InstanceValList.query({ index: $scope.stack_frame_index }, function(response) {
|
121
|
+
$scope.vals = response.result;
|
140
122
|
});
|
141
123
|
};
|
142
124
|
|
143
125
|
$scope.send_code = function() {
|
144
|
-
SendCode.query({ index: $scope.
|
145
|
-
$scope.disp = $sce.trustAsHtml(
|
126
|
+
SendCode.query({ index: $scope.stack_frame_index, code: $scope.code }, function(response) {
|
127
|
+
$scope.disp = $sce.trustAsHtml(response.result);
|
146
128
|
});
|
147
129
|
};
|
148
|
-
|
149
|
-
$scope.selected_index = 1;
|
150
130
|
}]);
|
151
131
|
</script>
|
152
132
|
|
153
133
|
<script src="https://code.jquery.com/jquery.js"></script>
|
154
|
-
<script src="//netdna.bootstrapcdn.com/bootstrap/3.
|
134
|
+
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
|
155
135
|
</body>
|
156
136
|
</html>
|
data/lib/gui_debugger/version.rb
CHANGED
data/lib/gui_debugger.rb
CHANGED
@@ -1,13 +1,12 @@
|
|
1
|
-
require "gui_debugger/version"
|
2
|
-
require "gui_debugger/gui_debug"
|
3
|
-
require "gui_debugger/debug_page"
|
4
|
-
require "gui_debugger/middleware"
|
5
|
-
|
6
1
|
module GuiDebugger
|
7
2
|
|
3
|
+
autoload :GuiDebug, 'gui_debugger/gui_debug'
|
4
|
+
autoload :DebugPage, 'gui_debugger/debug_page'
|
5
|
+
autoload :Middleware, 'gui_debugger/middleware'
|
6
|
+
autoload :DebugContext, 'gui_debugger/debug_context.rb'
|
7
|
+
|
8
8
|
class << self
|
9
|
-
# retain
|
10
|
-
# method is called.
|
9
|
+
# retain a context for debug
|
11
10
|
attr_accessor :debug_context
|
12
11
|
end
|
13
12
|
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gui_debugger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- NorimasaAndo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 4.1.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 4.1.1
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: bundler
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,6 +122,34 @@ dependencies:
|
|
108
122
|
- - ">="
|
109
123
|
- !ruby/object:Gem::Version
|
110
124
|
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: coderay
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 1.0.0
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 1.0.0
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: sqlite3
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
111
153
|
description: ''
|
112
154
|
email:
|
113
155
|
- norimasa.ando@gmail.com
|
@@ -115,12 +157,9 @@ executables: []
|
|
115
157
|
extensions: []
|
116
158
|
extra_rdoc_files: []
|
117
159
|
files:
|
118
|
-
-
|
119
|
-
-
|
120
|
-
- LICENSE.txt
|
121
|
-
- README.md
|
160
|
+
- MIT-LICENSE
|
161
|
+
- README.rdoc
|
122
162
|
- Rakefile
|
123
|
-
- gui_debugger.gemspec
|
124
163
|
- lib/gui_debugger.rb
|
125
164
|
- lib/gui_debugger/debug_context.rb
|
126
165
|
- lib/gui_debugger/debug_page.rb
|
@@ -129,9 +168,8 @@ files:
|
|
129
168
|
- lib/gui_debugger/railtie.rb
|
130
169
|
- lib/gui_debugger/templates/main.html.erb
|
131
170
|
- lib/gui_debugger/version.rb
|
132
|
-
-
|
133
|
-
|
134
|
-
homepage: https://github.com/yurup/gui_debugger
|
171
|
+
- lib/tasks/gui_debugger_tasks.rake
|
172
|
+
homepage: https://github.com/worldtravel1013/gui_debugger
|
135
173
|
licenses:
|
136
174
|
- MIT
|
137
175
|
metadata: {}
|
@@ -151,10 +189,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
151
189
|
version: '0'
|
152
190
|
requirements: []
|
153
191
|
rubyforge_project:
|
154
|
-
rubygems_version: 2.2.
|
192
|
+
rubygems_version: 2.2.2
|
155
193
|
signing_key:
|
156
194
|
specification_version: 4
|
157
195
|
summary: ''
|
158
|
-
test_files:
|
159
|
-
- spec/gui_debugger_spec.rb
|
160
|
-
- spec/spec_helper.rb
|
196
|
+
test_files: []
|
data/.gitignore
DELETED
data/Gemfile
DELETED
data/gui_debugger.gemspec
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
lib = File.expand_path('../lib', __FILE__)
|
4
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
-
require 'gui_debugger/version'
|
6
|
-
|
7
|
-
Gem::Specification.new do |s|
|
8
|
-
s.name = "gui_debugger"
|
9
|
-
s.version = GuiDebugger::VERSION
|
10
|
-
s.authors = ["NorimasaAndo"]
|
11
|
-
s.email = ["norimasa.ando@gmail.com"]
|
12
|
-
s.description = ""
|
13
|
-
s.summary = ""
|
14
|
-
s.homepage = "https://github.com/yurup/gui_debugger"
|
15
|
-
s.license = "MIT"
|
16
|
-
|
17
|
-
s.files = `git ls-files`.split($/)
|
18
|
-
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
-
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
20
|
-
s.require_paths = ["lib"]
|
21
|
-
|
22
|
-
s.add_development_dependency "bundler", "~> 1.3"
|
23
|
-
s.add_development_dependency "rake"
|
24
|
-
s.add_development_dependency "rspec", "~> 2.9"
|
25
|
-
s.add_development_dependency "pry"
|
26
|
-
s.add_development_dependency "actionpack", "~> 4.0"
|
27
|
-
s.add_development_dependency "binding_of_caller"
|
28
|
-
s.add_development_dependency "erubis"
|
29
|
-
end
|
data/spec/gui_debugger_spec.rb
DELETED
data/spec/spec_helper.rb
DELETED