redcar 0.7 → 0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +42 -0
- data/README.md +5 -3
- data/Rakefile +39 -81
- data/bin/redcar +1 -1
- data/lib/redcar.rb +9 -6
- data/lib/redcar/installer.rb +1 -1
- data/lib/redcar/ruby_extensions.rb +19 -0
- data/lib/redcar/runner.rb +1 -1
- data/lib/redcar/usage.rb +3 -0
- data/lib/redcar_quick_start.rb +11 -11
- data/plugins/application/features/step_definitions/tree_steps.rb +22 -5
- data/plugins/application/features/step_definitions/window_steps.rb +9 -1
- data/plugins/application/features/support/env.rb +5 -2
- data/plugins/application/lib/application.rb +51 -46
- data/plugins/application/lib/application/window.rb +60 -30
- data/plugins/application_swt/lib/application_swt.rb +16 -16
- data/plugins/application_swt/lib/application_swt/window.rb +35 -7
- data/plugins/auto_completer/features/support/env.rb +0 -2
- data/plugins/auto_indenter/features/support/env.rb +0 -1
- data/plugins/auto_pairer/features/auto_pairer.feature +50 -45
- data/plugins/auto_pairer/features/support/env.rb +0 -1
- data/plugins/auto_pairer/lib/auto_pairer/document_controller.rb +11 -6
- data/plugins/clipboard-viewer/Screenshot.png +0 -0
- data/plugins/clipboard-viewer/lib/clipboard_viewer.rb +50 -0
- data/plugins/clipboard-viewer/lib/clipboard_viewer/browser_controller.rb +27 -0
- data/plugins/clipboard-viewer/lib/clipboard_viewer/clipboard_bar.rb +67 -0
- data/plugins/clipboard-viewer/plugin.rb +9 -0
- data/plugins/clipboard-viewer/views/clipboard.html.erb +15 -0
- data/plugins/clipboard-viewer/views/default.css +43 -0
- data/plugins/clipboard-viewer/views/redcar_small_icon.png +0 -0
- data/plugins/comment/features/line_comment.feature +137 -0
- data/plugins/comment/features/selection_comment.feature +21 -0
- data/plugins/comment/features/step_definitions/comment_steps.rb +7 -0
- data/plugins/comment/lib/comment.rb +266 -0
- data/plugins/comment/plugin.rb +7 -0
- data/plugins/comment/vendor/comment_lib.json +47 -0
- data/plugins/declarations/lib/declarations.rb +1 -1
- data/plugins/document_search/features/replace.feature +10 -2
- data/plugins/document_search/features/support/env.rb +0 -1
- data/plugins/document_search/lib/document_search.rb +4 -1
- data/plugins/document_search/lib/document_search/replace.rb +11 -3
- data/plugins/document_search/lib/document_search/search_and_replace.rb +5 -2
- data/plugins/edit_view/features/case_change.feature +9 -9
- data/plugins/edit_view/features/cursor_navigation.feature +36 -0
- data/plugins/edit_view/features/step_definitions/editing_steps.rb +63 -8
- data/plugins/edit_view/features/step_definitions/notebook_steps.rb +2 -0
- data/plugins/edit_view/features/step_definitions/tab_steps.rb +8 -5
- data/plugins/edit_view/features/support/env.rb +8 -2
- data/plugins/edit_view/lib/edit_view.rb +16 -1
- data/plugins/edit_view/lib/edit_view/actions/cmd_enter.rb +11 -0
- data/plugins/edit_view/lib/edit_view/document.rb +27 -10
- data/plugins/edit_view/lib/edit_view/edit_tab.rb +17 -4
- data/plugins/edit_view/spec/edit_view/document_spec.rb +3 -0
- data/plugins/edit_view_swt/lib/edit_view_swt.rb +42 -3
- data/plugins/edit_view_swt/lib/edit_view_swt/word_movement.rb +17 -15
- data/plugins/help/lib/help.rb +40 -0
- data/plugins/help/plugin.rb +8 -0
- data/plugins/html_view/features/step_definitions/html_view_steps.rb +6 -4
- data/plugins/line_tools/features/support/env.rb +0 -1
- data/plugins/macros/features/step_definitions/macro_steps.rb +0 -55
- data/plugins/macros/features/support/env.rb +0 -2
- data/plugins/open_default_app/lib/open_default_app.rb +35 -0
- data/plugins/open_default_app/plugin.rb +8 -0
- data/plugins/open_default_app/screenshot.png +0 -0
- data/plugins/plugin_manager_ui/lib/plugin_manager_ui.rb +17 -3
- data/plugins/project/features/find_file.feature +3 -2
- data/plugins/project/features/highlight_focussed_tab.feature +8 -0
- data/plugins/project/features/move_and_rename_files.feature +25 -0
- data/plugins/project/features/open_and_save_files.feature +10 -1
- data/plugins/project/features/open_directory_tree.feature +32 -2
- data/plugins/project/features/step_definitions/directory_steps.rb +17 -0
- data/plugins/project/features/step_definitions/project_tree_steps.rb +3 -0
- data/plugins/project/features/sub_project.feature +14 -0
- data/plugins/project/features/support/env.rb +22 -3
- data/plugins/project/features/watch_for_modified_files.feature +32 -9
- data/plugins/project/lib/project.rb +53 -21
- data/plugins/project/lib/project/adapters/local.rb +21 -16
- data/plugins/project/lib/project/adapters/remote.rb +15 -13
- data/plugins/project/lib/project/commands.rb +37 -16
- data/plugins/project/lib/project/dir_controller.rb +41 -42
- data/plugins/project/lib/project/drb_service.rb +35 -21
- data/plugins/project/lib/project/file_list.rb +7 -1
- data/plugins/project/lib/project/manager.rb +28 -3
- data/plugins/project/lib/project/sub_project.rb +17 -0
- data/plugins/project/lib/project/support/recycle.js +2 -0
- data/plugins/project/lib/project/support/trash.rb +72 -0
- data/plugins/project/spec/fixtures/multi-byte-files/a/341/204/200/341/205/247/341/206/274/341/204/205/341/205/251/foo +1 -0
- data/plugins/project/spec/fixtures/multi-byte-files//341/204/220/341/205/246/341/204/211/341/205/263/341/204/220/341/205/263.py +1 -0
- data/plugins/project/spec/project/file_list_spec.rb +4 -0
- data/plugins/redcar/features/goto_line_command.feature +20 -0
- data/plugins/redcar/redcar.rb +107 -47
- data/plugins/repl/lib/repl.rb +20 -20
- data/plugins/repl/lib/repl/clojure_mirror.rb +50 -58
- data/plugins/repl/lib/repl/groovy_mirror.rb +22 -41
- data/plugins/repl/lib/repl/repl_mirror.rb +85 -14
- data/plugins/repl/lib/repl/ruby_mirror.rb +12 -39
- data/plugins/repl/spec/repl/groovy_mirror_spec.rb +1 -1
- data/plugins/repl/spec/repl/ruby_mirror_spec.rb +12 -12
- data/plugins/ruby/README +6 -0
- data/plugins/ruby/lib/syntax_check/ruby.rb +28 -0
- data/plugins/ruby/plugin.rb +7 -0
- data/plugins/runnables/features/command_tree.feature +9 -0
- data/plugins/runnables/features/file_runner_input.feature +20 -0
- data/plugins/runnables/features/run_alternate_command.feature +14 -0
- data/plugins/runnables/features/support/env.rb +42 -5
- data/plugins/runnables/lib/runnables.rb +67 -21
- data/plugins/runnables/lib/runnables/commands.rb +35 -18
- data/plugins/runnables/lib/runnables/tree_mirror/nodes/runnable_group.rb +23 -37
- data/plugins/runnables/lib/runnables/tree_mirror/nodes/runnable_type_group.rb +16 -18
- data/plugins/scm_svn/features/support/env.rb +0 -3
- data/plugins/snippets/features/snippets.feature +17 -2
- data/plugins/snippets/features/support/env.rb +0 -1
- data/plugins/snippets/lib/snippets/tab_handler.rb +51 -18
- data/plugins/swt/lib/swt/cucumber_patches.rb +13 -68
- data/plugins/swt/lib/swt/cucumber_runner.rb +2 -3
- data/plugins/syntax_check/README +6 -0
- data/plugins/syntax_check/lib/syntax_check.rb +16 -0
- data/plugins/syntax_check/lib/syntax_check/checker.rb +47 -0
- data/plugins/syntax_check/lib/syntax_check/error.rb +23 -0
- data/plugins/syntax_check/plugin.rb +7 -0
- data/plugins/tree_view_swt/lib/tree_view_swt.rb +6 -0
- data/plugins/web_bookmarks/Screenshot.png +0 -0
- data/plugins/web_bookmarks/lib/web_bookmarks.rb +42 -0
- data/plugins/web_bookmarks/lib/web_bookmarks/bookmark.rb +43 -0
- data/plugins/web_bookmarks/lib/web_bookmarks/browser_bar.rb +70 -0
- data/plugins/web_bookmarks/lib/web_bookmarks/commands.rb +111 -0
- data/plugins/web_bookmarks/lib/web_bookmarks/tree.rb +67 -0
- data/plugins/web_bookmarks/lib/web_bookmarks/view_controller.rb +22 -0
- data/plugins/web_bookmarks/plugin.rb +11 -0
- data/plugins/web_bookmarks/views/index.html.erb +5 -0
- metadata +60 -10
@@ -2,39 +2,17 @@ module Redcar
|
|
2
2
|
class Runnables
|
3
3
|
class RunnableGroup
|
4
4
|
include Redcar::Tree::Mirror::NodeMirror
|
5
|
+
attr_reader :text
|
5
6
|
|
6
|
-
def initialize(name,path,runnables)
|
7
|
-
@
|
8
|
-
@
|
9
|
-
|
10
|
-
|
11
|
-
type
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
@children << Runnable.new(runnable["name"],path,runnable)
|
16
|
-
elsif type.nil?
|
17
|
-
type = runnable["type"]
|
18
|
-
group << runnable
|
19
|
-
elsif type == runnable["type"]
|
20
|
-
group << runnable
|
21
|
-
end
|
22
|
-
if i == runnables.length - 1 or type != runnable["type"]
|
23
|
-
if type == name
|
24
|
-
group.each {|r| @children << Runnable.new(r["name"],path,r)}
|
25
|
-
else
|
26
|
-
type = type[name.length,type.length] if type =~ /^#{name}/
|
27
|
-
type = type[1,type.length] if type =~ /^\//
|
28
|
-
if type == ""
|
29
|
-
@children << Runnable.new(runnable["name"],path,runnable)
|
30
|
-
else
|
31
|
-
@children << RunnableTypeGroup.new(type,path,group) unless group.size == 0
|
32
|
-
end
|
33
|
-
end
|
34
|
-
type = runnable["type"]
|
35
|
-
group = [runnable]
|
36
|
-
end
|
37
|
-
i = i + 1
|
7
|
+
def initialize(name, path, runnables)
|
8
|
+
@text = name
|
9
|
+
@runnables = []
|
10
|
+
@subgroups = {}
|
11
|
+
runnables.each do |runnable|
|
12
|
+
if runnable["type"].nil? or runnable["type"].empty?
|
13
|
+
@runnables << Runnable.new(runnable["name"], path, runnable)
|
14
|
+
else
|
15
|
+
type_group(runnable["type"]).add_runnable Runnable.new(runnable["name"], path, runnable)
|
38
16
|
end
|
39
17
|
end
|
40
18
|
end
|
@@ -43,16 +21,24 @@ module Redcar
|
|
43
21
|
false
|
44
22
|
end
|
45
23
|
|
46
|
-
def text
|
47
|
-
@name
|
48
|
-
end
|
49
|
-
|
50
24
|
def icon
|
51
25
|
:file
|
52
26
|
end
|
53
27
|
|
28
|
+
# Sort the subgroups first, the runnables after that
|
54
29
|
def children
|
55
|
-
@children
|
30
|
+
@children ||= (@subgroups.sort_by(&:first).collect(&:last) + @runnables.sort_by(&:text))
|
31
|
+
end
|
32
|
+
|
33
|
+
# Return the type group that corresponds to the passed name-path, or self, if name is empty
|
34
|
+
# If a child with the specified path does not exist, create it and clear the children cache
|
35
|
+
def type_group(name)
|
36
|
+
names = name.split("/")
|
37
|
+
unless @subgroups[names.first]
|
38
|
+
@children = nil
|
39
|
+
@subgroups[names.first] = RunnableTypeGroup.new(names.first)
|
40
|
+
end
|
41
|
+
@subgroups[names.first].type_group(names[1..-1].join)
|
56
42
|
end
|
57
43
|
end
|
58
44
|
end
|
@@ -1,32 +1,30 @@
|
|
1
1
|
module Redcar
|
2
2
|
class Runnables
|
3
|
-
class RunnableTypeGroup
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
@
|
8
|
-
|
9
|
-
@children = runnables.map do |runnable|
|
10
|
-
Runnable.new(runnable["name"],path,runnable)
|
11
|
-
end
|
12
|
-
end
|
3
|
+
class RunnableTypeGroup < RunnableGroup
|
4
|
+
def initialize(name)
|
5
|
+
name_parts = name.split("/")
|
6
|
+
@text = name_parts.first
|
7
|
+
@runnables = []
|
8
|
+
@subgroups = {}
|
13
9
|
end
|
14
10
|
|
15
|
-
|
16
|
-
|
11
|
+
# Return the type group that corresponds to the passed name-path, or self, if name is empty
|
12
|
+
# If a child with the specified path does not exist, create it and clear the children cache
|
13
|
+
def type_group(name)
|
14
|
+
return super unless name.empty?
|
15
|
+
self
|
17
16
|
end
|
18
17
|
|
19
|
-
|
20
|
-
|
18
|
+
# Add a runnable to the children
|
19
|
+
# Tries to avoid re-building the children array
|
20
|
+
def add_runnable(runnable)
|
21
|
+
@children << runnable unless @children.nil?
|
22
|
+
return @runnables << runnable
|
21
23
|
end
|
22
24
|
|
23
25
|
def icon
|
24
26
|
File.join(Redcar::ICONS_DIRECTORY, "folder-open-small-gears.png")
|
25
27
|
end
|
26
|
-
|
27
|
-
def children
|
28
|
-
@children
|
29
|
-
end
|
30
28
|
end
|
31
29
|
end
|
32
30
|
end
|
@@ -1,6 +1,3 @@
|
|
1
|
-
RequireSupportFiles File.dirname(__FILE__) + "/../../../application/features/"
|
2
|
-
RequireSupportFiles File.dirname(__FILE__) + "/../../../project/features/"
|
3
|
-
RequireSupportFiles File.dirname(__FILE__) + "/../../../runnables/features/"
|
4
1
|
require File.join(Redcar.asset_dir, "svnkit")
|
5
2
|
require 'java'
|
6
3
|
import 'org.tmatesoft.svn.core.io.SVNRepositoryFactory'
|
@@ -13,6 +13,21 @@ Feature: Snippets
|
|
13
13
|
And I press the Tab key in the edit tab
|
14
14
|
Then the contents should be "Daniel Benjamin Lucraft<c>"
|
15
15
|
|
16
|
+
Scenario: Snippet text preceded by other characters and separated by non-word characters
|
17
|
+
Given there is a snippet with tab trigger "ewf" and scope "" and content
|
18
|
+
"""
|
19
|
+
Earth, Wind, and Fire
|
20
|
+
"""
|
21
|
+
When I replace the contents with "}}ewf<c>"
|
22
|
+
And I press the Tab key in the edit tab
|
23
|
+
Then the contents should be "}}Earth, Wind, and Fire<c>"
|
24
|
+
When I replace the contents with "(1,2,4)}}ewf<c>"
|
25
|
+
And I press the Tab key in the edit tab
|
26
|
+
Then the contents should be "(1,2,4)}}Earth, Wind, and Fire<c>"
|
27
|
+
When I replace the contents with "blank.test1.ewf<c>"
|
28
|
+
And I press the Tab key in the edit tab
|
29
|
+
Then the contents should be "blank.test1.Earth, Wind, and Fire<c>"
|
30
|
+
|
16
31
|
Scenario: Simple content snippet in plain text scope
|
17
32
|
Given there is a snippet with tab trigger "DBL" and scope "text.plain" and content
|
18
33
|
"""
|
@@ -75,7 +90,7 @@ Feature: Snippets
|
|
75
90
|
When I replace the contents with "if<c>"
|
76
91
|
And I press the Tab key in the edit tab
|
77
92
|
Then the contents should be "if <c>\n\t\nend"
|
78
|
-
|
93
|
+
|
79
94
|
Scenario: Escapes dollars
|
80
95
|
Given there is a snippet with tab trigger "DBL" and scope "text.plain" and content
|
81
96
|
"""
|
@@ -336,7 +351,7 @@ Feature: Snippets
|
|
336
351
|
Then the contents should be "def <s>fname<c> docstring for fname\"\"\"\n"
|
337
352
|
When I replace 4 to 9 with ""
|
338
353
|
Then the contents should be "def <c> docstring for \"\"\"\n"
|
339
|
-
|
354
|
+
|
340
355
|
Scenario: Abutting dollars 2
|
341
356
|
Given there is a snippet with tab trigger "def" and scope "text.plain" and content
|
342
357
|
"""
|
@@ -5,7 +5,7 @@ module Redcar
|
|
5
5
|
def self.priority
|
6
6
|
10
|
7
7
|
end
|
8
|
-
|
8
|
+
|
9
9
|
def self.handle(edit_view, modifiers)
|
10
10
|
controller = edit_view.document.controllers(Snippets::DocumentController).first
|
11
11
|
if controller.in_snippet?
|
@@ -23,31 +23,64 @@ module Redcar
|
|
23
23
|
find_snippet(edit_view)
|
24
24
|
end
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
27
|
def self.activate_snippet(edit_view, snippet)
|
28
28
|
controller = edit_view.document.controllers(Snippets::DocumentController).first
|
29
29
|
doc = edit_view.document
|
30
|
-
|
31
|
-
|
30
|
+
edit_view.compound do
|
31
|
+
doc.delete(doc.cursor_offset - snippet.tab_trigger.length, snippet.tab_trigger.length)
|
32
|
+
controller.start_snippet!(snippet)
|
33
|
+
end
|
32
34
|
end
|
33
|
-
|
35
|
+
|
34
36
|
# Decides whether a snippet can be inserted at this location. If so
|
35
37
|
# returns the snippet, if not returns false.
|
36
38
|
def self.find_snippet(edit_view)
|
37
39
|
document = edit_view.document
|
38
40
|
@word, @offset, @start_word_offset = nil, nil, nil
|
39
41
|
@word = word_before_cursor(edit_view)
|
40
|
-
|
41
42
|
if @word
|
42
43
|
@offset = document.cursor_offset
|
43
44
|
@start_word_offset = document.cursor_offset - @word.length
|
44
|
-
options =
|
45
|
+
options = find_snippet_options(document.cursor_scope, @word)
|
45
46
|
if options.any?
|
46
47
|
choose_snippet(edit_view, options)
|
47
48
|
end
|
48
49
|
end
|
49
50
|
end
|
50
|
-
|
51
|
+
|
52
|
+
#search for snippet matches inside a word block in an intelligent way
|
53
|
+
def self.find_snippet_options(scope,word)
|
54
|
+
search_word = word
|
55
|
+
options = search_registry(scope,word)
|
56
|
+
if not options.any? and word.match(/\W/) and word.match(/\w/)
|
57
|
+
|
58
|
+
#most likely, there is just one symbol preceding the snippet
|
59
|
+
if not options.any? and char = word.index(/\w/,word.index(/\W/))
|
60
|
+
search_word = word[char,word.split(//).length]
|
61
|
+
options = search_registry(scope, search_word)
|
62
|
+
end
|
63
|
+
|
64
|
+
#otherwise, search from the end
|
65
|
+
if not options.any?
|
66
|
+
offset = -1
|
67
|
+
while not options.any? and
|
68
|
+
(offset * -1) < word.split(//).length and
|
69
|
+
symbol_idx = word.rindex(/\W/,offset) and
|
70
|
+
char = word.index(/\w/,symbol_idx)
|
71
|
+
search_word = word[char,word.split(//).length]
|
72
|
+
options = search_registry(scope, search_word)
|
73
|
+
offset = offset - 1
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
options
|
78
|
+
end
|
79
|
+
|
80
|
+
def self.search_registry(scope,word)
|
81
|
+
Snippets.registry.find_by_scope_and_tab_trigger(scope,word)
|
82
|
+
end
|
83
|
+
|
51
84
|
def self.word_before_cursor(edit_view)
|
52
85
|
document = edit_view.document
|
53
86
|
line = document.get_slice(document.cursor_line_start_offset, document.cursor_offset).reverse
|
@@ -56,7 +89,7 @@ module Redcar
|
|
56
89
|
end
|
57
90
|
word
|
58
91
|
end
|
59
|
-
|
92
|
+
|
60
93
|
def self.choose_snippet(edit_view, snippets)
|
61
94
|
if not snippets or snippets.length == 0
|
62
95
|
false
|
@@ -64,18 +97,18 @@ module Redcar
|
|
64
97
|
activate_snippet(edit_view, snippets.first)
|
65
98
|
true
|
66
99
|
else
|
67
|
-
|
68
|
-
|
69
|
-
|
100
|
+
builder = Menu::Builder.new do
|
101
|
+
snippets.group_by {|s| s.bundle_name }.each do |_, bsnippets|
|
102
|
+
bsnippets.each_with_index do |snippet, i|
|
70
103
|
item(snippet.name||"<untitled>") do
|
71
|
-
Snippets::TabHandler.activate_snippet(edit_view, snippet)
|
104
|
+
Snippets::TabHandler.activate_snippet(edit_view, snippet)
|
72
105
|
end
|
73
|
-
|
74
|
-
|
106
|
+
end
|
107
|
+
separator
|
75
108
|
end
|
76
|
-
|
77
|
-
|
78
|
-
|
109
|
+
end
|
110
|
+
Redcar.app.focussed_window.popup_menu_with_numbers(builder.menu)
|
111
|
+
true
|
79
112
|
end
|
80
113
|
end
|
81
114
|
|
@@ -1,88 +1,33 @@
|
|
1
1
|
|
2
2
|
module Cucumber
|
3
3
|
module Ast
|
4
|
-
class StepInvocation #:nodoc:#
|
4
|
+
class StepInvocation #:nodoc:#
|
5
5
|
class << self
|
6
6
|
attr_accessor :wait_time
|
7
7
|
end
|
8
|
-
|
9
|
-
def invoke(step_mother, options)
|
10
|
-
block = Swt::RRunnable.new do
|
11
|
-
find_step_match!(step_mother)
|
12
|
-
unless @skip_invoke || options[:dry_run] || @exception || @step_collection.exception
|
13
|
-
@skip_invoke = true
|
14
|
-
begin
|
15
|
-
@step_match.invoke(@multiline_arg)
|
16
|
-
step_mother.after_step
|
17
|
-
status!(:passed)
|
18
|
-
rescue Pending => e
|
19
|
-
failed(options, e, false)
|
20
|
-
status!(:pending)
|
21
|
-
rescue Undefined => e
|
22
|
-
failed(options, e, false)
|
23
|
-
status!(:undefined)
|
24
|
-
rescue Exception => e
|
25
|
-
failed(options, e, false)
|
26
|
-
status!(:failed)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
Redcar::ApplicationSWT.display.syncExec(block)
|
32
8
|
|
33
|
-
|
34
|
-
|
35
|
-
|
9
|
+
def invoke_with_swt(step_mother, options)
|
10
|
+
block = Swt::RRunnable.new { invoke_without_swt(step_mother, options) }
|
11
|
+
|
12
|
+
Redcar::ApplicationSWT.display.syncExec(block)
|
13
|
+
sleep ENV["SLOW_CUKES"].to_f if ENV["SLOW_CUKES"]
|
36
14
|
sleep(Cucumber::Ast::StepInvocation.wait_time || 0)
|
37
15
|
Cucumber::Ast::StepInvocation.wait_time = nil
|
38
16
|
end
|
39
|
-
end
|
40
|
-
end
|
41
17
|
|
42
|
-
|
43
|
-
|
44
|
-
def require_support_files(path)
|
45
|
-
@step_mother.load_code_files(Cli::Configuration.code_files_in_paths([path]))
|
46
|
-
end
|
18
|
+
alias_method :invoke_without_swt, :invoke
|
19
|
+
alias_method :invoke, :invoke_with_swt
|
47
20
|
end
|
48
|
-
|
49
|
-
module RbDsl
|
50
|
-
def RequireSupportFiles(path)
|
51
|
-
RbDsl.require_support_files(path)
|
52
|
-
end
|
53
|
-
|
54
|
-
class << self
|
55
|
-
def require_support_files(path)
|
56
|
-
@rb_language.require_support_files(path)
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
21
|
end
|
62
|
-
|
22
|
+
|
63
23
|
module Cli
|
64
24
|
class Configuration
|
65
|
-
def
|
66
|
-
|
67
|
-
files = Configuration.code_files_in_paths(requires)
|
68
|
-
remove_excluded_files_from(files)
|
69
|
-
files
|
25
|
+
def require_dirs_with_redcar_plugins
|
26
|
+
require_dirs_without_redcar_plugins + Dir['plugins/*/features']
|
70
27
|
end
|
71
28
|
|
72
|
-
|
73
|
-
|
74
|
-
files = requires.map do |path|
|
75
|
-
path = path.gsub(/\\/, '/') # In case we're on windows. Globs don't work with backslashes.
|
76
|
-
path = path.gsub(/\/$/, '') # Strip trailing slash.
|
77
|
-
File.directory?(path) ? Dir["#{path}/**/*"] : path
|
78
|
-
end.flatten.uniq
|
79
|
-
files.map! {|f| File.expand_path(f) }
|
80
|
-
files.reject! {|f| !File.file?(f)}
|
81
|
-
files.reject! {|f| File.extname(f) == '.feature' }
|
82
|
-
files.reject! {|f| f =~ /^http/}
|
83
|
-
files
|
84
|
-
end
|
85
|
-
end
|
29
|
+
alias_method :require_dirs_without_redcar_plugins, :require_dirs
|
30
|
+
alias_method :require_dirs, :require_dirs_with_redcar_plugins
|
86
31
|
end
|
87
32
|
end
|
88
33
|
end
|
@@ -11,9 +11,8 @@ module Swt
|
|
11
11
|
begin
|
12
12
|
sleep START_DELAY
|
13
13
|
main = Cucumber::Cli::Main.new(args)
|
14
|
-
main.execute!
|
14
|
+
main.execute!
|
15
15
|
Redcar.app.quit
|
16
|
-
Redcar::ApplicationSWT.display.wake
|
17
16
|
rescue Object => e
|
18
17
|
puts e.message
|
19
18
|
puts e.backtrace
|
@@ -21,4 +20,4 @@ module Swt
|
|
21
20
|
end
|
22
21
|
end
|
23
22
|
end
|
24
|
-
end
|
23
|
+
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
== Abstract Syntax checking Redcar
|
2
|
+
|
3
|
+
Get redcar from github.com/redcar/redcar and do a git clone in your
|
4
|
+
$HOME/.redcar/plugins of this repository. You will also need a
|
5
|
+
concrete syntax checker for your language, Ruby is currently supported
|
6
|
+
in timfel/redcar_syntax_check_ruby
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'syntax_check/checker'
|
2
|
+
require 'syntax_check/error'
|
3
|
+
|
4
|
+
module Redcar
|
5
|
+
module SyntaxCheck
|
6
|
+
def self.remove_syntax_error_annotations(edit_view)
|
7
|
+
edit_view.remove_all_annotations :type => Error::Type
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.after_save(doc)
|
11
|
+
remove_syntax_error_annotations(doc.edit_view)
|
12
|
+
checker = Checker[doc.edit_view.grammar]
|
13
|
+
checker.new(doc).check if checker
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Redcar
|
2
|
+
module SyntaxCheck
|
3
|
+
class Checker
|
4
|
+
attr_reader :doc
|
5
|
+
|
6
|
+
def self.checkers
|
7
|
+
@checkers ||= {}
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.[] name
|
11
|
+
checkers[name]
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.supported_grammars(*names)
|
15
|
+
if names.any?
|
16
|
+
names.each {|g| Checker.checkers[g] = self }
|
17
|
+
@supported_grammars = supported_grammars + names
|
18
|
+
else
|
19
|
+
@supported_grammars ||= []
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def initialize(document)
|
24
|
+
@doc = document
|
25
|
+
end
|
26
|
+
|
27
|
+
def manifest_path(doc = @doc)
|
28
|
+
path = doc.path
|
29
|
+
unless path and File.exist? path
|
30
|
+
Tempfile.open(doc.title) do |f|
|
31
|
+
f << doc.get_all_text
|
32
|
+
path = f.path
|
33
|
+
end
|
34
|
+
end
|
35
|
+
path
|
36
|
+
end
|
37
|
+
|
38
|
+
def supported_grammars
|
39
|
+
raise NotImplementedError, "My subclass #{self.class.name} should have implemented check"
|
40
|
+
end
|
41
|
+
|
42
|
+
def check
|
43
|
+
raise NotImplementedError, "My subclass #{self.class.name} should have implemented check"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|