Module: Repla

Defined in:
lib/repla.rb,
lib/repla/repl.rb,
lib/repla/test.rb,
lib/repla/logger.rb,
lib/repla/lib/view.rb,
lib/repla/lib/module.rb,
lib/repla/lib/window.rb,
lib/repla/dependencies.rb,
lib/repla/lib/constants.rb,
lib/repla/repl/lib/view.rb,
lib/repla/lib/controller.rb,
lib/repla/test/lib/helper.rb,
lib/repla/lib/view/resources.rb,
lib/repla/lib/view/javascript.rb,
lib/repla/dependencies/lib/view.rb,
lib/repla/dependencies/lib/model.rb,
lib/repla/dependencies/lib/tester.rb,
lib/repla/repl/lib/input_controller.rb,
lib/repla/repl/lib/output_controller.rb,
lib/repla/dependencies/lib/controller.rb,
lib/repla/test/bundles/Print.wcplugin/Contents/Resources/lib/view.rb,
lib/repla/test/bundles/Print.wcplugin/Contents/Resources/lib/controller.rb

Overview

Repla

Defined Under Namespace

Modules: Dependencies, Print, REPL, Test 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 =

Resources

File.join(APPLESCRIPT_DIRECTORY,
'resource_path_for_plugin.scpt')
RESOURCE_URL_FOR_PLUGIN_SCRIPT =
File.join(APPLESCRIPT_DIRECTORY,
'resource_url_for_plugin.scpt')
PLUGIN_NAME_KEY =

Keys

'WC_PLUGIN_NAME'.freeze
SPLIT_ID_KEY =
'WC_SPLIT_ID'.freeze
WINDOW_ID_KEY =
'WC_WINDOW_ID'.freeze
APPLESCRIPT_DIRECTORY =

Directories

File.join(File.dirname(__FILE__), '../../applescript')

Class Method Summary collapse

Class Method Details

.application_existsObject



14
15
16
17
# File 'lib/repla/lib/module.rb', line 14

def self.application_exists
  result = run_applescript(EXISTS_SCRIPT)
  result == 'true'
end

.create_windowObject



56
57
58
# File 'lib/repla/lib/module.rb', line 56

def self.create_window
  run_applescript(CREATE_WINDOW_SCRIPT)
end

.load_plugin(path) ⇒ Object



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

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

.resource_path_for_plugin(name) ⇒ Object



64
65
66
# File 'lib/repla/lib/module.rb', line 64

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

.resource_url_for_plugin(name) ⇒ Object



70
71
72
# File 'lib/repla/lib/module.rb', line 70

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

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



20
21
22
23
24
25
# File 'lib/repla/lib/module.rb', line 20

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

.run_plugin_in_split(name, window_id, split_id) ⇒ Object



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

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

.split_id_in_window(window_id, plugin_name = nil) ⇒ Object



42
43
44
45
46
# File 'lib/repla/lib/module.rb', line 42

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

.split_id_in_window_last(window_id) ⇒ Object



50
51
52
53
# File 'lib/repla/lib/module.rb', line 50

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

.window_id_for_plugin(name) ⇒ Object



36
37
38
# File 'lib/repla/lib/module.rb', line 36

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