ruined 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,3 +1,11 @@
1
+ Tue Oct 12 00:17:00 2010 arton
2
+ * BSDL
3
+ * readme.txt
4
+ license changed to dual (BSDL or (GPLv3 or later))
5
+ * ruined/html/main.html
6
+ support variable modification
7
+ * ruined/ruinmain.rb
8
+ support variable modification
1
9
  Mon Oct 11 21:25:00 2010 arton
2
10
  * lib/ruined/ruinmain.rb
3
11
  fix local vairable confliction with 'v'
@@ -2,7 +2,7 @@
2
2
  <html> <head>
3
3
  <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
4
4
  <meta http-equiv="content-style-type" content="text/css"/>
5
- <title>Ruby visutal debugger</title>
5
+ <title>Ruby visual debugger</title>
6
6
  </head>
7
7
  <frameset border="0" frameborder="0" framespacing="0" rows="50,*">
8
8
  <frame id="header" noresize scrolling="no" src="header.html" marginheight="0">
@@ -96,6 +96,11 @@ function stepProc(command) {
96
96
  stopRun();
97
97
  if (data['event'] == 'exit') {
98
98
  $('button').button('disable');
99
+ $('#vars').tabs({
100
+ show: function(envet, ui) {
101
+ alert('program terminated');
102
+ }
103
+ });
99
104
  alert('program exit');
100
105
  }
101
106
  }
@@ -129,6 +134,29 @@ $(document).ready(function() {
129
134
  $('#vars').tabs({
130
135
  show: function(envet, ui) {
131
136
  $('#vars').tabs('load', $('#vars').tabs('option', 'selected'));
137
+ },
138
+ load: function(event, ui) {
139
+ $('.var-value').dblclick(function(e) {
140
+ var v = e.currentTarget.innerHTML;
141
+ e.currentTarget.innerHTML = '<input type="text" value="' + v + '"/>';
142
+ setTimeout(function() {
143
+ e.currentTarget.childNodes.item(0).focus();
144
+ $(e.currentTarget.childNodes.item(0)).focusout(function(ev) {
145
+ var loc = 'locals/';
146
+ if ($('#vars').tabs('option', 'selected') == 1) {
147
+ loc = 'self/';
148
+ } else if ($('#vars').tabs('option', 'selected') == 2) {
149
+ loc = 'globals/';
150
+ }
151
+ var url = '/debug/' + loc + e.currentTarget.previousSibling.innerHTML
152
+ + '/' + ev.currentTarget.value;
153
+ e.currentTarget.innerHTML = ev.currentTarget.value;
154
+ $.get(url, function() {
155
+ $('#vars').tabs('load', $('#vars').tabs('option', 'selected'));
156
+ });
157
+ });
158
+ }, 0);
159
+ });
132
160
  }
133
161
  });
134
162
  $('#intval').slider();
@@ -156,11 +184,6 @@ $(document).ready(function() {
156
184
  if (contTimer != null) {
157
185
  stopRun();
158
186
  }
159
- $('#vars').tabs({
160
- show: function(envet, ui) {
161
- alert('program terminated');
162
- }
163
- });
164
187
  });
165
188
  stepProc('stepping');
166
189
  });
