harmony 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. data/Manifest +0 -104
  2. data/README.md +7 -1
  3. data/harmony.gemspec +2 -1
  4. data/lib/harmony.rb +1 -1
  5. data/lib/harmony/page.rb +8 -7
  6. data/test/page_test.rb +28 -0
  7. metadata +13 -107
  8. data/vendor/README +0 -1
  9. data/vendor/envjs/README +0 -36
  10. data/vendor/envjs/bin/envjsrb +0 -255
  11. data/vendor/envjs/bin/jquery-1.2.6-test.js +0 -33
  12. data/vendor/envjs/bin/jquery-1.3.1-test.js +0 -33
  13. data/vendor/envjs/bin/jquery-1.3.2-test.js +0 -106
  14. data/vendor/envjs/bin/prototype-1.6.0.3-test.js +0 -82
  15. data/vendor/envjs/bin/prototype_1.6.0.3_tmpl.txt +0 -27
  16. data/vendor/envjs/bin/test-jquery.sh +0 -58
  17. data/vendor/envjs/bin/test-prototype.sh +0 -54
  18. data/vendor/envjs/bin/tidy +0 -0
  19. data/vendor/envjs/lib/envjs.rb +0 -23
  20. data/vendor/envjs/lib/envjs/env.js +0 -21665
  21. data/vendor/envjs/lib/envjs/net.rb +0 -3
  22. data/vendor/envjs/lib/envjs/net/cgi.rb +0 -94
  23. data/vendor/envjs/lib/envjs/net/file.rb +0 -75
  24. data/vendor/envjs/lib/envjs/options.rb +0 -11
  25. data/vendor/envjs/lib/envjs/runtime.rb +0 -351
  26. data/vendor/envjs/lib/envjs/tempfile.rb +0 -24
  27. data/vendor/envjs/test/base64.js +0 -80
  28. data/vendor/envjs/test/call-load-test.js +0 -15
  29. data/vendor/envjs/test/data.js +0 -45
  30. data/vendor/envjs/test/debug.js +0 -53
  31. data/vendor/envjs/test/firebug/errorIcon.png +0 -0
  32. data/vendor/envjs/test/firebug/firebug.css +0 -209
  33. data/vendor/envjs/test/firebug/firebug.html +0 -23
  34. data/vendor/envjs/test/firebug/firebug.js +0 -672
  35. data/vendor/envjs/test/firebug/firebugx.js +0 -10
  36. data/vendor/envjs/test/firebug/infoIcon.png +0 -0
  37. data/vendor/envjs/test/firebug/warningIcon.png +0 -0
  38. data/vendor/envjs/test/fixtures/html/events.html +0 -171
  39. data/vendor/envjs/test/fixtures/html/iframe1.html +0 -46
  40. data/vendor/envjs/test/fixtures/html/iframe1a.html +0 -46
  41. data/vendor/envjs/test/fixtures/html/iframe2.html +0 -45
  42. data/vendor/envjs/test/fixtures/html/iframe3.html +0 -28
  43. data/vendor/envjs/test/fixtures/html/iframeN.html +0 -57
  44. data/vendor/envjs/test/fixtures/html/malformed.html +0 -181
  45. data/vendor/envjs/test/fixtures/html/scope.html +0 -81
  46. data/vendor/envjs/test/fixtures/html/trivial.html +0 -19
  47. data/vendor/envjs/test/fixtures/html/with_js.html +0 -26
  48. data/vendor/envjs/test/fixtures/images/icon-blue.png +0 -0
  49. data/vendor/envjs/test/fixtures/js/external_script.js +0 -1
  50. data/vendor/envjs/test/fixtures/js/script.js +0 -1
  51. data/vendor/envjs/test/fixtures/js/script_error.js +0 -2
  52. data/vendor/envjs/test/html/events.html +0 -171
  53. data/vendor/envjs/test/html/iframe1.html +0 -46
  54. data/vendor/envjs/test/html/iframe1a.html +0 -46
  55. data/vendor/envjs/test/html/iframe2.html +0 -45
  56. data/vendor/envjs/test/html/iframe3.html +0 -30
  57. data/vendor/envjs/test/html/iframeN.html +0 -57
  58. data/vendor/envjs/test/html/malformed.html +0 -181
  59. data/vendor/envjs/test/html/scope.html +0 -87
  60. data/vendor/envjs/test/html/script.js +0 -1
  61. data/vendor/envjs/test/html/trivial.html +0 -19
  62. data/vendor/envjs/test/html/with_js.html +0 -26
  63. data/vendor/envjs/test/index.html +0 -328
  64. data/vendor/envjs/test/java-prototype.js +0 -9
  65. data/vendor/envjs/test/primary-tests.js +0 -24
  66. data/vendor/envjs/test/prototype-test.js +0 -13
  67. data/vendor/envjs/test/qunit.js +0 -61
  68. data/vendor/envjs/test/qunit/qunit/qunit.css +0 -17
  69. data/vendor/envjs/test/qunit/qunit/qunit.js +0 -997
  70. data/vendor/envjs/test/scope.rb +0 -25
  71. data/vendor/envjs/test/specs/dist/env.spec.js +0 -1534
  72. data/vendor/envjs/test/specs/envjs.spec.css +0 -46
  73. data/vendor/envjs/test/specs/parser/html.js +0 -31
  74. data/vendor/envjs/test/specs/parser/spec.html +0 -40
  75. data/vendor/envjs/test/specs/parser/xml.js +0 -31
  76. data/vendor/envjs/test/specs/qunit.bdd.js +0 -210
  77. data/vendor/envjs/test/specs/qunit.css +0 -17
  78. data/vendor/envjs/test/specs/qunit.js +0 -997
  79. data/vendor/envjs/test/specs/template/spec-0.js +0 -31
  80. data/vendor/envjs/test/specs/template/spec-1.js +0 -31
  81. data/vendor/envjs/test/specs/template/spec.html +0 -40
  82. data/vendor/envjs/test/specs/window/css.js +0 -23
  83. data/vendor/envjs/test/specs/window/dialog.js +0 -25
  84. data/vendor/envjs/test/specs/window/document.js +0 -23
  85. data/vendor/envjs/test/specs/window/event.js +0 -25
  86. data/vendor/envjs/test/specs/window/history.js +0 -34
  87. data/vendor/envjs/test/specs/window/location.js +0 -34
  88. data/vendor/envjs/test/specs/window/navigator.js +0 -71
  89. data/vendor/envjs/test/specs/window/screen.js +0 -42
  90. data/vendor/envjs/test/specs/window/spec.html +0 -48
  91. data/vendor/envjs/test/specs/window/timer.js +0 -26
  92. data/vendor/envjs/test/specs/window/window.js +0 -53
  93. data/vendor/envjs/test/specs/xhr/spec.html +0 -47
  94. data/vendor/envjs/test/specs/xhr/xhr.js +0 -31
  95. data/vendor/envjs/test/test.js +0 -10
  96. data/vendor/envjs/test/unit/dom.js +0 -44
  97. data/vendor/envjs/test/unit/elementmembers.js +0 -60
  98. data/vendor/envjs/test/unit/events.js +0 -195
  99. data/vendor/envjs/test/unit/fixtures/external_script.js +0 -1
  100. data/vendor/envjs/test/unit/iframe.js +0 -234
  101. data/vendor/envjs/test/unit/multi-window.js +0 -212
  102. data/vendor/envjs/test/unit/nu.validator.js +0 -34
  103. data/vendor/envjs/test/unit/onload.js +0 -90
  104. data/vendor/envjs/test/unit/parser.js +0 -121
  105. data/vendor/envjs/test/unit/prototypecompat.js +0 -22
  106. data/vendor/envjs/test/unit/proxy.js +0 -6
  107. data/vendor/envjs/test/unit/scope.js +0 -209
  108. data/vendor/envjs/test/unit/timer.js +0 -115
  109. data/vendor/envjs/test/unit/window.js +0 -41
  110. data/vendor/envjs/test/vendor/jQuery/README +0 -2
  111. data/vendor/envjs/test/vendor/prototype-1.6.0.3.js +0 -4320
