redcar 0.6.1 → 0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +26 -0
- data/README.md +17 -31
- data/Rakefile +1 -1
- data/bin/redcar +1 -1
- data/lib/redcar.rb +8 -4
- data/lib/redcar/installer.rb +2 -1
- data/plugins/application/features/step_definitions/dialog_steps.rb +5 -0
- data/plugins/application/features/step_definitions/tree_steps.rb +1 -1
- data/plugins/application/features/support/env.rb +38 -17
- data/plugins/application/lib/application.rb +4 -0
- data/plugins/application/lib/application/command.rb +8 -2
- data/plugins/application/lib/application/command/executor.rb +37 -8
- data/plugins/application/lib/application/command/history.rb +3 -3
- data/plugins/application/lib/application/menu.rb +4 -0
- data/plugins/application/lib/application/menu/item.rb +9 -1
- data/plugins/application/lib/application/tab.rb +11 -0
- data/plugins/application/spec/application/command/executor_spec.rb +3 -3
- data/plugins/application/spec/application/command_spec.rb +24 -0
- data/plugins/application/spec/spec_helper.rb +1 -0
- data/plugins/application_swt/lib/application_swt.rb +27 -24
- data/plugins/application_swt/lib/application_swt/dialog_adapter.rb +4 -33
- data/plugins/application_swt/lib/application_swt/dialogs/input_dialog.rb +46 -0
- data/plugins/application_swt/lib/application_swt/dialogs/text_and_file_dialog.rb +118 -0
- data/plugins/application_swt/lib/application_swt/icon.rb +37 -0
- data/plugins/application_swt/lib/application_swt/menu.rb +8 -3
- data/plugins/application_swt/lib/application_swt/tab.rb +6 -3
- data/plugins/application_swt/lib/application_swt/treebook.rb +29 -31
- data/plugins/application_swt/lib/swt/graphics_utils.rb +170 -0
- data/plugins/application_swt/lib/swt/vtab_folder.rb +125 -0
- data/plugins/application_swt/lib/swt/vtab_item.rb +69 -0
- data/plugins/application_swt/lib/swt/vtab_label.rb +84 -0
- data/plugins/auto_indenter/lib/auto_indenter.rb +4 -2
- data/plugins/core/lib/core/controller.rb +18 -0
- data/plugins/declarations/lib/declarations.rb +1 -1
- data/plugins/document_search/lib/document_search.rb +8 -6
- data/plugins/document_search/lib/document_search/replace.rb +51 -31
- data/plugins/document_search/lib/document_search/search_and_replace.rb +12 -11
- data/plugins/edit_view/features/step_definitions/editing_steps.rb +33 -17
- data/plugins/edit_view/lib/edit_view.rb +100 -21
- data/plugins/edit_view/lib/edit_view/actions/arrow_keys.rb +34 -11
- data/plugins/edit_view/lib/edit_view/actions/deletion.rb +10 -0
- data/plugins/edit_view/lib/edit_view/command.rb +5 -1
- data/plugins/edit_view/lib/edit_view/document.rb +8 -3
- data/plugins/edit_view/lib/edit_view/document/command.rb +15 -1
- data/plugins/edit_view/lib/edit_view/document/controller.rb +9 -0
- data/plugins/edit_view/lib/edit_view/document/history.rb +41 -0
- data/plugins/edit_view/lib/edit_view/tab_settings.rb +1 -11
- data/plugins/edit_view_swt/lib/edit_view_swt.rb +150 -4
- data/plugins/edit_view_swt/lib/edit_view_swt/document.rb +1 -1
- data/plugins/edit_view_swt/vendor/java-mateview.rb +1 -1
- data/plugins/find-in-project/lib/find_in_project.rb +7 -5
- data/plugins/html_view/features/step_definitions/html_view_steps.rb +2 -2
- data/plugins/line_tools/features/step_definitions/line_tools_steps.rb +0 -1
- data/plugins/line_tools/lib/line_tools.rb +7 -9
- data/plugins/macros/features/block_selection_in_macros.feature +48 -0
- data/plugins/macros/features/predictive_macros.feature +79 -0
- data/plugins/macros/features/record_and_run_macro.feature +87 -0
- data/plugins/macros/features/step_definitions/macro_steps.rb +66 -0
- data/plugins/macros/features/step_definitions/prediction_steps.rb +8 -0
- data/plugins/macros/features/support/env.rb +2 -0
- data/plugins/macros/lib/macros.rb +167 -0
- data/plugins/macros/lib/macros/action_sequence.rb +30 -0
- data/plugins/macros/lib/macros/commands.rb +108 -0
- data/plugins/macros/lib/macros/macro.rb +37 -0
- data/plugins/macros/lib/macros/manager_controller.rb +67 -0
- data/plugins/macros/lib/macros/predictive/document_controller.rb +69 -0
- data/plugins/macros/lib/macros/predictive/sequence_finder.rb +112 -0
- data/plugins/macros/plugin.rb +9 -0
- data/plugins/macros/spec/macros/predictive/sequence_finder_spec.rb +142 -0
- data/plugins/macros/spec/spec_helper.rb +6 -0
- data/plugins/macros/views/macro_manager.html.erb +86 -0
- data/plugins/outline_view/lib/outline_view.rb +1 -1
- data/plugins/project/lib/project/commands.rb +2 -2
- data/plugins/redcar/redcar.rb +37 -46
- data/plugins/repl/lib/repl.rb +4 -4
- data/plugins/runnables/features/command_tree.feature +1 -1
- data/plugins/runnables/features/parameter_input.feature +42 -0
- data/plugins/runnables/features/step_definitions/runnable_steps.rb +6 -0
- data/plugins/runnables/features/support/env.rb +28 -8
- data/plugins/runnables/lib/runnables.rb +35 -206
- data/plugins/runnables/lib/runnables/commands.rb +65 -0
- data/plugins/runnables/lib/runnables/tree_mirror/nodes/runnable.rb +62 -0
- data/plugins/runnables/lib/runnables/tree_mirror/nodes/runnable_group.rb +59 -0
- data/plugins/runnables/lib/runnables/tree_mirror/nodes/runnable_type_group.rb +32 -0
- data/plugins/runnables/lib/runnables/tree_mirror/tree_controller.rb +41 -0
- data/plugins/runnables/lib/runnables/tree_mirror/tree_mirror.rb +61 -0
- data/plugins/scm/lib/scm.rb +78 -45
- data/plugins/scm/lib/scm/commands.rb +18 -4
- data/plugins/scm/lib/scm/model.rb +54 -41
- data/plugins/scm_svn/LICENSE +48 -0
- data/plugins/scm_svn/features/add_and_commit.feature +18 -0
- data/plugins/scm_svn/features/checkout.feature +5 -0
- data/plugins/scm_svn/features/edit_and_index.feature +12 -0
- data/plugins/scm_svn/features/ignore_files.feature +14 -0
- data/plugins/scm_svn/features/merge.feature +34 -0
- data/plugins/scm_svn/features/resolve_conflict.feature +23 -0
- data/plugins/scm_svn/features/revert_and_delete.feature +21 -0
- data/plugins/scm_svn/features/step_definitions/branch_and_merge_steps.rb +27 -0
- data/plugins/scm_svn/features/step_definitions/checkout_steps.rb +25 -0
- data/plugins/scm_svn/features/step_definitions/edit_and_index_steps.rb +50 -0
- data/plugins/scm_svn/features/step_definitions/scm_svn_steps.rb +57 -0
- data/plugins/scm_svn/features/support/env.rb +74 -0
- data/plugins/scm_svn/features/switch_branches.feature +53 -0
- data/plugins/scm_svn/features/update.feature +16 -0
- data/plugins/scm_svn/lib/scm_svn.rb +423 -9
- data/plugins/scm_svn/lib/scm_svn/change.rb +116 -0
- data/plugins/swt/lib/swt.rb +0 -15
- data/plugins/swt/lib/swt/cucumber_patches.rb +2 -37
- data/plugins/swt/lib/swt/cucumber_runner.rb +1 -0
- data/plugins/swt/lib/swt/full_swt.rb +2 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Clojure.tmbundle/Syntaxes/Clojure.tmLanguage +14 -2
- data/plugins/todo_list/lib/todo_list/todo_controller.rb +1 -1
- data/plugins/todo_list/views/default.css +50 -0
- data/plugins/todo_list/views/index.html.erb +5 -16
- data/plugins/todo_list/views/redcar_small_icon.png +0 -0
- data/plugins/tree_view_swt/lib/tree_view_swt.rb +14 -33
- data/plugins/view_shortcuts/views/default.css +31 -0
- data/plugins/view_shortcuts/views/index.html.erb +26 -16
- data/plugins/view_shortcuts/views/redcar_small_icon.png +0 -0
- data/{plugins/runnables → share}/icons/cog.png +0 -0
- data/share/icons/folder-gear-emblem.png +0 -0
- data/share/icons/folder-gear.png +0 -0
- data/share/icons/folder-open-small-gears.png +0 -0
- metadata +59 -5
@@ -1,18 +1,38 @@
|
|
1
1
|
require 'runnables/command_output_controller'
|
2
|
-
require 'runnables/
|
2
|
+
require 'runnables/commands'
|
3
3
|
require 'runnables/output_processor'
|
4
|
+
require 'runnables/running_process_checker'
|
5
|
+
require 'runnables/tree_mirror/nodes/runnable'
|
6
|
+
require 'runnables/tree_mirror/nodes/runnable_group'
|
7
|
+
require 'runnables/tree_mirror/nodes/runnable_type_group'
|
8
|
+
require 'runnables/tree_mirror/tree_controller'
|
9
|
+
require 'runnables/tree_mirror/tree_mirror'
|
4
10
|
|
5
11
|
module Redcar
|
6
12
|
class Runnables
|
7
13
|
TREE_TITLE = "Runnables"
|
14
|
+
PARAMS = "__PARAMS__"
|
15
|
+
DISPLAY_PARAMS = "__?__"
|
16
|
+
DISPLAY_NEXT_PARAMS = "_____"
|
8
17
|
|
9
18
|
def self.run_process(path, command, title, output = "tab")
|
19
|
+
window = Redcar.app.focussed_window
|
20
|
+
while command.include?(PARAMS)
|
21
|
+
msg = command.sub(PARAMS,DISPLAY_PARAMS)
|
22
|
+
msg = msg.gsub(PARAMS,DISPLAY_NEXT_PARAMS)
|
23
|
+
msg = "" if msg == DISPLAY_PARAMS
|
24
|
+
msg_title = "Enter Command Parameters"
|
25
|
+
out = Redcar::Application::Dialog.input(msg_title,msg)
|
26
|
+
params = out[:value] || ""
|
27
|
+
return if out[:button] == :cancel
|
28
|
+
command = command.sub(PARAMS,params)
|
29
|
+
end
|
10
30
|
if Runnables.storage['save_project_before_running'] == true
|
11
|
-
|
31
|
+
window.notebooks.each do |notebook|
|
12
32
|
notebook.tabs.each do |tab|
|
13
33
|
case tab
|
14
34
|
when EditTab
|
15
|
-
tab.edit_view.document.save!
|
35
|
+
tab.edit_view.document.save! if tab.edit_view.document.modified?
|
16
36
|
end
|
17
37
|
end
|
18
38
|
end
|
@@ -28,13 +48,13 @@ module Redcar
|
|
28
48
|
if output == "window"
|
29
49
|
Redcar.app.new_window
|
30
50
|
end
|
31
|
-
tab =
|
51
|
+
tab = window.new_tab(HtmlTab)
|
32
52
|
tab.html_view.controller = controller
|
33
53
|
tab.focus
|
34
54
|
end
|
35
55
|
end
|
36
56
|
end
|
37
|
-
|
57
|
+
|
38
58
|
def self.previous_tab_for(command)
|
39
59
|
Redcar.app.all_tabs.detect do |t|
|
40
60
|
t.respond_to?(:html_view) &&
|
@@ -61,61 +81,21 @@ module Redcar
|
|
61
81
|
end
|
62
82
|
end
|
63
83
|
end
|
64
|
-
|
65
|
-
def self.toolbars
|
66
|
-
ToolBar::Builder.build do
|
67
|
-
item "Runnables", :command => Runnables::ShowRunnables, :icon => File.join(File.dirname(__FILE__),"/../icons/cog.png"), :barname => :runnables
|
68
|
-
item "Run Tab", :command => Runnables::RunEditTabCommand, :icon => File.join(Redcar::ICONS_DIRECTORY, "control.png"), :barname => :runnables
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
class TreeMirror
|
73
|
-
include Redcar::Tree::Mirror
|
74
|
-
|
75
|
-
attr_accessor :last_loaded
|
76
84
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
@project.config_files("runnables/*.json")
|
83
|
-
end
|
84
|
-
|
85
|
-
def last_updated
|
86
|
-
runnable_file_paths.map{ |p| File.mtime(p) }.max
|
87
|
-
end
|
88
|
-
|
89
|
-
def changed?
|
90
|
-
!last_loaded || last_loaded < last_updated
|
91
|
-
end
|
92
|
-
|
93
|
-
def load
|
94
|
-
groups = {}
|
95
|
-
runnable_file_paths.each do |path|
|
96
|
-
runnables = []
|
97
|
-
name = File.basename(path,".json")
|
98
|
-
json = File.read(path)
|
99
|
-
this_runnables = JSON(json)["commands"]
|
100
|
-
runnables += this_runnables || []
|
101
|
-
groups[name.to_s] = runnables.to_a
|
102
|
-
end
|
103
|
-
|
104
|
-
if groups.any?
|
105
|
-
groups.map do |name, runnables|
|
106
|
-
RunnableGroup.new(name,runnables)
|
85
|
+
def self.runnables_context_menus(node)
|
86
|
+
Menu::Builder.build do
|
87
|
+
if not node.nil? and node.is_a?(Runnable)
|
88
|
+
item("Run with parameters") do
|
89
|
+
AppendParamsAndRunCommand.new(node).run
|
107
90
|
end
|
108
|
-
else
|
109
|
-
[HelpItem.new]
|
110
91
|
end
|
111
92
|
end
|
93
|
+
end
|
112
94
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
def top
|
118
|
-
load
|
95
|
+
def self.toolbars
|
96
|
+
ToolBar::Builder.build do
|
97
|
+
item "Runnables", :command => Runnables::ShowRunnables, :icon => File.join(Redcar::ICONS_DIRECTORY,"cog.png"), :barname => :project
|
98
|
+
item "Run Tab", :command => Runnables::RunEditTabCommand, :icon => File.join(Redcar::ICONS_DIRECTORY, "control.png"), :barname => :project
|
119
99
|
end
|
120
100
|
end
|
121
101
|
|
@@ -126,156 +106,5 @@ module Redcar
|
|
126
106
|
storage
|
127
107
|
end
|
128
108
|
end
|
129
|
-
|
130
|
-
class RunnableGroup
|
131
|
-
include Redcar::Tree::Mirror::NodeMirror
|
132
|
-
|
133
|
-
def initialize(name,runnables)
|
134
|
-
@name = name
|
135
|
-
if runnables.any?
|
136
|
-
@children = runnables.map do |runnable|
|
137
|
-
Runnable.new(runnable["name"], runnable)
|
138
|
-
end
|
139
|
-
end
|
140
|
-
end
|
141
|
-
|
142
|
-
def leaf?
|
143
|
-
false
|
144
|
-
end
|
145
|
-
|
146
|
-
def text
|
147
|
-
@name
|
148
|
-
end
|
149
|
-
|
150
|
-
def icon
|
151
|
-
:file
|
152
|
-
end
|
153
|
-
|
154
|
-
def children
|
155
|
-
@children
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
|
-
class HelpItem
|
160
|
-
include Redcar::Tree::Mirror::NodeMirror
|
161
|
-
|
162
|
-
def text
|
163
|
-
"No runnables (HELP)"
|
164
|
-
end
|
165
|
-
end
|
166
|
-
|
167
|
-
class Runnable
|
168
|
-
include Redcar::Tree::Mirror::NodeMirror
|
169
|
-
|
170
|
-
def initialize(name, info)
|
171
|
-
@name = name
|
172
|
-
@info = info
|
173
|
-
end
|
174
|
-
|
175
|
-
def text
|
176
|
-
@name
|
177
|
-
end
|
178
|
-
|
179
|
-
def leaf?
|
180
|
-
@info["command"]
|
181
|
-
end
|
182
|
-
|
183
|
-
def icon
|
184
|
-
if leaf?
|
185
|
-
File.dirname(__FILE__) + "/../icons/cog.png"
|
186
|
-
else
|
187
|
-
:directory
|
188
|
-
end
|
189
|
-
end
|
190
|
-
|
191
|
-
def children
|
192
|
-
[]
|
193
|
-
end
|
194
|
-
|
195
|
-
def command
|
196
|
-
@info["command"]
|
197
|
-
end
|
198
|
-
|
199
|
-
def out?
|
200
|
-
@info["output"]
|
201
|
-
end
|
202
|
-
|
203
|
-
def output
|
204
|
-
if out?
|
205
|
-
@info["output"]
|
206
|
-
else
|
207
|
-
"tab"
|
208
|
-
end
|
209
|
-
end
|
210
|
-
end
|
211
|
-
|
212
|
-
class TreeController
|
213
|
-
include Redcar::Tree::Controller
|
214
|
-
|
215
|
-
def initialize(project)
|
216
|
-
@project = project
|
217
|
-
end
|
218
|
-
|
219
|
-
def activated(tree, node)
|
220
|
-
case node
|
221
|
-
when Runnable
|
222
|
-
Runnables.run_process(@project.home_dir, node.command, node.text, node.output)
|
223
|
-
when HelpItem
|
224
|
-
tab = Redcar.app.focussed_window.new_tab(HtmlTab)
|
225
|
-
tab.go_to_location("http://wiki.github.com/danlucraft/redcar/users-guide-runnables")
|
226
|
-
tab.title = "Runnables Help"
|
227
|
-
tab.focus
|
228
|
-
end
|
229
|
-
end
|
230
|
-
end
|
231
|
-
|
232
|
-
class ShowRunnables < Redcar::Command
|
233
|
-
sensitize :open_project
|
234
|
-
def execute
|
235
|
-
if tree = win.treebook.trees.detect {|tree| tree.tree_mirror.title == TREE_TITLE }
|
236
|
-
tree.refresh
|
237
|
-
win.treebook.focus_tree(tree)
|
238
|
-
else
|
239
|
-
project = Project::Manager.in_window(win)
|
240
|
-
tree = Tree.new(
|
241
|
-
TreeMirror.new(project),
|
242
|
-
TreeController.new(project)
|
243
|
-
)
|
244
|
-
win.treebook.add_tree(tree)
|
245
|
-
end
|
246
|
-
end
|
247
|
-
end
|
248
|
-
|
249
|
-
class RunEditTabCommand < Redcar::EditTabCommand
|
250
|
-
def file_mappings
|
251
|
-
project = Project::Manager.in_window(win)
|
252
|
-
runnable_file_paths = project.config_files("runnables/*.json")
|
253
|
-
|
254
|
-
file_runners = []
|
255
|
-
runnable_file_paths.each do |path|
|
256
|
-
json = File.read(path)
|
257
|
-
this_file_runners = JSON(json)["file_runners"]
|
258
|
-
file_runners += this_file_runners || []
|
259
|
-
end
|
260
|
-
file_runners
|
261
|
-
end
|
262
|
-
|
263
|
-
def execute
|
264
|
-
project = Project::Manager.in_window(win)
|
265
|
-
file_mappings.each do |file_mapping|
|
266
|
-
regex = Regexp.new(file_mapping["regex"])
|
267
|
-
if tab.edit_view.document.mirror.path =~ regex
|
268
|
-
command_schema = file_mapping["command"]
|
269
|
-
output = file_mapping["output"]
|
270
|
-
if output.nil?
|
271
|
-
output = "tab"
|
272
|
-
end
|
273
|
-
path = tab.edit_view.document.mirror.path
|
274
|
-
command = command_schema.gsub("__PATH__", path)
|
275
|
-
Runnables.run_process(project.home_dir,command, "Running #{File.basename(path)}", output)
|
276
|
-
end
|
277
|
-
end
|
278
|
-
end
|
279
|
-
end
|
280
109
|
end
|
281
110
|
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
|
2
|
+
module Redcar
|
3
|
+
class Runnables
|
4
|
+
class AppendParamsAndRunCommand < Redcar::Command
|
5
|
+
def initialize(node)
|
6
|
+
@node = node
|
7
|
+
end
|
8
|
+
|
9
|
+
def execute
|
10
|
+
command = @node.command
|
11
|
+
command = "#{command} #{PARAMS}" unless command =~ /#{PARAMS}$/
|
12
|
+
Runnables.run_process(@node.path, command, @node.text, @node.output)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class ShowRunnables < Redcar::Command
|
17
|
+
sensitize :open_project
|
18
|
+
def execute
|
19
|
+
if tree = win.treebook.trees.detect {|tree| tree.tree_mirror.title == TREE_TITLE }
|
20
|
+
tree.refresh
|
21
|
+
win.treebook.focus_tree(tree)
|
22
|
+
else
|
23
|
+
project = Project::Manager.in_window(win)
|
24
|
+
tree = Tree.new(
|
25
|
+
TreeMirror.new(project),
|
26
|
+
TreeController.new(project)
|
27
|
+
)
|
28
|
+
win.treebook.add_tree(tree)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
class RunEditTabCommand < Redcar::EditTabCommand
|
34
|
+
def file_mappings
|
35
|
+
project = Project::Manager.in_window(win)
|
36
|
+
runnable_file_paths = project.config_files("runnables/*.json")
|
37
|
+
|
38
|
+
file_runners = []
|
39
|
+
runnable_file_paths.each do |path|
|
40
|
+
json = File.read(path)
|
41
|
+
this_file_runners = JSON(json)["file_runners"]
|
42
|
+
file_runners += this_file_runners || []
|
43
|
+
end
|
44
|
+
file_runners
|
45
|
+
end
|
46
|
+
|
47
|
+
def execute
|
48
|
+
project = Project::Manager.in_window(win)
|
49
|
+
file_mappings.each do |file_mapping|
|
50
|
+
regex = Regexp.new(file_mapping["regex"])
|
51
|
+
if tab.edit_view.document.mirror.path =~ regex
|
52
|
+
command_schema = file_mapping["command"]
|
53
|
+
output = file_mapping["output"]
|
54
|
+
if output.nil?
|
55
|
+
output = "tab"
|
56
|
+
end
|
57
|
+
path = tab.edit_view.document.mirror.path
|
58
|
+
command = command_schema.gsub("__PATH__", path)
|
59
|
+
Runnables.run_process(project.home_dir,command, "Running #{File.basename(path)}", output)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
module Redcar
|
2
|
+
class Runnables
|
3
|
+
|
4
|
+
class HelpItem
|
5
|
+
include Redcar::Tree::Mirror::NodeMirror
|
6
|
+
|
7
|
+
def text
|
8
|
+
"No runnables (HELP)"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
class Runnable
|
13
|
+
include Redcar::Tree::Mirror::NodeMirror
|
14
|
+
|
15
|
+
def initialize(name,path,info)
|
16
|
+
@name = name
|
17
|
+
@info = info
|
18
|
+
@path = path
|
19
|
+
end
|
20
|
+
|
21
|
+
def text
|
22
|
+
@name
|
23
|
+
end
|
24
|
+
|
25
|
+
def path
|
26
|
+
@path
|
27
|
+
end
|
28
|
+
|
29
|
+
def tooltip_text
|
30
|
+
@info["description"] || ""
|
31
|
+
end
|
32
|
+
|
33
|
+
def leaf?
|
34
|
+
@info["command"]
|
35
|
+
end
|
36
|
+
|
37
|
+
def icon
|
38
|
+
File.join(Redcar::ICONS_DIRECTORY, "cog.png")
|
39
|
+
end
|
40
|
+
|
41
|
+
def children
|
42
|
+
[]
|
43
|
+
end
|
44
|
+
|
45
|
+
def command
|
46
|
+
@info["command"]
|
47
|
+
end
|
48
|
+
|
49
|
+
def out?
|
50
|
+
@info["output"]
|
51
|
+
end
|
52
|
+
|
53
|
+
def output
|
54
|
+
if out?
|
55
|
+
@info["output"]
|
56
|
+
else
|
57
|
+
"tab"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
module Redcar
|
2
|
+
class Runnables
|
3
|
+
class RunnableGroup
|
4
|
+
include Redcar::Tree::Mirror::NodeMirror
|
5
|
+
|
6
|
+
def initialize(name,path,runnables)
|
7
|
+
@children = []
|
8
|
+
@name = name
|
9
|
+
if runnables.any?
|
10
|
+
group = []
|
11
|
+
type = nil
|
12
|
+
i = 0
|
13
|
+
runnables.map.sort_by{|r|r["type"]||""}.each do |runnable|
|
14
|
+
if runnable["type"] == nil or runnable["type"] == ""
|
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
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def leaf?
|
43
|
+
false
|
44
|
+
end
|
45
|
+
|
46
|
+
def text
|
47
|
+
@name
|
48
|
+
end
|
49
|
+
|
50
|
+
def icon
|
51
|
+
:file
|
52
|
+
end
|
53
|
+
|
54
|
+
def children
|
55
|
+
@children
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|