redcar 0.11.0dev → 0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES +14 -1
- data/README.md +28 -8
- data/Rakefile +23 -18
- data/bin/redcar +9 -4
- data/lib/redcar.rb +42 -4
- data/lib/redcar/installer.rb +7 -2
- data/lib/redcar/logger.rb +64 -0
- data/lib/redcar/runner.rb +17 -8
- data/lib/redcar/usage.rb +2 -0
- data/plugins/application/features/step_definitions/tree_steps.rb +4 -4
- data/plugins/application/features/support/env.rb +6 -6
- data/plugins/application/lib/application.rb +31 -3
- data/plugins/application/lib/application/command.rb +6 -0
- data/plugins/application/lib/application/command/executor.rb +0 -1
- data/plugins/application/lib/application/commands/application_commands.rb +21 -0
- data/plugins/application/lib/application/commands/notebook_commands.rb +73 -0
- data/plugins/application/lib/application/commands/tab_commands.rb +105 -0
- data/plugins/application/lib/application/commands/treebook_commands.rb +117 -0
- data/plugins/application/lib/application/commands/window_commands.rb +68 -0
- data/plugins/{tree/lib → application/lib/application}/tree.rb +0 -4
- data/plugins/{tree/lib → application/lib/application}/tree/command.rb +0 -0
- data/plugins/{tree/lib → application/lib/application}/tree/controller.rb +0 -0
- data/plugins/{tree/lib → application/lib/application}/tree/mirror.rb +0 -0
- data/plugins/application/spec/application/keymap/builder_spec.rb +1 -1
- data/plugins/application/spec/application/menu/builder_spec.rb +2 -2
- data/plugins/application_swt/lib/application_swt.rb +4 -2
- data/plugins/application_swt/lib/swt/vtab_label.rb +6 -3
- data/plugins/auto_indenter/lib/auto_indenter/document_controller.rb +6 -3
- data/plugins/clojure/lib/clojure.rb +2 -2
- data/plugins/core/lib/core.rb +0 -4
- data/plugins/core/lib/core/gui.rb +2 -4
- data/plugins/core/lib/core/plugin/storage.rb +68 -21
- data/plugins/core/spec/core/base_storage_spec.rb +81 -0
- data/plugins/core/spec/core/shared_storage_spec.rb +49 -0
- data/plugins/core/spec/core/storage_spec.rb +13 -63
- data/plugins/declarations/lib/declarations.rb +3 -1
- data/plugins/document_search/features/replace.feature +29 -20
- data/plugins/document_search/lib/document_search/find_speedbar.rb +4 -1
- data/plugins/edit_view/features/indentation_commands.feature +6 -5
- data/plugins/edit_view/features/step_definitions/notebook_steps.rb +4 -4
- data/plugins/edit_view/features/step_definitions/tab_steps.rb +7 -7
- data/plugins/edit_view/features/step_definitions/window_steps.rb +2 -2
- data/plugins/edit_view/lib/edit_view.rb +15 -1
- data/plugins/edit_view/lib/edit_view/modified_tabs_checker.rb +7 -7
- data/plugins/edit_view_swt/lib/edit_view_swt.rb +7 -6
- data/plugins/execute_current_tab/lib/execute_current_tab.rb +1 -1
- data/plugins/groovy/lib/groovy.rb +3 -3
- data/plugins/groovy/lib/groovy/commands.rb +1 -1
- data/plugins/help/lib/help/view_controller.rb +5 -0
- data/plugins/help/views/index.html.erb +10 -1
- data/plugins/html_view/features/step_definitions/html_view_steps.rb +1 -1
- data/plugins/html_view/features/support/env.rb +0 -15
- data/plugins/html_view/lib/html_view.rb +3 -4
- data/plugins/html_view/lib/html_view/commands.rb +1 -1
- data/plugins/key_bindings/lib/key_bindings.rb +34 -0
- data/plugins/key_bindings/plugin.rb +8 -0
- data/plugins/{tree → key_bindings}/spec/spec_helper.rb +0 -0
- data/plugins/line_tools/features/lower_text.feature +3 -4
- data/plugins/line_tools/lib/line_tools.rb +6 -5
- data/plugins/mirah/lib/mirah.rb +2 -2
- data/plugins/pair_highlighter/lib/pair_highlighter/document_controller.rb +5 -3
- data/plugins/project/features/open_directory_tree.feature +1 -1
- data/plugins/project/features/step_definitions/file_steps.rb +5 -5
- data/plugins/project/features/step_definitions/find_file_steps.rb +2 -3
- data/plugins/project/features/support/env.rb +4 -0
- data/plugins/project/lib/project.rb +15 -9
- data/plugins/project/lib/project/commands.rb +46 -16
- data/plugins/project/lib/project/dir_controller.rb +1 -1
- data/plugins/project/lib/project/dir_mirror.rb +3 -2
- data/plugins/project/lib/project/drb_service.rb +3 -1
- data/plugins/project/lib/project/file_list.rb +99 -21
- data/plugins/project/lib/project/find_file_dialog.rb +8 -24
- data/plugins/project/lib/project/manager.rb +68 -12
- data/plugins/project/lib/project/project_tree_controller.rb +1 -1
- data/plugins/project/plugin.rb +1 -2
- data/plugins/project_search/features/word_search.feature +1 -1
- data/plugins/project_search/lib/project_search.rb +16 -6
- data/plugins/project_search/lib/project_search/commands.rb +15 -28
- data/plugins/project_search/lib/project_search/hit.rb +4 -0
- data/plugins/project_search/lib/project_search/lucene_index.rb +14 -4
- data/plugins/project_search/lib/project_search/views/_file.html.erb +11 -11
- data/plugins/project_search/lib/project_search/word_search.rb +22 -4
- data/plugins/project_search/spec/project_search/word_search_spec.rb +2 -2
- data/plugins/redcar/redcar.rb +140 -588
- data/plugins/repl/features/step_definitions/repl_steps.rb +3 -3
- data/plugins/repl/features/support/fake_repl.rb +1 -1
- data/plugins/ruby/lib/ruby.rb +4 -4
- data/plugins/runnables/features/fixtures/alternate.ruby +1 -0
- data/plugins/runnables/features/fixtures/line_app.rb +1 -0
- data/plugins/runnables/features/fixtures/name_app.rb +1 -0
- data/plugins/runnables/features/fixtures/params_app.rb +1 -0
- data/plugins/runnables/features/fixtures/runnable_app.rb +1 -0
- data/plugins/runnables/lib/runnables.rb +21 -0
- data/plugins/runnables/lib/runnables/command_output_controller.rb +14 -9
- data/plugins/runnables/lib/runnables/output_processor.rb +4 -4
- data/plugins/runnables/lib/runnables/running_process_checker.rb +6 -6
- data/plugins/runnables/plugin.rb +1 -2
- data/plugins/scm/lib/scm.rb +18 -18
- data/plugins/scm/lib/scm/commit_mirror.rb +2 -2
- data/plugins/scm/lib/scm/scm_changes_controller.rb +1 -1
- data/plugins/scm_hg/lib/scm_hg.rb +1 -1
- data/plugins/snippets/lib/snippets/document_controller.rb +46 -40
- data/plugins/swt/lib/swt.rb +2 -0
- data/plugins/test_runner/lib/test_runner.rb +1 -0
- data/plugins/test_runner/lib/test_runner/jasmine_test_runner.rb +15 -0
- data/plugins/test_runner/lib/test_runner/runnable_test_runner.rb +21 -5
- data/plugins/textmate/lib/textmate.rb +5 -1
- data/plugins/textmate/lib/textmate/preference.rb +4 -0
- data/plugins/textmate/lib/textmate/snippet.rb +0 -2
- data/plugins/textmate/lib/textmate/tree_mirror.rb +6 -5
- data/plugins/textmate/plugin.rb +1 -1
- data/plugins/textmate/vendor/redcar-bundles/Bundles/C.tmbundle/Syntaxes/C.plist +2 -2
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Clojure.tmbundle/info.plist +2 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Cucumber.tmbundle/Syntaxes/Cucumber_Plain_Text_Feature.tmLanguage +0 -4
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Cucumber.tmbundle/info.plist +2 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Mirah.tmbundle/info.plist +3 -1
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Palm-WebOS-Development.tmbundle/info.plist +2 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/RedcarRepl.tmbundle/info.plist +2 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/SQL.tmbundle/info.plist +2 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Scala.tmbundle/info.plist +2 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Smalltalk.tmbundle/Preferences/GNU_Smalltalk.tmPreferences +1 -1
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Smalltalk.tmbundle/Preferences/MIST_Smalltalk_Format.tmPreferences +1 -1
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Smalltalk.tmbundle/info.plist +2 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Vala.tmbundle/info.plist +4 -2
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Webrat.tmbundle/info.plist +2 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/YAML.tmbundle/Syntaxes/YAML.plist +1 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/groovy.tmbundle/info.plist +2 -0
- data/plugins/textmate/vendor/redcar-bundles/Themes/Twilight.tmTheme +0 -2
- data/plugins/todo_list/lib/todo_list.rb +3 -3
- data/plugins/todo_list/lib/todo_list/todo_controller.rb +1 -1
- data/plugins/web_bookmarks/features/step_definitions/web_steps.rb +1 -1
- data/plugins/web_bookmarks/lib/web_bookmarks.rb +11 -4
- data/plugins/web_bookmarks/lib/web_bookmarks/commands.rb +1 -1
- data/plugins/web_bookmarks/plugin.rb +1 -2
- metadata +29 -20
- data/plugins/core/lib/core/logger.rb +0 -28
- data/plugins/file_parser/lib/file_parser.rb +0 -125
- data/plugins/file_parser/plugin.rb +0 -7
- data/plugins/tree/plugin.rb +0 -9
@@ -1,9 +1,9 @@
|
|
1
1
|
When /^I open a "([^"]*)" repl$/ do |repl|
|
2
|
-
Redcar.const_get(repl.camelize).const_get(repl.camelize + "
|
2
|
+
Redcar.const_get(repl.camelize).const_get("Open" + repl.camelize + "REPL").new.run
|
3
3
|
end
|
4
4
|
|
5
5
|
When /^I open a new repl$/ do
|
6
|
-
Redcar::REPL::
|
6
|
+
Redcar::REPL::OpenFakeREPL.new.run
|
7
7
|
end
|
8
8
|
|
9
9
|
Then /^the REPL output should be "([^"]*)"$/ do |output|
|
@@ -16,4 +16,4 @@ end
|
|
16
16
|
|
17
17
|
Then /^the current command should be blank$/ do
|
18
18
|
current_tab.current_command.should == nil
|
19
|
-
end
|
19
|
+
end
|
data/plugins/ruby/lib/ruby.rb
CHANGED
@@ -8,7 +8,7 @@ module Redcar
|
|
8
8
|
Menu::Builder.build do
|
9
9
|
sub_menu "Plugins" do
|
10
10
|
sub_menu "REPL" do
|
11
|
-
item "Open Ruby REPL",
|
11
|
+
item "Open Ruby REPL", OpenRubyREPL
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
@@ -16,17 +16,17 @@ module Redcar
|
|
16
16
|
|
17
17
|
def self.keymaps
|
18
18
|
osx = Keymap.build("main", :osx) do
|
19
|
-
link "Cmd+Shift+R",
|
19
|
+
link "Cmd+Shift+R", OpenRubyREPL
|
20
20
|
end
|
21
21
|
|
22
22
|
linwin = Keymap.build("main", [:linux, :windows]) do
|
23
|
-
link "Ctrl+Shift+R",
|
23
|
+
link "Ctrl+Shift+R", OpenRubyREPL
|
24
24
|
end
|
25
25
|
|
26
26
|
[linwin, osx]
|
27
27
|
end
|
28
28
|
|
29
|
-
class
|
29
|
+
class OpenRubyREPL < Redcar::REPL::OpenREPL
|
30
30
|
def execute
|
31
31
|
open_repl(ReplMirror.new)
|
32
32
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
ARGV.each { |it| print it+' '}
|
@@ -0,0 +1 @@
|
|
1
|
+
ARGV.each { |it| println it}
|
@@ -0,0 +1 @@
|
|
1
|
+
ARGV.each { |it| println it}
|
@@ -0,0 +1 @@
|
|
1
|
+
ARGV.each { |it| print it+' '}
|
@@ -0,0 +1 @@
|
|
1
|
+
puts "hello world"
|
@@ -155,5 +155,26 @@ module Redcar
|
|
155
155
|
storage
|
156
156
|
end
|
157
157
|
end
|
158
|
+
|
159
|
+
def self.quit_guard
|
160
|
+
Runnables::RunningProcessChecker.new(
|
161
|
+
Redcar.app.all_tabs.select {|t| t.is_a?(HtmlTab)},
|
162
|
+
"Kill all and quit?"
|
163
|
+
).check
|
164
|
+
end
|
165
|
+
|
166
|
+
def self.close_window_guard(win)
|
167
|
+
Runnables::RunningProcessChecker.new(
|
168
|
+
win.notebooks.map(&:tabs).flatten.select {|t| t.is_a?(HtmlTab)},
|
169
|
+
"Kill them and close the window?"
|
170
|
+
).check
|
171
|
+
end
|
172
|
+
|
173
|
+
def self.project_closed(project,window)
|
174
|
+
rtree = window.treebook.trees.detect { |t|
|
175
|
+
t.tree_mirror.is_a? Runnables::TreeMirror
|
176
|
+
}
|
177
|
+
rtree.close if rtree
|
178
|
+
end
|
158
179
|
end
|
159
180
|
end
|
@@ -18,14 +18,14 @@ module Redcar
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def ask_before_closing
|
21
|
-
if @
|
21
|
+
if @pid
|
22
22
|
"This tab contains an unfinished process. \n\nKill the process and close?"
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
26
|
def close
|
27
|
-
if @
|
28
|
-
Process.kill(9, @
|
27
|
+
if @pid
|
28
|
+
Process.kill(9, @pid.to_i + 1)
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
@@ -82,21 +82,26 @@ module Redcar
|
|
82
82
|
# TODO: Find browser's onload rather than sleeping
|
83
83
|
sleep 1
|
84
84
|
start_output_block
|
85
|
-
Redcar.
|
85
|
+
Redcar.log.info "Running: #{cmd}"
|
86
86
|
|
87
87
|
# JRuby-specific
|
88
|
-
pid, input, output, error = IO.popen4(cmd)
|
88
|
+
@pid, input, output, error = IO.popen4(cmd)
|
89
89
|
@stdout_thread = output_thread(:stdout, output)
|
90
90
|
@stderr_thread = output_thread(:stderr, error)
|
91
91
|
|
92
92
|
Thread.new do
|
93
|
-
sleep 0.1 until
|
94
|
-
|
93
|
+
sleep 0.1 until finished?
|
94
|
+
@pid = nil
|
95
95
|
end_output_block
|
96
96
|
end
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
100
|
+
def finished?
|
101
|
+
@stdout_thread_started && @stderr_thread_started &&
|
102
|
+
!@stdout_thread.alive? && !@stderr_thread.alive?
|
103
|
+
end
|
104
|
+
|
100
105
|
def format_time(time)
|
101
106
|
time.strftime("%I:%M:%S %p").downcase
|
102
107
|
end
|
@@ -163,8 +168,8 @@ module Redcar
|
|
163
168
|
end
|
164
169
|
|
165
170
|
def open_file(file, line)
|
166
|
-
|
167
|
-
|
171
|
+
Project::Manager.open_file(File.join(Project::Manager.focussed_project.path, file))
|
172
|
+
Redcar.app.focussed_window.focussed_notebook_tab.edit_view.document.scroll_to_line(line.to_i)
|
168
173
|
end
|
169
174
|
|
170
175
|
def index
|
@@ -18,9 +18,9 @@ module Redcar
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def process_file_line_numbers(str)
|
21
|
-
file_number_regex = /(
|
21
|
+
file_number_regex = /(\S+)\:(\d+)/
|
22
22
|
if str =~ file_number_regex
|
23
|
-
str.gsub(file_number_regex,
|
23
|
+
str.gsub(file_number_regex,
|
24
24
|
%{<a class="file_line_link" href="javascript:Controller.openFile('#{$1}', '#{$2}');">#{$1}:#{$2}</a>})
|
25
25
|
else
|
26
26
|
str
|
@@ -29,7 +29,7 @@ module Redcar
|
|
29
29
|
|
30
30
|
def initialize
|
31
31
|
@ansi_stack = []
|
32
|
-
@ansi_colors = %w(black red green yellow blue purple cyan gray)
|
32
|
+
@ansi_colors = %w(black red green yellow blue purple cyan gray)
|
33
33
|
end
|
34
34
|
|
35
35
|
def color(num)
|
@@ -58,7 +58,7 @@ module Redcar
|
|
58
58
|
if match[2] == "0" && match[4].nil?
|
59
59
|
close_ansi_spans(:clear)
|
60
60
|
else
|
61
|
-
style = ""
|
61
|
+
style = ""
|
62
62
|
style << "ansi-regular " if match[2] == "0"
|
63
63
|
style << "ansi-bold " if match[2] == "1"
|
64
64
|
style << "ansi-light " if match[4] == "9"
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module Redcar
|
2
2
|
class Runnables
|
3
3
|
class RunningProcessChecker
|
4
|
-
def initialize(tabs, message
|
5
|
-
@tabs, @message
|
4
|
+
def initialize(tabs, message)
|
5
|
+
@tabs, @message = tabs, message
|
6
6
|
end
|
7
7
|
|
8
8
|
def check
|
@@ -19,14 +19,14 @@ module Redcar
|
|
19
19
|
t.focus
|
20
20
|
t.close
|
21
21
|
end
|
22
|
-
|
22
|
+
true
|
23
23
|
when :no
|
24
|
-
|
24
|
+
true
|
25
25
|
when :cancel
|
26
|
-
|
26
|
+
false
|
27
27
|
end
|
28
28
|
else
|
29
|
-
|
29
|
+
true
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
data/plugins/runnables/plugin.rb
CHANGED
data/plugins/scm/lib/scm.rb
CHANGED
@@ -42,12 +42,12 @@ module Redcar
|
|
42
42
|
|
43
43
|
def self.keymaps
|
44
44
|
osx = Keymap.build("main", :osx) do
|
45
|
-
link "Cmd+Shift+C", Scm::CommitMirror::
|
46
|
-
link "Cmd+Shift+.", :command => Scm::CommitMirror::
|
45
|
+
link "Cmd+Shift+C", Scm::CommitMirror::CommitChangesCommand
|
46
|
+
link "Cmd+Shift+.", :command => Scm::CommitMirror::CommitChangesCommand, :value => [:commit, [Scm::ScmChangesMirror, Scm::ScmChangesController]]
|
47
47
|
end
|
48
48
|
|
49
49
|
linwin = Keymap.build("main", [:linux, :windows]) do
|
50
|
-
link "Ctrl+Shift+C", Scm::CommitMirror::
|
50
|
+
link "Ctrl+Shift+C", Scm::CommitMirror::CommitChangesCommand
|
51
51
|
end
|
52
52
|
|
53
53
|
[linwin, osx]
|
@@ -66,8 +66,8 @@ module Redcar
|
|
66
66
|
item "Toggle Changes Tree", :command => Scm::ToggleScmTreeCommand, :value => [:commit, [Scm::ScmChangesMirror, Scm::ScmChangesController]]
|
67
67
|
item "Toggle Commits Tree", :command => Scm::ToggleScmTreeCommand, :value => [:push, [Scm::ScmCommitsMirror, Scm::ScmCommitsController]]
|
68
68
|
separator
|
69
|
-
item "Create Commit", :command => Scm::CommitMirror::
|
70
|
-
item "Save Commit", :command => Scm::CommitMirror::
|
69
|
+
item "Create Commit", :command => Scm::CommitMirror::CreateCommitCommand
|
70
|
+
item "Save Commit", :command => Scm::CommitMirror::CommitChangesCommand
|
71
71
|
end
|
72
72
|
end
|
73
73
|
end
|
@@ -86,16 +86,16 @@ module Redcar
|
|
86
86
|
def self.modules
|
87
87
|
@modules ||= begin
|
88
88
|
mods = []
|
89
|
-
|
89
|
+
Redcar.log.debug "SCM Loading Redcar SCM modules..."
|
90
90
|
|
91
91
|
Redcar.plugin_manager.objects_implementing(:scm_module).each do |i|
|
92
|
-
|
92
|
+
Redcar.log.debug "SCM Found #{i.name}."
|
93
93
|
object = i.scm_module
|
94
94
|
|
95
95
|
if object.supported?
|
96
96
|
mods.push(object)
|
97
97
|
elsif debug
|
98
|
-
|
98
|
+
Redcar.log.debug "SCM but discarding because it isn't supported on the current system."
|
99
99
|
end
|
100
100
|
end
|
101
101
|
|
@@ -111,7 +111,7 @@ module Redcar
|
|
111
111
|
begin
|
112
112
|
assert_interface(mod, Redcar::Scm::Model)
|
113
113
|
rescue RuntimeError => e
|
114
|
-
|
114
|
+
Redcar.log.debug "SCM Skipping SCM module #{m.name} because it has an invalid interface."
|
115
115
|
nil
|
116
116
|
else
|
117
117
|
mod
|
@@ -131,17 +131,17 @@ module Redcar
|
|
131
131
|
# for now we only want to attempt to handle the local case
|
132
132
|
return if project.remote?
|
133
133
|
|
134
|
-
|
134
|
+
Redcar.log.debug "SCM #{modules.count} SCM modules loaded."
|
135
135
|
|
136
136
|
repo = modules_instance.find do |m|
|
137
|
-
|
137
|
+
Redcar.log.debug "SCM Checking if #{project.path} is a #{m.repository_type} repository..."
|
138
138
|
m.repository?(project.path)
|
139
139
|
end
|
140
140
|
|
141
141
|
# quit if we can't find something to handle this project
|
142
142
|
return if repo.nil?
|
143
143
|
|
144
|
-
|
144
|
+
Redcar.log.debug "SCM Yes it is!"
|
145
145
|
|
146
146
|
prepare(project, repo)
|
147
147
|
end
|
@@ -156,7 +156,7 @@ module Redcar
|
|
156
156
|
repo.load(project.path)
|
157
157
|
adapter = repo.adapter(project.adapter)
|
158
158
|
if not adapter.nil?
|
159
|
-
|
159
|
+
Redcar.log.debug "SCM Attaching a custom adapter to the project."
|
160
160
|
project.adapter = adapter
|
161
161
|
end
|
162
162
|
|
@@ -165,19 +165,19 @@ module Redcar
|
|
165
165
|
# cleanup
|
166
166
|
info = project_repositories.delete project
|
167
167
|
|
168
|
-
|
168
|
+
Redcar.log.error "*** Error loading SCM: " + $!.message
|
169
169
|
puts $!.backtrace
|
170
170
|
end
|
171
171
|
|
172
|
-
|
172
|
+
Redcar.log.debug "SCM start took #{Time.now - start}s"
|
173
173
|
end
|
174
174
|
|
175
|
-
def self.project_closed(project)
|
175
|
+
def self.project_closed(project,window)
|
176
176
|
# disassociate this project with any repositories
|
177
177
|
info = project_repositories.delete project
|
178
178
|
return if info.nil?
|
179
179
|
|
180
|
-
info['trees'].each {|t|
|
180
|
+
info['trees'].each {|t| window.treebook.remove_tree(t)}
|
181
181
|
end
|
182
182
|
|
183
183
|
def self.refresh_trees
|
@@ -191,7 +191,7 @@ module Redcar
|
|
191
191
|
# Search for the current project
|
192
192
|
project = Project::Manager.in_window(Redcar.app.focussed_window)
|
193
193
|
if project.nil?
|
194
|
-
|
194
|
+
Redcar.log.debug "SCM Couldn't detect the project in the current window."
|
195
195
|
end
|
196
196
|
repo_info = project_repositories[project]
|
197
197
|
init_modules = Redcar::Scm::Manager.modules_with_init
|
@@ -43,7 +43,7 @@ module Redcar
|
|
43
43
|
notify_listeners(:change)
|
44
44
|
end
|
45
45
|
|
46
|
-
class
|
46
|
+
class CommitChangesCommand < Command
|
47
47
|
sensitize :open_commit_tab
|
48
48
|
|
49
49
|
def execute
|
@@ -57,7 +57,7 @@ module Redcar
|
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
|
-
class
|
60
|
+
class CreateCommitCommand < Command
|
61
61
|
sensitize :open_scm
|
62
62
|
|
63
63
|
def execute
|
@@ -21,7 +21,7 @@ module Redcar
|
|
21
21
|
|
22
22
|
def activated(tree, node)
|
23
23
|
if node.respond_to?(:status) and node.status == [:unmerged]
|
24
|
-
Project::
|
24
|
+
Project::FileCreateCommitCommand.new(node.path).run
|
25
25
|
elsif node.respond_to?(:diff)
|
26
26
|
diff = node.diff
|
27
27
|
if diff
|
@@ -16,7 +16,7 @@ module Redcar
|
|
16
16
|
@text = text
|
17
17
|
end
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
20
|
def after_modify
|
21
21
|
if in_snippet? and @start_offset and !@constructing
|
22
22
|
left_marks = marks_at_offset(@start_offset)
|
@@ -53,25 +53,31 @@ module Redcar
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
56
|
-
if in_snippet?
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
56
|
+
if in_snippet?
|
57
|
+
if @end_offset
|
58
|
+
if @end_offset > @start_offset and !@ignore
|
59
|
+
update_after_delete(@start_offset, @end_offset)
|
60
|
+
end
|
61
|
+
if !@ignore and @start_offset
|
62
|
+
document.controllers(AutoPairer::DocumentController).first.ignore do
|
63
|
+
update_after_insert(@start_offset, @text.length)
|
64
|
+
end
|
65
|
+
@start_offset, @end_offset, @text = nil, nil, nil
|
66
|
+
end
|
67
|
+
else
|
68
|
+
clear_snippet
|
62
69
|
end
|
63
|
-
@start_offset, @end_offset, @text = nil, nil, nil
|
64
70
|
end
|
65
71
|
|
66
72
|
false
|
67
73
|
end
|
68
|
-
|
74
|
+
|
69
75
|
def cursor_moved(new_offset)
|
70
76
|
if @current_snippet and !@ignore
|
71
77
|
check_in_snippet
|
72
78
|
end
|
73
79
|
end
|
74
|
-
|
80
|
+
|
75
81
|
def start_snippet!(snippet)
|
76
82
|
@current_snippet = snippet
|
77
83
|
document.controllers(AutoPairer::DocumentController).first.ignore do
|
@@ -80,17 +86,17 @@ module Redcar
|
|
80
86
|
end
|
81
87
|
end
|
82
88
|
end
|
83
|
-
|
89
|
+
|
84
90
|
def in_snippet?
|
85
91
|
!!current_snippet
|
86
92
|
end
|
87
|
-
|
93
|
+
|
88
94
|
SnippetMark ||= Struct.new(:mark, :order_id, :stop_id)
|
89
|
-
|
95
|
+
|
90
96
|
class SnippetMark
|
91
97
|
attr_accessor :name
|
92
98
|
end
|
93
|
-
|
99
|
+
|
94
100
|
def insert_snippet(snippet)
|
95
101
|
@content = snippet.content
|
96
102
|
@insert_line_num = document.cursor_line
|
@@ -102,7 +108,7 @@ module Redcar
|
|
102
108
|
@marks = []
|
103
109
|
@order_id = 0
|
104
110
|
@stop_id = 0
|
105
|
-
|
111
|
+
|
106
112
|
@env = Textmate::Environment.new
|
107
113
|
fix_line_endings
|
108
114
|
# Not sure what to do about backticks. Currently they don't work in Redcar.
|
@@ -125,17 +131,17 @@ module Redcar
|
|
125
131
|
select_tab_stop(@tab_stops.keys.sort.first)
|
126
132
|
end
|
127
133
|
end
|
128
|
-
|
134
|
+
|
129
135
|
def leading_whitespace(line)
|
130
136
|
line[/^(\s*)([^\s]|$)/, 1].chomp
|
131
137
|
end
|
132
|
-
|
138
|
+
|
133
139
|
def fix_line_endings
|
134
140
|
if document.delim != "\n" # textmate uses "\n" everywhere
|
135
141
|
@content = @content.gsub("\n", document.delim)
|
136
142
|
end
|
137
143
|
end
|
138
|
-
|
144
|
+
|
139
145
|
def compute_tab_stop(line, tab_width, soft_tabs)
|
140
146
|
re = / {0,#{tab_width - 1}}\t|#{" "*tab_width}/
|
141
147
|
sc = StringScanner.new(leading_whitespace(line))
|
@@ -143,7 +149,7 @@ module Redcar
|
|
143
149
|
tab_stop += 1 while sc.skip(re)
|
144
150
|
tab_stop
|
145
151
|
end
|
146
|
-
|
152
|
+
|
147
153
|
def fix_indent
|
148
154
|
tab_width = document.edit_view.tab_width
|
149
155
|
soft_tabs = document.edit_view.soft_tabs?
|
@@ -163,7 +169,7 @@ module Redcar
|
|
163
169
|
document.delete(document.offset_at_line(line_ix) + new_indent.length, pre.length)
|
164
170
|
end
|
165
171
|
end
|
166
|
-
|
172
|
+
|
167
173
|
def unescape(text)
|
168
174
|
text.gsub("\\$", "$").gsub("\\\\", "\\").gsub("\\}", "}").gsub("\\`", "`")
|
169
175
|
end
|
@@ -172,7 +178,7 @@ module Redcar
|
|
172
178
|
document.insert_at_cursor(text)
|
173
179
|
document.cursor_offset += text.length
|
174
180
|
end
|
175
|
-
|
181
|
+
|
176
182
|
def check_in_snippet
|
177
183
|
clear_snippet unless find_current_tab_stop
|
178
184
|
end
|
@@ -184,7 +190,7 @@ module Redcar
|
|
184
190
|
while remaining_content.length > 0
|
185
191
|
i += 1
|
186
192
|
raise "Snippet failed to parse: #{text.inspect}" if i > 100
|
187
|
-
|
193
|
+
|
188
194
|
if md = Regexp.new("(?<!\\\\)\\$").match(remaining_content)
|
189
195
|
insert_at_cursor_with_gravity(unescape(md.pre_match))
|
190
196
|
@stop_id += 1
|
@@ -290,11 +296,11 @@ module Redcar
|
|
290
296
|
end
|
291
297
|
@end_line_num = document.cursor_line
|
292
298
|
end
|
293
|
-
|
299
|
+
|
294
300
|
def onig_split(string, re)
|
295
301
|
line = string.dup
|
296
302
|
bits = []
|
297
|
-
while line.length > 0 and
|
303
|
+
while line.length > 0 and
|
298
304
|
md = re.match(line)
|
299
305
|
line = md.post_match
|
300
306
|
bits << md.pre_match
|
@@ -328,26 +334,26 @@ module Redcar
|
|
328
334
|
@marks << snippet_mark
|
329
335
|
snippet_mark
|
330
336
|
end
|
331
|
-
|
337
|
+
|
332
338
|
def marks_at_cursor
|
333
339
|
marks_at_offset(document.cursor_offset)
|
334
340
|
end
|
335
|
-
|
341
|
+
|
336
342
|
def marks_at_offset(offset)
|
337
343
|
marks.select {|m| m.mark.get_offset == offset }
|
338
344
|
end
|
339
|
-
|
345
|
+
|
340
346
|
def marks
|
341
347
|
@marks
|
342
348
|
end
|
343
|
-
|
349
|
+
|
344
350
|
def update_after_insert(offset, length)
|
345
351
|
#@buf.parser.stop_parsing
|
346
352
|
update_mirrors(offset, offset+length)
|
347
353
|
update_transformations(offset, offset+length)
|
348
354
|
#@buf.parser.start_parsing
|
349
355
|
end
|
350
|
-
|
356
|
+
|
351
357
|
def update_after_delete(offset1, offset2)
|
352
358
|
#@buf.parser.stop_parsing
|
353
359
|
delete_any_mirrors(offset1, offset2)
|
@@ -355,7 +361,7 @@ module Redcar
|
|
355
361
|
update_transformations(offset1, offset2)
|
356
362
|
#@buf.parser.start_parsing
|
357
363
|
end
|
358
|
-
|
364
|
+
|
359
365
|
def delete_any_mirrors(offset1, offset2)
|
360
366
|
@mirrors.each do |num, mirrors|
|
361
367
|
(mirrors||[]).reject! do |mirror|
|
@@ -404,7 +410,7 @@ module Redcar
|
|
404
410
|
end
|
405
411
|
end
|
406
412
|
end
|
407
|
-
|
413
|
+
|
408
414
|
def set_names
|
409
415
|
@tab_stops.each do |i, h|
|
410
416
|
h[:leftmark].name = "$#{i}l"
|
@@ -423,12 +429,12 @@ module Redcar
|
|
423
429
|
end
|
424
430
|
end
|
425
431
|
end
|
426
|
-
|
432
|
+
|
427
433
|
def select_tab_stop(n)
|
428
|
-
document.set_selection_range(@tab_stops[n][:rightmark].mark.get_offset,
|
434
|
+
document.set_selection_range(@tab_stops[n][:rightmark].mark.get_offset,
|
429
435
|
@tab_stops[n][:leftmark].mark.get_offset)
|
430
436
|
end
|
431
|
-
|
437
|
+
|
432
438
|
def move_forward_tab_stop
|
433
439
|
current = find_current_tab_stop
|
434
440
|
raise "unexpectedly outside snippet" unless current
|
@@ -462,7 +468,7 @@ module Redcar
|
|
462
468
|
select_tab_stop(current-1)
|
463
469
|
end
|
464
470
|
end
|
465
|
-
|
471
|
+
|
466
472
|
def clear_snippet
|
467
473
|
@current_snippet = false
|
468
474
|
@word = nil
|
@@ -476,7 +482,7 @@ module Redcar
|
|
476
482
|
document.delete_mark(mark.mark)
|
477
483
|
end
|
478
484
|
end
|
479
|
-
|
485
|
+
|
480
486
|
def find_current_tab_stop
|
481
487
|
candidates = []
|
482
488
|
@tab_stops.each do |num, hash|
|
@@ -495,13 +501,13 @@ module Redcar
|
|
495
501
|
candidates.sort.first[1]
|
496
502
|
end
|
497
503
|
end
|
498
|
-
|
504
|
+
|
499
505
|
def get_tab_stop_range(num)
|
500
506
|
off1 = @tab_stops[num][:leftmark].mark.get_offset
|
501
507
|
off2 = @tab_stops[num][:rightmark].mark.get_offset
|
502
508
|
off1..off2
|
503
509
|
end
|
504
|
-
|
510
|
+
|
505
511
|
def get_tab_stop_text(num)
|
506
512
|
i1 = @tab_stops[num][:leftmark].mark.get_offset
|
507
513
|
i2 = @tab_stops[num][:rightmark].mark.get_offset
|
@@ -512,7 +518,7 @@ module Redcar
|
|
512
518
|
update_mirrors
|
513
519
|
update_transformations
|
514
520
|
end
|
515
|
-
|
521
|
+
|
516
522
|
def update_mirrors(start=nil, stop=nil)
|
517
523
|
@mirrors.each do |num, mirrors|
|
518
524
|
next unless mirrors
|
@@ -541,7 +547,7 @@ module Redcar
|
|
541
547
|
end
|
542
548
|
@editing_stop_id = nil
|
543
549
|
end
|
544
|
-
|
550
|
+
|
545
551
|
def update_transformations(start=nil, stop=nil)
|
546
552
|
@transformations.each do |num, transformations|
|
547
553
|
r = get_tab_stop_range(num)
|