data/Manifest CHANGED
@@ -11,107 +11,3 @@ specs.watchr
11
11
  test/harmony_test.rb
12
12
  test/page_test.rb
13
13
  test/test_helper.rb
14
- vendor/README
15
- vendor/envjs/README
16
- vendor/envjs/bin/envjsrb
17
- vendor/envjs/bin/jquery-1.2.6-test.js
18
- vendor/envjs/bin/jquery-1.3.1-test.js
19
- vendor/envjs/bin/jquery-1.3.2-test.js
20
- vendor/envjs/bin/prototype-1.6.0.3-test.js
21
- vendor/envjs/bin/prototype_1.6.0.3_tmpl.txt
22
- vendor/envjs/bin/test-jquery.sh
23
- vendor/envjs/bin/test-prototype.sh
24
- vendor/envjs/bin/tidy
25
- vendor/envjs/lib/envjs.rb
26
- vendor/envjs/lib/envjs/env.js
27
- vendor/envjs/lib/envjs/net.rb
28
- vendor/envjs/lib/envjs/net/cgi.rb
29
- vendor/envjs/lib/envjs/net/file.rb
30
- vendor/envjs/lib/envjs/options.rb
31
- vendor/envjs/lib/envjs/runtime.rb
32
- vendor/envjs/lib/envjs/tempfile.rb
33
- vendor/envjs/test/base64.js
34
- vendor/envjs/test/call-load-test.js
35
- vendor/envjs/test/data.js
36
- vendor/envjs/test/debug.js
37
- vendor/envjs/test/firebug/errorIcon.png
38
- vendor/envjs/test/firebug/firebug.css
39
- vendor/envjs/test/firebug/firebug.html
40
- vendor/envjs/test/firebug/firebug.js
41
- vendor/envjs/test/firebug/firebugx.js
42
- vendor/envjs/test/firebug/infoIcon.png
43
- vendor/envjs/test/firebug/warningIcon.png
44
- vendor/envjs/test/fixtures/html/events.html
45
- vendor/envjs/test/fixtures/html/iframe1.html
46
- vendor/envjs/test/fixtures/html/iframe1a.html
47
- vendor/envjs/test/fixtures/html/iframe2.html
48
- vendor/envjs/test/fixtures/html/iframe3.html
49
- vendor/envjs/test/fixtures/html/iframeN.html
50
- vendor/envjs/test/fixtures/html/malformed.html
51
- vendor/envjs/test/fixtures/html/scope.html
52
- vendor/envjs/test/fixtures/html/trivial.html
53
- vendor/envjs/test/fixtures/html/with_js.html
54
- vendor/envjs/test/fixtures/images/icon-blue.png
55
- vendor/envjs/test/fixtures/js/external_script.js
56
- vendor/envjs/test/fixtures/js/script.js
57
- vendor/envjs/test/fixtures/js/script_error.js
58
- vendor/envjs/test/html/events.html
59
- vendor/envjs/test/html/iframe1.html
60
- vendor/envjs/test/html/iframe1a.html
61
- vendor/envjs/test/html/iframe2.html
62
- vendor/envjs/test/html/iframe3.html
63
- vendor/envjs/test/html/iframeN.html
64
- vendor/envjs/test/html/malformed.html
65
- vendor/envjs/test/html/scope.html
66
- vendor/envjs/test/html/script.js
67
- vendor/envjs/test/html/trivial.html
68
- vendor/envjs/test/html/with_js.html
69
- vendor/envjs/test/index.html
70
- vendor/envjs/test/java-prototype.js
71
- vendor/envjs/test/primary-tests.js
72
- vendor/envjs/test/prototype-test.js
73
- vendor/envjs/test/qunit.js
74
- vendor/envjs/test/qunit/qunit/qunit.css
75
- vendor/envjs/test/qunit/qunit/qunit.js
76
- vendor/envjs/test/scope.rb
77
- vendor/envjs/test/specs/dist/env.spec.js
78
- vendor/envjs/test/specs/envjs.spec.css
79
- vendor/envjs/test/specs/parser/html.js
80
- vendor/envjs/test/specs/parser/spec.html
81
- vendor/envjs/test/specs/parser/xml.js
82
- vendor/envjs/test/specs/qunit.bdd.js
83
- vendor/envjs/test/specs/qunit.css
84
- vendor/envjs/test/specs/qunit.js
85
- vendor/envjs/test/specs/template/spec-0.js
86
- vendor/envjs/test/specs/template/spec-1.js
87
- vendor/envjs/test/specs/template/spec.html
88
- vendor/envjs/test/specs/window/css.js
89
- vendor/envjs/test/specs/window/dialog.js
90
- vendor/envjs/test/specs/window/document.js
91
- vendor/envjs/test/specs/window/event.js
92
- vendor/envjs/test/specs/window/history.js
93
- vendor/envjs/test/specs/window/location.js
94
- vendor/envjs/test/specs/window/navigator.js
95
- vendor/envjs/test/specs/window/screen.js
96
- vendor/envjs/test/specs/window/spec.html
97
- vendor/envjs/test/specs/window/timer.js
98
- vendor/envjs/test/specs/window/window.js
99
- vendor/envjs/test/specs/xhr/spec.html
100
- vendor/envjs/test/specs/xhr/xhr.js
101
- vendor/envjs/test/test.js
102
- vendor/envjs/test/unit/dom.js
103
- vendor/envjs/test/unit/elementmembers.js
104
- vendor/envjs/test/unit/events.js
105
- vendor/envjs/test/unit/fixtures/external_script.js
106
- vendor/envjs/test/unit/iframe.js
107
- vendor/envjs/test/unit/multi-window.js
108
- vendor/envjs/test/unit/nu.validator.js
109
- vendor/envjs/test/unit/onload.js
110
- vendor/envjs/test/unit/parser.js
111
- vendor/envjs/test/unit/prototypecompat.js
112
- vendor/envjs/test/unit/proxy.js
113
- vendor/envjs/test/unit/scope.js
114
- vendor/envjs/test/unit/timer.js
115
- vendor/envjs/test/unit/window.js
116
- vendor/envjs/test/vendor/jQuery/README
117
- vendor/envjs/test/vendor/prototype-1.6.0.3.js
data/README.md CHANGED
@@ -111,10 +111,15 @@ Install
111
111
  # There's a gem dependency bug in rubygems currently, so we'll have to
