repla 0.6.0 → 0.6.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.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/lib/applescript/close_window.scpt +0 -0
  3. data/lib/applescript/create_window.scpt +0 -0
  4. data/lib/applescript/do_javascript.scpt +0 -0
  5. data/lib/applescript/exists.scpt +0 -0
  6. data/lib/applescript/hide_log.scpt +0 -0
  7. data/lib/applescript/load.scpt +0 -0
  8. data/lib/applescript/load_plugin.scpt +0 -0
  9. data/lib/applescript/load_with_root_access_directory.scpt +0 -0
  10. data/lib/applescript/read_from_standard_input.scpt +0 -0
  11. data/lib/applescript/resource_path_for_plugin.scpt +0 -0
  12. data/lib/applescript/resource_url_for_plugin.scpt +0 -0
  13. data/lib/applescript/run_plugin.scpt +0 -0
  14. data/lib/applescript/run_plugin_in_split.scpt +0 -0
  15. data/lib/applescript/show_log.scpt +0 -0
  16. data/lib/applescript/split_id_in_window.scpt +0 -0
  17. data/lib/applescript/split_id_in_window_last.scpt +0 -0
  18. data/lib/applescript/toggle_log.scpt +0 -0
  19. data/lib/applescript/window_id_for_plugin.scpt +0 -0
  20. data/lib/repla/lib/escape.rb +6 -1
  21. data/lib/repla/test/applescript/cancel_dialog.scpt +0 -0
  22. data/lib/repla/test/applescript/confirm_dialog.scpt +0 -0
  23. data/lib/repla/test/applescript/is_running.scpt +0 -0
  24. data/lib/repla/test/applescript/quit.scpt +0 -0
  25. data/lib/repla/test/applescript/set_window_bounds.scpt +0 -0
  26. data/lib/repla/test/applescript/switch_windows.scpt +0 -0
  27. data/lib/repla/test/applescript/window_bounds.scpt +0 -0
  28. data/lib/repla/test/applescript/window_id.scpt +0 -0
  29. data/lib/repla/test/bundles/FileExtension.replabundle/Contents/Info.plist +18 -0
  30. data/lib/repla/test/bundles/FileExtension.replabundle/Contents/Resources/cat.sh +3 -0
  31. data/lib/repla/test/bundles/PromptInterrupt.replabundle/Contents/Info.plist +16 -0
  32. data/lib/repla/test/bundles/PromptInterrupt.replabundle/Contents/Resources/cat.sh +3 -0
  33. data/lib/repla/test/bundles/TestEnvironment.replabundle/Contents/Resources/test_environment.rb +1 -1
  34. data/lib/repla/test/lib/helper.rb +8 -8
  35. metadata +13 -9
  36. data/lib/repla/test/applescript/cancel_dialog.applescript +0 -2
  37. data/lib/repla/test/applescript/confirm_dialog.applescript +0 -2
  38. data/lib/repla/test/applescript/is_running.applescript +0 -5
  39. data/lib/repla/test/applescript/quit.applescript +0 -3
  40. data/lib/repla/test/applescript/set_window_bounds.applescript +0 -23
  41. data/lib/repla/test/applescript/switch_windows.applescript +0 -2
  42. data/lib/repla/test/applescript/window_bounds.applescript +0 -20
  43. data/lib/repla/test/applescript/window_id.applescript +0 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6c2dc9f461e6638a509f122e2824c66b72a7cddf
4
- data.tar.gz: 24eb12b83008de6aa55e093f4b287f0ad8aff720
3
+ metadata.gz: '0803f2aea2e54e900f31119d591a1b5efa128f09'
4
+ data.tar.gz: 47b47687ed0bdf847c6c036eaabb6d4f79c4920e
5
5
  SHA512:
6
- metadata.gz: a588e850c89b662a473d3436f39413033ee608080de589c56564eeac89cad4ea8c02a517e5711dba65c46089feed87e9d366b8950c61b833614a342e8b9c4867
7
- data.tar.gz: 2f708ba46b0380daa54f188fcd299c9118c3e2ad415d3a575793e4628cf2a80a623a81b63b7a4027e049a33dff43a82fe8d4890377a7bf1c6ac404dfc4b8dd01
6
+ metadata.gz: f62b3713160d59ce955981e98a5d821f0ad4aa81ac43e153905c6cdf986cad8a1fb002f3ad5961da62cf54c240496600d69154d664336734a6fa6f5bf0d54603
7
+ data.tar.gz: 1e5468c3716e0d98161959935a1fa9c04f7b17a75db11eac40b3165cf535b608325eddab2583ea8c15a456da4a98bc9fd4a47cccbc743faed79c9602491aae3f
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -52,7 +52,12 @@ module Escape
52
52
  # they this only fails when the code imported into the `gem`?
53
53
 
54
54
  def self.javascript_escape(string)
