repla 0.3.0 → 0.4.0

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 (98) hide show
  1. checksums.yaml +4 -4
  2. data/lib/applescript/{load_html.scpt → load.scpt} +0 -0
  3. data/lib/applescript/{load_html_with_base_url.scpt → load_with_root_access_directory.scpt} +0 -0
  4. data/lib/repla/dependencies/html/index.html +25 -0
  5. data/lib/repla/dependencies/lib/view.rb +5 -5
  6. data/lib/repla/dependencies.rb +1 -2
  7. data/lib/repla/lib/constants.rb +0 -2
  8. data/lib/repla/lib/module.rb +1 -24
  9. data/lib/repla/lib/view/javascript.rb +7 -1
  10. data/lib/repla/lib/view/resources.rb +0 -38
  11. data/lib/repla/lib/view.rb +0 -1
  12. data/lib/repla/lib/window.rb +10 -15
  13. data/lib/repla/logger/test/Rakefile +7 -9
  14. data/lib/repla/logger/test/lib/test_setup.rb +10 -0
  15. data/lib/repla/logger/test/lib/test_view_helper.rb +1 -1
  16. data/lib/repla/logger/test/run_tests.sh +3 -1
  17. data/lib/repla/logger/test/tc_logger.rb +18 -21
  18. data/lib/repla/logger.rb +1 -2
  19. data/lib/repla/repl/html/index.html +22 -0
  20. data/lib/repla/repl/lib/view.rb +5 -50
  21. data/lib/repla/repl.rb +1 -2
  22. data/lib/repla/resources/css/raster.css +131 -0
  23. data/lib/repla/resources/js/bullets/Gruntfile.js +30 -0
  24. data/lib/repla/resources/js/bullets/README.md +3 -0
  25. data/lib/repla/resources/js/bullets/bullets.js +82 -0
  26. data/lib/repla/resources/js/bullets/example/css/bullets.css +6 -0
  27. data/lib/repla/resources/js/bullets/example/css/raster.css +131 -0
  28. data/lib/repla/resources/js/bullets/example/css/style.css +7 -0
  29. data/lib/repla/resources/js/bullets/example/index.html +137 -0
  30. data/lib/repla/resources/js/bullets/example/jade/content.jade +10 -0
  31. data/lib/repla/resources/js/bullets/example/jade/css.jade +3 -0
  32. data/lib/repla/resources/js/bullets/example/jade/index.jade +10 -0
  33. data/lib/repla/resources/js/bullets/example/jade/javascript.jade +5 -0
  34. data/lib/repla/resources/js/bullets/example/js/handlebars.js +2278 -0
  35. data/lib/repla/resources/js/bullets/example/js/jquery.js +9789 -0
  36. data/lib/repla/resources/js/bullets/example/js/mousetrap.js +910 -0
  37. data/lib/repla/resources/js/bullets/example/js/mousetrap_config.js +14 -0
  38. data/lib/repla/resources/js/bullets/example/js/zepto.js +1565 -0
  39. data/lib/repla/resources/js/bullets/package.json +28 -0
  40. data/lib/repla/resources/js/bullets/test/lib/css/mocha.css +270 -0
  41. data/lib/repla/resources/js/bullets/test/lib/index.html +153 -0
  42. data/lib/repla/resources/js/bullets/test/lib/jade/index.jade +13 -0
  43. data/lib/repla/resources/js/bullets/test/lib/jade/mocha.html +15 -0
  44. data/lib/repla/resources/js/bullets/test/lib/js/chai.js +4613 -0
  45. data/lib/repla/resources/js/bullets/test/lib/js/mocha.js +5726 -0
  46. data/lib/repla/resources/js/bullets/test/lib/js/test_helper.js +26 -0
  47. data/lib/repla/resources/js/bullets/test/run_tests.rb +7 -0
  48. data/lib/repla/resources/js/bullets/test/test.js +131 -0
  49. data/lib/repla/resources/js/handlebars.js +2278 -0
  50. data/lib/repla/resources/js/mousetrap.js +910 -0
  51. data/lib/repla/resources/js/zepto.js +1565 -0
  52. data/lib/repla/test/applescript/cancel_dialog.applescript +2 -0
  53. data/lib/repla/test/applescript/confirm_dialog.applescript +2 -0
  54. data/lib/repla/test/applescript/is_running.applescript +5 -0
  55. data/lib/repla/test/applescript/quit.applescript +3 -0
  56. data/lib/repla/test/applescript/set_window_bounds.applescript +23 -0
  57. data/lib/repla/test/applescript/switch_windows.applescript +2 -0
  58. data/lib/repla/test/applescript/window_bounds.applescript +20 -0
  59. data/lib/repla/test/applescript/window_id.applescript +7 -0
  60. data/lib/repla/test/bundles/Cat.wcplugin/Contents/Info.plist +14 -0
  61. data/lib/repla/test/bundles/Cat.wcplugin/Contents/Resources/cat.sh +3 -0
  62. data/lib/repla/test/bundles/HelloWorld.wcplugin/Contents/Info.plist +14 -0
  63. data/lib/repla/test/bundles/HelloWorld.wcplugin/Contents/Resources/hello_world.rb +3 -0
  64. data/lib/repla/test/bundles/Invalid.wcplugin/Contents/Info.plist +16 -0
  65. data/lib/repla/test/bundles/Print.wcplugin/Contents/Info.plist +16 -0
  66. data/lib/repla/test/bundles/Print.wcplugin/Contents/Resources/html/css/style.css +7 -0
  67. data/lib/repla/test/bundles/Print.wcplugin/Contents/Resources/html/index.html +24 -0
  68. data/lib/repla/test/bundles/Print.wcplugin/Contents/Resources/html/js/wcprint.js +8 -0
  69. data/lib/repla/test/bundles/Print.wcplugin/Contents/Resources/lib/controller.rb +18 -0
  70. data/lib/repla/test/bundles/Print.wcplugin/Contents/Resources/lib/view.rb +13 -0
  71. data/lib/repla/test/bundles/Print.wcplugin/Contents/Resources/print.rb +10 -0
  72. data/lib/repla/test/bundles/TestEnvironment.wcplugin/Contents/Info.plist +14 -0
  73. data/lib/repla/test/bundles/TestEnvironment.wcplugin/Contents/Resources/constants.rb +1 -0
  74. data/lib/repla/test/bundles/TestEnvironment.wcplugin/Contents/Resources/test_environment.rb +35 -0
  75. data/lib/repla/test/bundles/TestLog.wcplugin/Contents/Info.plist +16 -0
  76. data/lib/repla/test/bundles/TestLog.wcplugin/Contents/Resources/test_log.rb +13 -0
  77. data/lib/repla/test/html/index.html +36 -0
  78. data/lib/repla/test/html/indexjquery.html +37 -0
  79. data/lib/repla/test/html/js/zepto.js +1565 -0
  80. data/lib/repla/test/js/firstcode.js +3 -0
  81. data/lib/repla/test/js/lastcode.js +3 -0
  82. data/lib/repla/test/js/nodom.js +5 -0
  83. data/lib/repla/test/js/text.js +1 -0
  84. data/lib/repla/test/js/textjquery.js +1 -0
  85. data/lib/repla/test/js/title.js +1 -0
  86. data/lib/repla/test/lib/helper.rb +121 -0
  87. data/lib/repla/test.rb +51 -0
  88. data/lib/repla.rb +6 -6
  89. metadata +78 -14
  90. data/lib/repla/dependencies/views/view.html.erb +0 -25
  91. data/lib/repla/extension_constants.rb +0 -1
  92. data/lib/repla/lib/view/erb.rb +0 -17
  93. data/lib/repla/logger/test/lib/test_constants.rb +0 -8
  94. data/lib/repla/repl/view/view.html.erb +0 -12
  95. /data/lib/repla/dependencies/{css → html/css}/style.css +0 -0
  96. /data/lib/repla/dependencies/{js → html/js}/wcdependencies.js +0 -0
  97. /data/lib/repla/repl/{css → html/css}/style.css +0 -0
  98. /data/lib/repla/repl/{js → html/js}/wcrepl.js +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1b80e1592a3dc429896f001bda2bddff25b7e3d8