112
112
  # install dependencies manually. This will be fixed soon.
113
113
  gem install stackdeck
114
- gem install johnson -v "2.0.0.pre0"
114
+ gem install johnson -v "2.0.0.pre1"
115
115
 
116
116
  gem install harmony
117
117
 
118
+ See Also
119
+ --------
120
+
121
+ * [holygrail][20]: Harmony plugin for Rails tests
122
+
118
123
  Acknowledgement
119
124
  ---------------
120
125
 
@@ -153,4 +158,5 @@ YinYang ASCII art is © Normand Veilleux (nveilleuATemr1.emrDOTca)
153
158
  [11]: http://github.com/smparkes/env-js/commit/49abe259813a505b0761e6d31dde671344b5bc87#L0R279
154
159
  [12]: http://groups.google.com/group/envjs/msg/4ac719f7db7912f5
155
160
  [13]: http://gemcutter.org/gems/envjs
161
+ [20]: http://github.com/mynyml/holygrail
156
162
  [30]: http://github.com/thatcher/env-js
@@ -12,6 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.version = Harmony::VERSION
13
13
  s.files = File.read("Manifest").strip.split("\n")
14
14
 
15
- s.add_dependency 'johnson', '2.0.0.pre0'
15
+ s.add_dependency 'johnson', '2.0.0.pre1'
16
+ s.add_dependency 'envjs', '0.1.2'
16
17
  s.add_development_dependency 'minitest'
