xpcomcore-rubygem 0.6.2 → 0.6.3
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.
- data/Rakefile +2 -1
- data/VERSION +1 -1
- data/bin/xpcomcore-gem +23 -0
- data/xpcomcore-rubygem.gemspec +11 -4
- data/xpcomcore/Rakefile +8 -2
- data/xpcomcore/build_properties.yml +1 -1
- data/xpcomcore/components/XPCOMCore.js +1 -1
- data/xpcomcore/doc/files.html +15 -3
- data/xpcomcore/doc/index.html +1 -1
- data/xpcomcore/doc/symbols/_global_.html +72 -1
- data/xpcomcore/doc/symbols/error.html +1 -1
- data/xpcomcore/doc/symbols/file.html +1 -1
- data/xpcomcore/doc/symbols/file.nosuchfileerror.html +1 -1
- data/xpcomcore/doc/symbols/kernel.html +1 -1
- data/xpcomcore/doc/symbols/loaderror.html +1 -1
- data/xpcomcore/doc/symbols/selfconcepterror.html +1 -1
- data/xpcomcore/doc/symbols/src/lib_stdlib_rubygems.js.html +42 -0
- data/xpcomcore/doc/symbols/src/lib_sys.js.html +17 -11
- data/xpcomcore/doc/symbols/sys.html +1 -1
- data/xpcomcore/doc/symbols/xpcbuiltins.html +1 -1
- data/xpcomcore/lib/stdlib/rubygems.js +34 -0
- data/xpcomcore/lib/sys.js +9 -3
- data/xpcomcore/test/file_test.js +23 -21
- data/xpcomcore/test/kernel_test.js +51 -59
- data/xpcomcore/test/stdlib/rubygems_test.js +17 -0
- data/xpcomcore/test/sys_test.js +13 -14
- data/xpcomcore/test/test_helper.js +7 -0
- data/xpcomcore/test/xpc_builtins_test.js +6 -4
- metadata +19 -3
data/Rakefile
CHANGED
@@ -7,7 +7,7 @@ begin
|
|
7
7
|
|
8
8
|
Jeweler::Tasks.new do |gem|
|
9
9
|
gem.name = "xpcomcore-rubygem"
|
10
|
-
gem.executables = %w[xpcomcore]
|
10
|
+
gem.executables = %w[xpcomcore xpcomcore-gem]
|
11
11
|
gem.summary = %Q{Gem to allow for using XPCOMCore via RubyGems}
|
12
12
|
gem.description = %Q{Gem to allow for using XPCOMCore via RubyGems}
|
13
13
|
gem.email = "gabriel.gironda@gmail.com"
|
@@ -31,6 +31,7 @@ begin
|
|
31
31
|
gem.add_dependency "cmdparse"
|
32
32
|
gem.add_dependency "plist"
|
33
33
|
gem.add_dependency "iniparse"
|
34
|
+
gem.add_dependency "json"
|
34
35
|
gem.add_dependency "uuidtools", ">=2.0.0"
|
35
36
|
gem.add_dependency "jeweler", "=1.2.1"
|
36
37
|
gem.add_development_dependency "colored"
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.3
|
data/bin/xpcomcore-gem
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require "rubygems"
|
3
|
+
require "json"
|
4
|
+
require 'pathname'
|
5
|
+
# TODO - add support for fetching a specific version.
|
6
|
+
# This isn't an 'xpcomcore' command because we don't
|
7
|
+
# want the baggage associated and want this to return
|
8
|
+
# as fast as possible.
|
9
|
+
# TODO - clean this sucker up.
|
10
|
+
app_name = ARGV[0]
|
11
|
+
exit 1 unless app_name
|
12
|
+
|
13
|
+
lib_path = "xpcomcore/lib"
|
14
|
+
gems = Gem.source_index.find_name(app_name)
|
15
|
+
if gems
|
16
|
+
spec = gems.last
|
17
|
+
expected_libs = Pathname(spec.full_gem_path) + lib_path
|
18
|
+
exit 1 unless expected_libs.exist? && expected_libs.directory?
|
19
|
+
print({'libDir' => expected_libs.expand_path.to_s}.to_json)
|
20
|
+
exit 0
|
21
|
+
else
|
22
|
+
exit 1
|
23
|
+
end
|
data/xpcomcore-rubygem.gemspec
CHANGED
@@ -5,15 +5,14 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{xpcomcore-rubygem}
|
8
|
-
s.version = "0.6.
|
8
|
+
s.version = "0.6.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["ggironda"]
|
12
|
-
s.date = %q{2009-10-
|
13
|
-
s.default_executable = %q{xpcomcore}
|
12
|
+
s.date = %q{2009-10-21}
|
14
13
|
s.description = %q{Gem to allow for using XPCOMCore via RubyGems}
|
15
14
|
s.email = %q{gabriel.gironda@gmail.com}
|
16
|
-
s.executables = ["xpcomcore"]
|
15
|
+
s.executables = ["xpcomcore", "xpcomcore-gem"]
|
17
16
|
s.extra_rdoc_files = [
|
18
17
|
"LICENSE",
|
19
18
|
"README.markdown"
|
@@ -27,6 +26,7 @@ Gem::Specification.new do |s|
|
|
27
26
|
"Rakefile",
|
28
27
|
"VERSION",
|
29
28
|
"bin/xpcomcore",
|
29
|
+
"bin/xpcomcore-gem",
|
30
30
|
"ext/stub_runners/darwin/StubApp.app/Contents/Info.plist",
|
31
31
|
"ext/stub_runners/darwin/StubApp.app/Contents/MacOS/stub_runner",
|
32
32
|
"ext/stub_runners/darwin/StubApp.app/Contents/PkgInfo",
|
@@ -73,12 +73,14 @@ Gem::Specification.new do |s|
|
|
73
73
|
"xpcomcore/doc/symbols/selfconcepterror.html",
|
74
74
|
"xpcomcore/doc/symbols/src/lib_file.js.html",
|
75
75
|
"xpcomcore/doc/symbols/src/lib_kernel.js.html",
|
76
|
+
"xpcomcore/doc/symbols/src/lib_stdlib_rubygems.js.html",
|
76
77
|
"xpcomcore/doc/symbols/src/lib_sys.js.html",
|
77
78
|
"xpcomcore/doc/symbols/src/lib_xpc_builtins.js.html",
|
78
79
|
"xpcomcore/doc/symbols/sys.html",
|
79
80
|
"xpcomcore/doc/symbols/xpcbuiltins.html",
|
80
81
|
"xpcomcore/lib/file.js",
|
81
82
|
"xpcomcore/lib/kernel.js",
|
83
|
+
"xpcomcore/lib/stdlib/rubygems.js",
|
82
84
|
"xpcomcore/lib/sys.js",
|
83
85
|
"xpcomcore/lib/xpc_builtins.js",
|
84
86
|
"xpcomcore/test/file_test.js",
|
@@ -88,7 +90,9 @@ Gem::Specification.new do |s|
|
|
88
90
|
"xpcomcore/test/fixtures/mad_world.js",
|
89
91
|
"xpcomcore/test/fixtures/syntax_error.js",
|
90
92
|
"xpcomcore/test/kernel_test.js",
|
93
|
+
"xpcomcore/test/stdlib/rubygems_test.js",
|
91
94
|
"xpcomcore/test/sys_test.js",
|
95
|
+
"xpcomcore/test/test_helper.js",
|
92
96
|
"xpcomcore/test/xpc_builtins_test.js"
|
93
97
|
]
|
94
98
|
s.homepage = %q{http://github.com/gabrielg/xpcomcore-rubygem}
|
@@ -121,6 +125,7 @@ Gem::Specification.new do |s|
|
|
121
125
|
s.add_runtime_dependency(%q<cmdparse>, [">= 0"])
|
122
126
|
s.add_runtime_dependency(%q<plist>, [">= 0"])
|
123
127
|
s.add_runtime_dependency(%q<iniparse>, [">= 0"])
|
128
|
+
s.add_runtime_dependency(%q<json>, [">= 0"])
|
124
129
|
s.add_runtime_dependency(%q<uuidtools>, [">= 2.0.0"])
|
125
130
|
s.add_runtime_dependency(%q<jeweler>, ["= 1.2.1"])
|
126
131
|
s.add_development_dependency(%q<colored>, [">= 0"])
|
@@ -129,6 +134,7 @@ Gem::Specification.new do |s|
|
|
129
134
|
s.add_dependency(%q<cmdparse>, [">= 0"])
|
130
135
|
s.add_dependency(%q<plist>, [">= 0"])
|
131
136
|
s.add_dependency(%q<iniparse>, [">= 0"])
|
137
|
+
s.add_dependency(%q<json>, [">= 0"])
|
132
138
|
s.add_dependency(%q<uuidtools>, [">= 2.0.0"])
|
133
139
|
s.add_dependency(%q<jeweler>, ["= 1.2.1"])
|
134
140
|
s.add_dependency(%q<colored>, [">= 0"])
|
@@ -138,6 +144,7 @@ Gem::Specification.new do |s|
|
|
138
144
|
s.add_dependency(%q<cmdparse>, [">= 0"])
|
139
145
|
s.add_dependency(%q<plist>, [">= 0"])
|
140
146
|
s.add_dependency(%q<iniparse>, [">= 0"])
|
147
|
+
s.add_dependency(%q<json>, [">= 0"])
|
141
148
|
s.add_dependency(%q<uuidtools>, [">= 2.0.0"])
|
142
149
|
s.add_dependency(%q<jeweler>, ["= 1.2.1"])
|
143
150
|
s.add_dependency(%q<colored>, [">= 0"])
|
data/xpcomcore/Rakefile
CHANGED
@@ -7,9 +7,15 @@ require 'english'
|
|
7
7
|
|
8
8
|
here = (Pathname(__FILE__).parent.expand_path)
|
9
9
|
|
10
|
-
task :
|
10
|
+
task :set_bootstrapper_env do
|
11
11
|
ENV['XPCOMCORE'] = (Pathname(__FILE__).parent.expand_path + "bootstrapper.js").to_s
|
12
|
-
|
12
|
+
end
|
13
|
+
|
14
|
+
gem 'xultestrunner'
|
15
|
+
require 'xultestrunner/tasks/test_task'
|
16
|
+
XULTestRunner::TestTask.new(:test => :set_bootstrapper_env) do |tt|
|
17
|
+
tt.test_lib = "test"
|
18
|
+
tt.test_dir = "test"
|
13
19
|
end
|
14
20
|
|
15
21
|
task :default => :test
|
@@ -1,5 +1,5 @@
|
|
1
1
|
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
2
|
-
var XPCOMCoreVersion = '0.5.
|
2
|
+
var XPCOMCoreVersion = '0.5.3'; // DO NOT REMOVE THIS COMMENT OR MOVE THIS LINE. THIS LINE IS AUTO-GENERATED FROM A RAKE TASK. @XPCOMCORE_VERSION@
|
3
3
|
const $Cc = Components.classes;
|
4
4
|
const $Ci = Components.interfaces;
|
5
5
|
|
data/xpcomcore/doc/files.html
CHANGED
@@ -222,6 +222,19 @@ console.
|
|
222
222
|
|
223
223
|
|
224
224
|
|
225
|
+
</dl>
|
226
|
+
</div>
|
227
|
+
<hr />
|
228
|
+
|
229
|
+
<div>
|
230
|
+
<h2><a href="symbols/src/lib_file.js.html">file.js</a></h2>
|
231
|
+
|
232
|
+
This file defines the implementation of our File object.
|
233
|
+
<dl>
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
225
238
|
</dl>
|
226
239
|
</div>
|
227
240
|
<hr />
|
@@ -253,9 +266,8 @@ This file defines the implementation of our XPCBuiltins namespace.
|
|
253
266
|
<hr />
|
254
267
|
|
255
268
|
<div>
|
256
|
-
<h2><a href="symbols/src/
|
269
|
+
<h2><a href="symbols/src/lib_stdlib_rubygems.js.html">lib/stdlib/rubygems.js</a></h2>
|
257
270
|
|
258
|
-
This file defines the implementation of our File object.
|
259
271
|
<dl>
|
260
272
|
|
261
273
|
|
@@ -269,7 +281,7 @@ This file defines the implementation of our File object.
|
|
269
281
|
</div>
|
270
282
|
<div class="fineprint" style="clear:both">
|
271
283
|
|
272
|
-
Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.3.2 on
|
284
|
+
Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.3.2 on Wed Oct 21 2009 09:55:02 GMT-0500 (CDT)
|
273
285
|
</div>
|
274
286
|
</body>
|
275
287
|
</html>
|
data/xpcomcore/doc/index.html
CHANGED
@@ -269,7 +269,7 @@ build the rest of XPCOMCore on top of.
|
|
269
269
|
</div>
|
270
270
|
<div class="fineprint" style="clear:both">
|
271
271
|
|
272
|
-
Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.3.2 on
|
272
|
+
Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.3.2 on Wed Oct 21 2009 09:55:02 GMT-0500 (CDT)
|
273
273
|
</div>
|
274
274
|
</body>
|
275
275
|
</html>
|
@@ -237,6 +237,33 @@ ul.inheritsList
|
|
237
237
|
|
238
238
|
<!-- ============================== methods summary ======================== -->
|
239
239
|
|
240
|
+
|
241
|
+
|
242
|
+
<table class="summaryTable" cellspacing="0" summary="A summary of the methods documented in the class _global_.">
|
243
|
+
<caption>Method Summary</caption>
|
244
|
+
<thead>
|
245
|
+
<tr>
|
246
|
+
<th scope="col">Method Attributes</th>
|
247
|
+
<th scope="col">Method Name and Description</th>
|
248
|
+
</tr>
|
249
|
+
</thead>
|
250
|
+
<tbody>
|
251
|
+
|
252
|
+
<tr>
|
253
|
+
<td class="attributes"> </td>
|
254
|
+
<td class="nameDescription">
|
255
|
+
<div class="fixedFont"><b><a href="../symbols/_global_.html#gem">gem</a></b>(gemName)
|
256
|
+
</div>
|
257
|
+
<div class="description"></div>
|
258
|
+
</td>
|
259
|
+
</tr>
|
260
|
+
|
261
|
+
</tbody>
|
262
|
+
</table>
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
|
240
267
|
<!-- ============================== events summary ======================== -->
|
241
268
|
|
242
269
|
|
@@ -248,6 +275,50 @@ ul.inheritsList
|
|
248
275
|
|
249
276
|
<!-- ============================== method details ========================= -->
|
250
277
|
|
278
|
+
<div class="sectionTitle">
|
279
|
+
Method Detail
|
280
|
+
</div>
|
281
|
+
|
282
|
+
<a name="gem"> </a>
|
283
|
+
<div class="fixedFont">
|
284
|
+
|
285
|
+
|
286
|
+
<b>gem</b>(gemName)
|
287
|
+
|
288
|
+
</div>
|
289
|
+
<div class="description">
|
290
|
+
|
291
|
+
|
292
|
+
<br />
|
293
|
+
<i>Defined in: </i> <a href="../symbols/src/lib_stdlib_rubygems.js.html">rubygems.js</a>.
|
294
|
+
|
295
|
+
|
296
|
+
</div>
|
297
|
+
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
<dl class="detailList">
|
302
|
+
<dt class="heading">Parameters:</dt>
|
303
|
+
|
304
|
+
<dt>
|
305
|
+
<b>gemName</b>
|
306
|
+
|
307
|
+
</dt>
|
308
|
+
<dd></dd>
|
309
|
+
|
310
|
+
</dl>
|
311
|
+
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
|
316
|
+
|
317
|
+
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
|
251
322
|
|
252
323
|
<!-- ============================== event details ========================= -->
|
253
324
|
|
@@ -259,7 +330,7 @@ ul.inheritsList
|
|
259
330
|
<!-- ============================== footer ================================= -->
|
260
331
|
<div class="fineprint" style="clear:both">
|
261
332
|
|
262
|
-
Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.3.2 on
|
333
|
+
Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.3.2 on Wed Oct 21 2009 09:55:02 GMT-0500 (CDT)
|
263
334
|
</div>
|
264
335
|
</body>
|
265
336
|
</html>
|
@@ -259,7 +259,7 @@ ul.inheritsList
|
|
259
259
|
<!-- ============================== footer ================================= -->
|
260
260
|
<div class="fineprint" style="clear:both">
|
261
261
|
|
262
|
-
Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.3.2 on
|
262
|
+
Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.3.2 on Wed Oct 21 2009 09:55:02 GMT-0500 (CDT)
|
263
263
|
</div>
|
264
264
|
</body>
|
265
265
|
</html>
|
@@ -446,7 +446,7 @@ from the specified file
|
|
446
446
|
<!-- ============================== footer ================================= -->
|
447
447
|
<div class="fineprint" style="clear:both">
|
448
448
|
|
449
|
-
Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.3.2 on
|
449
|
+
Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.3.2 on Wed Oct 21 2009 09:55:02 GMT-0500 (CDT)
|
450
450
|
</div>
|
451
451
|
</body>
|
452
452
|
</html>
|
@@ -329,7 +329,7 @@ ul.inheritsList
|
|
329
329
|
<!-- ============================== footer ================================= -->
|
330
330
|
<div class="fineprint" style="clear:both">
|
331
331
|
|
332
|
-
Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.3.2 on
|
332
|
+
Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.3.2 on Wed Oct 21 2009 09:55:02 GMT-0500 (CDT)
|
333
333
|
</div>
|
334
334
|
</body>
|
335
335
|
</html>
|
@@ -1136,7 +1136,7 @@ in <a href="../symbols/kernel.html#$LOAD_PATH">Kernel#$LOAD_PATH</a>.</dd>
|
|
1136
1136
|
<!-- ============================== footer ================================= -->
|
1137
1137
|
<div class="fineprint" style="clear:both">
|
1138
1138
|
|
1139
|
-
Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.3.2 on
|
1139
|
+
Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.3.2 on Wed Oct 21 2009 09:55:02 GMT-0500 (CDT)
|
1140
1140
|
</div>
|
1141
1141
|
</body>
|
1142
1142
|
</html>
|
@@ -329,7 +329,7 @@ ul.inheritsList
|
|
329
329
|
<!-- ============================== footer ================================= -->
|
330
330
|
<div class="fineprint" style="clear:both">
|
331
331
|
|
332
|
-
Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.3.2 on
|
332
|
+
Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.3.2 on Wed Oct 21 2009 09:55:02 GMT-0500 (CDT)
|
333
333
|
</div>
|
334
334
|
</body>
|
335
335
|
</html>
|
@@ -329,7 +329,7 @@ ul.inheritsList
|
|
329
329
|
<!-- ============================== footer ================================= -->
|
330
330
|
<div class="fineprint" style="clear:both">
|
331
331
|
|
332
|
-
Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.3.2 on
|
332
|
+
Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.3.2 on Wed Oct 21 2009 09:55:02 GMT-0500 (CDT)
|
333
333
|
</div>
|
334
334
|
</body>
|
335
335
|
</html>
|
@@ -0,0 +1,42 @@
|
|
1
|
+
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
|
2
|
+
.KEYW {color: #933;}
|
3
|
+
.COMM {color: #bbb; font-style: italic;}
|
4
|
+
.NUMB {color: #393;}
|
5
|
+
.STRN {color: #393;}
|
6
|
+
.REGX {color: #339;}
|
7
|
+
.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
|
8
|
+
</style></head><body><pre><span class='line'> 1</span> <span class="COMM">// UNDOCUMENTED DONT USE THIS UNTIL IT'S TESTED.</span><span class="WHIT">
|
9
|
+
<span class='line'> 2</span>
|
10
|
+
<span class='line'> 3</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">Gem</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
11
|
+
<span class='line'> 4</span> </span><span class="WHIT"> </span><span class="NAME">command</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"xpcomcore-gem"</span><span class="PUNC">,</span><span class="WHIT">
|
12
|
+
<span class='line'> 5</span> </span><span class="WHIT"> </span><span class="NAME">get</span><span class="WHIT"> </span><span class="NAME">isSupported</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
13
|
+
<span class='line'> 6</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">arguments.callee.__memoizedResult__</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
14
|
+
<span class='line'> 7</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">gemCommandResult</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Sys.run</span><span class="PUNC">(</span><span class="STRN">"which"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">this.command</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
15
|
+
<span class='line'> 8</span> </span><span class="WHIT"> </span><span class="NAME">arguments.callee.__memoizedResult__</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">gemCommandResult.exitStatus</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
16
|
+
<span class='line'> 9</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
17
|
+
<span class='line'> 10</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">arguments.callee.__memoizedResult__</span><span class="PUNC">;</span><span class="WHIT">
|
18
|
+
<span class='line'> 11</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
19
|
+
<span class='line'> 12</span> </span><span class="WHIT">
|
20
|
+
<span class='line'> 13</span> </span><span class="NAME">gem</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">gemName</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
21
|
+
<span class='line'> 14</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">cmdReturn</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Sys.run</span><span class="PUNC">(</span><span class="NAME">this.command</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">gemName</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
22
|
+
<span class='line'> 15</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">cmdReturn.exitStatus</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
23
|
+
<span class='line'> 16</span> </span><span class="WHIT"> </span><span class="COMM">// TODO - throw appropriate exception here.</span><span class="WHIT">
|
24
|
+
<span class='line'> 17</span> </span><span class="WHIT"> </span><span class="KEYW">throw</span><span class="PUNC">(</span><span class="STRN">"Gem "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">gemName</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">" wasn't found."</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
25
|
+
<span class='line'> 18</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
26
|
+
<span class='line'> 19</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">gemDetails</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">JSON.parse</span><span class="PUNC">(</span><span class="NAME">cmdReturn.output</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
27
|
+
<span class='line'> 20</span> </span><span class="WHIT"> </span><span class="NAME">$LOAD_PATH.push</span><span class="PUNC">(</span><span class="NAME">gemDetails.libDir</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
28
|
+
<span class='line'> 21</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
|
29
|
+
<span class='line'> 22</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
30
|
+
<span class='line'> 23</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
31
|
+
<span class='line'> 24</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
32
|
+
<span class='line'> 25</span>
|
33
|
+
<span class='line'> 26</span> </span><span class="NAME">Gem.LoadError</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">message</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
34
|
+
<span class='line'> 27</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">err</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Error</span><span class="PUNC">(</span><span class="NAME">message</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
35
|
+
<span class='line'> 28</span> </span><span class="WHIT"> </span><span class="NAME">err.name</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"Gem.LoadError"</span><span class="PUNC">;</span><span class="WHIT">
|
36
|
+
<span class='line'> 29</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">err</span><span class="PUNC">;</span><span class="WHIT">
|
37
|
+
<span class='line'> 30</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
38
|
+
<span class='line'> 31</span>
|
39
|
+
<span class='line'> 32</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">gem</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">gemName</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
40
|
+
<span class='line'> 33</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">Gem.gem</span><span class="PUNC">(</span><span class="NAME">gemName</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
41
|
+
<span class='line'> 34</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
42
|
+
<span class='line'> 35</span> </span></pre></body></html>
|
@@ -46,15 +46,21 @@
|
|
46
46
|
<span class='line'> 39</span> </span><span class="WHIT">
|
47
47
|
<span class='line'> 40</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">outputPipe</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">File.join</span><span class="PUNC">(</span><span class="NAME">tempDir</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">process.pid</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">".stdout.pipe"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
48
48
|
<span class='line'> 41</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">outputPipeFile</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">XPCBuiltins.nsILocalFile</span><span class="PUNC">(</span><span class="NAME">outputPipe</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
49
|
-
<span class='line'> 42</span>
|
50
|
-
<span class='line'> 43</span>
|
51
|
-
<span class='line'> 44</span> </span><span class="WHIT">
|
52
|
-
<span class='line'> 45</span> </span><span class="WHIT">
|
53
|
-
<span class='line'> 46</span> </span><span class="WHIT"> </span><span class="PUNC">
|
54
|
-
<span class='line'> 47</span> </span><span class="WHIT">
|
55
|
-
<span class='line'> 48</span>
|
49
|
+
<span class='line'> 42</span>
|
50
|
+
<span class='line'> 43</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">thread</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$Cc</span><span class="PUNC">[</span><span class="STRN">"@mozilla.org/thread-manager;1"</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">getService</span><span class="PUNC">(</span><span class="NAME">$Ci.nsIThreadManager</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">currentThread</span><span class="PUNC">;</span><span class="WHIT">
|
51
|
+
<span class='line'> 44</span> </span><span class="WHIT">
|
52
|
+
<span class='line'> 45</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">output</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
|
53
|
+
<span class='line'> 46</span> </span><span class="WHIT"> </span><span class="KEYW">while</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">outputPipeFile.exists</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
54
|
+
<span class='line'> 47</span> </span><span class="WHIT"> </span><span class="NAME">thread.processNextEvent</span><span class="PUNC">(</span><span class="KEYW">false</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
55
|
+
<span class='line'> 48</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
56
56
|
<span class='line'> 49</span> </span><span class="WHIT">
|
57
|
-
<span class='line'> 50</span> </span><span class="
|
58
|
-
<span class='line'> 51</span> </span><span class="WHIT">
|
59
|
-
<span class='line'> 52</span> </span><span class="PUNC">
|
60
|
-
<span class='line'> 53</span> </span
|
57
|
+
<span class='line'> 50</span> </span><span class="NAME">output</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">File.read</span><span class="PUNC">(</span><span class="NAME">outputPipe</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
58
|
+
<span class='line'> 51</span> </span><span class="WHIT">
|
59
|
+
<span class='line'> 52</span> </span><span class="KEYW">while</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">process.exitValue</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
60
|
+
<span class='line'> 53</span> </span><span class="WHIT"> </span><span class="NAME">thread.processNextEvent</span><span class="PUNC">(</span><span class="KEYW">false</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
61
|
+
<span class='line'> 54</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
62
|
+
<span class='line'> 55</span>
|
63
|
+
<span class='line'> 56</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="NAME">exitStatus</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">process.exitValue</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">output</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">output</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
64
|
+
<span class='line'> 57</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
65
|
+
<span class='line'> 58</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
66
|
+
<span class='line'> 59</span> </span></pre></body></html>
|
@@ -389,7 +389,7 @@ invoke the command with.</dd>
|
|
389
389
|
<!-- ============================== footer ================================= -->
|
390
390
|
<div class="fineprint" style="clear:both">
|
391
391
|
|
392
|
-
Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.3.2 on
|
392
|
+
Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.3.2 on Wed Oct 21 2009 09:55:02 GMT-0500 (CDT)
|
393
393
|
</div>
|
394
394
|
</body>
|
395
395
|
</html>
|
@@ -309,7 +309,7 @@ ul.inheritsList
|
|
309
309
|
<!-- ============================== footer ================================= -->
|
310
310
|
<div class="fineprint" style="clear:both">
|
311
311
|
|
312
|
-
Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.3.2 on
|
312
|
+
Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.3.2 on Wed Oct 21 2009 09:55:02 GMT-0500 (CDT)
|
313
313
|
</div>
|
314
314
|
</body>
|
315
315
|
</html>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
// UNDOCUMENTED DONT USE THIS UNTIL IT'S TESTED.
|
2
|
+
|
3
|
+
var Gem = {
|
4
|
+
command: "xpcomcore-gem",
|
5
|
+
get isSupported() {
|
6
|
+
if (arguments.callee.__memoizedResult__ === undefined) {
|
7
|
+
var gemCommandResult = Sys.run("which", this.command);
|
8
|
+
arguments.callee.__memoizedResult__ = (gemCommandResult.exitStatus === 0);
|
9
|
+
}
|
10
|
+
return arguments.callee.__memoizedResult__;
|
11
|
+
},
|
12
|
+
|
13
|
+
gem: function(gemName) {
|
14
|
+
var cmdReturn = Sys.run(this.command, gemName);
|
15
|
+
if (cmdReturn.exitStatus != 0) {
|
16
|
+
// TODO - throw appropriate exception here.
|
17
|
+
throw("Gem " + gemName + " wasn't found.");
|
18
|
+
} else {
|
19
|
+
var gemDetails = JSON.parse(cmdReturn.output);
|
20
|
+
$LOAD_PATH.push(gemDetails.libDir);
|
21
|
+
return true;
|
22
|
+
}
|
23
|
+
}
|
24
|
+
};
|
25
|
+
|
26
|
+
Gem.LoadError = function(message) {
|
27
|
+
var err = new Error(message);
|
28
|
+
err.name = "Gem.LoadError";
|
29
|
+
return err;
|
30
|
+
};
|
31
|
+
|
32
|
+
var gem = function(gemName) {
|
33
|
+
return Gem.gem(gemName);
|
34
|
+
};
|
data/xpcomcore/lib/sys.js
CHANGED
@@ -39,14 +39,20 @@ var Sys = {
|
|
39
39
|
|
40
40
|
var outputPipe = File.join(tempDir, process.pid + ".stdout.pipe");
|
41
41
|
var outputPipeFile = new XPCBuiltins.nsILocalFile(outputPipe);
|
42
|
-
|
42
|
+
|
43
|
+
var thread = $Cc["@mozilla.org/thread-manager;1"].getService($Ci.nsIThreadManager).currentThread;
|
44
|
+
|
43
45
|
var output = null;
|
44
46
|
while (!outputPipeFile.exists()) {
|
45
|
-
|
47
|
+
thread.processNextEvent(false);
|
46
48
|
};
|
47
49
|
|
48
50
|
output = File.read(outputPipe);
|
49
|
-
|
51
|
+
|
52
|
+
while (process.exitValue < 0) {
|
53
|
+
thread.processNextEvent(false);
|
54
|
+
}
|
55
|
+
|
50
56
|
return({exitStatus: process.exitValue, output: output});
|
51
57
|
}
|
52
58
|
};
|
data/xpcomcore/test/file_test.js
CHANGED
@@ -1,27 +1,29 @@
|
|
1
|
-
|
1
|
+
require("test_helper");
|
2
2
|
|
3
|
-
|
4
|
-
this.assertEqual($CURRENT_FILE, File.join($CURRENT_DIRECTORY, "file_test.js"));
|
5
|
-
});
|
6
|
-
|
7
|
-
test("File.read without a maxBytes argument should read the entire contents of a file if it exists", function() {
|
8
|
-
this.assertEqual("var love = true;", File.read(File.join($CURRENT_DIRECTORY, "fixtures", "love.js")));
|
9
|
-
});
|
3
|
+
Riot.context("File", function(should) {
|
10
4
|
|
11
|
-
|
12
|
-
|
13
|
-
});
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
});
|
5
|
+
should("have File.join properly concatenate strings", function(){
|
6
|
+
return File.join($CURRENT_DIRECTORY, "file_test.js");
|
7
|
+
}).equals($CURRENT_FILE);
|
8
|
+
|
9
|
+
should("read the entire contents of a file with File.read without a maxBytes argument", function(){
|
10
|
+
return File.read(File.join($CURRENT_DIRECTORY, "fixtures", "love.js"));
|
11
|
+
}).equals("var love = true;");
|
18
12
|
|
19
|
-
|
20
|
-
|
21
|
-
});
|
13
|
+
should("read the given numbers of bytes using File.read with a maxBytes argument", function(){
|
14
|
+
return File.read(File.join($CURRENT_DIRECTORY, "fixtures", "love.js"), 8);
|
15
|
+
}).equals("var love");
|
16
|
+
|
17
|
+
should("not throw an exception with a maxBytes argument of 0 to File.read", function(){
|
18
|
+
return File.read(File.join($CURRENT_DIRECTORY, "fixtures", "love.js"), 0);
|
19
|
+
}).equals("");
|
20
|
+
|
21
|
+
should("not throw an exception when reading an empty file", function(){
|
22
|
+
return File.read(File.join($CURRENT_DIRECTORY, "fixtures", "empty"));
|
23
|
+
}).equals("");
|
22
24
|
|
23
|
-
|
24
|
-
|
25
|
-
});
|
25
|
+
should("throw an exception with a non existent file given to File.read", function(){
|
26
|
+
File.read("/tmp/ohmanihopethisfiledoesntexist");
|
27
|
+
}).raises("File.NoSuchFileError");
|
26
28
|
|
27
29
|
});
|
@@ -1,95 +1,87 @@
|
|
1
|
-
|
1
|
+
require("test_helper");
|
2
|
+
|
3
|
+
Riot.context("Kernel", function(should, setup) {
|
4
|
+
|
2
5
|
setup(function() {
|
3
6
|
$LOAD_PATH.push(File.join($CURRENT_DIRECTORY, "fixtures"));
|
4
7
|
});
|
5
8
|
|
6
|
-
|
9
|
+
should("mix its properties into the passed in scope when used as a function", function(){
|
7
10
|
var newScope = {};
|
8
|
-
this.assertNotEqual(0, Kernel.prototype.__count__);
|
9
|
-
this.assertEqual(0, newScope.__count__);
|
10
11
|
Kernel(newScope);
|
11
|
-
|
12
|
-
});
|
12
|
+
return newScope.__count__;
|
13
|
+
}).equals(Kernel.prototype.__count__);
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
});
|
18
|
-
|
19
|
-
test("$CURRENT_FILE should end in kernel_test.js", function(){
|
20
|
-
this.assertMatch(/kernel_test.js$/, $CURRENT_FILE);
|
21
|
-
});
|
15
|
+
should("expose $CURRENT_FILE as a getter that returns a value that is a string", function(){
|
16
|
+
return $CURRENT_FILE;
|
17
|
+
}).isTypeOf("string");
|
22
18
|
|
19
|
+
should("have $CURRENT_FILE end in kernel_test.js", function(){
|
20
|
+
return $CURRENT_FILE;
|
21
|
+
}).matches(/kernel_test.js$/);
|
23
22
|
|
24
|
-
|
25
|
-
|
26
|
-
});
|
23
|
+
should("expose $CURRENT_DIRECTORY as a getter that returns a value that is a string", function(){
|
24
|
+
return $CURRENT_DIRECTORY;
|
25
|
+
}).isTypeOf("string");
|
27
26
|
|
28
|
-
|
29
|
-
|
30
|
-
});
|
27
|
+
should("have $CURRENT_DIRECTORY end in test", function(){
|
28
|
+
return $CURRENT_DIRECTORY;
|
29
|
+
}).matches(/test$/);
|
31
30
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
load("some-junk");
|
36
|
-
});
|
37
|
-
});
|
31
|
+
should("throw an exception when you give load a non-existent resource", function() {
|
32
|
+
load("some-junk");
|
33
|
+
}).raises("LoadError");
|
38
34
|
|
39
|
-
|
40
|
-
|
41
|
-
});
|
35
|
+
should("return true when load can load a file successfully", function() {
|
36
|
+
return load("love.js");
|
37
|
+
}).equals(true);
|
42
38
|
|
43
|
-
|
44
|
-
|
45
|
-
});
|
39
|
+
should("bubble up a syntax error if the loaded file is syntactically whack", function() {
|
40
|
+
load("syntax_error.js");
|
41
|
+
}).raises("SyntaxError");
|
46
42
|
|
47
|
-
|
43
|
+
should("allow loading a resource multiple times", function() {
|
48
44
|
load("love.js");
|
49
|
-
this.assertEqual(true, love);
|
50
|
-
|
51
45
|
love = false;
|
52
46
|
load("love.js");
|
53
|
-
|
54
|
-
});
|
47
|
+
return love;
|
48
|
+
}).equals(true);
|
55
49
|
|
56
|
-
|
50
|
+
should("allow loading using absolute paths", function() {
|
57
51
|
love = false;
|
58
|
-
|
59
52
|
var absolutePath = File.join($CURRENT_DIRECTORY, "fixtures", "love.js");
|
60
53
|
// FIXME: this is unix-only and janky:
|
61
|
-
|
54
|
+
if (!absolutePath.match(/^\//)) { throw("Expected an absolute path."); }
|
62
55
|
|
63
56
|
load(absolutePath);
|
64
|
-
|
65
|
-
});
|
57
|
+
return love;
|
58
|
+
}).equals(true);
|
66
59
|
|
60
|
+
should("have require return true the first time (just like load)", function() {
|
61
|
+
return require("love");
|
62
|
+
}).equals(true);
|
67
63
|
|
68
|
-
|
69
|
-
this.assertEqual(true, require("love"));
|
70
|
-
});
|
71
|
-
|
72
|
-
test("require should return false if the resource has already been loaded", function() {
|
64
|
+
should("have require return false if the resource has already been loaded", function() {
|
73
65
|
require("mad_love");
|
74
|
-
|
75
|
-
});
|
66
|
+
return require("mad_love");
|
67
|
+
}).equals(false);
|
76
68
|
|
77
|
-
|
69
|
+
should("not require a resource that's already been loaded", function() {
|
78
70
|
require("mad_world");
|
79
|
-
|
71
|
+
if (!mad_world) { throw("Expected mad_world to be true"); }
|
80
72
|
|
81
73
|
mad_world = false;
|
82
74
|
require("mad_world");
|
83
|
-
|
84
|
-
});
|
75
|
+
return mad_world;
|
76
|
+
}).equals(false);
|
85
77
|
|
86
|
-
|
87
|
-
|
88
|
-
});
|
78
|
+
should("expose a $ENV object that allows for getting environment variables", function() {
|
79
|
+
return $ENV.get('HOME');
|
80
|
+
}).isTypeOf('string');
|
89
81
|
|
90
|
-
|
82
|
+
should("expose a $ENV object that allows for setting environment variables", function() {
|
91
83
|
$ENV.set('XPCOMCORETEST', "testing");
|
92
|
-
|
93
|
-
});
|
84
|
+
return $ENV.get('XPCOMCORETEST');
|
85
|
+
}).equals("testing");
|
94
86
|
|
95
87
|
});
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require("test_helper");
|
2
|
+
require("stdlib/rubygems");
|
3
|
+
|
4
|
+
if (Gem.isSupported) {
|
5
|
+
|
6
|
+
Riot.context("RubyGems", function(should) {
|
7
|
+
|
8
|
+
// should("have Sys.tempDir return a string path to the OS temporary directory", function(){
|
9
|
+
// var tempDir = XPCBuiltins.nsILocalFile(Sys.tempDir);
|
10
|
+
// return tempDir.exists();
|
11
|
+
// }).equals(true);
|
12
|
+
|
13
|
+
});
|
14
|
+
|
15
|
+
} else {
|
16
|
+
puts("Warning - Gem support isn't available on your system so the RubyGems support tests will be skipped.");
|
17
|
+
}
|
data/xpcomcore/test/sys_test.js
CHANGED
@@ -1,19 +1,18 @@
|
|
1
|
-
|
1
|
+
require("test_helper");
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
Riot.context("Sys", function(should) {
|
4
|
+
|
5
|
+
should("have Sys.tempDir return a string path to the OS temporary directory", function(){
|
6
|
+
var tempDir = XPCBuiltins.nsILocalFile(Sys.tempDir);
|
7
|
+
return tempDir.exists();
|
8
|
+
}).equals(true);
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
});
|
10
|
+
should("have Sys.run execute the given command and return the exit status in an object", function(){
|
11
|
+
return Sys.run("exit", "47").exitStatus;
|
12
|
+
}).equals(47);
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
});
|
14
|
+
should("have Sys.run execute the given command and return the output in an object", function(){
|
15
|
+
return Sys.run("echo", "foo bar baz").output;
|
16
|
+
}).equals("foo bar baz\n");
|
18
17
|
|
19
18
|
});
|
@@ -1,8 +1,10 @@
|
|
1
|
-
|
1
|
+
require("test_helper");
|
2
2
|
|
3
|
-
|
3
|
+
Riot.context("XPCBuiltins", function(should) {
|
4
|
+
|
5
|
+
should("have the constructor for nsILocalFile should return an nsILocalFile QI'd object", function() {
|
4
6
|
var localFile = new XPCBuiltins.nsILocalFile("/");
|
5
|
-
|
6
|
-
});
|
7
|
+
return localFile.toString();
|
8
|
+
}).matches(/nsILocalFile/);
|
7
9
|
|
8
10
|
});
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xpcomcore-rubygem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ggironda
|
@@ -9,8 +9,8 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-10-
|
13
|
-
default_executable:
|
12
|
+
date: 2009-10-21 00:00:00 -05:00
|
13
|
+
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: sys-uname
|
@@ -52,6 +52,16 @@ dependencies:
|
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: "0"
|
54
54
|
version:
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: json
|
57
|
+
type: :runtime
|
58
|
+
version_requirement:
|
59
|
+
version_requirements: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: "0"
|
64
|
+
version:
|
55
65
|
- !ruby/object:Gem::Dependency
|
56
66
|
name: uuidtools
|
57
67
|
type: :runtime
|
@@ -86,6 +96,7 @@ description: Gem to allow for using XPCOMCore via RubyGems
|
|
86
96
|
email: gabriel.gironda@gmail.com
|
87
97
|
executables:
|
88
98
|
- xpcomcore
|
99
|
+
- xpcomcore-gem
|
89
100
|
extensions: []
|
90
101
|
|
91
102
|
extra_rdoc_files:
|
@@ -100,6 +111,7 @@ files:
|
|
100
111
|
- Rakefile
|
101
112
|
- VERSION
|
102
113
|
- bin/xpcomcore
|
114
|
+
- bin/xpcomcore-gem
|
103
115
|
- ext/stub_runners/darwin/StubApp.app/Contents/Info.plist
|
104
116
|
- ext/stub_runners/darwin/StubApp.app/Contents/MacOS/stub_runner
|
105
117
|
- ext/stub_runners/darwin/StubApp.app/Contents/PkgInfo
|
@@ -146,12 +158,14 @@ files:
|
|
146
158
|
- xpcomcore/doc/symbols/selfconcepterror.html
|
147
159
|
- xpcomcore/doc/symbols/src/lib_file.js.html
|
148
160
|
- xpcomcore/doc/symbols/src/lib_kernel.js.html
|
161
|
+
- xpcomcore/doc/symbols/src/lib_stdlib_rubygems.js.html
|
149
162
|
- xpcomcore/doc/symbols/src/lib_sys.js.html
|
150
163
|
- xpcomcore/doc/symbols/src/lib_xpc_builtins.js.html
|
151
164
|
- xpcomcore/doc/symbols/sys.html
|
152
165
|
- xpcomcore/doc/symbols/xpcbuiltins.html
|
153
166
|
- xpcomcore/lib/file.js
|
154
167
|
- xpcomcore/lib/kernel.js
|
168
|
+
- xpcomcore/lib/stdlib/rubygems.js
|
155
169
|
- xpcomcore/lib/sys.js
|
156
170
|
- xpcomcore/lib/xpc_builtins.js
|
157
171
|
- xpcomcore/test/file_test.js
|
@@ -161,7 +175,9 @@ files:
|
|
161
175
|
- xpcomcore/test/fixtures/mad_world.js
|
162
176
|
- xpcomcore/test/fixtures/syntax_error.js
|
163
177
|
- xpcomcore/test/kernel_test.js
|
178
|
+
- xpcomcore/test/stdlib/rubygems_test.js
|
164
179
|
- xpcomcore/test/sys_test.js
|
180
|
+
- xpcomcore/test/test_helper.js
|
165
181
|
- xpcomcore/test/xpc_builtins_test.js
|
166
182
|
has_rdoc: true
|
167
183
|
homepage: http://github.com/gabrielg/xpcomcore-rubygem
|