plugins/runnables/lib/runnables.rb in redcar-0.5.6dev vs plugins/runnables/lib/runnables.rb in redcar-0.6
- old
+ new
@@ -1,9 +1,5 @@
-
-require File.dirname(__FILE__) + "/../vendor/session/lib/session"
-Session.use_open4 = true
-
require 'runnables/command_output_controller'
require 'runnables/running_process_checker'
require 'runnables/output_processor'
module Redcar
@@ -21,11 +17,11 @@
end
end
end
controller = CommandOutputController.new(path, command, title)
if output == "none"
- controller.run
+ controller.run
else
if tab = previous_tab_for(command)
tab.html_view.controller.run
tab.focus
else
@@ -33,11 +29,11 @@
Redcar.app.new_window
end
tab = Redcar.app.focussed_window.new_tab(HtmlTab)
tab.html_view.controller = controller
tab.focus
- end
+ end
end
end
def self.previous_tab_for(command)
Redcar.app.all_tabs.detect do |t|
@@ -54,20 +50,27 @@
[map, map]
end
def self.menus
Menu::Builder.build do
- sub_menu "Project", :priority => 15 do
+ sub_menu "Project" do
group(:priority => 15) {
separator
item "Runnables", Runnables::ShowRunnables
item "Run Tab", Runnables::RunEditTabCommand
}
end
end
end
+ def self.toolbars
+ ToolBar::Builder.build do
+ item "Runnables", :command => Runnables::ShowRunnables, :icon => File.join(File.dirname(__FILE__),"/../icons/cog.png"), :barname => :runnables
+ item "Run Tab", :command => Runnables::RunEditTabCommand, :icon => File.join(Redcar::ICONS_DIRECTORY, "control.png"), :barname => :runnables
+ end
+ end
+
class TreeMirror
include Redcar::Tree::Mirror
attr_accessor :last_loaded
@@ -225,10 +228,11 @@
end
end
end
class ShowRunnables < Redcar::Command
+ sensitize :open_project
def execute
if tree = win.treebook.trees.detect {|tree| tree.tree_mirror.title == TREE_TITLE }
tree.refresh
win.treebook.focus_tree(tree)
else
@@ -255,10 +259,10 @@
end
file_runners
end
def execute
- project = Project::Manager.in_window(win)
+ project = Project::Manager.in_window(win)
file_mappings.each do |file_mapping|
regex = Regexp.new(file_mapping["regex"])
if tab.edit_view.document.mirror.path =~ regex
command_schema = file_mapping["command"]
output = file_mapping["output"]