17
18
  end
@@ -1,5 +1,5 @@
1
1
  module Harmony
2
- VERSION = '0.5.1'
2
+ VERSION = '0.5.2'
3
3
 
4
4
  autoload :Page, 'harmony/page'
5
5
  end
@@ -2,7 +2,7 @@ require 'pathname'
2
2
  require 'tempfile'
3
3
 
4
4
  require 'johnson/tracemonkey'
5
- require Pathname(__FILE__).dirname.parent.parent + 'vendor/envjs/lib/envjs/runtime'
5
+ require 'envjs/runtime'
6
6
 
7
7
  module Harmony
8
8
  class Page
@@ -65,15 +65,16 @@ module Harmony
65
65
  @window = Window.from_document(document) if document
66
66
  end
67
67
 
68
- # Load a javascript file in page's context
69
- #
70
- # @param [String] path
71
- # path to js file
68
+ # Load one or more javascript files in page's context
72
69
  #
70
+ # @param [#to_s, #to_s, ...] paths
71
+ # paths to js file
73
72
  # @return [Page] self
74
73
  #
75
- def load(path)
76
- window.load(path.to_s)
74
+ def load(*paths)
75
+ paths.flatten.each do |path|
76
+ window.load(path.to_s)
77
+ end
77
78
  self
78
79
  end
79
80
 
@@ -65,6 +65,34 @@ class PageTest < MiniTest::Unit::TestCase
65
65
  assert_equal 'bar', page.x('foo()')
66
66
  end
67
67
 