55
- string.gsub('\\', '\\\\\\\\').gsub("\n", '\\\\n').gsub("'", "\\\\'")
55
+ # string.gsub('\\', '\\\\\\\\').gsub("\n", '\\\\n').gsub("'", "\\\\'")
56
+ # Combined as one command, comparable in speed:
57
+ string.gsub(/\\\\|\n|'/,
58
+ '\\\\' => '\\\\\\\\',
59
+ "\n" => '\\n',
60
+ "'" => '\\\'')
56
61
  end
57
62
 
58
63
  def self.shell_escape(string)
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>WCName</key>
6
+ <string>FileExtension</string>
7
+ <key>WCCommand</key>
8
+ <string>cat.sh</string>
9
+ <key>WCUUID</key>
10
+ <string>C4B09ED5-ED60-44FF-A0BB-43EF6F8AF569</string>
11
+ <key>WCEditable</key>
12
+ <integer>0</integer>
13
+ <key>WCFileExtensions</key>
14
+ <array>
15
+ <string>txt</string>
16
+ </array>
17
+ </dict>
18
+ </plist>
@@ -0,0 +1,16 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>WCName</key>
6
+ <string>PromptInterrupt</string>
7
+ <key>WCCommand</key>
8
+ <string>cat.sh</string>
9
+ <key>WCUUID</key>
10
+ <string>2565A8F0-56E1-4CE4-AA35-DBDAEB720443</string>
11
+ <key>WCEditable</key>
12
+ <integer>0</integer>
13
+ <key>WCPromptInterrupt</key>
14
+ <integer>1</integer>
15
+ </dict>
16
+ </plist>
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'test/unit'
4
4
 
5
- require_relative '../../../../../../lib/repla'
5
+ require_relative '../../../../../../repla'
6
6
  require_relative 'constants'
7
7
  require_relative '../../../../../lib/escape'
8
8
 
@@ -18,53 +18,53 @@ module Repla
18
18
  end
19
19
 
20
20
  CONFIRMDIALOGAPPLESCRIPT_FILE = File.join(APPLESCRIPT_DIRECTORY,
21
- 'confirm_dialog.applescript')
21
+ 'confirm_dialog.scpt')
22
22
  def self.confirm_dialog
23
23
  run_applescript(CONFIRMDIALOGAPPLESCRIPT_FILE)
24
24
  sleep TEST_PAUSE_TIME # Give dialog time
25
25
  end
26
26
 
27
27
  WINDOWIDAPPLESCRIPT_FILE = File.join(APPLESCRIPT_DIRECTORY,
28
- 'window_id.applescript')
28
+ 'window_id.scpt')
29
29
  def self.window_id
30
30
  run_applescript(WINDOWIDAPPLESCRIPT_FILE)
31
31
  end
32
32
 
33
33
  CANCELDIALOGAPPLESCRIPT_FILE = File.join(APPLESCRIPT_DIRECTORY,
34
- 'cancel_dialog.applescript')
34
+ 'cancel_dialog.scpt')
35
35
  def self.cancel_dialog
36
36
  run_applescript(CANCELDIALOGAPPLESCRIPT_FILE)
37
37
  sleep TEST_PAUSE_TIME # Give dialog time
38
38
  end
39
39
 
40
40
  QUITAPPLESCRIPT_FILE = File.join(APPLESCRIPT_DIRECTORY,
41
- 'quit.applescript')
41
+ 'quit.scpt')
42
42
  def self.quit
43
43
  run_applescript(QUITAPPLESCRIPT_FILE)
44
44
  end
45
45
 
46
46
  ISRUNNINGAPPLESCRIPT_FILE = File.join(APPLESCRIPT_DIRECTORY,
47
- 'is_running.applescript')
47
+ 'is_running.scpt')
48
48
  def self.app_running?
49
49
  result = run_applescript(ISRUNNINGAPPLESCRIPT_FILE)
50
50
  result == 'true'
51
51
  end
52
52
 
53
53
  SWITCHWINDOWSAPPLESCRIPT_FILE = File.join(APPLESCRIPT_DIRECTORY,
54
- 'switch_windows.applescript')
54
+ 'switch_windows.scpt')
55
55
  def self.switch_windows
56
56
  run_applescript(SWITCHWINDOWSAPPLESCRIPT_FILE)
57
57
  end
58
58
 
59
59
  WINDOWBOUNDSAPPLESCRIPT_FILE = File.join(APPLESCRIPT_DIRECTORY,
60
- 'window_bounds.applescript')
60
+ 'window_bounds.scpt')
61
61
  def self.window_bounds(window_id = nil)
62
62
  run_applescript(WINDOWBOUNDSAPPLESCRIPT_FILE, [window_id])
63
63
  end
64
64
 
65
65
  SETWINDOWBOUNDSAPPLESCRIPT_FILE = File.join(APPLESCRIPT_DIRECTORY,
66
66
  'set_window_bounds'\
67
- '.applescript')
67
+ '.scpt')
68
68
  def self.set_window_bounds(bounds, window_id = nil)
69
69
  arguments = [bounds]
70
70
  arguments = arguments.push(window_id) if window_id
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.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roben Kleene
@@ -96,16 +96,18 @@ files:
96
96
  - lib/repla/resources/js/mousetrap.js
