repla 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/applescript/{load_html.scpt → load.scpt} +0 -0
- data/lib/applescript/{load_html_with_base_url.scpt → load_with_root_access_directory.scpt} +0 -0
- data/lib/repla/dependencies/html/index.html +25 -0
- data/lib/repla/dependencies/lib/view.rb +5 -5
- data/lib/repla/dependencies.rb +1 -2
- data/lib/repla/lib/constants.rb +0 -2
- data/lib/repla/lib/module.rb +1 -24
- data/lib/repla/lib/view/javascript.rb +7 -1
- data/lib/repla/lib/view/resources.rb +0 -38
- data/lib/repla/lib/view.rb +0 -1
- data/lib/repla/lib/window.rb +10 -15
- data/lib/repla/logger/test/Rakefile +7 -9
- data/lib/repla/logger/test/lib/test_setup.rb +10 -0
- data/lib/repla/logger/test/lib/test_view_helper.rb +1 -1
- data/lib/repla/logger/test/run_tests.sh +3 -1
- data/lib/repla/logger/test/tc_logger.rb +18 -21
- data/lib/repla/logger.rb +1 -2
- data/lib/repla/repl/html/index.html +22 -0
- data/lib/repla/repl/lib/view.rb +5 -50
- data/lib/repla/repl.rb +1 -2
- data/lib/repla/resources/css/raster.css +131 -0
- data/lib/repla/resources/js/bullets/Gruntfile.js +30 -0
- data/lib/repla/resources/js/bullets/README.md +3 -0
- data/lib/repla/resources/js/bullets/bullets.js +82 -0
- data/lib/repla/resources/js/bullets/example/css/bullets.css +6 -0
- data/lib/repla/resources/js/bullets/example/css/raster.css +131 -0
- data/lib/repla/resources/js/bullets/example/css/style.css +7 -0
- data/lib/repla/resources/js/bullets/example/index.html +137 -0
- data/lib/repla/resources/js/bullets/example/jade/content.jade +10 -0
- data/lib/repla/resources/js/bullets/example/jade/css.jade +3 -0
- data/lib/repla/resources/js/bullets/example/jade/index.jade +10 -0
- data/lib/repla/resources/js/bullets/example/jade/javascript.jade +5 -0
- data/lib/repla/resources/js/bullets/example/js/handlebars.js +2278 -0
- data/lib/repla/resources/js/bullets/example/js/jquery.js +9789 -0
- data/lib/repla/resources/js/bullets/example/js/mousetrap.js +910 -0
- data/lib/repla/resources/js/bullets/example/js/mousetrap_config.js +14 -0
- data/lib/repla/resources/js/bullets/example/js/zepto.js +1565 -0
- data/lib/repla/resources/js/bullets/package.json +28 -0
- data/lib/repla/resources/js/bullets/test/lib/css/mocha.css +270 -0
- data/lib/repla/resources/js/bullets/test/lib/index.html +153 -0
- data/lib/repla/resources/js/bullets/test/lib/jade/index.jade +13 -0
- data/lib/repla/resources/js/bullets/test/lib/jade/mocha.html +15 -0
- data/lib/repla/resources/js/bullets/test/lib/js/chai.js +4613 -0
- data/lib/repla/resources/js/bullets/test/lib/js/mocha.js +5726 -0
- data/lib/repla/resources/js/bullets/test/lib/js/test_helper.js +26 -0
- data/lib/repla/resources/js/bullets/test/run_tests.rb +7 -0
- data/lib/repla/resources/js/bullets/test/test.js +131 -0
- data/lib/repla/resources/js/handlebars.js +2278 -0
- data/lib/repla/resources/js/mousetrap.js +910 -0
- data/lib/repla/resources/js/zepto.js +1565 -0
- data/lib/repla/test/applescript/cancel_dialog.applescript +2 -0
- data/lib/repla/test/applescript/confirm_dialog.applescript +2 -0
- data/lib/repla/test/applescript/is_running.applescript +5 -0
- data/lib/repla/test/applescript/quit.applescript +3 -0
- data/lib/repla/test/applescript/set_window_bounds.applescript +23 -0
- data/lib/repla/test/applescript/switch_windows.applescript +2 -0
- data/lib/repla/test/applescript/window_bounds.applescript +20 -0
- data/lib/repla/test/applescript/window_id.applescript +7 -0
- data/lib/repla/test/bundles/Cat.wcplugin/Contents/Info.plist +14 -0
- data/lib/repla/test/bundles/Cat.wcplugin/Contents/Resources/cat.sh +3 -0
- data/lib/repla/test/bundles/HelloWorld.wcplugin/Contents/Info.plist +14 -0
- data/lib/repla/test/bundles/HelloWorld.wcplugin/Contents/Resources/hello_world.rb +3 -0
- data/lib/repla/test/bundles/Invalid.wcplugin/Contents/Info.plist +16 -0
- data/lib/repla/test/bundles/Print.wcplugin/Contents/Info.plist +16 -0
- data/lib/repla/test/bundles/Print.wcplugin/Contents/Resources/html/css/style.css +7 -0
- data/lib/repla/test/bundles/Print.wcplugin/Contents/Resources/html/index.html +24 -0
- data/lib/repla/test/bundles/Print.wcplugin/Contents/Resources/html/js/wcprint.js +8 -0
- data/lib/repla/test/bundles/Print.wcplugin/Contents/Resources/lib/controller.rb +18 -0
- data/lib/repla/test/bundles/Print.wcplugin/Contents/Resources/lib/view.rb +13 -0
- data/lib/repla/test/bundles/Print.wcplugin/Contents/Resources/print.rb +10 -0
- data/lib/repla/test/bundles/TestEnvironment.wcplugin/Contents/Info.plist +14 -0
- data/lib/repla/test/bundles/TestEnvironment.wcplugin/Contents/Resources/constants.rb +1 -0
- data/lib/repla/test/bundles/TestEnvironment.wcplugin/Contents/Resources/test_environment.rb +35 -0
- data/lib/repla/test/bundles/TestLog.wcplugin/Contents/Info.plist +16 -0
- data/lib/repla/test/bundles/TestLog.wcplugin/Contents/Resources/test_log.rb +13 -0
- data/lib/repla/test/html/index.html +36 -0
- data/lib/repla/test/html/indexjquery.html +37 -0
- data/lib/repla/test/html/js/zepto.js +1565 -0
- data/lib/repla/test/js/firstcode.js +3 -0
- data/lib/repla/test/js/lastcode.js +3 -0
- data/lib/repla/test/js/nodom.js +5 -0
- data/lib/repla/test/js/text.js +1 -0
- data/lib/repla/test/js/textjquery.js +1 -0
- data/lib/repla/test/js/title.js +1 -0
- data/lib/repla/test/lib/helper.rb +121 -0
- data/lib/repla/test.rb +51 -0
- data/lib/repla.rb +6 -6
- metadata +78 -14
- data/lib/repla/dependencies/views/view.html.erb +0 -25
- data/lib/repla/extension_constants.rb +0 -1
- data/lib/repla/lib/view/erb.rb +0 -17
- data/lib/repla/logger/test/lib/test_constants.rb +0 -8
- data/lib/repla/repl/view/view.html.erb +0 -12
- /data/lib/repla/dependencies/{css → html/css}/style.css +0 -0
- /data/lib/repla/dependencies/{js → html/js}/wcdependencies.js +0 -0
- /data/lib/repla/repl/{css → html/css}/style.css +0 -0
- /data/lib/repla/repl/{js → html/js}/wcrepl.js +0 -0
@@ -0,0 +1,23 @@
|
|
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
|
@@ -0,0 +1,20 @@
|
|
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
|
@@ -0,0 +1,14 @@
|
|
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>Cat</string>
|
7
|
+
<key>WCCommand</key>
|
8
|
+
<string>cat.sh</string>
|
9
|
+
<key>WCUUID</key>
|
10
|
+
<string>AAC76D4F-FC05-44A6-BFEA-4AF5000AA92D</string>
|
11
|
+
<key>WCEditable</key>
|
12
|
+
<integer>0</integer>
|
13
|
+
</dict>
|
14
|
+
</plist>
|
@@ -0,0 +1,14 @@
|
|
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>HelloWorld</string>
|
7
|
+
<key>WCCommand</key>
|
8
|
+
<string>hello_world.rb</string>
|
9
|
+
<key>WCUUID</key>
|
10
|
+
<string>9DF1F4D6-16BA-4D18-88D2-155CF262035F</string>
|
11
|
+
<key>WCEditable</key>
|
12
|
+
<integer>0</integer>
|
13
|
+
</dict>
|
14
|
+
</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>Invalid</string>
|
7
|
+
<key>WCCommand</key>
|
8
|
+
<string>invalid path</string>
|
9
|
+
<key>WCUUID</key>
|
10
|
+
<string>CB5617FF-F06C-4137-8C3A-8EDC959F3F44</string>
|
11
|
+
<key>WCDebugModeEnabled</key>
|
12
|
+
<integer>1</integer>
|
13
|
+
<key>WCEditable</key>
|
14
|
+
<integer>0</integer>
|
15
|
+
</dict>
|
16
|
+
</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>Print</string>
|
7
|
+
<key>WCCommand</key>
|
8
|
+
<string>print.rb</string>
|
9
|
+
<key>WCUUID</key>
|
10
|
+
<string>33EE3C86-3377-4F6D-B8FB-89B9539152AA</string>
|
11
|
+
<key>WCDebugModeEnabled</key>
|
12
|
+
<integer>0</integer>
|
13
|
+
<key>WCEditable</key>
|
14
|
+
<integer>0</integer>
|
15
|
+
</dict>
|
16
|
+
</plist>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<title>Print</title>
|
6
|
+
<link rel="stylesheet" href=
|
7
|
+
"../../../../../../resources/css/raster.css">
|
8
|
+
<link rel="stylesheet" href="css/style.css">
|
9
|
+
<script id="output-template" type="text/x-handlebars-template">
|
10
|
+
<section>
|
11
|
+
<code>
|
12
|
+
{{output}}
|
13
|
+
</code>
|
14
|
+
</section>
|
15
|
+
</script>
|
16
|
+
<script type="text/javascript" src=
|
17
|
+
"../../../../../../resources/js/zepto.js"></script>
|
18
|
+
<script type="text/javascript" src=
|
19
|
+
"../../../../../../resources/js/handlebars.js"></script>
|
20
|
+
<script type="text/javascript" src="js/wcprint.js"></script>
|
21
|
+
</head>
|
22
|
+
<body>
|
23
|
+
</body>
|
24
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require_relative 'view'
|
2
|
+
|
3
|
+
module Repla::Print
|
4
|
+
class Controller < Repla::Controller
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
@view = View.new
|
8
|
+
end
|
9
|
+
|
10
|
+
def parse_line(line)
|
11
|
+
line.chomp!
|
12
|
+
line.javascript_escape!
|
13
|
+
javascript = %Q[addOutput('#{line}');]
|
14
|
+
@view.do_javascript(javascript)
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Repla::Print
|
2
|
+
class View < Repla::View
|
3
|
+
ROOT_ACCESS_DIRECTORY = File.join(File.dirname(__FILE__), '../../../../../../')
|
4
|
+
HTML_DIRECTORY = File.join(File.dirname(__FILE__), '../html/')
|
5
|
+
VIEW_TEMPLATE = File.join(HTML_DIRECTORY, 'index.html')
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
super
|
9
|
+
self.root_access_directory_path = File.expand_path(ROOT_ACCESS_DIRECTORY)
|
10
|
+
load_file(VIEW_TEMPLATE)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,14 @@
|
|
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>TestEnvironment</string>
|
7
|
+
<key>WCCommand</key>
|
8
|
+
<string>test_environment.rb</string>
|
9
|
+
<key>WCUUID</key>
|
10
|
+
<string>028516C6-8AE2-4876-814F-F7245D7A4C98</string>
|
11
|
+
<key>WCEditable</key>
|
12
|
+
<integer>0</integer>
|
13
|
+
</dict>
|
14
|
+
</plist>
|
@@ -0,0 +1 @@
|
|
1
|
+
TEST_PLUGIN_NAME = "TestEnvironment"
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#!/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
|
2
|
+
|
3
|
+
require "test/unit"
|
4
|
+
|
5
|
+
require_relative '../../../../../../lib/repla'
|
6
|
+
require_relative "constants"
|
7
|
+
|
8
|
+
class ::String
|
9
|
+
def is_integer?
|
10
|
+
self.to_i.to_s == self
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class TestEnviroment < Test::Unit::TestCase
|
15
|
+
|
16
|
+
def test_plugin_name_key
|
17
|
+
assert(ENV.has_key?(Repla::PLUGIN_NAME_KEY), "The plugin name key should exist.")
|
18
|
+
plugin_name = ENV[Repla::PLUGIN_NAME_KEY]
|
19
|
+
assert_equal(plugin_name, TEST_PLUGIN_NAME, "The plugin name should equal the test plugin name.")
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_split_id_key
|
23
|
+
assert(ENV.has_key?(Repla::SPLIT_ID_KEY), "The split id key should exist.")
|
24
|
+
window_id = ENV[Repla::SPLIT_ID_KEY]
|
25
|
+
assert(!window_id.is_integer?, "The split id should not be an integer.")
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_window_id_key
|
29
|
+
assert(ENV.has_key?(Repla::WINDOW_ID_KEY), "The window id key should exist.")
|
30
|
+
window_id = ENV[Repla::WINDOW_ID_KEY]
|
31
|
+
assert(window_id.is_integer?, "The window id should be an integer.")
|
32
|
+
assert(window_id.to_i > 0, "The window id should be greater than zero.")
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
@@ -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>TestLog</string>
|
7
|
+
<key>WCCommand</key>
|
8
|
+
<string>test_log.rb</string>
|
9
|
+
<key>WCUUID</key>
|
10
|
+
<string>7A95638E-798D-437C-9404-08E7DC68655B</string>
|
11
|
+
<key>WCDebugModeEnabled</key>
|
12
|
+
<integer>1</integer>
|
13
|
+
<key>WCEditable</key>
|
14
|
+
<integer>0</integer>
|
15
|
+
</dict>
|
16
|
+
</plist>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
|
2
|
+
|
3
|
+
require_relative '../../../../../../lib/repla'
|
4
|
+
require_relative '../../../../../../lib/repla/logger'
|
5
|
+
|
6
|
+
logger = Repla::Logger.new
|
7
|
+
logger.info("Testing log message")
|
8
|
+
puts "Testing print to standard input"
|
9
|
+
STDERR.puts "Testing print to standard error"
|
10
|
+
window = Repla::Window.new
|
11
|
+
window.do_javascript("document.body.innerHTML = \"test\";")
|
12
|
+
logger.error("Testing log error")
|
13
|
+
logger.show
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8" />
|
5
|
+
<title>Index</title>
|
6
|
+
<style>
|
7
|
+
header[role="banner"], section, footer {
|
8
|
+
margin: 20px;
|
9
|
+
}
|
10
|
+
</style>
|
11
|
+
</head>
|
12
|
+
<body>
|
13
|
+
|
14
|
+
<header role="banner">
|
15
|
+
<h1>1Percenter</h1>
|
16
|
+
<nav>
|
17
|
+
<ul>
|
18
|
+
<li><a href="#">About</a></li>
|
19
|
+
</ul>
|
20
|
+
</nav>
|
21
|
+
</header>
|
22
|
+
|
23
|
+
<section>
|
24
|
+
<header>
|
25
|
+
<h1>Content</h1>
|
26
|
+
</header>
|
27
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
28
|
+
</section>
|
29
|
+
|
30
|
+
<footer>
|
31
|
+
©2013 Roben Kleene
|
32
|
+
</footer>
|
33
|
+
|
34
|
+
<!-- 1P -->
|
35
|
+
</body>
|
36
|
+
</html>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8" />
|
5
|
+
<title>Index JQuery</title>
|
6
|
+
<script type="text/javascript" src="js/zepto.js"></script>
|
7
|
+
<style>
|
8
|
+
header[role="banner"], section, footer {
|
9
|
+
margin: 20px;
|
10
|
+
}
|
11
|
+
</style>
|
12
|
+
</head>
|
13
|
+
<body>
|
14
|
+
|
15
|
+
<header role="banner">
|
16
|
+
<h1>1Percenter</h1>
|
17
|
+
<nav>
|
18
|
+
<ul>
|
19
|
+
<li><a href="#">About</a></li>
|
20
|
+
</ul>
|
21
|
+
</nav>
|
22
|
+
</header>
|
23
|
+
|
24
|
+
<section>
|
25
|
+
<header>
|
26
|
+
<h1>Content</h1>
|
27
|
+
</header>
|
28
|
+
<p id="text">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
29
|
+
</section>
|
30
|
+
|
31
|
+
<footer>
|
32
|
+
©2013 Roben Kleene
|
33
|
+
</footer>
|
34
|
+
|
35
|
+
<!-- 1P -->
|
36
|
+
</body>
|
37
|
+
</html>
|