68
+ test "can load multiple files as array" do
69
+ paths = []
70
+ paths << tempfile(<<-HTML)
71
+ function foo() { return 'bar' };
72
+ HTML
73
+ paths << tempfile(<<-HTML)
74
+ function moo() { return 'boo' };
75
+ HTML
76
+
77
+ page = Page.new.load(paths)
78
+ assert_equal 'bar', page.x('foo()')
79
+ assert_equal 'boo', page.x('moo()')
80
+ end
81
+
82
+ test "can load multiple files as splat" do
83
+ paths = []
84
+ paths << tempfile(<<-HTML)
85
+ function foo() { return 'bar' };
86
+ HTML
87
+ paths << tempfile(<<-HTML)
88
+ function moo() { return 'boo' };
89
+ HTML
90
+
91
+ page = Page.new.load(*paths)
92
+ assert_equal 'bar', page.x('foo()')
93
+ assert_equal 'boo', page.x('moo()')
94
+ end
95
+
68
96
  private
69
97
  def tempfile(content)
70
98
  Tempfile.open('abc') {|f| f << content; @__path = f.path }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: harmony
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - mynyml
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-02-11 00:00:00 -05:00
12
+ date: 2010-02-13 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,17 @@ dependencies:
20
20
  requirements:
21
21
  - - "="
22
22
  - !ruby/object:Gem::Version
23
- version: 2.0.0.pre0
23
+ version: 2.0.0.pre1
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: envjs
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.1.2
24
34
  version:
25
35
  - !ruby/object:Gem::Dependency
26
36
  name: minitest
@@ -54,110 +64,6 @@ files:
54
64
  - test/harmony_test.rb
55
65
  - test/page_test.rb
56
66
  - test/test_helper.rb
