repla 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/applescript/run_plugin_with_environment.scpt +0 -0
- data/lib/repla/lib/module.rb +10 -2
- data/lib/repla/test/lib/helper.rb +4 -3
- data/lib/repla/test/packages/HelloWorld.replaplugin/Contents/Info.plist +2 -0
- data/lib/repla/test/packages/TestEnvironment.replaplugin/Contents/Resources/constants.rb +2 -0
- data/lib/repla/test/packages/TestEnvironment.replaplugin/Contents/Resources/test_environment.rb +6 -0
- data/lib/repla/test/packages/TestLog.replaplugin/Contents/Info.plist +2 -0
- data/lib/repla/test.rb +6 -3
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87526d7ca6ba1268da5cc15117822bdd450f23b7
|
4
|
+
data.tar.gz: ee6780d5b3cdaaaae58198c768c4a9361ebb3e7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46314f9cb676081d120aaa853da3c6e7c6daf92ea23f1cac9fc5015d76e5f19af0d384d20f4683bec43e058b388ac735d2cc4effa95d3733a5c164adca878f2f
|
7
|
+
data.tar.gz: a06271d13d7f1eee4492f0a5726cb7438005b7b93d493327f17d558f5ca96ff6c1b40f2d28f8fabc0ea1a41b6608200b489555983686ab72c903749ed161a9e3
|
Binary file
|
data/lib/repla/lib/module.rb
CHANGED
@@ -29,6 +29,14 @@ module Repla
|
|
29
29
|
run_applescript(RUN_PLUGIN_SCRIPT, parameters)
|
30
30
|
end
|
31
31
|
|
32
|
+
RUN_PLUGIN_WITH_ENVIRONMENT_SCRIPT = File.join(
|
33
|
+
APPLESCRIPT_DIRECTORY, 'run_plugin_with_environment.scpt'
|
34
|
+
)
|
35
|
+
def self.run_plugin_with_environment(name, environment)
|
36
|
+
parameters = [name, environment]
|
37
|
+
run_applescript(RUN_PLUGIN_WITH_ENVIRONMENT_SCRIPT, parameters)
|
38
|
+
end
|
39
|
+
|
32
40
|
RUN_PLUGIN_IN_SPLIT_SCRIPT = File.join(APPLESCRIPT_DIRECTORY,
|
33
41
|
'run_plugin_in_split.scpt')
|
34
42
|
def self.run_plugin_in_split(name, window_id, split_id)
|
@@ -79,8 +87,8 @@ module Repla
|
|
79
87
|
# TODO: `self.run_applescript` should be private but now all of a sudden
|
80
88
|
# instances method can't call private class methods?
|
81
89
|
def self.run_applescript(script, arguments = nil)
|
82
|
-
# command = "osascript #{script.shell_escape}"
|
83
|
-
command = "osascript #{script}"
|
90
|
+
# command = "/usr/bin/osascript #{script.shell_escape}"
|
91
|
+
command = "/usr/bin/osascript #{script}"
|
84
92
|
|
85
93
|
if arguments
|
86
94
|
command += ' ' + arguments.compact.map(&:to_s).map do |x|
|
@@ -11,8 +11,9 @@ module Repla
|
|
11
11
|
'applescript')
|
12
12
|
|
13
13
|
def self.run_javascript(javascript)
|
14
|
-
#
|
15
|
-
|
14
|
+
# `/usr/bin/osascript` requires redirecting stderr to stdout for some
|
15
|
+
# reason
|
16
|
+
`/usr/bin/osascript -l JavaScript -e \
|
16
17
|
#{Shellwords.escape(javascript)} 2>&1`.chomp!
|
17
18
|
# return `node -e #{Shellwords.escape(javascript)}`
|
18
19
|
end
|
@@ -74,7 +75,7 @@ module Repla
|
|
74
75
|
# TODO: `self.run_applescript` should be private but now all of a sudden
|
75
76
|
# instances method can't call private class methods?
|
76
77
|
def self.run_applescript(script, arguments = nil)
|
77
|
-
command = "osascript #{Shellwords.escape(script)}"
|
78
|
+
command = "/usr/bin/osascript #{Shellwords.escape(script)}"
|
78
79
|
if arguments
|
79
80
|
arguments.each do |argument|
|
80
81
|
if argument
|
data/lib/repla/test/packages/TestEnvironment.replaplugin/Contents/Resources/test_environment.rb
CHANGED
@@ -27,4 +27,10 @@ class TestEnviroment < Test::Unit::TestCase
|
|
27
27
|
assert(window_id.integer?)
|
28
28
|
assert(window_id.to_i > 0)
|
29
29
|
end
|
30
|
+
|
31
|
+
def test_message_key
|
32
|
+
assert(ENV.key?(TEST_MESSAGE_KEY))
|
33
|
+
message = ENV[TEST_MESSAGE_KEY]
|
34
|
+
assert_equal(message, TEST_MESSAGE_VALUE)
|
35
|
+
end
|
30
36
|
end
|
data/lib/repla/test.rb
CHANGED
@@ -52,9 +52,9 @@ module Repla
|
|
52
52
|
'title.js')
|
53
53
|
# Plugins
|
54
54
|
TEST_PLUGIN_DIRECTORY = File.join(TEST_DIRECTORY, 'packages')
|
55
|
-
|
56
|
-
|
57
|
-
|
55
|
+
TEST_HELLOWORLD_PLUGIN_FILE = File.join(TEST_PLUGIN_DIRECTORY,
|
56
|
+
'HelloWorld.replaplugin')
|
57
|
+
TEST_HELLOWORLD_PLUGIN_NAME = 'HelloWorld'.freeze
|
58
58
|
TEST_SERVER_PLUGIN_NAME = 'TestServer'.freeze
|
59
59
|
TEST_SERVER_PLUGIN_FILE = File.join(TEST_PLUGIN_DIRECTORY,
|
60
60
|
'TestServer.replaplugin')
|
@@ -71,6 +71,9 @@ module Repla
|
|
71
71
|
INVALID_PLUGIN_FILE = File.join(TEST_PLUGIN_DIRECTORY,
|
72
72
|
'Invalid.replaplugin')
|
73
73
|
INVALID_PLUGIN_NAME = 'Invalid'.freeze
|
74
|
+
TEST_ENVIRONMENT_PLUGIN_FILE = File.join(TEST_PLUGIN_DIRECTORY,
|
75
|
+
'TestEnvironment.replaplugin')
|
76
|
+
TEST_ENVIRONMENT_PLUGIN_NAME = 'TestEnvironment'.freeze
|
74
77
|
|
75
78
|
# Local Asssets
|
76
79
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: repla
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roben Kleene
|
@@ -31,6 +31,7 @@ files:
|
|
31
31
|
- lib/applescript/resource_url_for_plugin.scpt
|
32
32
|
- lib/applescript/run_plugin.scpt
|
33
33
|
- lib/applescript/run_plugin_in_split.scpt
|
34
|
+
- lib/applescript/run_plugin_with_environment.scpt
|
34
35
|
- lib/applescript/show_log.scpt
|
35
36
|
- lib/applescript/split_id_in_window.scpt
|
36
37
|
- lib/applescript/split_id_in_window_last.scpt
|