4
- data.tar.gz: fdc62f4bd40eee40bd310317e0a69c94aed98c57
3
+ metadata.gz: e6c25d2a775a0a58b1b85c28fb7e659c031733ba
4
+ data.tar.gz: 7bbd40e204cb30ccc62931c0669725dd6dd91cff
5
5
  SHA512:
6
- metadata.gz: cc65843d273f506f347478d436fbc9ccc12e07f49621be18dba68f2f3428907c349c140e83b2c20c5d6ad70bdb0e3d2e46b727a48ee5b7ebe3130a1e2027144e
7
- data.tar.gz: 29484bdba1f0240d71ff699a530a938756f2911473472d9d5efe102da1657d46e3f128b6a77573ced49fce80949932eb18fa1b09b71c2beb5942e4ef440ac7ec
6
+ metadata.gz: 61e74ff0e82cc4e04b45495fbdd58ec26b828d0af6990efd856fabe575de63c9941b9e95a3edfc35357345746eab6dd2d3c8515503ed4dcfd57170fdb9fbb8c8
7
+ data.tar.gz: 01ffaf898ce45b8964e7a0e63b8e4571a85f2aae7c51ba3c0d3d5c2ff779e9771d20c1fea7d19fb24c4f05172cb39dbe7d55703898b31fb05d7f0db3e5279735
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Dependencies</title>
6
+ <link rel="stylesheet" href="css/style.css">
7
+ <link rel="stylesheet" href="../../resources/css/raster.css">
8
+ <script id="dependency-template" type="text/x-handlebars-template">
9
+ <section>
10
+ <header>
11
+ <h5>Dependency <span class="type">{{type}}</span> <code class="name">{{name}}</code> not found.</h5>
12
+ </header>
13
+ {{#if installationInstructions}}
14
+ <p><blockquote class="installation">To install <code>{{name}}</code>: {{{installationInstructions}}}</blockquote></p>
15
+ {{/if}}
16
+ </section>
17
+ </script>
18
+ <script type="text/javascript" src=
19
+ "../../resources/js/handlebars.js"></script>
20
+ <script type="text/javascript" src="../../resources/js/zepto.js"></script>
21
+ <script type="text/javascript" src="js/wcdependencies.js"></script>
22
+ </head>
23
+ <body>
24
+ </body>
25
+ </html>
@@ -1,14 +1,14 @@
1
1
  module Repla::Dependencies
2
2
 
3
3
  class View < Repla::View
4
- BASE_DIRECTORY = File.join(File.dirname(__FILE__), '..')
5
- VIEWS_DIRECTORY = File.join(BASE_DIRECTORY, "views")
6
- VIEW_TEMPLATE = File.join(VIEWS_DIRECTORY, 'view.html.erb')
4
+ ROOT_ACCESS_DIRECTORY = File.join(File.dirname(__FILE__), '../../')
5
+ HTML_DIRECTORY = File.join(File.dirname(__FILE__), '../html/')
6
+ VIEW_TEMPLATE = File.join(HTML_DIRECTORY, 'index.html')
7
7
 
8
8
  def initialize
9
9
  super
10
- self.base_url_path = File.expand_path(BASE_DIRECTORY)
11
- load_erb_from_path(VIEW_TEMPLATE)
10
+ self.root_access_directory_path = File.expand_path(ROOT_ACCESS_DIRECTORY)
11
+ load_file(VIEW_TEMPLATE)
12
12
  end
13
13
 
14
14
  ADD_MISSING_DEPENDENCY_FUNCTION = "addMissingDependency"
@@ -1,5 +1,4 @@
1
- require_relative 'extension_constants'
2
- require REPLA_FILE
1
+ require_relative '../repla'
3
2
 
4
3
  module Repla::Dependencies
5
4
  class Checker
@@ -3,8 +3,6 @@ module Repla
3
3
  PLUGIN_NAME_KEY = 'WC_PLUGIN_NAME'
4
4
  SPLIT_ID_KEY = 'WC_SPLIT_ID'
5
5
  WINDOW_ID_KEY = 'WC_WINDOW_ID'
6
- SHARED_RESOURCES_PATH_KEY = 'WC_SHARED_RESOURCES_PATH'
7
- SHARED_RESOURCES_URL_KEY = 'WC_SHARED_RESOURCES_URL'
8
6
 
9
7
  # Directories
10
8
  APPLESCRIPT_DIRECTORY = File.join(File.dirname(__FILE__), "..", "..", "applescript")
@@ -48,40 +48,17 @@ module Repla
48
48
  self.run_applescript(CREATE_WINDOW_SCRIPT)
49
49
  end
50
50
 
51
- # Shared Resources
51
+ # Resources
52
52
 
53
53
  RESOURCE_PATH_FOR_PLUGIN_SCRIPT = File.join(APPLESCRIPT_DIRECTORY, "resource_path_for_plugin.scpt")
54
54
  def self.resource_path_for_plugin(name)
55
55
  self.run_applescript(RESOURCE_PATH_FOR_PLUGIN_SCRIPT, [name])
56
56
  end
57
57
 
58
- # Shared Resource Path
59
-
60
- SHARED_RESOURCES_PLUGIN_NAME = "Shared Resources"
61
- SHARED_TEST_RESOURCES_PLUGIN_NAME = "Shared Test Resources"
62
- def self.shared_resources_path
63
- resource_path_for_plugin(SHARED_RESOURCES_PLUGIN_NAME)
64
- end
65
- def self.shared_test_resources_path
66
- resource_path_for_plugin(SHARED_TEST_RESOURCES_PLUGIN_NAME)
67
- end
68
-
69
- def self.shared_resource(resource)
70
- File.join(self.shared_resources_path, resource)
71
- end
72
- def self.shared_test_resource(resource)
73
- File.join(self.shared_test_resources_path, resource)
74
- end
75
-
76
- # Shared Resource URL
77
-
78
58
  RESOURCE_URL_FOR_PLUGIN_SCRIPT = File.join(APPLESCRIPT_DIRECTORY, "resource_url_for_plugin.scpt")
79
59
  def self.resource_url_for_plugin(name)
80
60
  self.run_applescript(RESOURCE_URL_FOR_PLUGIN_SCRIPT, [name])
81
61
  end
82
- def self.shared_resources_url
83
- resource_url_for_plugin(SHARED_RESOURCES_PLUGIN_NAME)
84
- end
85
62
 
86
63
  private
87
64
 
@@ -13,7 +13,7 @@ module Repla
13
13
  if arguments
14
14
  arguments.each { |argument|
15
15
  if argument
16
- function << argument.javascript_argument
16
+ function << argument.javascript_argument
17
17
  else
18
18
  function << "null"
19
19
  end
@@ -27,6 +27,12 @@ module Repla
27
27
 
28
28
  private
29
29
 
30
+ class ::Fixnum
31
+ def javascript_argument
32
+ "#{self}"
33
+ end
34
+ end
35
+
30
36
  class ::String
31
37
  def javascript_argument
32
38
  "'#{self.javascript_escape}'"
@@ -1,42 +1,4 @@
1
1
  module Repla
2
2
  class View < Window
3
- require 'open-uri'
4
-
5
- require_relative "../constants"
6
- require_relative "../module"
7
-
8
- attr_accessor :title
9
-
10
- CSS_EXTENSION = ".css"
11
- CSS_PATH_COMPONENT = "css/"
12
- def shared_stylesheet_link_tag(resource)
13
- uri = URI.join(shared_resources_url, CSS_PATH_COMPONENT, resource + CSS_EXTENSION)
14
- stylesheet_link_tag(uri.to_s)
15
- end
16
-
17
- def stylesheet_link_tag(url)
18
- "<link rel=\"stylesheet\" href=\"#{url}\" />"
19
- end
20
-
21
- JS_EXTENSION = ".js"
22
- JS_PATH_COMPONENT = "js/"
23
- def shared_javascript_include_tag(resource)
24
- uri = URI.join(shared_resources_url, JS_PATH_COMPONENT, resource + JS_EXTENSION)
25
- javascript_include_tag(uri.to_s)
26
- end
27
-
28
- def javascript_include_tag(url)
29
- "<script type=\"text/javascript\" src=\"#{url}\"></script>"
30
- end
31
-
32
- def title
33
- @title ||= ENV.has_key?(PLUGIN_NAME_KEY) ? ENV[PLUGIN_NAME_KEY] : nil
34
- end
35
-
36
- private
37
-
38
- def shared_resources_url
39
- @shared_resources_url || ENV.has_key?(SHARED_RESOURCES_URL_KEY) ? ENV[SHARED_RESOURCES_URL_KEY] : Repla::shared_resources_url
40
- end
41
3
  end
42
4
  end
@@ -1,6 +1,5 @@
1
1
  require_relative "window"
2
2
  require_relative "view/javascript"
3
- require_relative "view/erb"
4
3
  require_relative "view/resources"
5
4
 
6
5
  module Repla
@@ -2,34 +2,29 @@ module Repla
2
2
  class Window
3
3
  require_relative "constants"
4
4
 
5
- attr_writer :base_url
6
-
5
+ attr_accessor :root_access_directory_path
7
6
  def initialize(window_id = nil)
8
7
  @window_id = window_id
9
8
  end
10
9
 
11
10
  # Properties
12
11
 
13
- def base_url_path=(value)
14
- @base_url = "file://" + value
15
- end
16
-
17
12
  def window_id
18
13
  @window_id ||= ENV.has_key?(WINDOW_ID_KEY) ? ENV[WINDOW_ID_KEY] : Repla::create_window
19
14
  end
20
-
15
+
21
16
  # Web
22
17
 
23
- LOADHTML_SCRIPT = File.join(APPLESCRIPT_DIRECTORY, "load_html.scpt")
24
- LOADHTMLWITHBASEURL_SCRIPT = File.join(APPLESCRIPT_DIRECTORY, "load_html_with_base_url.scpt")
25
- def load_html(html)
26
- arguments = [html]
18
+ LOAD_SCRIPT = File.join(APPLESCRIPT_DIRECTORY, "load.scpt")
19
+ LOADWITHROOTACCESSDIRECTORY_SCRIPT = File.join(APPLESCRIPT_DIRECTORY, "load_with_root_access_directory.scpt")
20
+ def load_file(file)
21
+ arguments = [file]
27
22
 
28
- script = LOADHTML_SCRIPT
23
+ script = LOAD_SCRIPT
29
24
 
30
- if @base_url
31
- script = LOADHTMLWITHBASEURL_SCRIPT
32
- arguments.push(@base_url)
25
+ if @root_access_directory_path
26
+ script = LOADWITHROOTACCESSDIRECTORY_SCRIPT
27
+ arguments.push(@root_access_directory_path)
33
28
  end
34
29
 
35
30
  run_script(script, arguments)
@@ -1,20 +1,18 @@
1
1
  require 'shellwords'
2
- require 'repla'
3
- require Repla::shared_test_resource("ruby/test_constants")
4
- require Repla::Tests::TEST_HELPER_FILE
5
2
 
6
- task :default => ['logger:tests']
3
+ require_relative 'lib/test_requires.rb'
4
+
5
+ task default: ['logger:tests']
7
6
 
8
7
  namespace :logger do
9
-
10
- task :tests => [:clean_up]
8
+ task tests: [:clean_up]
11
9
 
12
10
  task :test_logger do
13
- logger_tests_file = File.join(File.dirname(__FILE__), "tc_logger.rb")
11
+ logger_tests_file = File.join(File.dirname(__FILE__), 'tc_logger.rb')
14
12
  ruby Shellwords.escape(logger_tests_file)
15
13
  end
16
14
 
17
- task :clean_up => [:test_logger] do
18
- Repla::Tests::Helper::quit
15
+ task clean_up: [:test_logger] do
16
+ Repla::Test::Helper.quit
19
17
  end
20
18
  end
@@ -0,0 +1,10 @@
1
+ require_relative "../../../test"
2
+ require Repla::Test::HELPER_FILE
3
+ require Repla::Test::REPLA_FILE
4
+
5
+ TEST_CLASS_JAVASCRIPT = 'document.body.lastChild.classList[0]'.freeze
6
+ TEST_MESSAGE_JAVASCRIPT = 'document.body.lastChild.innerText'.freeze
7
+ TEST_MESSAGE_COUNT_JAVASCRIPT = 'document.body.children.length'.freeze
8
+
9
+ TEST_JAVASCRIPT_DIRECTORY = File.join(File.dirname(__FILE__), '..', 'js')
10
+ TEST_JAVASCRIPT_FILE = File.join(TEST_JAVASCRIPT_DIRECTORY, 'test_view_helper.js')
@@ -1,4 +1,4 @@
1
- require_relative 'test_constants'
1
+ require_relative 'test_setup'
2
2
 
3
3
  class TestViewHelper
4
4
 
@@ -1,3 +1,5 @@
1
1
  #!/bin/sh
2
2
 
3
- rake
3
+ cd "$(dirname "$0")"
4
+
5
+ rake
@@ -2,15 +2,11 @@
2
2
 
3
3
  require "test/unit"
4
4
 
5
- require_relative "lib/test_constants"
6
- require REPLA_FILE
7
- require Repla::shared_test_resource("ruby/test_constants")
8
- require Repla::Tests::TEST_HELPER_FILE
5
+ require_relative 'lib/test_setup.rb'
9
6
 
10
7
  require_relative "lib/test_view_helper"
11
8
  require_relative "../../logger"
12
9
 
13
-
14
10
  class TestConstants < Test::Unit::TestCase
15
11
 
16
12
  def test_constants
@@ -26,8 +22,8 @@ end
26
22
  class TestUnintializedLogger < Test::Unit::TestCase
27
23
 
28
24
  def teardown
29
- Repla::Tests::Helper::quit
30
- assert(!Repla::Tests::Helper::is_running, "The application should not be running.")
25
+ Repla::Test::Helper::quit
26
+ assert(!Repla::Test::Helper::running?, "The application should not be running.")
31
27
  end
32
28
 
33
29
  def test_uninitialized_logger
@@ -36,11 +32,12 @@ class TestUnintializedLogger < Test::Unit::TestCase
36
32
  # Test Message
37
33
  message = "Testing log message"
38
34
  logger.info(message)
39
- sleep Repla::Tests::TEST_PAUSE_TIME # Pause for output to be processed
35
+ sleep Repla::Test::TEST_PAUSE_TIME # Pause for output to be processed
40
36
 
41
- # Make sure the log messages before accessing the logger's `view_id` and `window_id` because those run the logger.
42
- # This test should test logging a message and running the logger itself simultaneously.
43
- # This is why the `TestViewHelper` is intialized after logging the message.
37
+ # Make sure the log messages before accessing the logger's `view_id` and
38
+ # `window_id` because those run the logger. This test should test logging a
39
+ # message and running the logger itself simultaneously. This is why the
40
+ # `TestViewHelper` is intialized after logging the message.
44
41
  test_view_helper = TestViewHelper.new(logger.window_id, logger.view_id)
45
42
 
46
43
  test_message = test_view_helper.last_log_message
@@ -62,8 +59,8 @@ class TestLogger < Test::Unit::TestCase
62
59
  end
63
60
 
64
61
  def teardown
65
- Repla::Tests::Helper::quit
66
- assert(!Repla::Tests::Helper::is_running, "The application should not be running.")
62
+ Repla::Test::Helper::quit
63
+ assert(!Repla::Test::Helper::running?, "The application should not be running.")
67
64
  end
68
65
 
69
66
  def test_logger
@@ -72,7 +69,7 @@ class TestLogger < Test::Unit::TestCase
72
69
  # Test Error
73
70
  message = "Testing log error"
74
71
  @logger.error(message)
75
- sleep Repla::Tests::TEST_PAUSE_TIME # Pause for output to be processed
72
+ sleep Repla::Test::TEST_PAUSE_TIME # Pause for output to be processed
76
73
  test_message = @test_view_helper.last_log_message
77
74
  assert_equal(message, test_message, "The messages should match")
78
75
  test_class = @test_view_helper.last_log_class
@@ -84,7 +81,7 @@ class TestLogger < Test::Unit::TestCase
84
81
  # Test Message
85
82
  message = "Testing log message"
86
83
  @logger.info(message)
87
- sleep Repla::Tests::TEST_PAUSE_TIME # Pause for output to be processed
84
+ sleep Repla::Test::TEST_PAUSE_TIME # Pause for output to be processed
88
85
  test_message = @test_view_helper.last_log_message
89
86
  assert_equal(message, test_message, "The messages should match")
90
87
  test_class = @test_view_helper.last_log_class
@@ -96,7 +93,7 @@ class TestLogger < Test::Unit::TestCase
96
93
  # Test Only Error Prefix
97
94
  message = Repla::Logger::ERROR_PREFIX.rstrip # Note the trailing whitespace is trimmed
98
95
  @logger.info(message)
99
- sleep Repla::Tests::TEST_PAUSE_TIME # Pause for output to be processed
96
+ sleep Repla::Test::TEST_PAUSE_TIME # Pause for output to be processed
100
97
  test_message = @test_view_helper.last_log_message
101
98
  assert_equal(message, test_message, "The messages should match")
102
99
  test_class = @test_view_helper.last_log_class
@@ -108,7 +105,7 @@ class TestLogger < Test::Unit::TestCase
108
105
  # Test Only Message Prefix
109
106
  message = Repla::Logger::MESSAGE_PREFIX.rstrip # Note the trailing whitespace is trimmed
110
107
  @logger.info(message)
111
- sleep Repla::Tests::TEST_PAUSE_TIME # Pause for output to be processed
108
+ sleep Repla::Test::TEST_PAUSE_TIME # Pause for output to be processed
112
109
  test_message = @test_view_helper.last_log_message
113
110
  assert_equal(message, test_message, "The messages should match")
114
111
  test_class = @test_view_helper.last_log_class
@@ -119,7 +116,7 @@ class TestLogger < Test::Unit::TestCase
119
116
 
120
117
  # Test Blank Spaces
121
118
  @logger.info(" \t")
122
- sleep Repla::Tests::TEST_PAUSE_TIME # Pause for output to be processed
119
+ sleep Repla::Test::TEST_PAUSE_TIME # Pause for output to be processed
123
120
  test_message = @test_view_helper.last_log_message()
124
121
  assert_equal(message, test_message, "The messages should match")
125
122
  test_class = @test_view_helper.last_log_class()
@@ -127,7 +124,7 @@ class TestLogger < Test::Unit::TestCase
127
124
 
128
125
  # Test Empty String
129
126
  @logger.info("")
130
- sleep Repla::Tests::TEST_PAUSE_TIME # Pause for output to be processed
127
+ sleep Repla::Test::TEST_PAUSE_TIME # Pause for output to be processed
131
128
  test_message = @test_view_helper.last_log_message()
132
129
  assert_equal(message, test_message, "The messages should match")
133
130
  test_class = @test_view_helper.last_log_class()
@@ -141,7 +138,7 @@ class TestLogger < Test::Unit::TestCase
141
138
 
142
139
  # message = "\t Testing log message"
143
140
  # @logger.info(message + "\t ")
144
- # sleep Repla::Tests::TEST_PAUSE_TIME # Pause for output to be processed
141
+ # sleep Repla::Test::TEST_PAUSE_TIME # Pause for output to be processed
145
142
  # test_message = @test_view_helper.last_log_message
146
143
  # assert_equal(message, test_message, "The messages should match")
147
144
  # test_class = @test_view_helper.last_log_class
@@ -159,7 +156,7 @@ Line 2
159
156
  Line 3
160
157
  )
161
158
  @logger.info(message)
162
- sleep Repla::Tests::TEST_PAUSE_TIME * 2 # Pause for output to be processed
159
+ sleep Repla::Test::TEST_PAUSE_TIME * 2 # Pause for output to be processed
163
160
  result_count = @test_view_helper.number_of_log_messages
164
161
  assert_equal(result_count, 3, "The number of log messages should match")
165
162
 
data/lib/repla/logger.rb CHANGED
@@ -1,5 +1,4 @@
1
- require_relative 'extension_constants'
2
- require REPLA_FILE
1
+ require_relative '../repla'
3
2
 
4
3
  module Repla
5
4
 
@@ -0,0 +1,22 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>REPL</title>
6
+ <link rel="stylesheet" href="../../resources/css/raster.css">
7
+ <link rel="stylesheet" href="css/style.css">
8
+ <script id="output-template" type="text/x-handlebars-template">
9
+ <pre class="output"><code>{{code}}</code></pre>
10
+ </script>
11
+ <script id="input-template" type="text/x-handlebars-template">
12
+ <pre><code>{{code}}</code></pre>
13
+ </script>
14
+ </head>
15
+ <body>
16
+ ]
17
+ <script type="text/javascript" src=
18
+ "../../resources/js/handlebars.js"></script>
19
+ <script type="text/javascript" src="../../resources/js/zepto.js"></script>
20
+ <script type="text/javascript" src="js/wcrepl.js"></script>
21
+ </body>
22
+ </html>
@@ -1,13 +1,12 @@
1
1
  module Repla::REPL
2
2
  class View < Repla::View
3
-
4
- BASE_DIRECTORY = File.join(File.dirname(__FILE__), "..")
5
- VIEWS_DIRECTORY = File.join(BASE_DIRECTORY, "view")
6
- VIEW_TEMPLATE = File.join(VIEWS_DIRECTORY, 'view.html.erb')
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')
7
6
  def initialize
8
7
  super
9
- self.base_url_path = File.expand_path(BASE_DIRECTORY)
10
- load_erb_from_path(VIEW_TEMPLATE)
8
+ self.root_access_directory_path = File.expand_path(ROOT_ACCESS_DIRECTORY)
9
+ load_file(VIEW_TEMPLATE)
11
10
  end
12
11
 
13
12
  ADD_INPUT_JAVASCRIPT_FUNCTION = "WcREPL.addInput"
@@ -20,49 +19,5 @@ module Repla::REPL
20
19
  do_javascript_function(ADD_OUTPUT_JAVASCRIPT_FUNCTION, [output])
21
20
  end
22
21
 
23
- # Helpers to allow easy loading of REPL resource even from another base URL
24
-
25
- def repl_header_tags
26
- %Q[
27
- #{repl_stylesheet_link_tag}
28
- #{repl_handlebars_template_tags}
29
- #{shared_javascript_include_tag("handlebars")}
30
- #{shared_javascript_include_tag("zepto")}
31
- #{repl_javascript_include_tag}
32
- ]
33
- end
34
-
35
- def repl_handlebars_template_tags
36
- %Q[
37
- <script id="output-template" type="text/x-handlebars-template">
38
- <pre class="output"><code>{{code}}</code></pre>
39
- </script>
40
- <script id="input-template" type="text/x-handlebars-template">
41
- <pre><code>{{code}}</code></pre>
42
- </script>]
43
- end
44
-
45
- def repl_stylesheet_link_tag
46
- path = File.join(repl_base_resource_path, "css/style.css")
47
- url = repl_url_for_path(path)
48
- stylesheet_link_tag(url)
49
- end
50
-
51
- def repl_javascript_include_tag
52
- path = File.join(repl_base_resource_path, "js/wcrepl.js")
53
- url = repl_url_for_path(path)
54
- javascript_include_tag(url)
55
- end
56
-
57
- require 'open-uri'
58
- def repl_url_for_path(path)
59
- uri = URI::encode(path)
60
- "file://" + uri
61
- end
62
-
63
- def repl_base_resource_path
64
- File.expand_path(File.join(File.dirname(__FILE__), "../"))
65
- end
66
-
67
22
  end
68
23
  end
data/lib/repla/repl.rb CHANGED
@@ -1,5 +1,4 @@
1
- require_relative 'extension_constants'
2
- require REPLA_FILE
1
+ require_relative '../repla'
3
2
 
4
3
  module Repla::REPL
5
4
  require_relative "repl/lib/input_controller"
@@ -0,0 +1,131 @@
1
+ /* Settings */
2
+ /* Eric Meyer's Reset
3
+ ============================================================================*/
4
+ /* Details here:
5
+ http://meyerweb.com/eric/thoughts/2007/05/01/reset-reloaded/
6
+
7
+ Some of the rules have been broken up for cleaner display in firebug. */
8
+ /* First the resets ... */
9
+ /* Structural Tags
10
+ ----------------------------------------------------------------------------*/
11
+ html, body, div, span {
12
+ margin: 0;
13
+ padding: 0;
14
+ border: 0;
15
+ outline: 0;
16
+ font-size: 100%;
17
+ vertical-align: baseline;
18
+ background: transparent; }
19
+
20
+ /* Text Tags
21
+ ----------------------------------------------------------------------------*/
22
+ h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, ol, ul, li, strong, em {
23
+ margin: 0;
24
+ padding: 0;
25
+ border: 0;
26
+ outline: 0;
27
+ font-size: 100%;
28
+ vertical-align: baseline;
29
+ background: transparent; }
30
+
31
+ /* Less Used Tags
32
+ ----------------------------------------------------------------------------*/
33
+ applet, object, iframe, abbr, acronym, address, big, cite, code, del, dfn,
34
+ font, img, ins, kbd, q, s, samp, small, strike, sub, sup, tt, var, b, u, i,
35
+ center, dl, dt, dd, fieldset, form, label, legend, table, caption, tbody,
36
+ tfoot, thead, tr, th, td {
37
+ margin: 0;
38
+ padding: 0;
39
+ border: 0;
40
+ outline: 0;
41
+ font-size: 100%;
42
+ vertical-align: baseline;
43
+ background: transparent; }
44
+
45
+ /* ... and now everything else */
46
+ /* remember to define focus styles! */
47
+ :focus {
48
+ outline: 0; }
49
+
50
+ body {
51
+ line-height: 1;
52
+ color: black;
53
+ background: white; }
54
+
55
+ ol, ul {
56
+ list-style: none; }
57
+
58
+ /* tables still need 'cellspacing="0"' in the markup */
59
+ table {
60
+ border-collapse: separate;
61
+ border-spacing: 0; }
62
+
63
+ caption, th, td {
64
+ text-align: left;
65
+ font-weight: normal; }
66
+
67
+ blockquote:before, blockquote:after, q:before, q:after {
68
+ content: ""; }
69
+
70
+ blockquote, q {
71
+ quotes: "" ""; }
72
+
73
+ body {
74
+ font-size: 0.75em;
75
+ line-height: 1.41667em; }
76
+
77
+ h1 {
78
+ font-size: 3em;
79
+ line-height: 1.41667em;
80
+ margin-bottom: 0.47222em;
81
+ line-height: 1.41667em;
82
+ margin-bottom: 0.47222em; }
83
+
84
+ h2 {
85
+ font-size: 2em;
86
+ line-height: 1.41667em;
87
+ margin-bottom: 0.70833em;
88
+ line-height: 1.41667em;
89
+ margin-bottom: 0.70833em; }
90
+
91
+ h3 {
92
+ font-size: 1.75em;
93
+ line-height: 1.41667em;
94
+ margin-bottom: 0.20238em;
95
+ line-height: 1.42857em;
96
+ margin-bottom: 0.19048em; }
97
+
98
+ h4 {
99
+ font-size: 1.5em;
100
+ line-height: 1.41667em;
101
+ margin-bottom: 0.47222em;
102
+ line-height: 1.44444em;
103
+ margin-bottom: 0.44444em; }
104
+
105
+ h5 {
106
+ font-size: 1.16667em;
107
+ line-height: 1.41667em;
108
+ margin-bottom: 1.0119em;
109
+ line-height: 1.42857em;
110
+ margin-bottom: 1em; }
111
+
112
+ h6 {
113
+ font-size: 1em;
114
+ line-height: 1.41667em;
115
+ margin-bottom: 1.41667em;
116
+ line-height: 1.41667em;
117
+ margin-bottom: 1.41667em; }
118
+
119
+ p, ul, ol {
120
+ margin-bottom: 1.41667em; }
121
+
122
+ ul {
123
+ list-style-type: disc;
124
+ margin-left: 2em; }
125
+
126
+ ol {
127
+ list-style-type: decimal;
128
+ margin-left: 2em; }
129
+
130
+ body {
131
+ padding: 1.41667em; }