57
- - vendor/README
58
- - vendor/envjs/README
59
- - vendor/envjs/bin/envjsrb
60
- - vendor/envjs/bin/jquery-1.2.6-test.js
61
- - vendor/envjs/bin/jquery-1.3.1-test.js
62
- - vendor/envjs/bin/jquery-1.3.2-test.js
63
- - vendor/envjs/bin/prototype-1.6.0.3-test.js
64
- - vendor/envjs/bin/prototype_1.6.0.3_tmpl.txt
65
- - vendor/envjs/bin/test-jquery.sh
66
- - vendor/envjs/bin/test-prototype.sh
67
- - vendor/envjs/bin/tidy
68
- - vendor/envjs/lib/envjs.rb
69
- - vendor/envjs/lib/envjs/env.js
70
- - vendor/envjs/lib/envjs/net.rb
71
- - vendor/envjs/lib/envjs/net/cgi.rb
72
- - vendor/envjs/lib/envjs/net/file.rb
73
- - vendor/envjs/lib/envjs/options.rb
74
- - vendor/envjs/lib/envjs/runtime.rb
75
- - vendor/envjs/lib/envjs/tempfile.rb
76
- - vendor/envjs/test/base64.js
77
- - vendor/envjs/test/call-load-test.js
78
- - vendor/envjs/test/data.js
79
- - vendor/envjs/test/debug.js
80
- - vendor/envjs/test/firebug/errorIcon.png
81
- - vendor/envjs/test/firebug/firebug.css
82
- - vendor/envjs/test/firebug/firebug.html
83
- - vendor/envjs/test/firebug/firebug.js
84
- - vendor/envjs/test/firebug/firebugx.js
85
- - vendor/envjs/test/firebug/infoIcon.png
86
- - vendor/envjs/test/firebug/warningIcon.png
87
- - vendor/envjs/test/fixtures/html/events.html
88
- - vendor/envjs/test/fixtures/html/iframe1.html
89
- - vendor/envjs/test/fixtures/html/iframe1a.html
90
- - vendor/envjs/test/fixtures/html/iframe2.html
91
- - vendor/envjs/test/fixtures/html/iframe3.html
92
- - vendor/envjs/test/fixtures/html/iframeN.html
93
- - vendor/envjs/test/fixtures/html/malformed.html
94
- - vendor/envjs/test/fixtures/html/scope.html
95
- - vendor/envjs/test/fixtures/html/trivial.html
96
- - vendor/envjs/test/fixtures/html/with_js.html
97
- - vendor/envjs/test/fixtures/images/icon-blue.png
98
- - vendor/envjs/test/fixtures/js/external_script.js
99
- - vendor/envjs/test/fixtures/js/script.js
100
- - vendor/envjs/test/fixtures/js/script_error.js
101
- - vendor/envjs/test/html/events.html
102
- - vendor/envjs/test/html/iframe1.html
103
- - vendor/envjs/test/html/iframe1a.html
104
- - vendor/envjs/test/html/iframe2.html
105
- - vendor/envjs/test/html/iframe3.html
106
- - vendor/envjs/test/html/iframeN.html
107
- - vendor/envjs/test/html/malformed.html
108
- - vendor/envjs/test/html/scope.html
109
- - vendor/envjs/test/html/script.js
110
- - vendor/envjs/test/html/trivial.html
111
- - vendor/envjs/test/html/with_js.html
112
- - vendor/envjs/test/index.html
113
- - vendor/envjs/test/java-prototype.js
114
- - vendor/envjs/test/primary-tests.js
115
- - vendor/envjs/test/prototype-test.js
116
- - vendor/envjs/test/qunit.js
117
- - vendor/envjs/test/qunit/qunit/qunit.css
118
- - vendor/envjs/test/qunit/qunit/qunit.js
119
- - vendor/envjs/test/scope.rb
120
- - vendor/envjs/test/specs/dist/env.spec.js
121
- - vendor/envjs/test/specs/envjs.spec.css
122
- - vendor/envjs/test/specs/parser/html.js
123
- - vendor/envjs/test/specs/parser/spec.html
124
- - vendor/envjs/test/specs/parser/xml.js
125
- - vendor/envjs/test/specs/qunit.bdd.js
126
- - vendor/envjs/test/specs/qunit.css
127
- - vendor/envjs/test/specs/qunit.js
128
- - vendor/envjs/test/specs/template/spec-0.js
129
- - vendor/envjs/test/specs/template/spec-1.js
130
- - vendor/envjs/test/specs/template/spec.html
131
- - vendor/envjs/test/specs/window/css.js
132
- - vendor/envjs/test/specs/window/dialog.js
133
- - vendor/envjs/test/specs/window/document.js
134
- - vendor/envjs/test/specs/window/event.js
135
- - vendor/envjs/test/specs/window/history.js
136
- - vendor/envjs/test/specs/window/location.js
137
- - vendor/envjs/test/specs/window/navigator.js
138
- - vendor/envjs/test/specs/window/screen.js
139
- - vendor/envjs/test/specs/window/spec.html
140
- - vendor/envjs/test/specs/window/timer.js
141
- - vendor/envjs/test/specs/window/window.js
142
- - vendor/envjs/test/specs/xhr/spec.html
143
- - vendor/envjs/test/specs/xhr/xhr.js
144
- - vendor/envjs/test/test.js
145
- - vendor/envjs/test/unit/dom.js
146
- - vendor/envjs/test/unit/elementmembers.js
147
- - vendor/envjs/test/unit/events.js
148
- - vendor/envjs/test/unit/fixtures/external_script.js
149
- - vendor/envjs/test/unit/iframe.js
150
- - vendor/envjs/test/unit/multi-window.js
151
- - vendor/envjs/test/unit/nu.validator.js
152
- - vendor/envjs/test/unit/onload.js
153
- - vendor/envjs/test/unit/parser.js
154
- - vendor/envjs/test/unit/prototypecompat.js
155
- - vendor/envjs/test/unit/proxy.js
156
- - vendor/envjs/test/unit/scope.js
157
- - vendor/envjs/test/unit/timer.js
158
- - vendor/envjs/test/unit/window.js
159
- - vendor/envjs/test/vendor/jQuery/README
160
- - vendor/envjs/test/vendor/prototype-1.6.0.3.js
161
67
  has_rdoc: true
162
68
  homepage: http://github.com/mynyml/harmony
163
69
  licenses: []
