xpcomcore-rubygem 0.6.3 → 0.6.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  [submodule "xpcomcore"]
2
2
  path = xpcomcore
3
- url = git://github.com/gabrielg/xpcomcore.git
3
+ url = git://github.com/conflagrationjs/xpcomcore.git
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.3
1
+ 0.6.4
@@ -1,15 +1,15 @@
1
1
  # Generated by jeweler
2
- # DO NOT EDIT THIS FILE
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{xpcomcore-rubygem}
8
- s.version = "0.6.3"
8
+ s.version = "0.6.4"
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-21}
12
+ s.date = %q{2009-10-24}
13
13
  s.description = %q{Gem to allow for using XPCOMCore via RubyGems}
14
14
  s.email = %q{gabriel.gironda@gmail.com}
15
15
  s.executables = ["xpcomcore", "xpcomcore-gem"]
@@ -150,3 +150,4 @@ Gem::Specification.new do |s|
150
150
  s.add_dependency(%q<colored>, [">= 0"])
151
151
  end
152
152
  end
153
+
@@ -3,5 +3,5 @@ gecko:
3
3
  min_version: 1.9.0
4
4
  version:
5
5
  major: 0
6
- patch: 3
7
6
  minor: 5
7
+ patch: 4
@@ -1,5 +1,5 @@
1
1
  Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
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@
2
+ var XPCOMCoreVersion = '0.5.4'; // 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
 
@@ -281,7 +281,7 @@ This file defines the implementation of our XPCBuiltins namespace.
281
281
  </div>
282
282
  <div class="fineprint" style="clear:both">
283
283
 
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)
284
+ Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.3.2 on Sat Oct 24 2009 19:09:08 GMT-0500 (CDT)
285
285
  </div>
286
286
  </body>
287
287
  </html>
@@ -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 Wed Oct 21 2009 09:55:02 GMT-0500 (CDT)
272
+ Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.3.2 on Sat Oct 24 2009 19:09:08 GMT-0500 (CDT)
273
273
  </div>
274
274
  </body>
275
275
  </html>
@@ -330,7 +330,7 @@ ul.inheritsList
330
330
  <!-- ============================== footer ================================= -->
331
331
  <div class="fineprint" style="clear:both">
332
332
 
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)
333
+ Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.3.2 on Sat Oct 24 2009 19:09:08 GMT-0500 (CDT)
334
334
  </div>
335
335
  </body>
336
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 Wed Oct 21 2009 09:55:02 GMT-0500 (CDT)
262
+ Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.3.2 on Sat Oct 24 2009 19:09:08 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 Wed Oct 21 2009 09:55:02 GMT-0500 (CDT)
449
+ Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.3.2 on Sat Oct 24 2009 19:09:08 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 Wed Oct 21 2009 09:55:02 GMT-0500 (CDT)
332
+ Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.3.2 on Sat Oct 24 2009 19:09:08 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 Wed Oct 21 2009 09:55:02 GMT-0500 (CDT)
1139
+ Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.3.2 on Sat Oct 24 2009 19:09:08 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 Wed Oct 21 2009 09:55:02 GMT-0500 (CDT)
332
+ Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.3.2 on Sat Oct 24 2009 19:09:08 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 Wed Oct 21 2009 09:55:02 GMT-0500 (CDT)
332
+ Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.3.2 on Sat Oct 24 2009 19:09:08 GMT-0500 (CDT)
333
333
  </div>
334
334
  </body>
335
335
  </html>
