redcar 0.3.9 → 0.3.10.0dev
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +18 -2
- data/Rakefile +9 -1
- data/bin/redcar +1 -1
- data/lib/redcar.rb +26 -21
- data/lib/redcar/runner.rb +8 -4
- data/plugins/document_search/features/replace.feature +9 -0
- data/plugins/document_search/lib/document_search/search.rb +7 -5
- data/plugins/project/lib/project.rb +1 -1
- data/plugins/project/lib/project/adapters/remote.rb +0 -2
- data/plugins/project/lib/project/adapters/remote_protocols/ftp.rb +2 -2
- data/plugins/project/lib/project/adapters/remote_protocols/protocol.rb +0 -2
- data/plugins/project/lib/project/adapters/remote_protocols/sftp.rb +2 -2
- data/plugins/redcar/redcar.rb +4 -1
- data/plugins/runnables/lib/runnables.rb +27 -12
- data/plugins/runnables/lib/runnables/command_output_controller.rb +20 -3
- data/plugins/runnables/lib/runnables/output_processor.rb +63 -0
- data/plugins/runnables/spec/runnables/output_processor_spec.rb +57 -0
- data/plugins/runnables/spec/spec_helper.rb +5 -0
- data/plugins/runnables/vendor/session/LICENSE +3 -0
- data/plugins/runnables/vendor/{session-2.4.0/HISTORY → session/README} +96 -1
- data/plugins/runnables/vendor/session/Rakefile +233 -0
- data/plugins/runnables/vendor/session/gemspec.rb +62 -0
- data/plugins/runnables/vendor/{session-2.4.0 → session}/lib/session.rb +6 -103
- data/plugins/runnables/vendor/{session-2.4.0 → session}/sample/bash.rb +0 -0
- data/plugins/runnables/vendor/{session-2.4.0 → session}/sample/driver.rb +0 -0
- data/plugins/runnables/vendor/{session-2.4.0 → session}/sample/session_idl.rb +0 -0
- data/plugins/runnables/vendor/{session-2.4.0 → session}/sample/session_sh.rb +0 -0
- data/plugins/runnables/vendor/{session-2.4.0 → session}/sample/sh0.rb +0 -0
- data/plugins/runnables/vendor/{session-2.4.0 → session}/sample/stdin.rb +0 -0
- data/plugins/runnables/vendor/{session-2.4.0 → session}/sample/threadtest.rb +0 -0
- data/plugins/runnables/vendor/session/session.gemspec +27 -0
- data/plugins/runnables/vendor/{session-2.4.0 → session}/test/session.rb +3 -0
- data/plugins/runnables/views/basic_ansi.css +34 -0
- data/plugins/runnables/views/color_tester.html +50 -0
- data/plugins/runnables/views/command_output.html.erb +7 -1
- data/plugins/strip_trailing_spaces/CHANGELOG +12 -0
- data/plugins/strip_trailing_spaces/README.md +32 -0
- data/plugins/strip_trailing_spaces/lib/strip_trailing_spaces.rb +53 -0
- data/plugins/strip_trailing_spaces/plugin.rb +8 -0
- metadata +4225 -4200
- data/plugins/runnables/vendor/session-2.4.0/README +0 -89
- data/plugins/runnables/vendor/session-2.4.0/TODO +0 -3
- data/plugins/runnables/vendor/session-2.4.0/VERSION +0 -1
- data/plugins/runnables/vendor/session-2.4.0/gemspec.rb +0 -22
- data/plugins/runnables/vendor/session-2.4.0/install.rb +0 -143
- data/plugins/runnables/vendor/session-2.4.0/session-2.4.0.gem +0 -0
data/CHANGES
CHANGED
@@ -1,6 +1,22 @@
|
|
1
1
|
|
2
|
-
Version 0.3.
|
3
|
-
|
2
|
+
Version 0.3.10 (TBA)
|
3
|
+
====================
|
4
|
+
|
5
|
+
Enhancements:
|
6
|
+
|
7
|
+
* Colourful Runnables! (The output tab supports ANSI escape codes) (Mat Schaffer)
|
8
|
+
* Runnables scroll as the output gets longer (Delisa Mason)
|
9
|
+
* Option to save all tabs before running any Runnable (Delisa Mason)
|
10
|
+
* Strip trailing spaces on save option (Steven Hancock)
|
11
|
+
* Search and replace supports backreferences (\1 \2 etc) (Mat Schaffer)
|
12
|
+
* Uses client, 32bit jvm mode, for twice as fast startup. (Dan Lucraft)
|
13
|
+
|
14
|
+
Fixes:
|
15
|
+
|
16
|
+
* Fix for opening files with regex characters in. (Tom Murray)
|
17
|
+
|
18
|
+
Version 0.3.9 (12 Aug 2010)
|
19
|
+
===========================
|
4
20
|
|
5
21
|
* Clojure REPL (David Byrne)
|
6
22
|
* Remote edit files (Felipe Coury & Dan Lucraft)
|
data/Rakefile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
REDCAR_VERSION = "0.3.
|
1
|
+
REDCAR_VERSION = "0.3.10.0dev"
|
2
2
|
require 'rubygems'
|
3
3
|
require 'fileutils'
|
4
4
|
require 'spec/rake/spectask'
|
@@ -32,6 +32,14 @@ begin
|
|
32
32
|
rescue LoadError
|
33
33
|
end
|
34
34
|
|
35
|
+
desc "upload the docs to redcareditor.com"
|
36
|
+
task :release_docs do
|
37
|
+
port = YAML.load(File.read(".server.yaml"))["port"]
|
38
|
+
docs_dir = YAML.load(File.read(".server.yaml"))["dir"]
|
39
|
+
sh "rsync -e 'ssh -p #{port}' -avz doc/ danlucraft.com:#{docs_dir}/#{REDCAR_VERSION}/"
|
40
|
+
sh "rsync -e 'ssh -p #{port}' -avz doc/ danlucraft.com:#{docs_dir}/latest/"
|
41
|
+
end
|
42
|
+
|
35
43
|
### CI
|
36
44
|
task :ci => [:specs_ci, :cucumber_ci]
|
37
45
|
|
data/bin/redcar
CHANGED
data/lib/redcar.rb
CHANGED
@@ -41,10 +41,10 @@ require 'uri'
|
|
41
41
|
#
|
42
42
|
# and so on.
|
43
43
|
module Redcar
|
44
|
-
VERSION = '0.3.
|
44
|
+
VERSION = '0.3.10.0dev'
|
45
45
|
VERSION_MAJOR = 0
|
46
46
|
VERSION_MINOR = 3
|
47
|
-
VERSION_RELEASE =
|
47
|
+
VERSION_RELEASE = 10
|
48
48
|
|
49
49
|
ENVIRONMENTS = [:user, :debug, :test]
|
50
50
|
|
@@ -68,26 +68,31 @@ module Redcar
|
|
68
68
|
jruby = Config::CONFIG["RUBY_INSTALL_NAME"] == "jruby"
|
69
69
|
osx = ! [:linux, :windows].include?(platform)
|
70
70
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
71
|
+
begin
|
72
|
+
if forking and not jruby
|
73
|
+
# jRuby doesn't support fork() because of the runtime stuff...
|
74
|
+
forking = false
|
75
|
+
puts 'Forking failed, attempting to start anyway...' if (pid = fork) == -1
|
76
|
+
exit unless pid.nil? # kill the parent process
|
77
|
+
|
78
|
+
if pid.nil?
|
79
|
+
# reopen the standard pipes to nothingness
|
80
|
+
STDIN.reopen '/dev/null'
|
81
|
+
STDOUT.reopen '/dev/null', 'a'
|
82
|
+
STDERR.reopen STDOUT
|
83
|
+
end
|
84
|
+
elsif forking
|
85
|
+
# so we need to try something different...
|
86
|
+
# Need to work out the vendoring stuff here.
|
87
|
+
# for now just blow up and do what we'd normally do.
|
88
|
+
#require 'spoon'
|
89
|
+
raise NotImplementedError, 'Attempting to fork from inside jRuby. jRuby doesn\'t support this.'
|
90
|
+
#puts 'Continuing normally...'
|
91
|
+
#forking = false
|
82
92
|
end
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
# for now just blow up and do what we'd normally do.
|
87
|
-
#require 'spoon'
|
88
|
-
puts 'Attempting to fork from inside jRuby. jRuby doesn\'t support this.'
|
89
|
-
puts 'Continuing normally...'
|
90
|
-
forking = false
|
93
|
+
rescue NotImplementedError
|
94
|
+
puts "Forking isn't supported on this system. Sorry."
|
95
|
+
puts "Starting normally..."
|
91
96
|
end
|
92
97
|
|
93
98
|
return if no_runner
|
data/lib/redcar/runner.rb
CHANGED
@@ -13,7 +13,7 @@ module Redcar
|
|
13
13
|
exit 1
|
14
14
|
end
|
15
15
|
ENV['RUBYOPT'] = nil # disable other native args
|
16
|
-
command = "java #{java_args} -Xmx500m -Xss1024k -Djruby.memory.max=500m -Djruby.stack.max=1024k -cp \"#{jruby_complete}\" org.jruby.Main #{"--debug" if debug_mode?} \"#{bin}\" #{cleaned_args} --no-sub-jruby --ignore-stdin"
|
16
|
+
command = "java -d32 -client #{java_args} -Xmx500m -Xss1024k -Djruby.memory.max=500m -Djruby.stack.max=1024k -cp \"#{jruby_complete}\" org.jruby.Main #{"--debug" if debug_mode?} \"#{bin}\" #{cleaned_args} --no-sub-jruby --ignore-stdin"
|
17
17
|
puts command
|
18
18
|
exec(command)
|
19
19
|
end
|
@@ -34,11 +34,15 @@ module Redcar
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def java_args
|
37
|
+
str = ""
|
37
38
|
if Config::CONFIG["host_os"] =~ /darwin/
|
38
|
-
"-XstartOnFirstThread"
|
39
|
-
else
|
40
|
-
""
|
39
|
+
str <<"-XstartOnFirstThread"
|
41
40
|
end
|
41
|
+
|
42
|
+
if ARGV.include?("--load-timings")
|
43
|
+
str << " -Djruby.debug.loadService.timing=true"
|
44
|
+
end
|
45
|
+
str
|
42
46
|
end
|
43
47
|
end
|
44
48
|
end
|
@@ -111,4 +111,13 @@ Feature: Replace in file
|
|
111
111
|
Then the contents should be "THE\n* Speedbars have access to THE properties of THE widgets in THEm."
|
112
112
|
And the selection range should be from 64 to 67
|
113
113
|
|
114
|
+
Scenario: Replace regex with back-references
|
115
|
+
When I replace the contents with "Curry chicken"
|
116
|
+
And I move the cursor to 0
|
117
|
+
And I run the command DocumentSearch::SearchAndReplaceCommand
|
118
|
+
And I type "(\w+) chicken" into the "Search" field in the speedbar
|
119
|
+
And I type "\1 beef" into the "Replace" field in the speedbar
|
120
|
+
And I press "Replace" in the speedbar
|
121
|
+
Then the contents should be "Curry beef"
|
122
|
+
|
114
123
|
|
@@ -2,11 +2,13 @@ module DocumentSearch
|
|
2
2
|
class Search
|
3
3
|
# An instance of a search type method: Regular expression
|
4
4
|
def self.regex_search_method(line, query, replace)
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
new_line = line.sub(/#{query}/, replace)
|
6
|
+
|
7
|
+
if match = $~
|
8
|
+
startoff = match.pre_match.length
|
9
|
+
endoff = (startoff + match[0].length) - 1
|
10
|
+
|
11
|
+
return new_line, startoff, startoff + match[0].length
|
10
12
|
end
|
11
13
|
return nil
|
12
14
|
end
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'net/ssh'
|
2
|
-
require 'net/sftp'
|
3
1
|
|
4
2
|
module Redcar
|
5
3
|
class Project
|
@@ -13,6 +11,8 @@ module Redcar
|
|
13
11
|
end
|
14
12
|
|
15
13
|
def connection
|
14
|
+
require 'net/ssh'
|
15
|
+
require 'net/sftp'
|
16
16
|
Redcar.timeout(10) do
|
17
17
|
@connection ||= Net::SSH.start(host, user, :password => password, :keys => private_key_files)
|
18
18
|
end
|
data/plugins/redcar/redcar.rb
CHANGED
@@ -763,6 +763,7 @@ module Redcar
|
|
763
763
|
link "Ctrl+Shift+[", MoveTabDownCommand
|
764
764
|
link "Ctrl+Shift+]", MoveTabUpCommand
|
765
765
|
link "Ctrl+R", Runnables::RunEditTabCommand
|
766
|
+
link "Cmd+Alt+I", ToggleInvisibles
|
766
767
|
|
767
768
|
link "Ctrl+Shift+P", PrintScopeCommand
|
768
769
|
|
@@ -836,7 +837,8 @@ module Redcar
|
|
836
837
|
link "Ctrl+Shift+Page Up", MoveTabDownCommand
|
837
838
|
link "Ctrl+Shift+Page Down", MoveTabUpCommand
|
838
839
|
link "Ctrl+Shift+R", PluginManagerUi::ReloadLastReloadedCommand
|
839
|
-
|
840
|
+
link "Ctrl+Alt+I", ToggleInvisibles
|
841
|
+
|
840
842
|
link "Ctrl+Alt+S", Snippets::OpenSnippetExplorer
|
841
843
|
#Textmate.attach_keybindings(self, :linux)
|
842
844
|
|
@@ -1013,6 +1015,7 @@ module Redcar
|
|
1013
1015
|
Redcar::Project::Manager.start(args)
|
1014
1016
|
puts "project start took #{Time.now - s}s"
|
1015
1017
|
Redcar.app.make_sure_at_least_one_window_open
|
1018
|
+
puts "start time: #{Time.now - $redcar_process_start_time}"
|
1016
1019
|
end
|
1017
1020
|
end
|
1018
1021
|
end
|
@@ -1,29 +1,39 @@
|
|
1
1
|
|
2
|
-
require File.dirname(__FILE__) + "/../vendor/session
|
2
|
+
require File.dirname(__FILE__) + "/../vendor/session/lib/session"
|
3
3
|
Session.use_open4 = true
|
4
4
|
|
5
5
|
require 'runnables/command_output_controller'
|
6
6
|
require 'runnables/running_process_checker'
|
7
|
+
require 'runnables/output_processor'
|
7
8
|
|
8
9
|
module Redcar
|
9
10
|
class Runnables
|
10
11
|
TREE_TITLE = "Runnables"
|
11
|
-
|
12
|
-
def self.run_process(path, command, title, output)
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
12
|
+
|
13
|
+
def self.run_process(path, command, title, output = "tab")
|
14
|
+
if Runnables.storage['save_project_before_running'] == true
|
15
|
+
Redcar.app.focussed_window.notebooks.each do |notebook|
|
16
|
+
notebook.tabs.each do |tab|
|
17
|
+
case tab
|
18
|
+
when EditTab
|
19
|
+
tab.edit_view.document.save!
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
17
23
|
end
|
24
|
+
controller = CommandOutputController.new(path, command, title)
|
18
25
|
if output == "none"
|
19
26
|
controller.run
|
20
|
-
else
|
27
|
+
else #default to new tab
|
28
|
+
if output == "window"
|
29
|
+
Project::Manager.open_project_for_path(".")
|
30
|
+
end
|
21
31
|
tab = Redcar.app.focussed_window.new_tab(HtmlTab)
|
22
32
|
tab.html_view.controller = controller
|
23
33
|
tab.focus
|
24
34
|
end
|
25
35
|
end
|
26
|
-
|
36
|
+
|
27
37
|
def self.menus
|
28
38
|
Menu::Builder.build do
|
29
39
|
sub_menu "Project", :priority => 15 do
|
@@ -69,6 +79,14 @@ module Redcar
|
|
69
79
|
@top
|
70
80
|
end
|
71
81
|
end
|
82
|
+
|
83
|
+
def self.storage
|
84
|
+
@storage ||= begin
|
85
|
+
storage = Plugin::Storage.new('runnables')
|
86
|
+
storage.set_default('save_project_before_running', false)
|
87
|
+
storage
|
88
|
+
end
|
89
|
+
end
|
72
90
|
|
73
91
|
class RunnableGroup
|
74
92
|
include Redcar::Tree::Mirror::NodeMirror
|
@@ -220,6 +238,3 @@ module Redcar
|
|
220
238
|
end
|
221
239
|
end
|
222
240
|
end
|
223
|
-
|
224
|
-
|
225
|
-
|
@@ -35,16 +35,30 @@ module Redcar
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
+
def stylesheet_link_tag(*files)
|
39
|
+
files.map do |file|
|
40
|
+
path = File.join(Redcar.root, %w(plugins runnables views) + [file.to_s + ".css"])
|
41
|
+
url = "file://" + File.expand_path(path)
|
42
|
+
%Q|<link href="#{url}" rel="stylesheet" type="text/css" />|
|
43
|
+
end.join("\n")
|
44
|
+
end
|
45
|
+
|
46
|
+
def process(text)
|
47
|
+
@processor ||= OutputProcessor.new
|
48
|
+
@processor.process(text)
|
49
|
+
end
|
50
|
+
|
38
51
|
def run_windows
|
39
52
|
@thread = Thread.new do
|
40
53
|
output = `cd #{@path} & #{@cmd} 2>&1`
|
41
54
|
html=<<-HTML
|
42
55
|
<div class="stdout">
|
43
|
-
|
56
|
+
#{process(output)}
|
44
57
|
</div>
|
45
58
|
HTML
|
46
59
|
execute(<<-JAVASCRIPT)
|
47
60
|
$("#output").append(#{html.inspect});
|
61
|
+
$("html, body").attr({ scrollTop: $("#output").attr("scrollHeight") });
|
48
62
|
JAVASCRIPT
|
49
63
|
end
|
50
64
|
end
|
@@ -56,12 +70,13 @@ module Redcar
|
|
56
70
|
@shell.outproc = lambda do |out|
|
57
71
|
html=<<-HTML
|
58
72
|
<div class="stdout">
|
59
|
-
|
73
|
+
#{process(out)}
|
60
74
|
</div>
|
61
75
|
HTML
|
62
76
|
execute(<<-JAVASCRIPT)
|
63
77
|
$("#output").append(#{html.inspect});
|
64
|
-
|
78
|
+
$("html, body").attr({ scrollTop: $("#output").attr("scrollHeight") });
|
79
|
+
JAVASCRIPT
|
65
80
|
end
|
66
81
|
@shell.errproc = lambda do |err|
|
67
82
|
html=<<-HTML
|
@@ -71,6 +86,7 @@ module Redcar
|
|
71
86
|
HTML
|
72
87
|
execute(<<-JAVASCRIPT)
|
73
88
|
$("#output").append(#{html.inspect});
|
89
|
+
$("html, body").attr({ scrollTop: $("#output").attr("scrollHeight") });
|
74
90
|
JAVASCRIPT
|
75
91
|
end
|
76
92
|
begin
|
@@ -86,6 +102,7 @@ module Redcar
|
|
86
102
|
HTML
|
87
103
|
execute(<<-JAVASCRIPT)
|
88
104
|
$("#output").append(#{html.inspect});
|
105
|
+
$("html, body").attr({ scrollTop: $("#output").attr("scrollHeight") });
|
89
106
|
JAVASCRIPT
|
90
107
|
@shell = nil
|
91
108
|
@thread = nil
|
@@ -0,0 +1,63 @@
|
|
1
|
+
module Redcar
|
2
|
+
class Runnables
|
3
|
+
class OutputProcessor
|
4
|
+
# From TextMate's Support/lib/escape.rb
|
5
|
+
# Make string suitable for display as HTML, preserve spaces. Set :no_newline_after_br => true
|
6
|
+
# to cause “\n” to be substituted by “<br>” instead of “<br>\n”
|
7
|
+
def process(str, opts = {})
|
8
|
+
str = str.to_s.gsub("&", "&").gsub("<", "<")
|
9
|
+
str = process_ansi(str)
|
10
|
+
str = str.gsub(/\t+/, '<span style="white-space:pre;">\0</span>')
|
11
|
+
str = str.reverse.gsub(/ (?= |$)/, ';psbn&').reverse
|
12
|
+
if opts[:no_newline_after_br].nil?
|
13
|
+
str.gsub("\n", "<br>\n")
|
14
|
+
else
|
15
|
+
str.gsub("\n", "<br>")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def initialize
|
20
|
+
@ansi_stack = []
|
21
|
+
@ansi_colors = %w(black red green yellow blue purple cyan gray)
|
22
|
+
end
|
23
|
+
|
24
|
+
def color(num)
|
25
|
+
@ansi_colors[num.to_i]
|
26
|
+
end
|
27
|
+
|
28
|
+
def close_ansi_spans(clear = false)
|
29
|
+
stack_length = @ansi_stack.size
|
30
|
+
@ansi_stack = [] if clear
|
31
|
+
"</span>" * stack_length
|
32
|
+
end
|
33
|
+
|
34
|
+
def ansi_span(style)
|
35
|
+
%Q|<span class="#{style}">|
|
36
|
+
end
|
37
|
+
|
38
|
+
def restart_ansi_spans
|
39
|
+
@ansi_stack.map do |style|
|
40
|
+
ansi_span(style)
|
41
|
+
end.join('')
|
42
|
+
end
|
43
|
+
|
44
|
+
def process_ansi(str)
|
45
|
+
restart_ansi_spans + str.gsub(/\e\[(([0,1]);?)?((\d)(\d))?m/) do |m|
|
46
|
+
match = $~
|
47
|
+
if match[2] == "0" && match[4].nil?
|
48
|
+
close_ansi_spans(:clear)
|
49
|
+
else
|
50
|
+
style = ""
|
51
|
+
style += "ansi-regular " if match[2] == "0"
|
52
|
+
style += "ansi-bold " if match[2] == "1"
|
53
|
+
style += "ansi-light " if match[4] == "9"
|
54
|
+
style += "ansi-on-#{color(match[5])} " if match[4] == "4"
|
55
|
+
style += "ansi-#{color(match[5])}" if match[4] == "3" || match[4] == "9"
|
56
|
+
@ansi_stack << style unless style.empty?
|
57
|
+
ansi_span(style)
|
58
|
+
end
|
59
|
+
end + close_ansi_spans
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|