redcar-dev 0.12.7dev-java → 0.12.8dev-java
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +2 -0
- data/README.md +2 -2
- data/Rakefile +1 -0
- data/lib/redcar.rb +1 -1
- data/lib/redcar_quick_start.rb +6 -1
- data/plugins/application/lib/application.rb +15 -4
- data/plugins/project/features/find_file.feature +4 -4
- data/plugins/project/lib/project.rb +11 -2
- data/plugins/project/lib/project/manager.rb +4 -2
- data/plugins/redcar/redcar.rb +53 -2
- data/plugins/spray/README +32 -0
- data/plugins/spray/foo.rb +5 -0
- data/plugins/spray/lib/annotations.rb +50 -0
- data/plugins/spray/lib/controllers/rdebug_controller.rb +38 -0
- data/plugins/spray/lib/controllers/rdebug_no_print.rb +9 -0
- data/plugins/spray/lib/spray.rb +58 -0
- data/plugins/spray/lib/spray_repl_mirror.rb +58 -0
- data/plugins/spray/lib/spray_tabs.rb +56 -0
- data/plugins/spray/plugin.rb +8 -0
- data/plugins/spray/test/hanoi.rb +13 -0
- data/plugins/web_bookmarks/lib/web_bookmarks/commands.rb +1 -1
- metadata +29 -8
data/CHANGES
CHANGED
@@ -11,6 +11,8 @@ Version 0.12 (TBA)
|
|
11
11
|
* Fixed irritating bugs in the indenter (Dan Lucraft)
|
12
12
|
* Pressing enter when between {} will expand the block (Dan Lucraft)
|
13
13
|
* Tweak to line numbers so highlighting isn't lost as doc passes 100 lines (Dan Lucraft)
|
14
|
+
* Added next line, previous line bindings to Ctrl+N and Ctrl+P (Dan Lucraft)
|
15
|
+
* Added open line, transpose characters commands (Dan Lucraft)
|
14
16
|
|
15
17
|
Version 0.11 (23 March 2011)
|
16
18
|
============================
|
data/README.md
CHANGED
@@ -104,7 +104,7 @@ On Linux/Windows:
|
|
104
104
|
|
105
105
|
To just run all specs:
|
106
106
|
|
107
|
-
$
|
107
|
+
$ rake specs
|
108
108
|
|
109
109
|
### Features
|
110
110
|
|
@@ -118,7 +118,7 @@ On Linux/Windows:
|
|
118
118
|
|
119
119
|
To just run all features:
|
120
120
|
|
121
|
-
$
|
121
|
+
$ rake cucumber
|
122
122
|
|
123
123
|
## LICENSE
|
124
124
|
|
data/Rakefile
CHANGED
@@ -134,6 +134,7 @@ end
|
|
134
134
|
desc "Run all specs and features"
|
135
135
|
task :default => ["specs", "cucumber"]
|
136
136
|
|
137
|
+
desc "Run all specs"
|
137
138
|
task :specs do
|
138
139
|
files = Dir['plugins/*/spec/*/*_spec.rb'] + Dir['plugins/*/spec/*/*/*_spec.rb'] + Dir['plugins/*/spec/*/*/*/*_spec.rb']
|
139
140
|
case Config::CONFIG["host_os"]
|
data/lib/redcar.rb
CHANGED
data/lib/redcar_quick_start.rb
CHANGED
@@ -51,8 +51,13 @@ module Redcar
|
|
51
51
|
if arg =~ /--untitled-file=(.*)/
|
52
52
|
path = $1 if File.file?($1)
|
53
53
|
untitled = true
|
54
|
-
elsif
|
54
|
+
elsif arg !~ /^--/ # not --something
|
55
55
|
path = File.expand_path(arg)
|
56
|
+
if !File.exist?(path)
|
57
|
+
require 'fileutils'
|
58
|
+
FileUtils.mkdir_p File.dirname(path)
|
59
|
+
FileUtils.touch path
|
60
|
+
end
|
56
61
|
end
|
57
62
|
next unless path
|
58
63
|
drb_answer = drb.open_item_drb(path, untitled, ARGV.include?("-w"))
|
@@ -138,7 +138,7 @@ module Redcar
|
|
138
138
|
end
|
139
139
|
|
140
140
|
# Create a new Application::Window, and the controller for it.
|
141
|
-
def new_window
|
141
|
+
def new_window(show=true)
|
142
142
|
s = Time.now
|
143
143
|
new_window = Window.new
|
144
144
|
windows << new_window
|
@@ -146,18 +146,29 @@ module Redcar
|
|
146
146
|
attach_window_listeners(new_window)
|
147
147
|
new_window.refresh_menu
|
148
148
|
new_window.refresh_toolbar
|
149
|
-
new_window
|
150
|
-
set_focussed_window(new_window)
|
151
|
-
#puts "App#new_window took #{Time.now - s}s"
|
149
|
+
show_window(new_window) if show
|
152
150
|
new_window
|
153
151
|
end
|
154
152
|
|
153
|
+
def show_window(window)
|
154
|
+
window.show
|
155
|
+
set_focussed_window(window)
|
156
|
+
end
|
157
|
+
|
155
158
|
def make_sure_at_least_one_window_open
|
156
159
|
if windows.length == 0
|
157
160
|
new_window
|
158
161
|
end
|
159
162
|
end
|
160
163
|
|
164
|
+
def make_sure_at_least_one_window_there
|
165
|
+
if windows.length == 0
|
166
|
+
win = new_window(false)
|
167
|
+
set_focussed_window(win)
|
168
|
+
win
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
161
172
|
# Removes a window from this Application. Should not be called by plugins,
|
162
173
|
# use Window#close instead.
|
163
174
|
def window_closed(window)
|
@@ -36,23 +36,23 @@ Feature: Find file
|
|
36
36
|
Then the filter dialog should have 1 entry
|
37
37
|
And I should see "foo_spec.rb (myproject/spec)" at 0 the filter dialog
|
38
38
|
|
39
|
-
Scenario: One matching file when specifying a directory
|
39
|
+
Scenario: One matching file when specifying a symlinked directory
|
40
40
|
When I open the find file dialog
|
41
41
|
And I set the filter to "lib_sym/foo"
|
42
42
|
And I wait "0.4" seconds
|
43
43
|
Then the filter dialog should have 1 entry
|
44
44
|
And I should see "foo_lib.rb (myproject/lib_symlink)" at 0 the filter dialog
|
45
45
|
|
46
|
-
Scenario: Two matching files
|
46
|
+
Scenario: Two matching files, plus one in symlink
|
47
47
|
When I open the find file dialog
|
48
48
|
And I set the filter to "foo"
|
49
|
-
And I wait "
|
49
|
+
And I wait "1.4" seconds
|
50
50
|
Then the filter dialog should have 3 entries
|
51
51
|
And I should see "foo_lib.rb (myproject/lib)" at 0 the filter dialog
|
52
52
|
And I should see "foo_lib.rb (myproject/lib_symlink)" at 1 the filter dialog
|
53
53
|
And I should see "foo_spec.rb (myproject/spec)" at 2 the filter dialog
|
54
54
|
|
55
|
-
Scenario: Two matching files - spaces ignored
|
55
|
+
Scenario: Two matching files, plus one in symlink - spaces ignored
|
56
56
|
When I open the find file dialog
|
57
57
|
And I set the filter to "foo rb"
|
58
58
|
And I wait "0.4" seconds
|
@@ -236,8 +236,17 @@ module Redcar
|
|
236
236
|
end
|
237
237
|
|
238
238
|
def config_dir
|
239
|
-
|
240
|
-
|
239
|
+
if Redcar.platform == :windows && Redcar.environment != :test
|
240
|
+
dir = File.join(path, "._redcar")
|
241
|
+
else
|
242
|
+
dir = File.join(path, ".redcar")
|
243
|
+
end
|
244
|
+
unless File.directory? dir
|
245
|
+
FileUtils.mkdir_p(dir)
|
246
|
+
if Redcar.platform == :windows
|
247
|
+
system("attrib.exe +H \"#{dir}") # make hidden for cmd directory listings
|
248
|
+
end
|
249
|
+
end
|
241
250
|
dir
|
242
251
|
end
|
243
252
|
|
@@ -264,8 +264,10 @@ module Redcar
|
|
264
264
|
end
|
265
265
|
if should_open == :yes
|
266
266
|
win = Redcar.app.focussed_window
|
267
|
-
win = Redcar.app.new_window if !win or Manager.in_window(win)
|
267
|
+
win = Redcar.app.new_window(false) if !win or Manager.in_window(win)
|
268
268
|
project.open(win) if project.ready?
|
269
|
+
Redcar.app.show_window(win)
|
270
|
+
project
|
269
271
|
end
|
270
272
|
end
|
271
273
|
|
@@ -418,7 +420,7 @@ module Redcar
|
|
418
420
|
end
|
419
421
|
|
420
422
|
def self.close_tab_guard(tab)
|
421
|
-
if tab.respond_to?(:edit_view) && tab.edit_view.document.modified?
|
423
|
+
if tab.respond_to?(:edit_view) && tab.edit_view.document.modified? && !tab.is_a?(REPL::Tab)
|
422
424
|
tab.focus
|
423
425
|
result = Application::Dialog.message_box(
|
424
426
|
"This tab has unsaved changes. \n\nSave before closing?",
|
data/plugins/redcar/redcar.rb
CHANGED
@@ -246,6 +246,18 @@ Redcar.environment: #{Redcar.environment}
|
|
246
246
|
end
|
247
247
|
end
|
248
248
|
|
249
|
+
class MoveUpCommand < EditTabCommand
|
250
|
+
def execute
|
251
|
+
tab.edit_view.invoke_action(:LINE_UP)
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
class MoveDownCommand < EditTabCommand
|
256
|
+
def execute
|
257
|
+
tab.edit_view.invoke_action(:LINE_DOWN)
|
258
|
+
end
|
259
|
+
end
|
260
|
+
|
249
261
|
class ForwardCharCommand < DocumentCommand
|
250
262
|
def execute
|
251
263
|
doc.cursor_offset = [doc.cursor_offset + 1, doc.length].min
|
@@ -258,6 +270,14 @@ Redcar.environment: #{Redcar.environment}
|
|
258
270
|
end
|
259
271
|
end
|
260
272
|
|
273
|
+
class OpenLineCommand < DocumentCommand
|
274
|
+
def execute
|
275
|
+
prev = doc.cursor_offset
|
276
|
+
doc.insert_at_cursor("\n")
|
277
|
+
doc.cursor_offset = prev
|
278
|
+
end
|
279
|
+
end
|
280
|
+
|
261
281
|
class DeleteCharCommand < DocumentCommand
|
262
282
|
def execute
|
263
283
|
if doc.cursor_offset < doc.length
|
@@ -465,6 +485,25 @@ Redcar.environment: #{Redcar.environment}
|
|
465
485
|
doc.scroll_to_line(last_line_ix + 1)
|
466
486
|
end
|
467
487
|
end
|
488
|
+
|
489
|
+
class TransposeCharactersCommand < Redcar::DocumentCommand
|
490
|
+
def execute
|
491
|
+
line = doc.get_line(doc.cursor_line)
|
492
|
+
line_offset = doc.cursor_line_offset
|
493
|
+
|
494
|
+
if line_offset > 0 and line.length >= 2
|
495
|
+
if line_offset < line.length - 1
|
496
|
+
first_char = line.chars[line_offset - 1].to_s
|
497
|
+
second_char = line.chars[line_offset].to_s
|
498
|
+
doc.replace(doc.cursor_offset - 1, 2, second_char + first_char)
|
499
|
+
elsif line_offset == line.length - 1
|
500
|
+
first_char = line.chars[line_offset - 2].to_s
|
501
|
+
second_char = line.chars[line_offset - 1].to_s
|
502
|
+
doc.replace(doc.cursor_offset - 2, 2, second_char + first_char)
|
503
|
+
end
|
504
|
+
end
|
505
|
+
end
|
506
|
+
end
|
468
507
|
|
469
508
|
class SortLinesCommand < Redcar::DocumentCommand
|
470
509
|
|
@@ -617,6 +656,7 @@ Redcar.environment: #{Redcar.environment}
|
|
617
656
|
link "Cmd+C", CopyCommand
|
618
657
|
link "Cmd+V", PasteCommand
|
619
658
|
link "Cmd+D", DuplicateCommand
|
659
|
+
link "Ctrl+T", TransposeCharactersCommand
|
620
660
|
|
621
661
|
link "Home", MoveTopCommand
|
622
662
|
link "Ctrl+A", MoveHomeCommand
|
@@ -624,6 +664,10 @@ Redcar.environment: #{Redcar.environment}
|
|
624
664
|
link "End", MoveBottomCommand
|
625
665
|
link "Ctrl+F", ForwardCharCommand
|
626
666
|
link "Ctrl+B", BackwardCharCommand
|
667
|
+
link "Ctrl+P", MoveUpCommand
|
668
|
+
link "Ctrl+N", MoveDownCommand
|
669
|
+
link "Ctrl+B", BackwardCharCommand
|
670
|
+
link "Ctrl+O", OpenLineCommand
|
627
671
|
link "Ctrl+D", DeleteCharCommand
|
628
672
|
link "Ctrl+H", BackspaceCommand
|
629
673
|
|
@@ -858,8 +902,15 @@ Redcar.environment: #{Redcar.environment}
|
|
858
902
|
|
859
903
|
item "Forward Character", ForwardCharCommand
|
860
904
|
item "Backward Character", BackwardCharCommand
|
905
|
+
item "Previous Line", MoveUpCommand
|
906
|
+
item "Next Line", MoveDownCommand
|
907
|
+
item "Open Line", OpenLineCommand
|
908
|
+
|
909
|
+
separator
|
910
|
+
|
861
911
|
item "Delete Character", DeleteCharCommand
|
862
912
|
item "Backspace", BackspaceCommand
|
913
|
+
item "Transpose", TransposeCharactersCommand
|
863
914
|
end
|
864
915
|
end
|
865
916
|
|
@@ -1000,11 +1051,11 @@ Redcar.environment: #{Redcar.environment}
|
|
1000
1051
|
end
|
1001
1052
|
Redcar.update_gui do
|
1002
1053
|
SplashScreen.splash_screen.close if SplashScreen.splash_screen
|
1003
|
-
win = Redcar.app.
|
1004
|
-
win.close if win and args.include?("--no-window")
|
1054
|
+
win = Redcar.app.make_sure_at_least_one_window_there
|
1005
1055
|
Redcar.log.info("startup milestone: window open #{Time.now - Redcar.process_start_time}")
|
1006
1056
|
Redcar::Project::Manager.start(args)
|
1007
1057
|
Redcar.log.info("startup milestone: project open #{Time.now - Redcar.process_start_time}")
|
1058
|
+
win.show if win and !args.include?("--no-window")
|
1008
1059
|
end
|
1009
1060
|
Redcar.load_useful_libraries
|
1010
1061
|
Redcar.log.info("startup milestone: complete: #{Time.now - Redcar.process_start_time}")
|
@@ -0,0 +1,32 @@
|
|
1
|
+
Basic, simple (beta) debugger plugin for redcar editor.
|
2
|
+
|
3
|
+
It lacks:
|
4
|
+
- Variables, eval, and call stack information.
|
5
|
+
- Conditional breakpoints.
|
6
|
+
|
7
|
+
It has:
|
8
|
+
- Ruby debugger integrated in a REPL tab (variables, eval, conditional breakpoints... and much more).
|
9
|
+
- ToolBar debug buttons: debug, next, step, continue and list.
|
10
|
+
- Tags current line in editor tab.
|
11
|
+
|
12
|
+
Working in:
|
13
|
+
- Breakpoint toolbar button.
|
14
|
+
- Breakpoint persistence between restarts.
|
15
|
+
|
16
|
+
If you use rdebug, probably this is more than you ever needed.
|
17
|
+
If you use Netbeans or Rubymine, this could seem like a wombat against a sabretooth.
|
18
|
+
If you use Redcar, take a look at http://blog.bithug.org/2011/04/redcar-debug, it's far more advanced than this project.
|
19
|
+
|
20
|
+
Why would you like to test this plugin?
|
21
|
+
- It gives access to the rdebug command line power: conditional breakpoints, frames...
|
22
|
+
- It makes rdebug easier to use.
|
23
|
+
- It's small and hackable. You can add your own commands or support to new languages.
|
24
|
+
|
25
|
+
If you still want to install this:
|
26
|
+
- Install ruby-debug gem.
|
27
|
+
- Download and copy the spray folder to your redcar plugins folder.
|
28
|
+
- Restart redcar, and you can see the new buttons in the redcar ToolBar.
|
29
|
+
|
30
|
+
You can see it in action:
|
31
|
+
http://s3.amazonaws.com/files.posterous.com/temp-2011-07-22/eEfnBmyqCjgkzrkxesmCdIgpvvwIghxFJdFtvAyFupucGdjFtxgwFbpCAjFA/SprayTest.swf?AWSAccessKeyId=AKIAJFZAE65UYRT34AOQ&Expires=1311401313&Signature=WLEFFjhmHW4u59KNqKVf8oqwhq4%3D
|
32
|
+
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'spray_tabs'
|
2
|
+
|
3
|
+
module Annotations
|
4
|
+
|
5
|
+
BREAKPOINT = ["breakpoint.annotation.type","control-pause-small",[100, 100, 200]]
|
6
|
+
CURRENT_LINE = ["current_line.annotation.type","control",[100, 100, 200]]
|
7
|
+
|
8
|
+
def self.set(path, line, type=CURRENT_LINE)
|
9
|
+
tab= (SprayTabs.find_first_matching_tab(path) || SprayTabs.open_tab(path))
|
10
|
+
unless Annotations.get_types(path).andand.include?(type)
|
11
|
+
tab.edit_view.add_annotation_type(*type)
|
12
|
+
end
|
13
|
+
unless Annotations.get_lines(path, type).include?(line)
|
14
|
+
tab.edit_view.add_annotation(type[0], line-1, type[0].split('.')[0], 0,0)
|
15
|
+
end
|
16
|
+
SprayTabs.set_current_tab(path, line)
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.remove(path, line, type=CURRENT_LINE)
|
20
|
+
tab= (SprayTabs.find_first_matching_tab(path) || SprayTabs.open_tab(path))
|
21
|
+
tab.edit_view.remove_annotation(Annotations.get(path, line-1, type))
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.get(path, line, type=CURRENT_LINE)
|
25
|
+
tab= SprayTabs.find_first_matching_tab(path)
|
26
|
+
begin
|
27
|
+
annotation= tab.edit_view.annotations.select{|a|
|
28
|
+
(a.getLine==line) and (a.getType==type[0])
|
29
|
+
}.first
|
30
|
+
rescue
|
31
|
+
nil
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.get_types(path)
|
36
|
+
tab= SprayTabs.find_first_matching_tab(path)
|
37
|
+
tab.edit_view.annotations.map{|a| a.getType}.uniq! rescue []
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.get_lines(path, type=CURRENT_LINE)
|
41
|
+
tab= SprayTabs.find_first_matching_tab(path)
|
42
|
+
begin
|
43
|
+
annotations= tab.edit_view.annotations.select{|a| a.getType==type[0]}
|
44
|
+
annotations.map{|a| a.getLine+1}.sort!
|
45
|
+
rescue
|
46
|
+
[]
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'net/telnet'
|
2
|
+
|
3
|
+
class RDebugController
|
4
|
+
RDEBUG_NO_PRINT= File.join(Redcar.root, "plugins", "spray", "lib", "controllers", "rdebug_no_print.rb")
|
5
|
+
RDEBUG_PROMPT= /PROMPT \(rdb:\d*\) |CONFIRM Really quit\? \(y\/n\)/
|
6
|
+
@@current_port= 31415
|
7
|
+
@@s= nil
|
8
|
+
|
9
|
+
attr_reader :command
|
10
|
+
|
11
|
+
def initialize(path, host='localhost', port=nil)
|
12
|
+
@path, @host, @port = path, host, (port || @@current_port+=1)
|
13
|
+
@command= "rdebug --debug -nx -p #{@port} -s -w -r '#{RDEBUG_NO_PRINT}' '#{@path}'"
|
14
|
+
end
|
15
|
+
|
16
|
+
def connect
|
17
|
+
retries= 1 #1 seconds of timeout
|
18
|
+
begin
|
19
|
+
@@s= Net::Telnet::new("Host"=> @host, "Port"=> @port, "Prompt"=> RDEBUG_PROMPT,
|
20
|
+
"Telnetmode"=> false, "Timeout"=> 2, "Waittime"=> 0)
|
21
|
+
rescue
|
22
|
+
sleep 0.2
|
23
|
+
retry if 0 <= (retries-=0.2)
|
24
|
+
raise("Timeout connecting to rdebug on #{@host}:#{@port}")
|
25
|
+
end
|
26
|
+
@@s.waitfor(/PROMPT \(rdb:\d*\)/)
|
27
|
+
end
|
28
|
+
|
29
|
+
def send_command(command)
|
30
|
+
@@s.cmd(command) || ''
|
31
|
+
end
|
32
|
+
|
33
|
+
def current_position
|
34
|
+
line, file = @@s.cmd("info line").scan(/Line\s(\d+).*"(.*)"/).flatten
|
35
|
+
[line.to_i, File.expand_path(file, File.dirname(@path))]
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'spray_repl_mirror'
|
2
|
+
require 'spray_tabs'
|
3
|
+
|
4
|
+
module Redcar
|
5
|
+
class Spray
|
6
|
+
#menu and toolbar
|
7
|
+
def self.menus
|
8
|
+
Menu::Builder.build do
|
9
|
+
sub_menu "Plugins" do
|
10
|
+
sub_menu "Spray", :priority => 139 do
|
11
|
+
item "Debug file", OpenSprayREPL
|
12
|
+
["List", "Step", "Next", "Continue"].each{|command|
|
13
|
+
item(command) {Redcar.safely{SprayTabs.send_to_repl(command.downcase)}}
|
14
|
+
}
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.toolbars
|
21
|
+
ToolBar::Builder.build do
|
22
|
+
item "Debug file", {:icon=>File.join(Redcar::ICONS_DIRECTORY, "arrow-step-over.png"), :command=>OpenSprayREPL}
|
23
|
+
item "Next", {:icon=>File.join(Redcar::ICONS_DIRECTORY, "arrow-270.png"), :command=>SpraySendNext}
|
24
|
+
item "Step", {:icon=>File.join(Redcar::ICONS_DIRECTORY, "arrow-315.png"), :command=>SpraySendStep}
|
25
|
+
item "Continue", {:icon=>File.join(Redcar::ICONS_DIRECTORY, "arrow-step.png"), :command=>SpraySendContinue}
|
26
|
+
item "List", {:icon=>File.join(Redcar::ICONS_DIRECTORY, "arrow-continue.png"), :command=>SpraySendList}
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
class OpenSprayREPL < Redcar::REPL::OpenREPL
|
31
|
+
def execute
|
32
|
+
Redcar.safely{
|
33
|
+
SprayTabs.find_first_matching_tab("SprayOutput").andand.close
|
34
|
+
SprayTabs.find_first_matching_tab("Spray: ").andand.close
|
35
|
+
open_repl(SprayReplMirror.new)
|
36
|
+
}
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
class SpraySendList < Redcar::Command
|
41
|
+
def execute; Redcar.safely{SprayTabs.send_to_repl("list")}; end
|
42
|
+
end
|
43
|
+
|
44
|
+
class SpraySendStep < Redcar::Command
|
45
|
+
def execute; Redcar.safely{SprayTabs.send_to_repl("step")}; end
|
46
|
+
end
|
47
|
+
|
48
|
+
class SpraySendNext < Redcar::Command
|
49
|
+
def execute; Redcar.safely{SprayTabs.send_to_repl("next")}; end
|
50
|
+
end
|
51
|
+
|
52
|
+
class SpraySendContinue < Redcar::Command
|
53
|
+
def execute; Redcar.safely{SprayTabs.send_to_repl("continue")}; end
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'controllers/rdebug_controller'
|
2
|
+
require 'annotations'
|
3
|
+
|
4
|
+
module Redcar
|
5
|
+
class Spray
|
6
|
+
class SprayReplMirror < Redcar::REPL::ReplMirror
|
7
|
+
|
8
|
+
attr_reader :title, :prompt, :grammar_name, :evaluator
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
@spray_path = Redcar.app.focussed_window.focussed_notebook_tab_document.path
|
12
|
+
raise "No file, please select another tab" if @spray_path.nil?
|
13
|
+
@evaluator = SprayEvaluator.new(@spray_path)
|
14
|
+
@title = "Spray: #{File.basename(@spray_path)}"
|
15
|
+
@prompt= "(#{File.extname(@spray_path)})>"
|
16
|
+
@grammar_name= "Spray REPL"
|
17
|
+
super
|
18
|
+
end
|
19
|
+
|
20
|
+
def format_error(e)
|
21
|
+
backtrace= e.backtrace.reject{|l| l=~ /repl_mirror/}
|
22
|
+
backtrace.unshift("(repl):1")
|
23
|
+
"#{e.class}: #{e.message}" #\n '#{backtrace.join("'\n '")}'"
|
24
|
+
end
|
25
|
+
|
26
|
+
class SprayEvaluator
|
27
|
+
|
28
|
+
def initialize(path)
|
29
|
+
@binding = binding
|
30
|
+
@controller= case File.extname(path)
|
31
|
+
when '.rb' then RDebugController.new(path)
|
32
|
+
when '.java' then raise("Java support still not implemented")
|
33
|
+
else raise("Spray can't handle this file type")
|
34
|
+
end
|
35
|
+
@previous_file, @previous_line = path, 1
|
36
|
+
Redcar::Runnables.run_process(File.dirname(path), @controller.command, "SprayOutput")
|
37
|
+
end
|
38
|
+
|
39
|
+
def inspect; "SprayEvaluator"; end
|
40
|
+
|
41
|
+
def execute(command)
|
42
|
+
begin
|
43
|
+
retries=1
|
44
|
+
output= @controller.send_command(command)
|
45
|
+
@current_line, @current_file= @controller.current_position
|
46
|
+
Annotations.remove(@previous_file, @previous_line)
|
47
|
+
Annotations.set(@current_file, @current_line)
|
48
|
+
@previous_file, @previous_line = @current_file, @current_line
|
49
|
+
return output
|
50
|
+
rescue
|
51
|
+
(@controller.connect; retry) if 0 <= (retries-=1)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
##
|
2
|
+
# Module for files being debugged
|
3
|
+
module SprayTabs
|
4
|
+
|
5
|
+
##
|
6
|
+
# Sends and evaluates command with RDebug REPL
|
7
|
+
def self.send_to_repl(command)
|
8
|
+
tab= SprayTabs.find_first_matching_tab('Spray: ')
|
9
|
+
if tab.nil?
|
10
|
+
raise "Open a file and goto Plugins -> Spray -> Debug"
|
11
|
+
else
|
12
|
+
tab.edit_view.document.insert_at_cursor(command)
|
13
|
+
tab.edit_view.document.mirror.evaluate(command)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.set_current_tab(path, line)
|
18
|
+
tab= (SprayTabs.find_first_matching_tab(path) || SprayTabs.open_tab(path))
|
19
|
+
tab.focus
|
20
|
+
tab.document.scroll_to_line(line)
|
21
|
+
end
|
22
|
+
|
23
|
+
##
|
24
|
+
# Returns nil when no matches
|
25
|
+
def self.find_first_matching_tab(path)
|
26
|
+
Redcar.app.focussed_window.all_tabs.select{|tab|
|
27
|
+
((tab.document.path rescue nil) =~ /#{path}/) or
|
28
|
+
((tab.document.title rescue nil) =~ /#{path}/)
|
29
|
+
}.first
|
30
|
+
end
|
31
|
+
|
32
|
+
##
|
33
|
+
# Returns opened tab, or nil if file not exists
|
34
|
+
def self.open_tab(path)
|
35
|
+
if File.exist?(path)
|
36
|
+
tab = Redcar.app.focussed_window.new_tab(Redcar::EditTab)
|
37
|
+
mirror = Redcar::Project::FileMirror.new(path)
|
38
|
+
tab.edit_view.document.mirror = mirror
|
39
|
+
tab.edit_view.reset_undo
|
40
|
+
tab
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.scroll_to(path, line)
|
45
|
+
tab= (SprayTabs.find_first_matching_tab(path) || SprayTabs.open_tab(path))
|
46
|
+
tab.edit_view.document.scroll_to_line(line)
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.focussed_doc
|
50
|
+
Redcar.app.focussed_window.focussed_notebook_tab_document
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.focussed_path; focussed_doc.path rescue nil; end
|
54
|
+
|
55
|
+
def self.focussed_line; (focussed_doc.cursor_line+1) rescue nil; end
|
56
|
+
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: redcar-dev
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease: 6
|
5
|
-
version: 0.12.
|
5
|
+
version: 0.12.8dev
|
6
6
|
platform: java
|
7
7
|
authors:
|
8
8
|
- Daniel Lucraft
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-07-24 00:00:00 +01:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -157,7 +157,7 @@ dependencies:
|
|
157
157
|
type: :runtime
|
158
158
|
version_requirements: *id013
|
159
159
|
- !ruby/object:Gem::Dependency
|
160
|
-
name:
|
160
|
+
name: ruby-blockcache
|
161
161
|
prerelease: false
|
162
162
|
requirement: &id014 !ruby/object:Gem::Requirement
|
163
163
|
none: false
|
@@ -168,7 +168,7 @@ dependencies:
|
|
168
168
|
type: :runtime
|
169
169
|
version_requirements: *id014
|
170
170
|
- !ruby/object:Gem::Dependency
|
171
|
-
name:
|
171
|
+
name: spoon
|
172
172
|
prerelease: false
|
173
173
|
requirement: &id015 !ruby/object:Gem::Requirement
|
174
174
|
none: false
|
@@ -179,7 +179,7 @@ dependencies:
|
|
179
179
|
type: :runtime
|
180
180
|
version_requirements: *id015
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
|
-
name:
|
182
|
+
name: ffi
|
183
183
|
prerelease: false
|
184
184
|
requirement: &id016 !ruby/object:Gem::Requirement
|
185
185
|
none: false
|
@@ -187,10 +187,10 @@ dependencies:
|
|
187
187
|
- - ">="
|
188
188
|
- !ruby/object:Gem::Version
|
189
189
|
version: "0"
|
190
|
-
type: :
|
190
|
+
type: :runtime
|
191
191
|
version_requirements: *id016
|
192
192
|
- !ruby/object:Gem::Dependency
|
193
|
-
name:
|
193
|
+
name: cucumber
|
194
194
|
prerelease: false
|
195
195
|
requirement: &id017 !ruby/object:Gem::Requirement
|
196
196
|
none: false
|
@@ -201,7 +201,7 @@ dependencies:
|
|
201
201
|
type: :development
|
202
202
|
version_requirements: *id017
|
203
203
|
- !ruby/object:Gem::Dependency
|
204
|
-
name:
|
204
|
+
name: rspec
|
205
205
|
prerelease: false
|
206
206
|
requirement: &id018 !ruby/object:Gem::Requirement
|
207
207
|
none: false
|
@@ -211,6 +211,17 @@ dependencies:
|
|
211
211
|
version: "0"
|
212
212
|
type: :development
|
213
213
|
version_requirements: *id018
|
214
|
+
- !ruby/object:Gem::Dependency
|
215
|
+
name: watchr
|
216
|
+
prerelease: false
|
217
|
+
requirement: &id019 !ruby/object:Gem::Requirement
|
218
|
+
none: false
|
219
|
+
requirements:
|
220
|
+
- - ">="
|
221
|
+
- !ruby/object:Gem::Version
|
222
|
+
version: "0"
|
223
|
+
type: :development
|
224
|
+
version_requirements: *id019
|
214
225
|
description: ""
|
215
226
|
email:
|
216
227
|
- dan@fluentradical.com
|
@@ -3869,6 +3880,16 @@ files:
|
|
3869
3880
|
- plugins/snippets/lib/snippets/tab_handler.rb
|
3870
3881
|
- plugins/splash_screen/plugin.rb
|
3871
3882
|
- plugins/splash_screen/splash_screen.rb
|
3883
|
+
- plugins/spray/foo.rb
|
3884
|
+
- plugins/spray/plugin.rb
|
3885
|
+
- plugins/spray/README
|
3886
|
+
- plugins/spray/lib/annotations.rb
|
3887
|
+
- plugins/spray/lib/spray.rb
|
3888
|
+
- plugins/spray/lib/spray_repl_mirror.rb
|
3889
|
+
- plugins/spray/lib/spray_tabs.rb
|
3890
|
+
- plugins/spray/lib/controllers/rdebug_controller.rb
|
3891
|
+
- plugins/spray/lib/controllers/rdebug_no_print.rb
|
3892
|
+
- plugins/spray/test/hanoi.rb
|
3872
3893
|
- plugins/strip_trailing_spaces/plugin.rb
|
3873
3894
|
- plugins/strip_trailing_spaces/features/strip_trailing_spaces.feature
|
3874
3895
|
- plugins/strip_trailing_spaces/features/fixtures/test.txt
|