@@ -1 +0,0 @@
1
- vendoring specific envjs version (built from source) until changes are released
@@ -1,36 +0,0 @@
1
- This is a fork of the env.js project (http://github.com/thatcher/env-js/). See that link for env.js details.
2
-
3
- This fork is based on the Johnson Ruby gem (http://github.com/jbarnette/johnson) and will become obsolete when the Johnson support has been reintegrated into the master repo.
4
-
5
- For now, you can install the envjs gem by installing Johnson:
6
-
7
- gem install johnson --prerelease
8
-
9
- (You'll need to manually install any prerequisites it asks for) and then installing the envjs gem with
10
-
11
- gem install envjs
12
-
13
- The envjs gem provides the envjsrb command, which functions as an extended version of the Johnson javascript shell. For example:
14
-
15
- mbp:env-js smparkes$ envjsrb
16
- js> this
17
- => [object Window 0]
18
- js> window.location
19
- => about:blank
20
- js> document.innerHTML
21
- => "<html><head><title></title></head><body></body></html>"
22
- js>
23
-
24
- It's also possible to embed the envjs interpreter similar to the way it's done in Johnson, e.g.,
25
-
26
- require 'rubygems' # if necessary
27
- require 'johnson/tramonkey'
28
- require 'envjs/runtime'
29
-
30
- envjs = Johnson::Runtime.new
31
- envjs.extend Envjs::Runtime
32
- window = envjs.evaluate("")
33
- puts window.location.to_s # == "about:blank"
34
- puts window.document.innerHTML # == "<html><head><title></title></head><body></body></html>"
35
-
36
- Comments to http://groups.google.com/group/envjs or #envjs on freenode.
@@ -1,255 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'rubygems'
4
- require 'pathname'
5
-
6
- require 'envjs/options'
7
-
8
- require 'johnson/tracemonkey'
9
- require 'johnson/cli'
10
- require 'envjs/runtime'
11
-
12
- RUNTIME = js = Johnson::Runtime.new
13
- RUNTIME.extend Envjs::Runtime
14
-
15
- # RUNTIME.load Envjs::ENVJS
16
-
17
- EXIT_VERBS = [nil] + %w(exit quit)
18
-
19
- prepped = false
20
- ruby_readline = []
21
- js_readline = []
22
- local_binding = binding
23
- mode = nil
24
-
25
- (class<<self; self; end).send :define_method, :prep do
26
-
27
- return if prepped
28
- prepped = true
29
-
30
- require "readline"
31
- require "johnson/cli"
32
-
33
- RUNTIME.evaluate(Johnson::CLI::JS)
34
-
35
- def copy_history
36
- new_history = []
37
- until Readline::HISTORY.empty?
38
- new_history.push(Readline::HISTORY.pop)
39
- end
40
- new_history
41
- end
42
-
43
- def paste_history(old_history)
44
- until old_history.empty?
45
- Readline::HISTORY << old_history.pop
46
- end
47
- end
48
-
49
- def handle_exit(input)
50
- return EXIT_VERBS.include?(input)
51
- end
52
-
53
- def rescued(&block)
54
- yield
55
- rescue Exception => e
56
- exit if SystemExit === e
57
-
58
- puts e.message
59
- puts e.backtrace.reject { |l| l =~ /bin\/johnson/ }
60
- end
61
-
62
- def eval_in_js(expression,stream)
63
- rescued do
64
- v = RUNTIME.evaluate(expression, "(console)")
65
- stream.result { "=> " + v.inspect }
66
- end
67
- end
68
-
69
- def eval_in_ruby(expression, bind_to, stream)
70
- rescued do
71
- v = eval(expression, bind_to)
72
- stream.result { "=> " + v.inspect }
73
- end
74
- end
75
-
76
- (class<<self; self; end).send :define_method, :do_loop do |stream|
77
- # def foo
78
-
79
- catch "Breakout" do
80
- loop do
81
- mode = :js
82
- input = stream.next("js> ")
83
- input and input.chomp!
84
- begin stream.exit(input); throw "Breakout" end if handle_exit(input)
85
-
86
- if input =~ /^rb\s+(.+)$/
87
- eval_in_ruby($1, local_binding, stream)
88
- next
89
- end
90
-
91
- if input == "rb"
92
- js_readline = copy_history
93
- paste_history(ruby_readline)
94
-
95
- loop do
96
- mode = :rb
97
- # input = Readline.readline("rb> ", true)
98
- input = stream.next("rb> ")
99
- begin stream.exit(input); throw "Breakout" end if handle_exit(input)
100
-
101
- break if input == "js"
102
-
103
- if input =~ /^js\s+(.+)$/
104
- eval_in_js($1)
105
- next
106
- end
107
-
108
- eval_in_ruby(input, local_binding, stream)
109
- end
110
-
111
- ruby_readline = copy_history
112
- paste_history(js_readline)
113
- next
114
- end
115
-
116
- eval_in_js(input, stream)
117
- end
118
- end
119
- end
120
- end
121
-
122
- if ARGV.length > 0
123
-
124
- begin
125
- about_blank = true
126
- ARGV.each do |file|
127
-
128
- uri = URI.parse file
129
-
130
- if uri.scheme == nil
131
- uri.scheme = "file"
132
- begin
133
- uri.path = Pathname.new(uri.path).realpath.to_s
134
- rescue Errno::ENOENT; end
135
- uri = URI.parse uri.to_s
136
- end
137
-
138
- uri_s = uri.to_s.sub %r(^file:/([^/])), 'file:///\1'
139
-
140
- if uri.scheme == "about" and uri.opaque == "blank"
141
- RUNTIME.wait
142
- RUNTIME.evaluate("window.location = 'about:blank'", "(comand line)", 1)
143
- about_blank = true
144
- elsif uri.path =~ /\.x?html?$/ || uri.scheme =~ %r(^https?)
145
-
146
- # this might want to go alway; jazrb does it manually now, which I think was the use case
147
- # that wanted this
148
- if !about_blank
149
- RUNTIME.wait
150
- RUNTIME.evaluate("window.location = 'about:blank'", "(comand line)", 1)
151
- end
152
-
153
- RUNTIME.wait
154
- # RUNTIME.evaluate("window.location = 'file://#{Pathname.new(file).realpath}'", file, 1)
155
- RUNTIME.evaluate("window.location = '#{uri_s}'", file, 1)
156
- about_blank = false
157
- else
158
- RUNTIME.become_first_script_window
159
- RUNTIME.top_level_load uri_s
160
- RUNTIME.load uri_s
161
- end
162
- end
163
- rescue Johnson::Error => je
164
- if je.message.match /<SystemExit: exit>/
165
- exit
166
- end
167
- raise je
168
- end
169
-
170
- RUNTIME.wait
171
-
172
- else
173
-
174
- prep
175
-
176
- if !(files = Dir[".envjsrbrc",File.join(ENV["HOME"],".envjsrbrc")]).empty?
177
- file = Class.new do
178
- def initialize f
179
- @file = open f
180
- end
181
- def next prompt
182
- @file.gets
183
- end
184
- def result &block
185
- end
186
- def exit v; end
187
- end.new files[0]
188
-
189
- do_loop file
190
- end
191
-
192
- options = Johnson::CLI::Options.parse!(ARGV)
193
-
194
- options.load_paths.each { |d| $LOAD_PATH << d }
195
- options.paths_to_require.each { |p| RUNTIME.evaluate("Johnson.require('#{p}')") }
196
- options.files_to_preload.each { |f| RUNTIME.load(f) }
197
-
198
- unless options.expressions.empty?
199
- options.expressions.each { |e| RUNTIME.evaluate(e, '-e') }
200
- exit if options.files_to_evaluate.empty?
201
- end
202
-
203
- unless options.files_to_evaluate.empty?
204
- RUNTIME[:arguments] = options.arguments
205
-
206
- options.files_to_evaluate.each do |file|
207
- RUNTIME.load(file)
208
- end
209
-
210
- exit
211
- end
212
-
213
- reader = Class.new do
214
- def next prompt
215
- Readline.readline(prompt, true)
216
- end
217
- def result
218
- puts yield
219
- end
220
- def exit v; puts if v.nil?; end
221
- end.new
222
-
223
- begin
224
- open(File.join(ENV["HOME"],".envjsrb.js")) do |f|
225
- js_readline = f.read.split("\n")
226
- end
227
- rescue; end
228
-
229
- begin
230
- open(File.join(ENV["HOME"],".envjsrb.ruby")) do |f|
231
- ruby_readline = f.read.split("\n")
232
- end
233
- rescue; end
234
-
235
- case mode
236
- when :js; paste_history js_readline
237
- when :rb; paste_history ruby_readline
238
- end
239
-
240
- do_loop reader
241
-
242
- case mode
243
- when :js; js_readline = copy_history
244
- when :rb; ruby_readline = copy_history
245
- end
246
-
247
- open(File.join(ENV["HOME"],".envjsrb.js"),"w") do |f|
248
- f.write js_readline[0..100].join("\n")+"\n"
249
- end
250
-
251
- open(File.join(ENV["HOME"],".envjsrb.ruby"),"w") do |f|
252
- f.write ruby_readline[0..100].join("\n")+"\n"
253
- end
254
-
255
- end