doc/classes/Autobuild.src/M000034.html in autobuild-0.5.1 vs doc/classes/Autobuild.src/M000034.html in autobuild-0.6
- old
+ new
@@ -3,23 +3,45 @@
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
- <title>pathvar (Autobuild)</title>
+ <title>load (Autobuild)</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
</head>
<body class="standalone-code">
- <pre><span class="ruby-comment cmt"># File lib/autobuild/environment.rb, line 2</span>
- <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">pathvar</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">varname</span>)
- <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-identifier">path</span>)
- <span class="ruby-identifier">oldpath</span> = <span class="ruby-constant">ENV</span>[<span class="ruby-identifier">varname</span>]
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">oldpath</span>.<span class="ruby-identifier">empty?</span>
- <span class="ruby-constant">ENV</span>[<span class="ruby-identifier">varname</span>] = <span class="ruby-identifier">path</span>
- <span class="ruby-keyword kw">else</span>
- <span class="ruby-constant">ENV</span>[<span class="ruby-identifier">varname</span>] = <span class="ruby-node">"#{path}:#{oldpath}"</span>
- <span class="ruby-keyword kw">end</span>
+ <pre><span class="ruby-comment cmt"># File lib/autobuild/loaders/config.rb, line 50</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">load</span>(<span class="ruby-identifier">conffile</span>, <span class="ruby-identifier">user_options</span> = <span class="ruby-constant">Options</span>.<span class="ruby-identifier">nil</span>)
+ <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">conffile</span>
+ <span class="ruby-keyword kw">when</span> <span class="ruby-constant">Hash</span>
+ <span class="ruby-identifier">config</span> = <span class="ruby-identifier">conffile</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">data</span> = <span class="ruby-constant">YAML</span>.<span class="ruby-identifier">load</span>(<span class="ruby-identifier">conffile</span>)
+ <span class="ruby-identifier">config</span> = <span class="ruby-constant">Interpolator</span>.<span class="ruby-identifier">interpolate</span>(<span class="ruby-identifier">data</span>)
<span class="ruby-keyword kw">end</span>
+
+ <span class="ruby-identifier">check_backward_compatibility</span>(<span class="ruby-identifier">config</span>)
+ <span class="ruby-identifier">config</span> = <span class="ruby-identifier">config</span>.<span class="ruby-identifier">keys_to_sym</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">config</span>[<span class="ruby-identifier">:autobuild</span>]
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">ConfigException</span>, <span class="ruby-value str">"no toplevel autobuild config block"</span>
+ <span class="ruby-keyword kw">end</span>
+
+ <span class="ruby-comment cmt"># Merge user_options into the autobuild block</span>
+ <span class="ruby-identifier">autobuild_config</span> = <span class="ruby-identifier">config</span>[<span class="ruby-identifier">:autobuild</span>]
+ <span class="ruby-identifier">default_options</span> = <span class="ruby-constant">Options</span>.<span class="ruby-identifier">default</span>
+ <span class="ruby-identifier">user_options</span>.<span class="ruby-identifier">each_pair</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">sym</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">value</span>.<span class="ruby-identifier">nil?</span>
+ <span class="ruby-identifier">autobuild_config</span>[<span class="ruby-identifier">sym</span>] = <span class="ruby-identifier">value</span>
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-operator">!</span><span class="ruby-identifier">autobuild_config</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">sym</span>)
+ <span class="ruby-identifier">autobuild_config</span>[<span class="ruby-identifier">sym</span>] = <span class="ruby-identifier">default_options</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">sym</span>)
+ <span class="ruby-keyword kw">end</span>
+ }
+
+ <span class="ruby-identifier">$verbose</span> = <span class="ruby-identifier">$VERBOSE</span> = <span class="ruby-identifier">autobuild_config</span>[<span class="ruby-identifier">:verbose</span>]
+ <span class="ruby-identifier">$trace</span> = <span class="ruby-identifier">$DEBUG</span> = <span class="ruby-identifier">autobuild_config</span>[<span class="ruby-identifier">:debug</span>]
+
+ <span class="ruby-identifier">get_autobuild_config</span>(<span class="ruby-identifier">config</span>)
+ <span class="ruby-identifier">get_package_config</span>(<span class="ruby-identifier">config</span>)
<span class="ruby-keyword kw">end</span></pre>
</body>
</html>
\ No newline at end of file