doc/TaskJuggler/Tj3Daemon.html in taskjuggler-0.0.5 vs doc/TaskJuggler/Tj3Daemon.html in taskjuggler-0.0.6

- old
+ new

@@ -67,18 +67,20 @@ <div id="method-list-section" class="section"> <h3 class="section-header">Methods</h3> <ul class="link-list"> - <li><a href="#M001453">::new</a></li> + <li><a href="#method-c-new">::new</a></li> - <li><a href="#M001456">#error</a></li> + <li><a href="#method-i-error">#error</a></li> - <li><a href="#M001455">#main</a></li> + <li><a href="#method-i-main">#main</a></li> - <li><a href="#M001454">#processArguments</a></li> + <li><a href="#method-i-processArguments">#processArguments</a></li> + <li><a href="#method-i-sortInputFiles">#sortInputFiles</a></li> + </ul> </div> <!-- Included Modules --> @@ -90,10 +92,12 @@ <div id="fileindex-section" class="section project-section"> <h3 class="section-header">Files</h3> <ul> + <li class="file"><a href="../CHANGELOG.html">CHANGELOG</a></li> + <li class="file"><a href="../COPYING.html">COPYING</a></li> <li class="file"><a href="../README.html">README</a></li> </ul> @@ -259,10 +263,12 @@ <li><a href="../TaskJuggler/NikuReport.html">TaskJuggler::NikuReport</a></li> <li><a href="../TaskJuggler/NikuResource.html">TaskJuggler::NikuResource</a></li> + <li><a href="../TaskJuggler/NodeListAttribute.html">TaskJuggler::NodeListAttribute</a></li> + <li><a href="../TaskJuggler/OnShiftCache.html">TaskJuggler::OnShiftCache</a></li> <li><a href="../TaskJuggler/ProcessIntercom.html">TaskJuggler::ProcessIntercom</a></li> <li><a href="../TaskJuggler/ProcessIntercomIface.html">TaskJuggler::ProcessIntercomIface</a></li> @@ -273,10 +279,12 @@ <li><a href="../TaskJuggler/ProjectBrokerIface.html">TaskJuggler::ProjectBrokerIface</a></li> <li><a href="../TaskJuggler/ProjectFileParser.html">TaskJuggler::ProjectFileParser</a></li> + <li><a href="../TaskJuggler/ProjectFileScanner.html">TaskJuggler::ProjectFileScanner</a></li> + <li><a href="../TaskJuggler/ProjectRecord.html">TaskJuggler::ProjectRecord</a></li> <li><a href="../TaskJuggler/ProjectServer.html">TaskJuggler::ProjectServer</a></li> <li><a href="../TaskJuggler/ProjectServerIface.html">TaskJuggler::ProjectServerIface</a></li> @@ -289,16 +297,20 @@ <li><a href="../TaskJuggler/PropertyTreeNode.html">TaskJuggler::PropertyTreeNode</a></li> <li><a href="../TaskJuggler/Query.html">TaskJuggler::Query</a></li> + <li><a href="../TaskJuggler/RTFHandlers.html">TaskJuggler::RTFHandlers</a></li> + <li><a href="../TaskJuggler/RTFNavigator.html">TaskJuggler::RTFNavigator</a></li> <li><a href="../TaskJuggler/RTFQuery.html">TaskJuggler::RTFQuery</a></li> <li><a href="../TaskJuggler/RTFReport.html">TaskJuggler::RTFReport</a></li> + <li><a href="../TaskJuggler/RTFReportLink.html">TaskJuggler::RTFReportLink</a></li> + <li><a href="../TaskJuggler/RealFormat.html">TaskJuggler::RealFormat</a></li> <li><a href="../TaskJuggler/RealFormatAttribute.html">TaskJuggler::RealFormatAttribute</a></li> <li><a href="../TaskJuggler/ReferenceAttribute.html">TaskJuggler::ReferenceAttribute</a></li> @@ -313,10 +325,12 @@ <li><a href="../TaskJuggler/ReportServerIface.html">TaskJuggler::ReportServerIface</a></li> <li><a href="../TaskJuggler/ReportServerRecord.html">TaskJuggler::ReportServerRecord</a></li> + <li><a href="../TaskJuggler/ReportServlet.html">TaskJuggler::ReportServlet</a></li> + <li><a href="../TaskJuggler/ReportTable.html">TaskJuggler::ReportTable</a></li> <li><a href="../TaskJuggler/ReportTableCell.html">TaskJuggler::ReportTableCell</a></li> <li><a href="../TaskJuggler/ReportTableColumn.html">TaskJuggler::ReportTableColumn</a></li> @@ -441,10 +455,12 @@ <li><a href="../TaskJuggler/TextScanner/BufferStreamHandle.html">TaskJuggler::TextScanner::BufferStreamHandle</a></li> <li><a href="../TaskJuggler/TextScanner/FileStreamHandle.html">TaskJuggler::TextScanner::FileStreamHandle</a></li> + <li><a href="../TaskJuggler/TextScanner/MacroStackEntry.html">TaskJuggler::TextScanner::MacroStackEntry</a></li> + <li><a href="../TaskJuggler/TextScanner/StreamHandle.html">TaskJuggler::TextScanner::StreamHandle</a></li> <li><a href="../TaskJuggler/TimeSheet.html">TaskJuggler::TimeSheet</a></li> <li><a href="../TaskJuggler/TimeSheetReceiver.html">TaskJuggler::TimeSheetReceiver</a></li> @@ -485,12 +501,16 @@ <li><a href="../TaskJuggler/TjpExportRE.html">TaskJuggler::TjpExportRE</a></li> <li><a href="../TaskJuggler/TjpSyntaxRules.html">TaskJuggler::TjpSyntaxRules</a></li> + <li><a href="../TaskJuggler/URLParameter.html">TaskJuggler::URLParameter</a></li> + <li><a href="../TaskJuggler/UserManual.html">TaskJuggler::UserManual</a></li> + <li><a href="../TaskJuggler/WebServer.html">TaskJuggler::WebServer</a></li> + <li><a href="../TaskJuggler/WorkingHours.html">TaskJuggler::WorkingHours</a></li> <li><a href="../TaskJuggler/WorkingHoursAttribute.html">TaskJuggler::WorkingHoursAttribute</a></li> <li><a href="../TaskJuggler/XMLBlob.html">TaskJuggler::XMLBlob</a></li> @@ -513,10 +533,12 @@ <li><a href="../RuntimeConfig.html">RuntimeConfig</a></li> <li><a href="../String.html">String</a></li> + <li><a href="../StringIO.html">StringIO</a></li> + </ul> <div id="no-class-search-results" style="display: none;">No matching classes.</div> </div> @@ -541,11 +563,11 @@ <div id="public-class-method-details" class="method-section section"> <h3 class="section-header">Public Class Methods</h3> <div id="new-method" class="method-detail "> - <a name="M001453"></a> + <a name="method-c-new"></a> <div class="method-heading"> <span class="method-name">new</span><span class="method-args">()</span> @@ -570,11 +592,13 @@ 29: <span class="ruby-ivar">@log</span> = <span class="ruby-constant">LogFile</span>.<span class="ruby-identifier">instance</span> 30: <span class="ruby-ivar">@log</span>.<span class="ruby-identifier">logFile</span> = <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">getwd</span> <span class="ruby-operator">+</span> <span class="ruby-node">&quot;/#{AppConfig.appName}.log&quot;</span> 31: <span class="ruby-ivar">@log</span>.<span class="ruby-identifier">appName</span> = <span class="ruby-constant">AppConfig</span>.<span class="ruby-identifier">appName</span> 32: <span class="ruby-ivar">@daemonize</span> = <span class="ruby-keyword kw">true</span> 33: <span class="ruby-ivar">@port</span> = <span class="ruby-keyword kw">nil</span> -34: <span class="ruby-keyword kw">end</span></pre> +34: <span class="ruby-ivar">@webServer</span> = <span class="ruby-keyword kw">false</span> +35: <span class="ruby-ivar">@webServerPort</span> = <span class="ruby-keyword kw">nil</span> +36: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -588,11 +612,11 @@ <div id="public-instance-method-details" class="method-section section"> <h3 class="section-header">Public Instance Methods</h3> <div id="error-method" class="method-detail "> - <a name="M001456"></a> + <a name="method-i-error"></a> <div class="method-heading"> <span class="method-name">error</span><span class="method-args">(message)</span> @@ -607,15 +631,15 @@ <div class="method-source-code" id="error-source"> <pre> - <span class="ruby-comment cmt"># File lib/tj3d.rb, line 100</span> -100: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">error</span>(<span class="ruby-identifier">message</span>) -101: <span class="ruby-identifier">$stderr</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;ERROR: #{message}&quot;</span> -102: <span class="ruby-identifier">exit</span> <span class="ruby-value">1</span> -103: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/tj3d.rb, line 87</span> +87: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">error</span>(<span class="ruby-identifier">message</span>) +88: <span class="ruby-identifier">$stderr</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;ERROR: #{message}&quot;</span> +89: <span class="ruby-identifier">exit</span> <span class="ruby-value">1</span> +90: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -623,11 +647,11 @@ </div> <div id="main-method" class="method-detail "> - <a name="M001455"></a> + <a name="method-i-main"></a> <div class="method-heading"> <span class="method-name">main</span><span class="method-args">()</span> @@ -642,55 +666,29 @@ <div class="method-source-code" id="main-source"> <pre> - <span class="ruby-comment cmt"># File lib/tj3d.rb, line 55</span> -55: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">main</span> -56: <span class="ruby-identifier">files</span> = <span class="ruby-keyword kw">super</span> -57: <span class="ruby-identifier">broker</span> = <span class="ruby-constant">ProjectBroker</span>.<span class="ruby-identifier">new</span> -58: <span class="ruby-ivar">@rc</span>.<span class="ruby-identifier">configure</span>(<span class="ruby-keyword kw">self</span>, <span class="ruby-value str">'global'</span>) -59: <span class="ruby-ivar">@rc</span>.<span class="ruby-identifier">configure</span>(<span class="ruby-ivar">@log</span>, <span class="ruby-value str">'global.log'</span>) -60: <span class="ruby-ivar">@rc</span>.<span class="ruby-identifier">configure</span>(<span class="ruby-identifier">broker</span>, <span class="ruby-value str">'global'</span>) -61: <span class="ruby-ivar">@rc</span>.<span class="ruby-identifier">configure</span>(<span class="ruby-identifier">broker</span>, <span class="ruby-value str">'daemon'</span>) -62: <span class="ruby-identifier">broker</span>.<span class="ruby-identifier">port</span> = <span class="ruby-ivar">@port</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@port</span> -63: -64: <span class="ruby-identifier">projects</span> = [] -65: <span class="ruby-identifier">project</span> = <span class="ruby-keyword kw">nil</span> -66: <span class="ruby-identifier">files</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span> -67: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">file</span>[<span class="ruby-value">4</span><span class="ruby-operator">..</span><span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">'.tjp'</span> -68: <span class="ruby-comment cmt"># The project master file determines the working directory. If it's</span> -69: <span class="ruby-comment cmt"># an absolute file name, that directory will become the working</span> -70: <span class="ruby-comment cmt"># directory. If it's a relative file name, the current working</span> -71: <span class="ruby-comment cmt"># directory will be kept.</span> -72: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">file</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">'/'</span> -73: <span class="ruby-comment cmt"># Absolute file name</span> -74: <span class="ruby-identifier">workingDir</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-identifier">file</span>) -75: <span class="ruby-identifier">fileName</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-identifier">file</span>) -76: <span class="ruby-keyword kw">else</span> -77: <span class="ruby-comment cmt"># Relative file name</span> -78: <span class="ruby-identifier">workingDir</span> = <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">getwd</span> -79: <span class="ruby-identifier">fileName</span> = <span class="ruby-identifier">file</span> -80: <span class="ruby-keyword kw">end</span> -81: <span class="ruby-identifier">project</span> = [ <span class="ruby-identifier">workingDir</span>, <span class="ruby-identifier">fileName</span> ] -82: <span class="ruby-identifier">projects</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">project</span> -83: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">file</span>[<span class="ruby-value">4</span><span class="ruby-operator">..</span><span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">'.tji'</span> -84: <span class="ruby-comment cmt"># .tji files are optional. But if they are specified, they must</span> -85: <span class="ruby-comment cmt"># always follow the master file in the list.</span> -86: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">project</span>.<span class="ruby-identifier">nil?</span> -87: <span class="ruby-identifier">error</span>(<span class="ruby-value str">&quot;You must specify a '.tjp' file before the '.tji' files&quot;</span>) -88: <span class="ruby-keyword kw">end</span> -89: <span class="ruby-identifier">project</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">file</span> -90: <span class="ruby-keyword kw">else</span> -91: <span class="ruby-identifier">error</span>(<span class="ruby-value str">&quot;Project files must have a '.tjp' or '.tji' extension&quot;</span>) -92: <span class="ruby-keyword kw">end</span> -93: <span class="ruby-keyword kw">end</span> -94: -95: <span class="ruby-identifier">broker</span>.<span class="ruby-identifier">daemonize</span> = <span class="ruby-ivar">@daemonize</span> -96: -97: <span class="ruby-identifier">broker</span>.<span class="ruby-identifier">start</span>(<span class="ruby-identifier">projects</span>) -98: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/tj3d.rb, line 68</span> +68: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">main</span> +69: <span class="ruby-identifier">files</span> = <span class="ruby-keyword kw">super</span> +70: <span class="ruby-identifier">broker</span> = <span class="ruby-constant">ProjectBroker</span>.<span class="ruby-identifier">new</span> +71: <span class="ruby-ivar">@rc</span>.<span class="ruby-identifier">configure</span>(<span class="ruby-keyword kw">self</span>, <span class="ruby-value str">'global'</span>) +72: <span class="ruby-ivar">@rc</span>.<span class="ruby-identifier">configure</span>(<span class="ruby-ivar">@log</span>, <span class="ruby-value str">'global.log'</span>) +73: <span class="ruby-ivar">@rc</span>.<span class="ruby-identifier">configure</span>(<span class="ruby-identifier">broker</span>, <span class="ruby-value str">'global'</span>) +74: <span class="ruby-ivar">@rc</span>.<span class="ruby-identifier">configure</span>(<span class="ruby-identifier">broker</span>, <span class="ruby-value str">'daemon'</span>) +75: +76: <span class="ruby-comment cmt"># Set some config variables if corresponding data was provided via the</span> +77: <span class="ruby-comment cmt"># command line.</span> +78: <span class="ruby-identifier">broker</span>.<span class="ruby-identifier">port</span> = <span class="ruby-ivar">@port</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@port</span> +79: <span class="ruby-identifier">broker</span>.<span class="ruby-identifier">enableWebServer</span> = <span class="ruby-ivar">@webServer</span> +80: <span class="ruby-identifier">broker</span>.<span class="ruby-identifier">webServerPort</span> = <span class="ruby-ivar">@webServerPort</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@webServerPort</span> +81: <span class="ruby-identifier">broker</span>.<span class="ruby-identifier">projectFiles</span> = <span class="ruby-identifier">sortInputFiles</span>(<span class="ruby-identifier">files</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">files</span>.<span class="ruby-identifier">empty?</span> +82: <span class="ruby-identifier">broker</span>.<span class="ruby-identifier">daemonize</span> = <span class="ruby-ivar">@daemonize</span> +83: +84: <span class="ruby-identifier">broker</span>.<span class="ruby-identifier">start</span> +85: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -698,11 +696,11 @@ </div> <div id="process-rguments-method" class="method-detail "> - <a name="M001454"></a> + <a name="method-i-processArguments"></a> <div class="method-heading"> <span class="method-name">processArguments</span><span class="method-args">(argv)</span> @@ -717,24 +715,111 @@ <div class="method-source-code" id="process-rguments-source"> <pre> - <span class="ruby-comment cmt"># File lib/tj3d.rb, line 36</span> -36: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">processArguments</span>(<span class="ruby-identifier">argv</span>) -37: <span class="ruby-keyword kw">super</span> <span class="ruby-keyword kw">do</span> -38: <span class="ruby-ivar">@opts</span>.<span class="ruby-identifier">banner</span> <span class="ruby-operator">+=</span> <span class="ruby-value str">The TaskJuggler daemon can be used to quickly generate reports for a numberof scheduled projects that are resident in memory. Once the daemon has beenstarted tj3client can be used to control it.</span> -39: <span class="ruby-ivar">@opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">'-d'</span>, <span class="ruby-value str">'--dont-daemonize'</span>, -40: <span class="ruby-identifier">format</span>(<span class="ruby-value str">&quot;Don't put program into daemon mode. Keep it &quot;</span> <span class="ruby-operator">+</span> -41: <span class="ruby-value str">'connected to the terminal and show debug output.'</span>)) <span class="ruby-keyword kw">do</span> -42: <span class="ruby-ivar">@daemonize</span> = <span class="ruby-keyword kw">false</span> -43: <span class="ruby-keyword kw">end</span> -44: <span class="ruby-ivar">@opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">'-p'</span>, <span class="ruby-value str">'--port &lt;NUMBER&gt;'</span>, <span class="ruby-constant">Integer</span>, -45: <span class="ruby-identifier">format</span>(<span class="ruby-value str">'Use the specified TCP/IP port'</span>)) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">arg</span><span class="ruby-operator">|</span> -46: <span class="ruby-ivar">@port</span> = <span class="ruby-identifier">arg</span> -47: <span class="ruby-keyword kw">end</span> -48: <span class="ruby-keyword kw">end</span> -49: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/tj3d.rb, line 38</span> +38: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">processArguments</span>(<span class="ruby-identifier">argv</span>) +39: <span class="ruby-keyword kw">super</span> <span class="ruby-keyword kw">do</span> +40: <span class="ruby-ivar">@opts</span>.<span class="ruby-identifier">banner</span> <span class="ruby-operator">+=</span> <span class="ruby-value str">The TaskJuggler daemon can be used to quickly generate reports for a numberof scheduled projects that are resident in memory. Once the daemon has beenstarted tj3client can be used to control it.</span> +41: <span class="ruby-ivar">@opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">'-d'</span>, <span class="ruby-value str">'--dont-daemonize'</span>, +42: <span class="ruby-identifier">format</span>(<span class="ruby-value str">&quot;Don't put program into daemon mode. Keep it &quot;</span> <span class="ruby-operator">+</span> +43: <span class="ruby-value str">'connected to the terminal and show debug output.'</span>)) <span class="ruby-keyword kw">do</span> +44: <span class="ruby-ivar">@daemonize</span> = <span class="ruby-keyword kw">false</span> +45: <span class="ruby-keyword kw">end</span> +46: <span class="ruby-ivar">@opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">'-p'</span>, <span class="ruby-value str">'--port &lt;NUMBER&gt;'</span>, <span class="ruby-constant">Integer</span>, +47: <span class="ruby-identifier">format</span>(<span class="ruby-value str">'Use the specified TCP/IP port to serve tj3client '</span> <span class="ruby-operator">+</span> +48: <span class="ruby-value str">'requests (Default: 8474).'</span>)) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">arg</span><span class="ruby-operator">|</span> +49: <span class="ruby-ivar">@port</span> = <span class="ruby-identifier">arg</span> +50: <span class="ruby-keyword kw">end</span> +51: <span class="ruby-ivar">@opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">'-w'</span>, <span class="ruby-value str">'--webserver'</span>, +52: <span class="ruby-identifier">format</span>(<span class="ruby-value str">'Start a web server that serves the reports of '</span> <span class="ruby-operator">+</span> +53: <span class="ruby-value str">'the loaded projects.'</span>)) <span class="ruby-keyword kw">do</span> +54: <span class="ruby-ivar">@webServer</span> = <span class="ruby-keyword kw">true</span> +55: <span class="ruby-keyword kw">end</span> +56: <span class="ruby-ivar">@opts</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">'--webserver-port &lt;NUMBER&gt;'</span>, <span class="ruby-constant">Integer</span>, +57: <span class="ruby-identifier">format</span>(<span class="ruby-value str">'Use the specified TCP/IP port to serve web browser '</span> <span class="ruby-operator">+</span> +58: <span class="ruby-value str">'requests (Default: 8080).'</span>)) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">arg</span><span class="ruby-operator">|</span> +59: <span class="ruby-ivar">@webServerPort</span> = <span class="ruby-identifier">arg</span> +60: <span class="ruby-keyword kw">end</span> +61: <span class="ruby-keyword kw">end</span> +62: <span class="ruby-keyword kw">end</span></pre> + </div> + + </div> + + + + + </div> + + + </div> + + <div id="private-instance-method-details" class="method-section section"> + <h3 class="section-header">Private Instance Methods</h3> + + + <div id="sort-nput-iles-method" class="method-detail "> + <a name="method-i-sortInputFiles"></a> + + <div class="method-heading"> + + <span class="method-name">sortInputFiles</span><span + class="method-args">(files)</span> + <span class="method-click-advice">click to toggle source</span> + + </div> + + <div class="method-description"> + + <p> +Sort the provided input files into groups of projects. Each *.tjp file +starts a new project. A *.tjp file may be followed by any number of *.tji +files. The result is an Array of projects. Each consists of an Array like +this: [ <working directory>, <tjp file> (, <tji file> &#8230;) ]. +</p> + + + + <div class="method-source-code" + id="sort-nput-iles-source"> +<pre> + <span class="ruby-comment cmt"># File lib/tj3d.rb, line 98</span> + 98: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sortInputFiles</span>(<span class="ruby-identifier">files</span>) + 99: <span class="ruby-identifier">projects</span> = [] +100: <span class="ruby-identifier">project</span> = <span class="ruby-keyword kw">nil</span> +101: <span class="ruby-identifier">files</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span> +102: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">file</span>[<span class="ruby-value">4</span><span class="ruby-operator">..</span><span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">'.tjp'</span> +103: <span class="ruby-comment cmt"># The project master file determines the working directory. If it's</span> +104: <span class="ruby-comment cmt"># an absolute file name, that directory will become the working</span> +105: <span class="ruby-comment cmt"># directory. If it's a relative file name, the current working</span> +106: <span class="ruby-comment cmt"># directory will be kept.</span> +107: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">file</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">'/'</span> +108: <span class="ruby-comment cmt"># Absolute file name</span> +109: <span class="ruby-identifier">workingDir</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-identifier">file</span>) +110: <span class="ruby-identifier">fileName</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-identifier">file</span>) +111: <span class="ruby-keyword kw">else</span> +112: <span class="ruby-comment cmt"># Relative file name</span> +113: <span class="ruby-identifier">workingDir</span> = <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">getwd</span> +114: <span class="ruby-identifier">fileName</span> = <span class="ruby-identifier">file</span> +115: <span class="ruby-keyword kw">end</span> +116: <span class="ruby-identifier">project</span> = [ <span class="ruby-identifier">workingDir</span>, <span class="ruby-identifier">fileName</span> ] +117: <span class="ruby-identifier">projects</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">project</span> +118: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">file</span>[<span class="ruby-value">4</span><span class="ruby-operator">..</span><span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">'.tji'</span> +119: <span class="ruby-comment cmt"># .tji files are optional. But if they are specified, they must</span> +120: <span class="ruby-comment cmt"># always follow the master file in the list.</span> +121: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">project</span>.<span class="ruby-identifier">nil?</span> +122: <span class="ruby-identifier">error</span>(<span class="ruby-value str">&quot;You must specify a '.tjp' file before the '.tji' files&quot;</span>) +123: <span class="ruby-keyword kw">end</span> +124: <span class="ruby-identifier">project</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">file</span> +125: <span class="ruby-keyword kw">else</span> +126: <span class="ruby-identifier">error</span>(<span class="ruby-value str">&quot;Project files must have a '.tjp' or '.tji' extension&quot;</span>) +127: <span class="ruby-keyword kw">end</span> +128: <span class="ruby-keyword kw">end</span> +129: +130: <span class="ruby-identifier">projects</span> +131: <span class="ruby-keyword kw">end</span></pre> </div> </div>