@@ -202,6 +225,6 @@ $(document).ready(function() {
202
225
  <hr>
203
226
  <div id="waiting"></div>
204
227
  <address id="ruby-platform"></address>
205
- <!-- hhmts start --> Last modified: Mon Oct 11 17:22:50 +0900 2010 <!-- hhmts end -->
228
+ <!-- hhmts start --> Last modified: Wed Oct 13 00:12:03 +0900 2010 <!-- hhmts end -->
206
229
  </div>
207
230
  </body> </html>
@@ -1,4 +1,4 @@
1
- #!/usr/local/bin/ruby -Ku
1
+ #!/usr/local/bin/ruby
2
2
  # coding: utf-8
3
3
 
4
4
  require 'webrick'
@@ -8,7 +8,7 @@ require 'monitor'
8
8
  require 'stringio'
9
9
 
10
10
  module Ruined
11
- RUINED_VERSION = '0.0.3'
11
+ RUINED_VERSION = '0.0.4'
12
12
 
13
13
  @queue = [Queue.new, Queue.new]
14
14
  @breakpoints = []
@@ -87,27 +87,33 @@ module Ruined
87
87
  end
88
88
 
89
89
  def locals(*a)
90
- s = '<table class="vars"><tr><th>Name</th><th>Value</th></tr>'
91
- Ruined.local_vars.each do |e|
92
- s << "<tr><td>#{escape(e[:name])}</td><td>#{escape(e[:value].inspect)}</td></tr>"
90
+ if a.size == 0
91
+ create_varlist Ruined.local_vars
92
+ elsif a.size != 2
93
+ bye(response)
94
+ else
95
+ Ruined.set(a[0], a[1]).to_s
93
96
  end
94
- s + '</table>'
95
97
  end
96
98
 
97
99
  def globals(*a)
98
- s = '<table class="vars"><tr><th>Name</th><th>Value</th></tr>'
99
- Ruined.global_vars.each do |e|
100
- s << "<tr><td>#{e[:name]}</td><td>#{escape(e[:value].inspect)}</td></tr>"
100
+ if a.size == 0
101
+ create_varlist Ruined.global_vars
102
+ elsif a.size != 2
103
+ bye(response)
104
+ else
105
+ Ruined.set(a[0], a[1]).to_s
101
106
  end
102
- s + '</table>'
103
107
  end
104
108
 
105
109
  def self(*a)
106
- s = '<table class="vars"><tr><th>Name</th><th>Value</th></tr>'
107
- Ruined.self_vars.each do |e|
108
- s << "<tr><td>#{e[:name]}</td><td>#{escape(e[:value].inspect)}</td></tr>"
110
+ if a.size == 0
111
+ create_varlist Ruined.self_vars
112
+ elsif a.size != 2
113
+ bye(response)
114
+ else
115
+ Ruined.set(a[0], a[1]).to_s
109
116
  end
110
- s + '</table>'
111
117
  end
112
118
 
113
119
  def start(*a)
@@ -116,6 +122,14 @@ module Ruined
116
122
 
117
123
  private
118
124
 
125
+ def create_varlist(t)
126
+ s = '<table class="vars"><tr><th>Name</th><th>Value</th></tr>'
127
+ t.each do |e|
128
+ s << "<tr><td>#{e[:name]}</td><td class=\"var-value\">#{escape(e[:value].inspect)}</td></tr>"
129
+ end
130
+ s + '</table>'
131
+ end
132
+
119
133
  def bye(res)
120
134
  res.status = 404
121
135
  res.body = '<html>bye</html>'
@@ -171,6 +185,10 @@ EOD
171
185
  a
172
186
  end
173
187
 
188
+ def self.set(var, val)
189
+ eval("#{var} = #{val}", @current_binding)
190
+ end
191
+
174
192
  def self.tls_vars
175
193
  @@tlses
176
194
  end
data/readme.txt CHANGED
@@ -13,6 +13,11 @@ features:
13
13
  - global variables viewer
14
14
  - self's instance variables viewer
15
15
  - stdout viewer
16
+ - change variable's value
17
+
18
+ todo:
19
+ - more inspection
20
+ - editing source and save
16
21
 
17
22
  usage:
18
23
 
@@ -21,7 +26,7 @@ cf)
21
26
  ruby -ruined target.rb [ target's options ...]
22
27
 
23
28
  licence:
24
- GPL3
29
+ Simplified BSDL or (GPL3 or any later version)
25
30
 
26
31
  others:
27
32
  jQuery (bundled)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruined
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - arton
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-11 00:00:00 +09:00
18
+ date: 2010-10-13 00:00:00 +09:00
19
19
  default_executable:
20
20
  dependencies: []
21
21