97
97
  - lib/repla/resources/js/zepto.js
98
98
  - lib/repla/test.rb
99
- - lib/repla/test/applescript/cancel_dialog.applescript
100
- - lib/repla/test/applescript/confirm_dialog.applescript
101
- - lib/repla/test/applescript/is_running.applescript
102
- - lib/repla/test/applescript/quit.applescript
103
- - lib/repla/test/applescript/set_window_bounds.applescript
104
- - lib/repla/test/applescript/switch_windows.applescript
105
- - lib/repla/test/applescript/window_bounds.applescript
106
- - lib/repla/test/applescript/window_id.applescript
99
+ - lib/repla/test/applescript/cancel_dialog.scpt
100
+ - lib/repla/test/applescript/confirm_dialog.scpt
101
+ - lib/repla/test/applescript/is_running.scpt
102
+ - lib/repla/test/applescript/quit.scpt
103
+ - lib/repla/test/applescript/set_window_bounds.scpt
104
+ - lib/repla/test/applescript/switch_windows.scpt
105
+ - lib/repla/test/applescript/window_bounds.scpt
106
+ - lib/repla/test/applescript/window_id.scpt
107
107
  - lib/repla/test/bundles/Cat.replabundle/Contents/Info.plist
108
108
  - lib/repla/test/bundles/Cat.replabundle/Contents/Resources/cat.sh
109
+ - lib/repla/test/bundles/FileExtension.replabundle/Contents/Info.plist
110
+ - lib/repla/test/bundles/FileExtension.replabundle/Contents/Resources/cat.sh
109
111
  - lib/repla/test/bundles/HelloWorld.replabundle/Contents/Info.plist
110
112
  - lib/repla/test/bundles/HelloWorld.replabundle/Contents/Resources/hello_world.rb
111
113
  - lib/repla/test/bundles/Invalid.replabundle/Contents/Info.plist
@@ -116,6 +118,8 @@ files:
116
118
  - lib/repla/test/bundles/Print.replabundle/Contents/Resources/lib/controller.rb
117
119
  - lib/repla/test/bundles/Print.replabundle/Contents/Resources/lib/view.rb
118
120
  - lib/repla/test/bundles/Print.replabundle/Contents/Resources/print.rb
121
+ - lib/repla/test/bundles/PromptInterrupt.replabundle/Contents/Info.plist
122
+ - lib/repla/test/bundles/PromptInterrupt.replabundle/Contents/Resources/cat.sh
119
123
  - lib/repla/test/bundles/TestEnvironment.replabundle/Contents/Info.plist
120
124
  - lib/repla/test/bundles/TestEnvironment.replabundle/Contents/Resources/constants.rb
121
125
  - lib/repla/test/bundles/TestEnvironment.replabundle/Contents/Resources/test_environment.rb
@@ -1,2 +0,0 @@
1
- tell application "Repla" to activate
2
- tell application "System Events" to key code 53
@@ -1,2 +0,0 @@
1
- tell application "Repla" to activate
2
- tell application "System Events" to keystroke return
@@ -1,5 +0,0 @@
1
- if application "Repla" is running then
2
- return true
3
- else
4
- return false
5
- end if
@@ -1,3 +0,0 @@
1
- ignoring application responses
2
- tell application "Repla" to quit
3
- end ignoring
@@ -1,23 +0,0 @@
1
- on run arguments
2
- tell application "Repla"
3
-
4
- set theTextBounds to the first item of arguments
5
-
6
- set originalTextItemDelimiters to AppleScript's text item delimiters
7
- set AppleScript's text item delimiters to ", "
8
- set theBounds to text items of theTextBounds
9
- set AppleScript's text item delimiters to originalTextItemDelimiters
10
-
11
- set arguments to rest of arguments
12
-
13
- if arguments is {} then
14
- set theWindow to window 1
15
- else
16
- set windowid to the first item of arguments
17
- set theWindow to window id windowid
18
- end if
19
-
20
-
21
- set the bounds of theWindow to theBounds
22
- end tell
23
- end run
@@ -1,2 +0,0 @@
1
- tell application "Repla" to activate
2
- tell application "System Events" to keystroke "`" using command down
@@ -1,20 +0,0 @@
1
- on run windowid
2
- tell application "Repla"
3
-
4
- if windowid is {} then
5
- set theWindow to window 1
6
- else
7
- set theWindow to window id windowid
8
- end if
9
-
10
- set theBounds to bounds of theWindow
11
-
12
-
13
- set originalTextItemDelimiters to AppleScript's text item delimiters
14
- set AppleScript's text item delimiters to ", "
15
- set theTextBounds to theBounds as text
16
- set AppleScript's text item delimiters to originalTextItemDelimiters
17
-
18
- return theTextBounds
19
- end tell
20
- end run
@@ -1,7 +0,0 @@
1
- on run
2
- tell application "Repla"
3
- set theWindow to item 1 of windows
4
- return theWindow's id
5
- end tell
6
- end run
7
-