Module: WebConsole

Defined in:
lib/webconsole.rb,
lib/webconsole/logger.rb,
lib/webconsole/lib/view.rb,
lib/webconsole/lib/module.rb,
lib/webconsole/lib/window.rb,
lib/webconsole/lib/view/erb.rb,
lib/webconsole/lib/constants.rb,
lib/webconsole/lib/controller.rb,
lib/webconsole/lib/view/resources.rb,
lib/webconsole/lib/view/javascript.rb

Defined Under Namespace

Modules: Dependencies, REPL Classes: Controller, Logger, View, Window

Constant Summary collapse

LOAD_PLUGIN_SCRIPT =
File.join(APPLESCRIPT_DIRECTORY, "load_plugin.scpt")
EXISTS_SCRIPT =
File.join(APPLESCRIPT_DIRECTORY, "exists.scpt")
RUN_PLUGIN_SCRIPT =
File.join(APPLESCRIPT_DIRECTORY, "run_plugin.scpt")
RUN_PLUGIN_IN_SPLIT_SCRIPT =
File.join(APPLESCRIPT_DIRECTORY, "run_plugin_in_split.scpt")
WINDOW_ID_FOR_PLUGIN_SCRIPT =
File.join(APPLESCRIPT_DIRECTORY, "window_id_for_plugin.scpt")
SPLIT_ID_IN_WINDOW_SCRIPT =
File.join(APPLESCRIPT_DIRECTORY, "split_id_in_window.scpt")
SPLIT_ID_IN_WINDOW_LAST_SCRIPT =
File.join(APPLESCRIPT_DIRECTORY, "split_id_in_window_last.scpt")
CREATE_WINDOW_SCRIPT =
File.join(APPLESCRIPT_DIRECTORY, "create_window.scpt")
RESOURCE_PATH_FOR_PLUGIN_SCRIPT =

Shared Resources

File.join(APPLESCRIPT_DIRECTORY, "resource_path_for_plugin.scpt")
SHARED_RESOURCES_PLUGIN_NAME =

Shared Resource Path

"Shared Resources"
SHARED_TEST_RESOURCES_PLUGIN_NAME =
"Shared Test Resources"
RESOURCE_URL_FOR_PLUGIN_SCRIPT =

Shared Resource URL

File.join(APPLESCRIPT_DIRECTORY, "resource_url_for_plugin.scpt")
PLUGIN_NAME_KEY =

Keys

'WC_PLUGIN_NAME'
SPLIT_ID_KEY =
'WC_SPLIT_ID'
WINDOW_ID_KEY =
'WC_WINDOW_ID'
SHARED_RESOURCES_PATH_KEY =
'WC_SHARED_RESOURCES_PATH'
SHARED_RESOURCES_URL_KEY =
'WC_SHARED_RESOURCES_URL'
APPLESCRIPT_DIRECTORY =

Directories

File.join(File.dirname(__FILE__), "..", "..", "applescript")

Class Method Summary collapse

Class Method Details

.application_existsObject



9
10
11
12
# File 'lib/webconsole/lib/module.rb', line 9

def self.application_exists
  result = self.run_applescript(EXISTS_SCRIPT)
  result == "true" ? true : false
end

.create_windowObject



47
48
49
# File 'lib/webconsole/lib/module.rb', line 47

def self.create_window
  self.run_applescript(CREATE_WINDOW_SCRIPT)
end

.load_plugin(path) ⇒ Object



4
5
6
# File 'lib/webconsole/lib/module.rb', line 4

def self.load_plugin(path)
  self.run_applescript(LOAD_PLUGIN_SCRIPT, [path])
end

.resource_path_for_plugin(name) ⇒ Object



54
55
56
# File 'lib/webconsole/lib/module.rb', line 54

def self.resource_path_for_plugin(name)
  self.run_applescript(RESOURCE_PATH_FOR_PLUGIN_SCRIPT, [name])
end

.resource_url_for_plugin(name) ⇒ Object



79
80
81
# File 'lib/webconsole/lib/module.rb', line 79

def self.resource_url_for_plugin(name)
  self.run_applescript(RESOURCE_URL_FOR_PLUGIN_SCRIPT, [name])
end

.run_plugin(name, directory = nil, arguments = nil) ⇒ Object



15
16
17
18
19
20
# File 'lib/webconsole/lib/module.rb', line 15

def self.run_plugin(name, directory = nil, arguments = nil)
  parameters = [name]
  parameters.push(directory) unless directory.nil?
  parameters += arguments unless arguments.nil?
  self.run_applescript(RUN_PLUGIN_SCRIPT, parameters)
end

.run_plugin_in_split(name, window_id, split_id) ⇒ Object



23
24
25
26
# File 'lib/webconsole/lib/module.rb', line 23

def self.run_plugin_in_split(name, window_id, split_id)
  parameters = [name, window_id, split_id]
  self.run_applescript(RUN_PLUGIN_IN_SPLIT_SCRIPT, parameters)
end

.shared_resource(resource) ⇒ Object



69
70
71
# File 'lib/webconsole/lib/module.rb', line 69

def self.shared_resource(resource)
  File.join(self.shared_resources_path, resource)
end

.shared_resources_pathObject



62
63
64
# File 'lib/webconsole/lib/module.rb', line 62

def self.shared_resources_path
  resource_path_for_plugin(SHARED_RESOURCES_PLUGIN_NAME)
end

.shared_resources_urlObject



82
83
84
# File 'lib/webconsole/lib/module.rb', line 82

def self.shared_resources_url
  resource_url_for_plugin(SHARED_RESOURCES_PLUGIN_NAME)
end

.shared_test_resource(resource) ⇒ Object



72
73
74
# File 'lib/webconsole/lib/module.rb', line 72

def self.shared_test_resource(resource)
  File.join(self.shared_test_resources_path, resource)    
end

.shared_test_resources_pathObject



65
66
67
# File 'lib/webconsole/lib/module.rb', line 65

def self.shared_test_resources_path
  resource_path_for_plugin(SHARED_TEST_RESOURCES_PLUGIN_NAME)
end

.split_id_in_window(window_id, pluginName = nil) ⇒ Object



34
35
36
37
38
# File 'lib/webconsole/lib/module.rb', line 34

def self.split_id_in_window(window_id, pluginName = nil)
  arguments = [window_id]
  arguments.push(pluginName) unless pluginName.nil?
  self.run_applescript(SPLIT_ID_IN_WINDOW_SCRIPT, arguments)
end

.split_id_in_window_last(window_id) ⇒ Object



41
42
43
44
# File 'lib/webconsole/lib/module.rb', line 41

def self.split_id_in_window_last(window_id)
  arguments = [window_id]
  self.run_applescript(SPLIT_ID_IN_WINDOW_LAST_SCRIPT, arguments)
end

.window_id_for_plugin(name) ⇒ Object



29
30
31
# File 'lib/webconsole/lib/module.rb', line 29

def self.window_id_for_plugin(name)
  self.run_applescript(WINDOW_ID_FOR_PLUGIN_SCRIPT, [name])
end