redcar 0.3.4.3 → 0.3.5
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 +45 -0
- data/README.md +2 -1
- data/ROADMAP.md +0 -1
- data/Rakefile +10 -4
- data/bin/redcar +2 -2
- data/lib/openssl/build.properties +7 -0
- data/lib/plugin_manager/lib/plugin_manager.rb +10 -0
- data/lib/plugin_manager/lib/plugin_manager/plugin_definition.rb +1 -13
- data/lib/redcar.rb +12 -8
- data/lib/redcar/installer.rb +16 -15
- data/lib/redcar/ruby_extensions.rb +146 -1
- data/lib/redcar/runner.rb +16 -7
- data/lib/redcar/usage.rb +4 -7
- data/lib/redcar_quick_start.rb +5 -5
- data/lib/regex_replace.rb +0 -7
- data/plugins/application/features/step_definitions/command_steps.rb +5 -0
- data/plugins/application/features/step_definitions/dialog_steps.rb +5 -0
- data/plugins/application/features/step_definitions/filter_list_dialog_steps.rb +38 -0
- data/plugins/application/features/step_definitions/window_steps.rb +1 -1
- data/plugins/application/features/support/env.rb +44 -8
- data/plugins/application/lib/application.rb +32 -33
- data/plugins/application/lib/application/command.rb +32 -2
- data/plugins/application/lib/application/command/executor.rb +2 -12
- data/plugins/application/lib/application/dialog.rb +14 -14
- data/plugins/application/lib/application/event_spewer.rb +32 -0
- data/plugins/application/lib/application/menu.rb +5 -5
- data/plugins/application/lib/application/menu/builder.rb +5 -0
- data/plugins/application/lib/application/menu/lazy_menu.rb +24 -0
- data/plugins/application/lib/application/notebook.rb +4 -3
- data/plugins/application/lib/application/tab.rb +6 -2
- data/plugins/application/lib/application/window.rb +8 -4
- data/plugins/application/spec/application/menu/builder_spec.rb +17 -1
- data/plugins/application/spec/application/notebook_spec.rb +1 -1
- data/plugins/application_swt/build.xml +74 -0
- data/plugins/application_swt/lib/application_swt.rb +79 -0
- data/plugins/application_swt/lib/application_swt/cucumber_patches.rb +6 -1
- data/plugins/application_swt/lib/application_swt/dialog_adapter.rb +25 -17
- data/plugins/application_swt/lib/application_swt/dialogs/filter_list_dialog_controller.rb +50 -12
- data/plugins/application_swt/lib/application_swt/html_tab.rb +20 -0
- data/plugins/application_swt/lib/application_swt/menu.rb +26 -2
- data/plugins/application_swt/lib/application_swt/notebook.rb +10 -12
- data/plugins/application_swt/lib/application_swt/window.rb +11 -11
- data/plugins/application_swt/src/com/redcareditor/application_swt/CocoaUIEnhancer.java +313 -0
- data/plugins/auto_completer/lib/auto_completer.rb +74 -67
- data/plugins/auto_completer/lib/auto_completer/current_document_completion_source.rb +19 -0
- data/plugins/auto_completer/lib/auto_completer/document_controller.rb +2 -2
- data/plugins/auto_completer/lib/auto_completer/word_list.rb +8 -1
- data/plugins/auto_indenter/features/ruby_style_indentation.feature +24 -0
- data/plugins/auto_indenter/features/step_definitions/indentation_steps.rb +6 -0
- data/plugins/auto_indenter/features/support/env.rb +2 -0
- data/plugins/auto_indenter/lib/auto_indenter.rb +86 -0
- data/plugins/auto_indenter/lib/auto_indenter/analyzer.rb +91 -0
- data/plugins/auto_indenter/lib/auto_indenter/commands.rb +34 -0
- data/plugins/auto_indenter/lib/auto_indenter/document_controller.rb +67 -12
- data/plugins/auto_indenter/lib/auto_indenter/rules.rb +41 -0
- data/plugins/auto_indenter/spec/auto_indenter/analyzer_spec.rb +151 -0
- data/plugins/auto_indenter/spec/spec_helper.rb +5 -0
- data/plugins/auto_pairer/lib/auto_pairer.rb +1 -0
- data/plugins/auto_pairer/lib/auto_pairer/document_controller.rb +43 -42
- data/plugins/auto_pairer/lib/auto_pairer/pairs_for_scope.rb +1 -5
- data/plugins/core/lib/core.rb +12 -1
- data/plugins/core/lib/core/observable.rb +7 -7
- data/plugins/core/lib/core/persistent_cache.rb +14 -2
- data/plugins/core/lib/core/plugin.rb +7 -0
- data/plugins/core/lib/core/resource.rb +78 -0
- data/plugins/core/lib/core/task.rb +62 -0
- data/plugins/core/lib/core/task_queue.rb +72 -0
- data/plugins/core/spec/core/resource_spec.rb +124 -0
- data/plugins/core/spec/core/task_queue_spec.rb +202 -0
- data/plugins/core/spec/spec_helper.rb +23 -1
- data/plugins/declarations/TODO +3 -0
- data/plugins/declarations/lib/declarations.rb +144 -0
- data/plugins/declarations/lib/declarations/completion_source.rb +22 -0
- data/plugins/declarations/lib/declarations/file.rb +68 -0
- data/plugins/declarations/lib/declarations/parser.rb +94 -0
- data/plugins/declarations/lib/declarations/select_tag_dialog.rb +44 -0
- data/plugins/declarations/plugin.rb +7 -0
- data/plugins/declarations/spec/declarations/file_spec.rb +62 -0
- data/plugins/declarations/spec/fixtures/federalist.rb +15 -0
- data/plugins/declarations/spec/spec_helper.rb +4 -0
- data/plugins/edit_view/features/indentation_commands.feature +40 -0
- data/plugins/edit_view/features/line_delimiter.feature +40 -0
- data/plugins/edit_view/features/step_definitions/editing_steps.rb +16 -4
- data/plugins/edit_view/features/step_definitions/notebook_steps.rb +1 -1
- data/plugins/edit_view/features/step_definitions/tab_steps.rb +1 -1
- data/plugins/edit_view/features/step_definitions/window_steps.rb +5 -1
- data/plugins/edit_view/features/support/env.rb +3 -5
- data/plugins/edit_view/features/undo_and_redo.feature +21 -0
- data/plugins/edit_view/lib/edit_view.rb +57 -4
- data/plugins/edit_view/lib/edit_view/actions/arrow_keys.rb +19 -3
- data/plugins/edit_view/lib/edit_view/document.rb +46 -11
- data/plugins/edit_view/lib/edit_view/document/indentation.rb +35 -0
- data/plugins/edit_view/lib/edit_view/modified_tabs_checker.rb +35 -0
- data/plugins/edit_view/lib/edit_view/tab_settings.rb +13 -3
- data/plugins/edit_view/spec/edit_view/document/indentation_spec.rb +112 -0
- data/plugins/edit_view/spec/edit_view/document_spec.rb +22 -0
- data/plugins/edit_view/spec/spec_helper.rb +1 -0
- data/plugins/edit_view_swt/lib/edit_view_swt.rb +59 -7
- data/plugins/edit_view_swt/lib/edit_view_swt/document.rb +3 -3
- data/plugins/edit_view_swt/lib/edit_view_swt/word_movement.rb +2 -2
- data/plugins/edit_view_swt/vendor/java-mateview.rb +3 -2
- data/plugins/encryption/encryption.rb +13 -6
- data/plugins/execute_current_tab/lib/execute_current_tab.rb +25 -15
- data/plugins/html_view/assets/redcar.css +32 -1
- data/plugins/html_view/lib/html_view.rb +23 -3
- data/plugins/html_view/lib/html_view/html_tab.rb +4 -0
- data/plugins/my_plugin/lib/my_plugin.rb +4 -12
- data/plugins/plugin_manager_ui/lib/plugin_manager_ui.rb +1 -0
- data/plugins/plugin_manager_ui/views/index.html.erb +30 -37
- data/plugins/project/features/find_file.feature +75 -0
- data/plugins/project/features/open_and_save_files.feature +7 -7
- data/plugins/project/features/open_directory_tree.feature +11 -3
- data/plugins/project/features/refresh_directory_tree.feature +7 -1
- data/plugins/project/features/step_definitions/directory_steps.rb +11 -1
- data/plugins/project/features/step_definitions/file_steps.rb +10 -0
- data/plugins/project/features/support/env.rb +6 -1
- data/plugins/project/features/watch_for_modified_files.feature +79 -0
- data/plugins/project/lib/project.rb +72 -306
- data/plugins/project/lib/project/commands.rb +128 -0
- data/plugins/project/lib/project/dir_mirror.rb +5 -1
- data/plugins/project/lib/project/drb_service.rb +21 -31
- data/plugins/project/lib/project/file_list.rb +76 -0
- data/plugins/project/lib/project/file_mirror.rb +13 -1
- data/plugins/project/lib/project/find_file_dialog.rb +22 -52
- data/plugins/project/lib/project/manager.rb +210 -0
- data/plugins/project/lib/project/recent_directories.rb +16 -3
- data/plugins/project/plugin.rb +1 -1
- data/plugins/project/spec/fixtures/myproject/README +2 -0
- data/plugins/project/spec/fixtures/myproject/lib/foo_lib.rb +1 -0
- data/plugins/project/spec/fixtures/myproject/spec/foo_spec.rb +1 -0
- data/plugins/project/{features → spec}/fixtures/winter.txt +0 -0
- data/plugins/project/spec/project/dir_mirror_spec.rb +1 -12
- data/plugins/project/spec/project/file_list_spec.rb +140 -0
- data/plugins/project/spec/spec_helper.rb +20 -0
- data/plugins/redcar/plugin.rb +1 -0
- data/plugins/redcar/redcar.rb +254 -84
- data/plugins/redcar_debug/lib/redcar_debug.rb +58 -11
- data/plugins/redcar_debug/vendor/jruby-prof/README +46 -0
- data/plugins/redcar_debug/vendor/jruby-prof/Rakefile +36 -0
- data/plugins/redcar_debug/vendor/jruby-prof/build.xml +31 -0
- data/plugins/redcar_debug/vendor/jruby-prof/example/call_tree.html +22677 -0
- data/plugins/redcar_debug/vendor/jruby-prof/example/call_tree.txt +589 -0
- data/plugins/redcar_debug/vendor/jruby-prof/example/flat.txt +28 -0
- data/plugins/redcar_debug/vendor/jruby-prof/example/graph.html +1670 -0
- data/plugins/redcar_debug/vendor/jruby-prof/example/graph.txt +125 -0
- data/plugins/redcar_debug/vendor/jruby-prof/example/pidigits.rb +92 -0
- data/plugins/redcar_debug/vendor/jruby-prof/example/test.rb +28 -0
- data/plugins/redcar_debug/vendor/jruby-prof/example/test2.rb +29 -0
- data/plugins/redcar_debug/vendor/jruby-prof/example/test_exception.rb +28 -0
- data/plugins/redcar_debug/vendor/jruby-prof/example/test_overhead.rb +43 -0
- data/plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof.rb +66 -0
- data/plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/abstract_printer.rb +21 -0
- data/plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/flat_text_printer.rb +35 -0
- data/plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/graph_html_printer.rb +123 -0
- data/plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/graph_text_printer.rb +45 -0
- data/plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/invocation_set.rb +34 -0
- data/plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/method.rb +107 -0
- data/plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/profile_invocation.rb +43 -0
- data/plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/simple_tree_printer.rb +27 -0
- data/plugins/redcar_debug/vendor/jruby-prof/lib/jruby-prof/tree_html_printer.rb +144 -0
- data/plugins/redcar_debug/vendor/jruby-prof/src/org/jruby/prof/Invocation.java +14 -0
- data/plugins/redcar_debug/vendor/jruby-prof/src/org/jruby/prof/JRubyProf.java +94 -0
- data/plugins/redcar_debug/vendor/jruby-prof/src/org/jruby/prof/ProfEventHook.java +49 -0
- data/plugins/redcar_debug/vendor/jruby-prof/templates/graph_row.html.erb +18 -0
- data/plugins/redcar_debug/vendor/jruby-prof/test/basic_test.rb +291 -0
- data/plugins/redcar_debug/views/history.html.erb +33 -0
- data/plugins/redcar_debug/views/index.html.erb +33 -0
- data/plugins/repl/lib/repl/internal_mirror.rb +3 -15
- data/plugins/repl/spec/repl/internal_mirror_spec.rb +2 -2
- data/plugins/snippets/lib/snippets.rb +0 -1
- data/plugins/snippets/lib/snippets/document_controller.rb +7 -1
- data/plugins/task_manager/lib/task_manager.rb +28 -0
- data/plugins/task_manager/plugin.rb +11 -0
- data/plugins/task_manager/views/index.html.erb +67 -0
- data/plugins/textmate/lib/textmate.rb +17 -21
- data/plugins/textmate/lib/textmate/plist.rb +1 -2
- data/plugins/textmate/lib/textmate/preference.rb +5 -1
- data/plugins/textmate/lib/textmate/snippet.rb +6 -1
- data/plugins/tree_view_swt/lib/tree_view_swt.rb +0 -6
- data/textmate/Bundles/Cucumber.tmbundle/Preferences/Comments.tmPreferences +1 -1
- data/textmate/Bundles/Cucumber.tmbundle/Preferences/next_Cucumber_Plain_Text_Feature_Completions.tmPreferences +30 -0
- data/textmate/Bundles/Cucumber.tmbundle/Preferences/next_Symbol_list___Scenario.tmPreferences +19 -0
- data/textmate/Bundles/Cucumber.tmbundle/Syntaxes/next_Cucumber_Plain_Text_Feature.tmLanguage +221 -0
- data/textmate/Bundles/Cucumber.tmbundle/Syntaxes/next_Cucumber_Steps.tmLanguage +424 -0
- data/textmate/Bundles/Cucumber.tmbundle/Syntaxes/plaintext_template.erb +19 -77
- data/textmate/Bundles/Cucumber.tmbundle/info.plist +1 -20
- data/textmate/Bundles/Perl.tmbundle/Syntaxes/Perl.plist +1 -1
- data/textmate/Themes/Emacs Strict.tmTheme +241 -0
- data/textmate/Themes/IR_White.tmTheme +792 -0
- data/textmate/Themes/Monokai.tmTheme +291 -0
- data/textmate/Themes/WhysPoignant.tmTheme +191 -0
- metadata +92 -7
- data/plugins/application/features/main_window.feature +0 -8
- data/plugins/project/lib/project/project_command.rb +0 -5
- data/textmate/Bundles/Cucumber.tmbundle/Snippets/Scenario.tmSnippet +0 -22
- data/textmate/Bundles/Cucumber.tmbundle/Snippets/Story.tmSnippet +0 -25
|
@@ -57,9 +57,9 @@ module Redcar
|
|
|
57
57
|
def replace(offset, length, text)
|
|
58
58
|
@model.verify_text(offset, offset+length, text)
|
|
59
59
|
jface_document.replace(offset, length, text)
|
|
60
|
-
if length > text.length
|
|
61
|
-
|
|
62
|
-
end
|
|
60
|
+
#if length > text.length
|
|
61
|
+
# @swt_mate_document.mateText.redraw
|
|
62
|
+
#end
|
|
63
63
|
@model.modify_text
|
|
64
64
|
end
|
|
65
65
|
|
|
@@ -9,7 +9,7 @@ module Redcar
|
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
def get_next_offset(e)
|
|
12
|
-
if
|
|
12
|
+
if [Swt::SWT::MOVEMENT_WORD, Swt::SWT::MOVEMENT_WORD_END].include? e.movement
|
|
13
13
|
e.newOffset = next_offset(e.offset, e.lineOffset, e.lineText)
|
|
14
14
|
# SWT gets pissy without this:
|
|
15
15
|
if e.newOffset == e.lineOffset + e.lineText.length + 1
|
|
@@ -36,7 +36,7 @@ module Redcar
|
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
def get_previous_offset(e)
|
|
39
|
-
if
|
|
39
|
+
if [Swt::SWT::MOVEMENT_WORD, Swt::SWT::MOVEMENT_WORD_START].include? e.movement
|
|
40
40
|
e.newOffset = previous_offset(e.offset, e.lineOffset, e.lineText)
|
|
41
41
|
# SWT gets pissy without this:
|
|
42
42
|
if e.newOffset == e.lineOffset - 1
|
|
@@ -6,6 +6,7 @@ module JavaMateView
|
|
|
6
6
|
import com.redcareditor.mate.Grammar
|
|
7
7
|
import com.redcareditor.mate.MateText
|
|
8
8
|
import com.redcareditor.mate.Parser
|
|
9
|
+
import com.redcareditor.mate.ParserScheduler
|
|
9
10
|
import com.redcareditor.mate.Pattern
|
|
10
11
|
import com.redcareditor.mate.Scope
|
|
11
12
|
import com.redcareditor.mate.ScopeMatcher
|
|
@@ -26,9 +27,9 @@ module JavaMateView
|
|
|
26
27
|
end
|
|
27
28
|
|
|
28
29
|
def delay_parsing
|
|
29
|
-
parser.deactivate
|
|
30
|
+
parser.parserScheduler.deactivate
|
|
30
31
|
yield
|
|
31
|
-
parser.reactivate
|
|
32
|
+
parser.parserScheduler.reactivate
|
|
32
33
|
end
|
|
33
34
|
end
|
|
34
35
|
end
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
require 'openssl'
|
|
3
|
-
require File.dirname(__FILE__) + "/jarmor-1.1"
|
|
4
|
-
require File.dirname(__FILE__) + "/ezcrypto"
|
|
5
2
|
|
|
6
3
|
module Encryption
|
|
7
4
|
def self.menus
|
|
@@ -15,21 +12,31 @@ module Encryption
|
|
|
15
12
|
end
|
|
16
13
|
end
|
|
17
14
|
|
|
15
|
+
def self.lazy_load
|
|
16
|
+
$:.push File.expand_path(File.join(Redcar.root, "openssl", "lib"))
|
|
17
|
+
require 'openssl'
|
|
18
|
+
|
|
19
|
+
require File.dirname(__FILE__) + "/jarmor-1.1"
|
|
20
|
+
require File.dirname(__FILE__) + "/ezcrypto"
|
|
21
|
+
end
|
|
22
|
+
|
|
18
23
|
class DecryptDocumentCommand < Redcar::EditTabCommand
|
|
19
24
|
def execute
|
|
20
|
-
|
|
25
|
+
Encryption.lazy_load
|
|
26
|
+
result = Redcar::Application::Dialog.input("Password", "Enter password")
|
|
21
27
|
pw = result[:value]
|
|
22
28
|
begin
|
|
23
29
|
doc.text = EncryptionTools.dearmour_and_decrypt(doc.to_s, pw)
|
|
24
30
|
rescue => e
|
|
25
|
-
Redcar::Application::Dialog.message_box(
|
|
31
|
+
Redcar::Application::Dialog.message_box("Couldn't decrypt!", :type => :error)
|
|
26
32
|
end
|
|
27
33
|
end
|
|
28
34
|
end
|
|
29
35
|
|
|
30
36
|
class EncryptDocumentCommand < Redcar::EditTabCommand
|
|
31
37
|
def execute
|
|
32
|
-
|
|
38
|
+
Encryption.lazy_load
|
|
39
|
+
result = Redcar::Application::Dialog.input("Password", "Enter password")
|
|
33
40
|
pw = result[:value]
|
|
34
41
|
doc.text = EncryptionTools.encrypt_and_armour(doc.to_s, pw)
|
|
35
42
|
end
|
|
@@ -19,33 +19,43 @@ module Redcar
|
|
|
19
19
|
}]
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
-
class Execute <
|
|
22
|
+
class Execute < EditTabCommand
|
|
23
23
|
|
|
24
24
|
def execute
|
|
25
|
-
|
|
26
|
-
path = doc.path if doc
|
|
25
|
+
path = doc.path
|
|
27
26
|
if path
|
|
28
|
-
|
|
29
|
-
out = `#{command}`
|
|
30
|
-
new_tab = Top::NewCommand.new.run
|
|
31
|
-
new_tab.document.text = "***** generated output from #{command} ***\n" + out
|
|
32
|
-
new_tab.title= 'exec output'
|
|
27
|
+
execute_file(path)
|
|
33
28
|
else
|
|
34
|
-
|
|
29
|
+
path = File.join(Redcar.tmp_dir, "execute_file.rb")
|
|
30
|
+
File.open(path, "w") { |file| file.puts doc.to_s }
|
|
31
|
+
execute_file(path)
|
|
32
|
+
FileUtils.rm(path)
|
|
35
33
|
end
|
|
36
34
|
end
|
|
37
35
|
|
|
36
|
+
def execute_file(path)
|
|
37
|
+
command = "ruby \"#{path}\" 2>&1"
|
|
38
|
+
output = `#{command}`
|
|
39
|
+
new_tab = Top::NewCommand.new.run
|
|
40
|
+
title = "Output from #{command}"
|
|
41
|
+
new_tab.document.text = title + "\n" + "="*title.length + "\n\n" + output
|
|
42
|
+
new_tab.title = 'Output'
|
|
43
|
+
end
|
|
38
44
|
end
|
|
39
45
|
|
|
40
|
-
class EmbeddedExecute <
|
|
46
|
+
class EmbeddedExecute < EditTabCommand
|
|
41
47
|
|
|
42
48
|
def execute
|
|
43
|
-
|
|
44
|
-
out = doc.get_all_text if doc
|
|
49
|
+
out = doc.get_all_text
|
|
45
50
|
if out
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
51
|
+
begin
|
|
52
|
+
eval(out, TOPLEVEL_BINDING, doc.path || doc.title || '')
|
|
53
|
+
rescue Object => e
|
|
54
|
+
Application::Dialog.message_box(
|
|
55
|
+
"#{e.class}\n#{e.message}",
|
|
56
|
+
:type => :error )
|
|
57
|
+
|
|
58
|
+
end
|
|
49
59
|
end
|
|
50
60
|
end
|
|
51
61
|
|
|
@@ -9,4 +9,35 @@ td.plugin {
|
|
|
9
9
|
|
|
10
10
|
td.links {
|
|
11
11
|
text-align: right;
|
|
12
|
-
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
body {
|
|
15
|
+
font-family: sans-serif;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
h1, h2, h3, h4, h5 {
|
|
19
|
+
border-bottom: 1px solid black;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
table {
|
|
23
|
+
border-collapse: collapse;
|
|
24
|
+
font-size: 0.8em;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
th {
|
|
28
|
+
padding: 7px 12px;
|
|
29
|
+
border: 1px solid #bbb;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
td {
|
|
33
|
+
padding: 7px 12px;
|
|
34
|
+
border: 1px solid #bbb;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
tr.error {
|
|
38
|
+
background-color: #FCC;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
tr.cancelled {
|
|
42
|
+
background-color: #EEE;
|
|
43
|
+
}
|
|
@@ -7,6 +7,7 @@ module Redcar
|
|
|
7
7
|
|
|
8
8
|
def initialize(html_tab)
|
|
9
9
|
@html_tab = html_tab
|
|
10
|
+
@html_tab.add_listener(:controller_action, &method(:controller_action))
|
|
10
11
|
end
|
|
11
12
|
|
|
12
13
|
def controller=(new_controller)
|
|
@@ -14,9 +15,28 @@ module Redcar
|
|
|
14
15
|
@html_tab.title = controller.title
|
|
15
16
|
func = RubyFunc.new(@html_tab.controller.browser, "rubyCall")
|
|
16
17
|
func.controller = @controller
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
controller_action("index")
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def controller_action(action_name, path=nil)
|
|
22
|
+
action_method_arity = controller.method(action_name).arity
|
|
23
|
+
begin
|
|
24
|
+
text = if action_method_arity == 0
|
|
25
|
+
controller.send(action_name)
|
|
26
|
+
elsif action_method_arity == 1
|
|
27
|
+
controller.send(action_name, path)
|
|
28
|
+
end
|
|
29
|
+
rescue => e
|
|
30
|
+
text = <<-HTML
|
|
31
|
+
Sorry, there was an error.<br />
|
|
32
|
+
#{e.message}
|
|
33
|
+
HTML
|
|
34
|
+
end
|
|
35
|
+
@html_tab.controller.browser.set_text(text + setup_javascript_listeners)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def contents=(source)
|
|
39
|
+
@html_tab.controller.browser.set_text(source)
|
|
20
40
|
end
|
|
21
41
|
|
|
22
42
|
private
|
|
@@ -20,7 +20,7 @@ module Redcar
|
|
|
20
20
|
# Example command: showing a dialog box.
|
|
21
21
|
class HelloWorldCommand < Redcar::Command
|
|
22
22
|
def execute
|
|
23
|
-
Application::Dialog.message_box(
|
|
23
|
+
Application::Dialog.message_box("Hello World!")
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
26
|
|
|
@@ -28,19 +28,11 @@ module Redcar
|
|
|
28
28
|
# and open this file.
|
|
29
29
|
class EditMyPluginCommand < Redcar::Command
|
|
30
30
|
def execute
|
|
31
|
-
#
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
# Create a new Tree. Tree's have mirrors for displaying data and controllers
|
|
35
|
-
# for reacting to events.
|
|
36
|
-
tree = Tree.new(Project::DirMirror.new(File.join(Redcar.root, "plugins", "my_plugin")),
|
|
37
|
-
Project::DirController.new)
|
|
38
|
-
|
|
39
|
-
# Open the tree in the new window.
|
|
40
|
-
Project.open_tree(new_window, tree)
|
|
31
|
+
# Open the project in a new window
|
|
32
|
+
Project::Manager.open_project_for_path("plugins/my_plugin")
|
|
41
33
|
|
|
42
34
|
# Create a new edittab
|
|
43
|
-
tab =
|
|
35
|
+
tab = Redcar.app.focussed_window.new_tab(Redcar::EditTab)
|
|
44
36
|
|
|
45
37
|
# A FileMirror's job is to wrap up the file in an interface that the Document understands.
|
|
46
38
|
mirror = Project::FileMirror.new(File.join(Redcar.root, "plugins", "my_plugin", "lib", "my_plugin.rb"))
|
|
@@ -40,6 +40,7 @@ module Redcar
|
|
|
40
40
|
def plugin_table(plugins)
|
|
41
41
|
str = "<table>\n"
|
|
42
42
|
highlight = true
|
|
43
|
+
plugins = plugins.sort_by {|pl| pl.name.downcase }
|
|
43
44
|
plugins.each do |plugin|
|
|
44
45
|
name = plugin.is_a?(PluginManager::PluginDefinition) ? plugin.name : plugin
|
|
45
46
|
str << "<tr class=\"#{highlight ? "grey" : ""}\">"
|
|
@@ -1,40 +1,33 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
} catch(e) {
|
|
32
|
-
alert(e.message);
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
</script>
|
|
36
|
-
</div>
|
|
37
|
-
</div>
|
|
1
|
+
<h3>Plugin Manager</h3>
|
|
2
|
+
|
|
3
|
+
<% jquery_path = File.expand_path(File.join(Redcar.root, %w(plugins html_view assets jquery-1.4.min.js))) %>
|
|
4
|
+
<script type="text/javascript" src="file://<%= jquery_path %>"></script>
|
|
5
|
+
<% redcar_css = File.expand_path(File.join(Redcar.root, %w(plugins html_view assets redcar.css))) %>
|
|
6
|
+
<link rel="stylesheet" href="file://<%= redcar_css %>" type="text/css" media="screen">
|
|
7
|
+
|
|
8
|
+
<h4>Loaded Plugins</h4>
|
|
9
|
+
<%= plugin_table(Redcar.plugin_manager.loaded_plugins) %>
|
|
10
|
+
|
|
11
|
+
<h4>Unloaded Plugins</h4>
|
|
12
|
+
<%= plugin_table(Redcar.plugin_manager.unloaded_plugins) %>
|
|
13
|
+
|
|
14
|
+
<h4>Unreadable definitions</h4>
|
|
15
|
+
<%= plugin_table(Redcar.plugin_manager.unreadable_definitions) %>
|
|
16
|
+
|
|
17
|
+
<h4>Plugins with Errors</h4>
|
|
18
|
+
<%= plugin_table(Redcar.plugin_manager.plugins_with_errors) %>
|
|
19
|
+
|
|
20
|
+
<script language="javascript">
|
|
21
|
+
$("a").click(function(e) {
|
|
22
|
+
e.preventDefault();
|
|
23
|
+
var pluginName = $(this).parent().parent().find(".plugin-name").text();
|
|
24
|
+
try {
|
|
25
|
+
Controller.reloadPlugin(pluginName);
|
|
26
|
+
} catch(e) {
|
|
27
|
+
alert(e.message);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
</script>
|
|
38
31
|
|
|
39
32
|
|
|
40
33
|
<script type="text/javascript">
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
Feature: Find file
|
|
2
|
+
|
|
3
|
+
Background:
|
|
4
|
+
Given I will choose "plugins/project/spec/fixtures/myproject" from the "open_directory" dialog
|
|
5
|
+
When I open a directory
|
|
6
|
+
|
|
7
|
+
Scenario: No files initially and with nothing typed
|
|
8
|
+
When I run the command Redcar::Project::FindFileCommand
|
|
9
|
+
Then there should be a filter dialog open
|
|
10
|
+
And the filter dialog should have no entries
|
|
11
|
+
|
|
12
|
+
Scenario: No matching files
|
|
13
|
+
When I run the command Redcar::Project::FindFileCommand
|
|
14
|
+
And I set the filter to "xxx"
|
|
15
|
+
And I wait "0.4" seconds
|
|
16
|
+
Then the filter dialog should have 0 entries
|
|
17
|
+
|
|
18
|
+
Scenario: One matching file
|
|
19
|
+
When I run the command Redcar::Project::FindFileCommand
|
|
20
|
+
And I set the filter to "foo_spec"
|
|
21
|
+
And I wait "0.4" seconds
|
|
22
|
+
Then the filter dialog should have 1 entry
|
|
23
|
+
And I should see "foo_spec.rb (myproject/spec)" at 0 the filter dialog
|
|
24
|
+
|
|
25
|
+
Scenario: Two matching files
|
|
26
|
+
When I run the command Redcar::Project::FindFileCommand
|
|
27
|
+
And I set the filter to "foo"
|
|
28
|
+
And I wait "0.4" seconds
|
|
29
|
+
Then the filter dialog should have 2 entries
|
|
30
|
+
And I should see "foo_lib.rb (myproject/lib)" at 0 the filter dialog
|
|
31
|
+
And I should see "foo_spec.rb (myproject/spec)" at 1 the filter dialog
|
|
32
|
+
|
|
33
|
+
Scenario: One matching file with arbitrary letters
|
|
34
|
+
When I run the command Redcar::Project::FindFileCommand
|
|
35
|
+
And I set the filter to "fsc"
|
|
36
|
+
And I wait "0.4" seconds
|
|
37
|
+
Then the filter dialog should have 1 entry
|
|
38
|
+
And I should see "foo_spec.rb (myproject/spec)" at 0 the filter dialog
|
|
39
|
+
|
|
40
|
+
Scenario: Open a file
|
|
41
|
+
When I run the command Redcar::Project::FindFileCommand
|
|
42
|
+
And I set the filter to "fsc"
|
|
43
|
+
And I wait "0.4" seconds
|
|
44
|
+
And I select in the filter dialog
|
|
45
|
+
Then there should be no filter dialog open
|
|
46
|
+
And I should see "foo spec" in the edit tab
|
|
47
|
+
|
|
48
|
+
Scenario: Open a file then see the file in the initial list
|
|
49
|
+
When I run the command Redcar::Project::FindFileCommand
|
|
50
|
+
And I set the filter to "fsc"
|
|
51
|
+
And I wait "0.4" seconds
|
|
52
|
+
And I select in the filter dialog
|
|
53
|
+
And I run the command Redcar::Project::FindFileCommand
|
|
54
|
+
Then the filter dialog should have 1 entry
|
|
55
|
+
And I should see "foo_spec.rb (myproject/spec)" at 0 the filter dialog
|
|
56
|
+
|
|
57
|
+
Scenario: Open two files then see the files in the initial list
|
|
58
|
+
When I have opened "plugins/project/spec/fixtures/myproject/spec/foo_spec.rb"
|
|
59
|
+
And I have opened "plugins/project/spec/fixtures/myproject/lib/foo_lib.rb"
|
|
60
|
+
And I run the command Redcar::Project::FindFileCommand
|
|
61
|
+
Then the filter dialog should have 2 entries
|
|
62
|
+
And I should see "foo_spec.rb (myproject/spec)" at 0 the filter dialog
|
|
63
|
+
And I should see "foo_lib.rb (myproject/lib)" at 1 the filter dialog
|
|
64
|
+
|
|
65
|
+
Scenario: Open three files then see the files in the initial list
|
|
66
|
+
When I have opened "plugins/project/spec/fixtures/myproject/spec/foo_spec.rb"
|
|
67
|
+
And I have opened "plugins/project/spec/fixtures/myproject/lib/foo_lib.rb"
|
|
68
|
+
And I have opened "plugins/project/spec/fixtures/myproject/README"
|
|
69
|
+
And I run the command Redcar::Project::FindFileCommand
|
|
70
|
+
Then the filter dialog should have 3 entries
|
|
71
|
+
And I should see "foo_lib.rb (myproject/lib)" at 0 the filter dialog
|
|
72
|
+
And I should see "foo_spec.rb (myproject/spec)" at 1 the filter dialog
|
|
73
|
+
And I should see "README (fixtures/myproject)" at 2 the filter dialog
|
|
74
|
+
|
|
75
|
+
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Feature: Open and save files
|
|
2
2
|
|
|
3
3
|
Scenario: Open a file
|
|
4
|
-
Given I will choose "plugins/project/
|
|
4
|
+
Given I will choose "plugins/project/spec/fixtures/winter.txt" from the "open_file" dialog
|
|
5
5
|
When I open a file
|
|
6
6
|
Then there should be one edit tab
|
|
7
7
|
And I should see "Wintersmith" in the edit tab
|
|
8
8
|
|
|
9
9
|
Scenario: Opening an already open file focusses the edit tab
|
|
10
|
-
Given I will choose "plugins/project/
|
|
10
|
+
Given I will choose "plugins/project/spec/fixtures/winter.txt" from the "open_file" dialog
|
|
11
11
|
When I open a file
|
|
12
12
|
And I open a new edit tab
|
|
13
13
|
And I replace the contents with "Jenny Green Eyes"
|
|
@@ -16,16 +16,16 @@ Feature: Open and save files
|
|
|
16
16
|
And I should see "Wintersmith" in the edit tab
|
|
17
17
|
|
|
18
18
|
Scenario: Save a file
|
|
19
|
-
Given I have opened "plugins/project/
|
|
19
|
+
Given I have opened "plugins/project/spec/fixtures/winter.txt"
|
|
20
20
|
When I replace the contents with "Hi!"
|
|
21
21
|
And I save the tab
|
|
22
|
-
Then the file "plugins/project/
|
|
22
|
+
Then the file "plugins/project/spec/fixtures/winter.txt" should contain "Hi!"
|
|
23
23
|
And I should see "Hi!" in the edit tab
|
|
24
24
|
|
|
25
25
|
Scenario: Save a file As
|
|
26
|
-
Given I have opened "plugins/project/
|
|
27
|
-
And I will choose "plugins/project/
|
|
26
|
+
Given I have opened "plugins/project/spec/fixtures/winter.txt"
|
|
27
|
+
And I will choose "plugins/project/spec/fixtures/winter2.txt" from the "save_file" dialog
|
|
28
28
|
And I save the tab as
|
|
29
|
-
Then the file "plugins/project/
|
|
29
|
+
Then the file "plugins/project/spec/fixtures/winter2.txt" should contain "Wintersmith"
|
|
30
30
|
And I should see "Wintersmith" in the edit tab
|
|
31
31
|
|