repla 0.5.0 → 0.5.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c40131156dfdc2aad9c483c50f0331a1aeea000
|
4
|
+
data.tar.gz: a39543f121d7c44dae0f5d942a00e733ca117293
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c45fecb1079553c8070d6fcf9816c3ab154c14bf39f51b9269d3c76dab063b3577138d8e7db11a794ea9f1ff5e75c8b0bbcaec6eb91fa103965abad7dbc24694
|
7
|
+
data.tar.gz: 07526cf5246d604768f25e4cd7ee0923e7300f4aaf448a3c7c5b3f6ac8fac5ea2b1ac79df3175d405dc5bb682a5ab36753a81d693312754d4de12f69bd0818c3
|
@@ -20,7 +20,9 @@ module Repla
|
|
20
20
|
@view.add_missing_dependency(name, type, installation_instructions)
|
21
21
|
end
|
22
22
|
|
23
|
-
|
23
|
+
# TODO: `self.run_applescript` should be private but now all of a sudden
|
24
|
+
# instances method can't call private class methods?
|
25
|
+
def self.string_for_type(type)
|
24
26
|
case type
|
25
27
|
when :shell_command
|
26
28
|
return 'shell command'
|
@@ -10,7 +10,10 @@ module Repla
|
|
10
10
|
end
|
11
11
|
|
12
12
|
require 'shellwords'
|
13
|
-
|
13
|
+
|
14
|
+
# TODO: `self.run_applescript` should be private but now all of a sudden
|
15
|
+
# instances method can't call private class methods?
|
16
|
+
def self.check_shell_command(name)
|
14
17
|
command = "type -a #{Shellwords.escape(name)} > /dev/null 2>&1"
|
15
18
|
system(command)
|
16
19
|
end
|
data/lib/repla/lib/escape.rb
CHANGED
@@ -47,11 +47,15 @@ module Escape
|
|
47
47
|
replace(StringEscape.shell_escape(self))
|
48
48
|
end
|
49
49
|
|
50
|
-
|
50
|
+
# TODO: `self.javascript_escape` and `self.shell_escape` should be private,
|
51
|
+
# but instance methods can't call private class methods in Ruby? Or can
|
52
|
+
# they this only fails when the code imported into the `gem`?
|
53
|
+
|
54
|
+
def self.javascript_escape(string)
|
51
55
|
string.gsub('\\', '\\\\\\\\').gsub("\n", '\\\\n').gsub("'", "\\\\'")
|
52
56
|
end
|
53
57
|
|
54
|
-
|
58
|
+
def self.shell_escape(string)
|
55
59
|
Shellwords.escape(string)
|
56
60
|
end
|
57
61
|
end
|
data/lib/repla/lib/module.rb
CHANGED
@@ -71,7 +71,9 @@ module Repla
|
|
71
71
|
run_applescript(RESOURCE_URL_FOR_PLUGIN_SCRIPT, [name])
|
72
72
|
end
|
73
73
|
|
74
|
-
|
74
|
+
# TODO: `self.run_applescript` should be private but now all of a sudden
|
75
|
+
# instances method can't call private class methods?
|
76
|
+
def self.run_applescript(script, arguments = nil)
|
75
77
|
command = "osascript #{script.shell_escape}"
|
76
78
|
|
77
79
|
if arguments
|
@@ -71,9 +71,9 @@ module Repla
|
|
71
71
|
run_applescript(SETWINDOWBOUNDSAPPLESCRIPT_FILE, arguments)
|
72
72
|
end
|
73
73
|
|
74
|
-
private
|
75
|
-
|
76
|
-
|
74
|
+
# TODO: `self.run_applescript` should be private but now all of a sudden
|
75
|
+
# instances method can't call private class methods?
|
76
|
+
def self.run_applescript(script, arguments = nil)
|
77
77
|
command = "osascript #{Shellwords.escape(script)}"
|
78
78
|
if arguments
|
79
79
|
arguments.each do |argument|
|