@@ -23,44 +23,62 @@
23
23
  <span class='line'> 16</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">$Cc</span><span class="PUNC">[</span><span class="STRN">"@mozilla.org/file/directory_service;1"</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">getService</span><span class="PUNC">(</span><span class="NAME">$Ci.nsIProperties</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">get</span><span class="PUNC">(</span><span class="STRN">"TmpD"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">$Ci.nsIFile</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">path</span><span class="PUNC">;</span><span class="WHIT">
24
24
  <span class='line'> 17</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
25
25
  <span class='line'> 18</span> </span><span class="WHIT">
26
- <span class='line'> 19</span> </span><span class="COMM">/**
27
- <span class='line'> 20</span> * Runs the command given as the first parameter with the arguments given as the remaining
28
- <span class='line'> 21</span> * parameters and returns an object containing the exit status (as the exitStatus property)
29
- <span class='line'> 22</span> * and command output (as the output property).
30
- <span class='line'> 23</span> * @param {String[]} parameters First parameter is command name, rest are arguments to
31
- <span class='line'> 24</span> * invoke the command with.
32
- <span class='line'> 25</span> * @returns {Object} Object with 'exitStatus' and 'output' properties.
33
- <span class='line'> 26</span> */</span><span class="WHIT">
34
- <span class='line'> 27</span> </span><span class="WHIT"> </span><span class="NAME">run</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
35
- <span class='line'> 28</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">tempDir</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Sys.tempDir</span><span class="PUNC">;</span><span class="WHIT">
36
- <span class='line'> 29</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">popenHelper</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">XPCOMCoreConfig.getProperty</span><span class="PUNC">(</span><span class="STRN">'binRoot'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"popen_helper.sh"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
37
- <span class='line'> 30</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">file</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">popenHelper</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="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">process</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/process/util;1"</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">createInstance</span><span class="PUNC">(</span><span class="NAME">$Ci.nsIProcess</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
40
- <span class='line'> 33</span> </span><span class="WHIT"> </span><span class="NAME">process.init</span><span class="PUNC">(</span><span class="NAME">file</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
41
- <span class='line'> 34</span> </span><span class="WHIT">
42
- <span class='line'> 35</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">args</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Array.prototype.slice.call</span><span class="PUNC">(</span><span class="NAME">arguments</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
43
- <span class='line'> 36</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">procArgs</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="NAME">tempDir</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"stdout"</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">concat</span><span class="PUNC">(</span><span class="NAME">args</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
44
- <span class='line'> 37</span> </span><span class="WHIT">
45
- <span class='line'> 38</span> </span><span class="NAME">process.run</span><span class="PUNC">(</span><span class="KEYW">false</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">procArgs</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">procArgs.length</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
46
- <span class='line'> 39</span> </span><span class="WHIT">
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
- <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> </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
- <span class='line'> 49</span> </span><span class="WHIT">
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">&lt;</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>
26
+ <span class='line'> 19</span> </span><span class="COMM">/**
27
+ <span class='line'> 20</span> * Initiates the termination of the application, returning an exit code.
28
+ <span class='line'> 21</span> * @param {int} An exit code (only 0 or 1 can be returned).
29
+ <span class='line'> 22</span> * invoke the command with.
30
+ <span class='line'> 23</span> */</span><span class="WHIT">
31
+ <span class='line'> 24</span> </span><span class="WHIT"> </span><span class="NAME">exit</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">exitCode</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
32
+ <span class='line'> 25</span> </span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">exitWithCode</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
33
+ <span class='line'> 26</span> </span><span class="WHIT"> </span><span class="NAME">Sys.run</span><span class="PUNC">(</span><span class="STRN">'/usr/bin/env'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'ruby'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'-e'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'"Process.kill(Process.ppid, 9)"'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
34
+ <span class='line'> 27</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
35
+ <span class='line'> 28</span>
36
+ <span class='line'> 29</span> </span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">exitZero</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
37
+ <span class='line'> 30</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">appStartup</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/toolkit/app-startup;1"</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">getService</span><span class="PUNC">(</span><span class="NAME">$Ci.nsIAppStartup</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
38
+ <span class='line'> 31</span> </span><span class="WHIT"> </span><span class="NAME">appStartup.quit</span><span class="PUNC">(</span><span class="NAME">$Ci.nsIAppStartup.eForceQuit</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
39
+ <span class='line'> 32</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
40
+ <span class='line'> 33</span>
41
+ <span class='line'> 34</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">exitCode</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">exitZero</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">exitWithCode</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
42
+ <span class='line'> 35</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
43
+ <span class='line'> 36</span>
44
+ <span class='line'> 37</span> </span><span class="WHIT"> </span><span class="COMM">/**
45
+ <span class='line'> 38</span> * Runs the command given as the first parameter with the arguments given as the remaining
46
+ <span class='line'> 39</span> * parameters and returns an object containing the exit status (as the exitStatus property)
47
+ <span class='line'> 40</span> * and command output (as the output property).
48
+ <span class='line'> 41</span> * @param {String[]} parameters First parameter is command name, rest are arguments to
49
+ <span class='line'> 42</span> * invoke the command with.
50
+ <span class='line'> 43</span> * @returns {Object} Object with 'exitStatus' and 'output' properties.
51
+ <span class='line'> 44</span> */</span><span class="WHIT">
52
+ <span class='line'> 45</span> </span><span class="WHIT"> </span><span class="NAME">run</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
53
+ <span class='line'> 46</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">tempDir</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Sys.tempDir</span><span class="PUNC">;</span><span class="WHIT">
54
+ <span class='line'> 47</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">popenHelper</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">XPCOMCoreConfig.getProperty</span><span class="PUNC">(</span><span class="STRN">'binRoot'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"popen_helper.sh"</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="KEYW">var</span><span class="WHIT"> </span><span class="NAME">file</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">popenHelper</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
56
+ <span class='line'> 49</span>
57
+ <span class='line'> 50</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">process</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/process/util;1"</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">createInstance</span><span class="PUNC">(</span><span class="NAME">$Ci.nsIProcess</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
58
+ <span class='line'> 51</span> </span><span class="WHIT"> </span><span class="NAME">process.init</span><span class="PUNC">(</span><span class="NAME">file</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
59
+ <span class='line'> 52</span> </span><span class="WHIT">
60
+ <span class='line'> 53</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">args</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Array.prototype.slice.call</span><span class="PUNC">(</span><span class="NAME">arguments</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="KEYW">var</span><span class="WHIT"> </span><span class="NAME">procArgs</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="NAME">tempDir</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"stdout"</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">concat</span><span class="PUNC">(</span><span class="NAME">args</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
62
+ <span class='line'> 55</span> </span><span class="WHIT">
63
+ <span class='line'> 56</span> </span><span class="NAME">process.run</span><span class="PUNC">(</span><span class="KEYW">false</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">procArgs</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">procArgs.length</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
64
+ <span class='line'> 57</span> </span><span class="WHIT">
65
+ <span class='line'> 58</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">
66
+ <span class='line'> 59</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">
67
+ <span class='line'> 60</span>
68
+ <span class='line'> 61</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">
69
+ <span class='line'> 62</span> </span><span class="WHIT">
70
+ <span class='line'> 63</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">
71
+ <span class='line'> 64</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">
72
+ <span class='line'> 65</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">
73
+ <span class='line'> 66</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
74
+ <span class='line'> 67</span> </span><span class="WHIT">
75
+ <span class='line'> 68</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">
76
+ <span class='line'> 69</span> </span><span class="WHIT">
77
+ <span class='line'> 70</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">&lt;</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">
78
+ <span class='line'> 71</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">
79
+ <span class='line'> 72</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
80
+ <span class='line'> 73</span>
81
+ <span class='line'> 74</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">
82
+ <span class='line'> 75</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
83
+ <span class='line'> 76</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
84
+ <span class='line'> 77</span> </span></pre></body></html>
@@ -272,6 +272,15 @@ ul.inheritsList
272
272
  </thead>
273
273
  <tbody>
274
274
 
275
+ <tr>
276
+ <td class="attributes">&lt;static&gt; &nbsp;</td>
277
+ <td class="nameDescription">
278
+ <div class="fixedFont">Sys.<b><a href="../symbols/sys.html#.exit">exit</a></b>(An)
279
+ </div>
280
+ <div class="description">Initiates the termination of the application, returning an exit code.</div>
281
+ </td>
282
+ </tr>
283
+
275
284
  <tr>
276
285
  <td class="attributes">&lt;static&gt; &nbsp;</td>
277
286
  <td class="nameDescription">
@@ -331,6 +340,43 @@ and command output (as the output property).</div>
331
340
  Method Detail
332
341
  </div>
333
342
 
343
+ <a name=".exit"> </a>
344
+ <div class="fixedFont">&lt;static&gt;
345
+
346
+
347
+ <span class="light">Sys.</span><b>exit</b>(An)
348
+
349
+ </div>
350
+ <div class="description">
351
+ Initiates the termination of the application, returning an exit code.
352
+
353
+
354
+ </div>
355
+
356
+
357
+
358
+
359
+ <dl class="detailList">
360
+ <dt class="heading">Parameters:</dt>
361
+
362
+ <dt>
363
+ <span class="light fixedFont">{int}</span> <b>An</b>
364
+
365
+ </dt>
366
+ <dd>exit code (only 0 or 1 can be returned).
367
+ invoke the command with.</dd>
368
+
369
+ </dl>
370
+
371
+
372
+
373
+
374
+
375
+
376
+
377
+
378
+ <hr />
379
+
334
380
  <a name=".run"> </a>
335
381
  <div class="fixedFont">&lt;static&gt;
336
382
 
@@ -389,7 +435,7 @@ invoke the command with.</dd>
389
435
  <!-- ============================== footer ================================= -->
390
436
  <div class="fineprint" style="clear:both">
391
437
 
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)
438
+ Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.3.2 on Sat Oct 24 2009 19:09:08 GMT-0500 (CDT)
393
439
  </div>
394
440
  </body>
395
441
  </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 Wed Oct 21 2009 09:55:02 GMT-0500 (CDT)
312
+ Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.3.2 on Sat Oct 24 2009 19:09:08 GMT-0500 (CDT)
313
313
  </div>
314
314
  </body>
315
315
  </html>
@@ -16,6 +16,24 @@ var Sys = {
16
16
  return $Cc["@mozilla.org/file/directory_service;1"].getService($Ci.nsIProperties).get("TmpD", $Ci.nsIFile).path;
17
17
  },
18
18
 
19
+ /**
20
+ * Initiates the termination of the application, returning an exit code.
21
+ * @param {int} An exit code (only 0 or 1 can be returned).
22
+ * invoke the command with.
23
+ */
24
+ exit: function(exitCode) {
25
+ function exitWithCode() {
26
+ Sys.run('/usr/bin/env', 'ruby', '-e', '"Process.kill(Process.ppid, 9)"');
27
+ }
28
+
29
+ function exitZero() {
30
+ var appStartup = $Cc["@mozilla.org/toolkit/app-startup;1"].getService($Ci.nsIAppStartup);
31
+ appStartup.quit($Ci.nsIAppStartup.eForceQuit);
32
+ }
33
+
34
+ return exitCode === 0 ? exitZero() : exitWithCode();
35
+ },
36
+
19
37
  /**
20
38
  * Runs the command given as the first parameter with the arguments given as the remaining
21
39
  * parameters and returns an object containing the exit status (as the exitStatus property)
@@ -1,29 +1,30 @@
1
1
  require("test_helper");
2
2
 
3
- Riot.context("File", function(should) {
3
+ var fileTestPaths = { dir: $CURRENT_DIRECTORY, file: $CURRENT_FILE };
4
4
 
5
- should("have File.join properly concatenate strings", function(){
6
- return File.join($CURRENT_DIRECTORY, "file_test.js");
7
- }).equals($CURRENT_FILE);
5
+ Riot.context("File", function() {
6
+ should("concatenate paths", function(){
7
+ return File.join(fileTestPaths.dir, "file_test.js");
8
+ }).equals(fileTestPaths.file);
8
9
 
9
10
  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
+ return File.read(File.join(fileTestPaths.dir, "fixtures", "love.js"));
11
12
  }).equals("var love = true;");
12
13
 
13
14
  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
+ return File.read(File.join(fileTestPaths.dir, "fixtures", "love.js"), 8);
15
16
  }).equals("var love");
16
17
 
17
18
  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
+ return File.read(File.join(fileTestPaths.dir, "fixtures", "love.js"), 0);
19
20
  }).equals("");
20
21
 
21
22
  should("not throw an exception when reading an empty file", function(){
22
- return File.read(File.join($CURRENT_DIRECTORY, "fixtures", "empty"));
23
+ return File.read(File.join(fileTestPaths.dir, "fixtures", "empty"));
23
24
  }).equals("");
24
25
 
25
26
  should("throw an exception with a non existent file given to File.read", function(){
26
27
  File.read("/tmp/ohmanihopethisfiledoesntexist");
27
28
  }).raises("File.NoSuchFileError");
28
29
 
29
- });
30
+ });
@@ -1,9 +1,11 @@
1
1
  require("test_helper");
2
2
 
3
- Riot.context("Kernel", function(should, setup) {
4
-
3
+ var kernelTestPaths = { dir: $CURRENT_DIRECTORY, file: $CURRENT_FILE };
4
+
5
+ Riot.context("Kernel", function() {
6
+
5
7
  setup(function() {
6
- $LOAD_PATH.push(File.join($CURRENT_DIRECTORY, "fixtures"));
8
+ $LOAD_PATH.push(File.join(kernelTestPaths.dir, "fixtures"));
7
9
  });
8
10
 
9
11
  should("mix its properties into the passed in scope when used as a function", function(){
@@ -13,19 +15,19 @@ Riot.context("Kernel", function(should, setup) {
13
15
  }).equals(Kernel.prototype.__count__);
14
16
 
15
17
  should("expose $CURRENT_FILE as a getter that returns a value that is a string", function(){
16
- return $CURRENT_FILE;
18
+ return kernelTestPaths.file;
17
19
  }).isTypeOf("string");
18
20
 
19
21
  should("have $CURRENT_FILE end in kernel_test.js", function(){
20
- return $CURRENT_FILE;
22
+ return kernelTestPaths.file;
21
23
  }).matches(/kernel_test.js$/);
22
24
 
23
25
  should("expose $CURRENT_DIRECTORY as a getter that returns a value that is a string", function(){
24
- return $CURRENT_DIRECTORY;
26
+ return kernelTestPaths.dir;
25
27
  }).isTypeOf("string");
26
28
 
27
29
  should("have $CURRENT_DIRECTORY end in test", function(){
28
- return $CURRENT_DIRECTORY;
30
+ return kernelTestPaths.dir;
29
31
  }).matches(/test$/);
30
32
 
31
33
  should("throw an exception when you give load a non-existent resource", function() {
@@ -49,7 +51,7 @@ Riot.context("Kernel", function(should, setup) {
49
51
 
50
52
  should("allow loading using absolute paths", function() {
51
53
  love = false;
52
- var absolutePath = File.join($CURRENT_DIRECTORY, "fixtures", "love.js");
54
+ var absolutePath = File.join(kernelTestPaths.dir, "fixtures", "love.js");
53
55
  // FIXME: this is unix-only and janky:
54
56
  if (!absolutePath.match(/^\//)) { throw("Expected an absolute path."); }
55
57
 
@@ -84,4 +86,4 @@ Riot.context("Kernel", function(should, setup) {
84
86
  return $ENV.get('XPCOMCORETEST');
85
87
  }).equals("testing");
86
88
 
87
- });
89
+ });
@@ -5,6 +5,8 @@ if (Gem.isSupported) {
5
5
 
6
6
  Riot.context("RubyGems", function(should) {
7
7
 
8
+ asserts("This space intentionally left blank.", true);
9
+
8
10
  // should("have Sys.tempDir return a string path to the OS temporary directory", function(){
9
11
  // var tempDir = XPCBuiltins.nsILocalFile(Sys.tempDir);
10
12
  // return tempDir.exists();
@@ -14,4 +16,4 @@ if (Gem.isSupported) {
14
16
 
15
17
  } else {
16
18
  puts("Warning - Gem support isn't available on your system so the RubyGems support tests will be skipped.");
17
- }
19
+ }
@@ -1,6 +1,6 @@
1
1
  require("test_helper");
2
2
 
3
- Riot.context("Sys", function(should) {
3
+ Riot.context("Sys", function() {
4
4
 
5
5
  should("have Sys.tempDir return a string path to the OS temporary directory", function(){
6
6
  var tempDir = XPCBuiltins.nsILocalFile(Sys.tempDir);
@@ -15,4 +15,4 @@ Riot.context("Sys", function(should) {
15
15
  return Sys.run("echo", "foo bar baz").output;
16
16
  }).equals("foo bar baz\n");
17
17
 
18
- });
18
+ });
@@ -1,7 +1,7 @@
1
1
  require("stdlib/rubygems");
2
- gem("riot-js");
2
+ gem("riotjs-xpcc");
3
3
  require("riot");
4
4
 
5
5
  XULTestRunner.atExit = function() {
6
6
  Riot.run();
7
- }
7
+ }
@@ -1,10 +1,10 @@
1
1
  require("test_helper");
2
2
 
3
- Riot.context("XPCBuiltins", function(should) {
3
+ Riot.context("XPCBuiltins", function() {
4
4
 
5
5
  should("have the constructor for nsILocalFile should return an nsILocalFile QI'd object", function() {
6
6
  var localFile = new XPCBuiltins.nsILocalFile("/");
7
7
  return localFile.toString();
8
8
  }).matches(/nsILocalFile/);
9
9
 
10
- });
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.3
4
+ version: 0.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - ggironda
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-21 00:00:00 -05:00
12
+ date: 2009-10-24 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency