Added: dev/buildr/1.5.0/site/rdoc/Buildr/ArtifactNamespace.html
==============================================================================
--- dev/buildr/1.5.0/site/rdoc/Buildr/ArtifactNamespace.html (added)
+++ dev/buildr/1.5.0/site/rdoc/Buildr/ArtifactNamespace.html Sat Sep 17 
06:18:39 2016
@@ -0,0 +1,1929 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+<meta charset="UTF-8">
+
+<title>class Buildr::ArtifactNamespace - buildr</title>
+
+<script type="text/javascript">
+  var rdoc_rel_prefix = "../";
+</script>
+
+<script src="../js/jquery.js"></script>
+<script src="../js/darkfish.js"></script>
+
+<link href="../css/fonts.css" rel="stylesheet">
+<link href="../css/rdoc.css" rel="stylesheet">
+
+
+
+<body id="top" role="document" class="class">
+<nav role="navigation">
+  <div id="project-navigation">
+    <div id="home-section" role="region" title="Quick navigation" 
class="nav-section">
+  <h2>
+    <a href="../index.html" rel="home">Home</a>
+  </h2>
+
+  <div id="table-of-contents-navigation">
+    <a href="../table_of_contents.html#pages">Pages</a>
+    <a href="../table_of_contents.html#classes">Classes</a>
+    <a href="../table_of_contents.html#methods">Methods</a>
+  </div>
+</div>
+
+    <div id="search-section" role="search" class="project-section 
initially-hidden">
+  <form action="#" method="get" accept-charset="utf-8">
+    <div id="search-field-wrapper">
+      <input id="search-field" role="combobox" aria-label="Search"
+             aria-autocomplete="list" aria-controls="search-results"
+             type="text" name="search" placeholder="Search" spellcheck="false"
+             title="Type to search, Up and Down to navigate, Enter to load">
+    </div>
+
+    <ul id="search-results" aria-label="Search Results"
+        aria-busy="false" aria-expanded="false"
+        aria-atomic="false" class="initially-hidden"></ul>
+  </form>
+</div>
+
+  </div>
+
+  
+<div class="nav-section">
+  <h3>Table of Contents</h3>
+
+  <ul class="link-list" role="directory">
+    <li><a 
href="#class-Buildr::ArtifactNamespace-label-Avoiding+constant+pollution+on+buildfile">Avoiding
 constant pollution on buildfile</a>
+    <li><a 
href="#class-Buildr::ArtifactNamespace-label-Loading+from+a+yaml+file+-28e.+profiles.yaml-29">Loading
 from a yaml file (e. profiles.yaml)</a>
+    <li><a 
href="#class-Buildr::ArtifactNamespace-label-For+addon-2Fplugin+writers+-26+Customizing+artifact+versions">For
 addon/plugin writers &amp; Customizing artifact versions</a>
+  </ul>
+</div>
+
+
+  <div id="class-metadata">
+    
+    <div id="parent-class-section" class="nav-section">
+  <h3>Parent</h3>
+
+  
+  <p class="link"><a href="../Object.html">Object</a>
+  
+</div>
+
+    <div id="includes-section" class="nav-section">
+  <h3>Included Modules</h3>
+
+  <ul class="link-list">
+  
+  
+    <li><span class="include">Enumerable</span>
+  
+  
+  </ul>
+</div>
+
+    
+    <!-- Method Quickref -->
+<div id="method-list-section" class="nav-section">
+  <h3>Methods</h3>
+
+  <ul class="link-list" role="directory">
+    
+    <li ><a href="#method-c-5B-5D">::[]</a>
+    
+    <li ><a href="#method-c-clear">::clear</a>
+    
+    <li ><a href="#method-c-for">::for</a>
+    
+    <li ><a href="#method-c-instance">::instance</a>
+    
+    <li ><a href="#method-c-load">::load</a>
+    
+    <li ><a href="#method-c-root">::root</a>
+    
+    <li ><a href="#method-c-to_hash">::to_hash</a>
+    
+    <li ><a href="#method-i-5B-5D">#[]</a>
+    
+    <li ><a href="#method-i-5B-5D-3D">#[]=</a>
+    
+    <li ><a href="#method-i-accessor">#accessor</a>
+    
+    <li ><a href="#method-i-alias">#alias</a>
+    
+    <li ><a href="#method-i-artifacts">#artifacts</a>
+    
+    <li ><a href="#method-i-clear">#clear</a>
+    
+    <li ><a href="#method-i-delete">#delete</a>
+    
+    <li ><a href="#method-i-each">#each</a>
+    
+    <li ><a href="#method-i-fetch">#fetch</a>
+    
+    <li ><a href="#method-i-group">#group</a>
+    
+    <li ><a href="#method-i-key-3F">#key?</a>
+    
+    <li ><a href="#method-i-keys">#keys</a>
+    
+    <li ><a href="#method-i-method_missing">#method_missing</a>
+    
+    <li ><a href="#method-i-need">#need</a>
+    
+    <li ><a href="#method-i-ns">#ns</a>
+    
+    <li ><a href="#method-i-ns-3F">#ns?</a>
+    
+    <li ><a href="#method-i-parent">#parent</a>
+    
+    <li ><a href="#method-i-parent-3D">#parent=</a>
+    
+    <li ><a href="#method-i-root">#root</a>
+    
+    <li ><a href="#method-i-root-3F">#root?</a>
+    
+    <li ><a href="#method-i-use">#use</a>
+    
+    <li ><a href="#method-i-values">#values</a>
+    
+    <li ><a href="#method-i-values_at">#values_at</a>
+    
+    <li ><a href="#method-i-virtual">#virtual</a>
+    
+  </ul>
+</div>
+
+  </div>
+</nav>
+
+<main role="main" aria-labelledby="class-Buildr::ArtifactNamespace">
+  <h1 id="class-Buildr::ArtifactNamespace" class="class">
+    class Buildr::ArtifactNamespace
+  </h1>
+
+  <section class="description">
+    
+<p>An <a href="ArtifactNamespace.html">ArtifactNamespace</a> is a hierarchical
+dictionary used to manage ArtifactRequirements. It can be used to have
+different artifact versions per project or to allow users to select a
+version for addons or modules.</p>
+
+<p>Namespaces are opened using the Buildr.artifact_ns method, most important
+methods are:</p>
+<dl class="rdoc-list label-list"><dt>need
+<dd>
+<p>Used to create a requirement on the namespace.</p>
+</dd><dt>use
+<dd>
+<p>Set the artifact version to use for a requirement.</p>
+</dd><dt><a href="ArtifactNamespace.html#method-i-values_at">#values_at</a>
+<dd>
+<p>Reference requirements by name.</p>
+</dd><dt>each
+<dd>
+<p>Return each <a
+href="ArtifactNamespace/ArtifactRequirement.html">ArtifactRequirement</a>
+in the namespace.</p>
+</dd></dl>
+
+<p>The <a
+href="ArtifactNamespace.html#method-i-method_missing">#method_missing</a>
+method for instances provides some syntactic sugar to these. See the
+following examples, and the methods for <a
+href="ArtifactNamespace/ArtifactRequirement.html">ArtifactRequirement</a>.</p>
+
+<h1 
id="class-Buildr::ArtifactNamespace-label-Avoiding+constant+pollution+on+buildfile">Avoiding
 constant pollution on buildfile<span><a 
href="#class-Buildr::ArtifactNamespace-label-Avoiding+constant+pollution+on+buildfile">&para;</a>
 <a href="#top">&uarr;</a></span></h1>
+
+<p>Each project has its own <a
+href="ArtifactNamespace.html">ArtifactNamespace</a> inheriting the one from
+the parent project up to the root namespace.</p>
+
+<p>Consider the following snippet, as project grows, each subproject may need
+different artifact combinations and/or versions. Assigning artifact
+specifications to constants can make it painful to maintain their
+references even if using structs/hashes.</p>
+
+<pre>-- buildfile --
+SPRING = &#39;org.springframework:spring:jar:2.5&#39;
+SPRING_OLD = &#39;org.springframework:spring:jar:1.0&#39;
+LOGGING = [&#39;comons-logging:commons-logging:jar:1.1.1&#39;,
+           &#39;log4j:log4j:jar:1.2.15&#39;]
+WL_LOGGING = 
artifact(&#39;bea:wlcommons-logging:jar:8.1&#39;).from(&#39;path/to/wlcommons-logging.jar&#39;)
+LOGGING_WEBLOGIC = [&#39;comons-logging:commons-logging:jar:1.1.1&#39;,
+                    WL_LOGGING]
+COMMONS = struct :collections =&gt; 
&#39;commons-collection:commons-collection:jar:3.1&#39;,
+                 :net =&gt; &#39;commons-net:commons-net:jar:1.4.0&#39;
+
+define &#39;example1&#39; do
+  define &#39;one&#39; do
+    compile.with SPRING, LOGGING_WEBLOGIC, COMMONS
+  end
+  define &#39;two&#39; do
+    compile.with SPRING_OLD, LOGGING, COMMONS
+  end
+  define &#39;three&#39; do
+    compile.with &quot;commons-collections:commons-collections:jar:2.2&quot;
+  end
+end</pre>
+
+<p>With <a href="ArtifactNamespace.html">ArtifactNamespace</a> you can do some
+more advanced stuff, the following annotated snipped could still be reduced
+if default artifact definitions were loaded from yaml file (see section
+below and <a href="ArtifactNamespace.html#method-c-load">::load</a>).</p>
+
+<pre>-- buildfile --
+artifact_ns do |ns| # the current namespace (root if called outside a project)
+  # default artifacts
+  ns.spring = &#39;org.springframework:spring:jar:2.5&#39;
+  # default logger is log4j
+  ns.logger = &#39;log4j:log4j:jar:1.2.15&#39;
+
+  # create a sub namespace by calling the #ns method,
+  # artifacts defined on the sub-namespace can be referenced by
+  # name :commons_net or by calling commons.net
+  ns.ns :commons, :net =&gt; &#39;commons-net:commons-net:jar:1.4.0&#39;,
+                  :logging =&gt; 
&#39;comons-logging:commons-logging:jar:1.1.1&#39;
+
+  # When a child namespace asks for the :log artifact,
+  # these artifacts will be searched starting from the :current namespace.
+  ns.virtual :log, :logger, :commons_logging
+end
+
+artifact_ns(&#39;example2:one&#39;) do |ns| # namespace for the one subproject
+  ns.logger = 
artifact(&#39;bea:wlcommons-logging:jar:8.1&#39;).from(&#39;path/to/wlcommons-logging.jar&#39;)
+end
+artifact_ns(&#39;example2:two&#39;) do |ns|
+  ns.spring = &#39;1.0&#39; # for project two use an older spring version 
(just for an example)
+end
+artifact_ns(&#39;example2:three&#39;).commons_collections = 2.2&#39;
+artifact_ns(&#39;example2:four&#39;) do |ns|
+  ns.beanutils = &#39;commons-beanutils:commons-beanutils:jar:1.5&#39;        
# just for this project
+  ns.ns(:compilation).use :commons_logging, :beanutils, :spring       # 
compile time dependencies
+  ns.ns(:testing).use :log, :beanutils, &#39;cglib:cglib-nodep:jar:2.1.3&#39; 
# run time dependencies
+end
+
+define &#39;example2&#39; do
+  define &#39;one&#39; do
+    compile.with :spring, :log, :commons # uses weblogic logging
+  end
+  define &#39;two&#39; do
+    compile.with :spring, :log, :commons # will take old spring
+  end
+  define &#39;three&#39; do
+    compile.with :commons_collections
+    test.with artifact_ns(&#39;example2:two&#39;).spring # use spring from 
project two
+  end
+  define &#39;four&#39; do
+    compile.with artifact_ns.compilation
+    test.with artifact_ns.testing
+  end
+  task(:down_them_all) do # again, just to fill this space with something ;)
+    
parent.projects.map(&amp;method(:artifact_ns)).map(&amp;:artifacts).map(&amp;:invoke)
+  end
+end</pre>
+
+<h1 
id="class-Buildr::ArtifactNamespace-label-Loading+from+a+yaml+file+-28e.+profiles.yaml-29">Loading
 from a yaml file (e. profiles.yaml)<span><a 
href="#class-Buildr::ArtifactNamespace-label-Loading+from+a+yaml+file+-28e.+profiles.yaml-29">&para;</a>
 <a href="#top">&uarr;</a></span></h1>
+
+<p>If your projects use lots of jars (after all we are using java ;) you may
+prefer to have constant artifact definitions on an external file. Doing so
+would allow an external tool (or future <a href="../Buildr.html">Buildr</a>
+feature) to maintain an artifacts.yaml for you. An example usage is
+documented on the <a href="ArtifactNamespace.html#method-c-load">::load</a>
+method.</p>
+
+<h1 
id="class-Buildr::ArtifactNamespace-label-For+addon-2Fplugin+writers+-26+Customizing+artifact+versions">For
 addon/plugin writers &amp; Customizing artifact versions<span><a 
href="#class-Buildr::ArtifactNamespace-label-For+addon-2Fplugin+writers+-26+Customizing+artifact+versions">&para;</a>
 <a href="#top">&uarr;</a></span></h1>
+
+<p>Sometimes users would need to change the default artifact versions used by
+some module, for example, the XMLBeans compiler needs this, because of
+compatibility issues. Another example would be to select the groovy version
+to use on all our projects so that <a href="../Buildr.html">Buildr</a>
+modules requiring groovy jars can use user prefered versions.</p>
+
+<p>To meet this goal, an <a
+href="ArtifactNamespace.html">ArtifactNamespace</a> allows to specify <a
+href="ArtifactNamespace/ArtifactRequirement.html">ArtifactRequirement</a>
+objects. In fact the only difference with the examples you have already
+seen is that requirements have an associated <a
+href="VersionRequirement.html">VersionRequirement</a>, so that each time a
+user tries to select a version, buildr checks if it satisfies the
+requirements.</p>
+
+<p>Requirements are declared using the <a
+href="ArtifactNamespace.html#method-i-need">#need</a> method, but again,
+syntactic sugar is provided by <a
+href="ArtifactNamespace.html#method-i-method_missing">#method_missing</a>.</p>
+
+<p>The following example is taken from the XMLBeans compiler module. And
+illustrates how addon authors should specify their requirements, provide
+default versions, and document the namespace for users to customize.</p>
+
+<pre class="ruby"><span class="ruby-keyword">module</span> <span 
class="ruby-constant">Buildr</span><span class="ruby-operator">::</span><span 
class="ruby-constant">XMLBeans</span>
+
+   <span class="ruby-comment"># You need to document this constant, giving 
users some hints</span>
+   <span class="ruby-comment"># about when are (maybe some of) these artifacts 
used. I mean,</span>
+   <span class="ruby-comment"># some modules, add jars to the Buildr classpath 
when its file</span>
+   <span class="ruby-comment"># is required, you would need to tell your 
users, so that they</span>
+   <span class="ruby-comment"># can open the namespace and specify their 
defaults. Of course</span>
+   <span class="ruby-comment"># when the requirements are defined, buildr 
checks if any compatible</span>
+   <span class="ruby-comment"># version has been already defined, if so, uses 
it.</span>
+   <span class="ruby-comment">#</span>
+   <span class="ruby-comment"># Some things here have been changed to 
illustrate their meaning.</span>
+   <span class="ruby-constant">REQUIRES</span> = <span 
class="ruby-constant">ArtifactNamespace</span>.<span 
class="ruby-identifier">for</span>(<span 
class="ruby-keyword">self</span>).<span class="ruby-identifier">tap</span> 
<span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span 
class="ruby-identifier">ns</span><span class="ruby-operator">|</span>
+
+     <span class="ruby-comment"># This jar requires a &gt;2.0 version, default 
being 2.3.0</span>
+     <span class="ruby-identifier">ns</span>.<span 
class="ruby-identifier">xmlbeans!</span> <span 
class="ruby-string">&#39;org.apache.xmlbeans:xmlbeans:jar:2.3.0&#39;</span>, 
<span class="ruby-string">&#39;&gt;2&#39;</span>
+
+     <span class="ruby-comment"># Users can customize with 
Buildr::XMLBeans::REQUIRES.stax_api = &#39;1.2&#39;</span>
+     <span class="ruby-comment"># This is a non-flexible requirement, only 
satisfied by version 1.0.1</span>
+     <span class="ruby-identifier">ns</span>.<span 
class="ruby-identifier">stax_api!</span> <span 
class="ruby-string">&#39;stax:stax-api:jar:1.0.1&#39;</span>
+
+     <span class="ruby-comment"># This one is not part of XMLBeans, but is 
just another example</span>
+     <span class="ruby-comment"># illustrating an `artifact requirement 
spec`.</span>
+
+     <span class="ruby-identifier">ns</span>.<span 
class="ruby-identifier">need</span> <span class="ruby-string">&quot; some_name 
-&gt;  ar:ti:fact:3.2.5 -&gt;  ( &gt;2 &amp; &lt;4)&quot;</span>
+
+     <span class="ruby-comment"># As you can see it&#39;s just an artifact 
spec, prefixed with</span>
+     <span class="ruby-comment"># &#39; some_name -&gt; &#39;, this means 
users can use that name to</span>
+     <span class="ruby-comment"># reference the requirement, also this string 
has a VersionRequirement</span>
+     <span class="ruby-comment"># just after another -&gt;.</span>
+   <span class="ruby-keyword">end</span>
+
+   <span class="ruby-comment"># The REQUIRES constant is an ArtifactNamespace 
instance,</span>
+   <span class="ruby-comment"># that means we can use it directly. Note that 
calling</span>
+   <span class="ruby-comment"># Buildr.artifact_ns would lead to the currently 
executing context,</span>
+   <span class="ruby-comment"># not the one for this module.</span>
+   <span class="ruby-keyword">def</span> <span 
class="ruby-identifier">use</span>
+     <span class="ruby-comment"># test if user specified his own version, if 
so, we could perform some</span>
+     <span class="ruby-comment"># functionallity based on this.</span>
+     <span class="ruby-constant">REQUIRES</span>.<span 
class="ruby-identifier">some_name</span>.<span 
class="ruby-identifier">selected?</span> <span class="ruby-comment"># =&gt; 
false</span>
+
+     <span class="ruby-constant">REQUIRES</span>.<span 
class="ruby-identifier">some_name</span>.<span 
class="ruby-identifier">satisfied_by?</span>(<span 
class="ruby-string">&#39;1.5&#39;</span>) <span class="ruby-comment"># =&gt; 
false</span>
+     <span class="ruby-identifier">puts</span> <span 
class="ruby-constant">REQUIRES</span>.<span 
class="ruby-identifier">some_name</span>.<span 
class="ruby-identifier">requirement</span>     <span class="ruby-comment"># 
=&gt; ( &gt;2 &amp; &lt;4 )</span>
+
+     <span class="ruby-constant">REQUIRES</span>.<span 
class="ruby-identifier">artifacts</span> <span class="ruby-comment"># get the 
Artifact tasks</span>
+   <span class="ruby-keyword">end</span>
+
+<span class="ruby-keyword">end</span>
+</pre>
+
+<p>A more advanced example using <a
+href="ArtifactNamespace/ArtifactRequirement.html">ArtifactRequirement</a>
+listeners is included in the artifact_namespace_spec.rb description for
+&#39;Extension using ArtifactNamespace&#39; That&#39;s it for addon
+writers, now, users can select their prefered version with something like:</p>
+
+<pre class="ruby"><span class="ruby-identifier">require</span> <span 
class="ruby-string">&#39;buildr/xmlbeans&#39;</span>
+<span class="ruby-constant">Buildr</span><span 
class="ruby-operator">::</span><span class="ruby-constant">XMLBeans</span><span 
class="ruby-operator">::</span><span 
class="ruby-constant">REQUIRES</span>.<span 
class="ruby-identifier">xmlbeans</span> = <span 
class="ruby-string">&#39;2.2.0&#39;</span>
+</pre>
+
+<p>More advanced stuff, if users really need to select an xmlbeans version per
+project, they can do so letting :current (that is, the currently running
+namespace) be parent of the REQUIRES namespace:</p>
+
+<pre class="ruby"><span class="ruby-constant">Buildr</span><span 
class="ruby-operator">::</span><span class="ruby-constant">XMLBeans</span><span 
class="ruby-operator">::</span><span 
class="ruby-constant">REQUIRES</span>.<span 
class="ruby-identifier">parent</span> = :<span 
class="ruby-identifier">current</span>
+</pre>
+
+<p>Now, provided that the compiler does not caches its artifacts, it will
+select the correct version. (See the first section for how to select per
+project artifacts).</p>
+
+  </section>
+
+  
+  
+  
+  <section id="5Buntitled-5D" class="documentation-section">
+    
+
+    
+
+    
+
+    
+    <section class="attribute-method-details" class="method-section">
+      <header>
+        <h3>Attributes</h3>
+      </header>
+
+      
+      <div id="attribute-i-name" class="method-detail">
+        <div class="method-heading attribute-method-heading">
+          <span class="method-name">name</span><span
+            class="attribute-access-type">[R]</span>
+        </div>
+
+        <div class="method-description">
+        
+        
+        
+        </div>
+      </div>
+      
+    </section>
+    
+
+    
+     <section id="public-class-5Buntitled-5D-method-details" 
class="method-section">
+       <header>
+         <h3>Public Class Methods</h3>
+       </header>
+
+    
+      <div id="method-c-5B-5D" class="method-detail method-alias">
+        
+        <div class="method-heading">
+          <span class="method-name">[]</span><span
+            class="method-args">(name = nil)</span>
+          
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+          
+
+          
+        </div>
+
+        
+
+        
+        <div class="aliases">
+          Alias for: <a 
href="ArtifactNamespace.html#method-c-instance">instance</a>
+        </div>
+        
+      </div>
+
+    
+      <div id="method-c-clear" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">clear</span><span
+            class="method-args">()</span>
+          
+          <span class="method-click-advice">click to toggle source</span>
+          
+        </div>
+        
+
+        <div class="method-description">
+          
+          <p>Forget all namespaces, create a new ROOT</p>
+          
+          
+
+          
+          <div class="method-source-code" id="clear-source">
+            <pre><span class="ruby-comment"># File 
lib/buildr/packaging/artifact_namespace.rb, line 217</span>
+<span class="ruby-keyword">def</span> <span 
class="ruby-identifier">clear</span>
+  <span class="ruby-ivar">@instances</span> = <span 
class="ruby-keyword">nil</span>
+  <span class="ruby-identifier">remove_const</span>(<span 
class="ruby-value">:ROOT</span>) <span class="ruby-keyword">rescue</span> <span 
class="ruby-keyword">nil</span>
+  <span class="ruby-identifier">const_set</span>(<span 
class="ruby-value">:ROOT</span>, <span class="ruby-identifier">new</span>(<span 
class="ruby-string">&#39;root&#39;</span>))
+<span class="ruby-keyword">end</span></pre>
+          </div>
+          
+        </div>
+
+        
+
+        
+      </div>
+
+    
+      <div id="method-c-for" class="method-detail method-alias">
+        
+        <div class="method-heading">
+          <span class="method-name">for</span><span
+            class="method-args">(name = nil)</span>
+          
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+          
+
+          
+        </div>
+
+        
+
+        
+        <div class="aliases">
+          Alias for: <a 
href="ArtifactNamespace.html#method-c-instance">instance</a>
+        </div>
+        
+      </div>
+
+    
+      <div id="method-c-instance" class="method-detail ">
+        
+        
+        <div class="method-heading">
+          <span class="method-callseq">
+            instance { |current_ns| ... } &rarr; current_ns
+          </span>
+          
+          <span class="method-click-advice">click to toggle source</span>
+          
+        </div>
+        
+        <div class="method-heading">
+          <span class="method-callseq">
+            instance(name) { |ns| ... } &rarr; ns
+          </span>
+          
+        </div>
+        
+        <div class="method-heading">
+          <span class="method-callseq">
+            instance(:current) { |current_ns| ... } &rarr; current_ns
+          </span>
+          
+        </div>
+        
+        <div class="method-heading">
+          <span class="method-callseq">
+            instance(:root) { |root_ns| ... } &rarr; root_ns
+          </span>
+          
+        </div>
+        
+        
+
+        <div class="method-description">
+          
+          <p>Obtain an instance for the given name</p>
+          
+          
+
+          
+          <div class="method-source-code" id="instance-source">
+            <pre><span class="ruby-comment"># File 
lib/buildr/packaging/artifact_namespace.rb, line 283</span>
+<span class="ruby-keyword">def</span> <span 
class="ruby-identifier">instance</span>(<span 
class="ruby-identifier">name</span> = <span class="ruby-keyword">nil</span>)
+  <span class="ruby-keyword">case</span> <span 
class="ruby-identifier">name</span>
+  <span class="ruby-keyword">when</span> <span 
class="ruby-value">:root</span>, <span 
class="ruby-string">&#39;root&#39;</span> <span 
class="ruby-keyword">then</span> <span class="ruby-keyword">return</span> <span 
class="ruby-constant">ROOT</span>
+  <span class="ruby-keyword">when</span> <span 
class="ruby-constant">ArtifactNamespace</span> <span 
class="ruby-keyword">then</span> <span class="ruby-keyword">return</span> <span 
class="ruby-identifier">name</span>
+  <span class="ruby-keyword">when</span> <span 
class="ruby-constant">Array</span> <span class="ruby-keyword">then</span> <span 
class="ruby-identifier">name</span> = <span 
class="ruby-identifier">name</span>.<span 
class="ruby-identifier">join</span>(<span 
class="ruby-string">&#39;:&#39;</span>)
+  <span class="ruby-keyword">when</span> <span 
class="ruby-constant">Module</span>, <span class="ruby-constant">Project</span> 
<span class="ruby-keyword">then</span> <span 
class="ruby-identifier">name</span> = <span 
class="ruby-identifier">name</span>.<span class="ruby-identifier">name</span>
+  <span class="ruby-keyword">when</span> <span 
class="ruby-value">:current</span>, <span 
class="ruby-string">&#39;current&#39;</span>, <span 
class="ruby-keyword">nil</span> <span class="ruby-keyword">then</span>
+    <span class="ruby-identifier">task</span> = <span 
class="ruby-constant">Thread</span>.<span 
class="ruby-identifier">current</span>[<span 
class="ruby-value">:rake_chain</span>]
+    <span class="ruby-identifier">task</span> = <span 
class="ruby-identifier">task</span>.<span 
class="ruby-identifier">instance_variable_get</span>(<span 
class="ruby-value">:@value</span>) <span class="ruby-keyword">if</span> <span 
class="ruby-identifier">task</span>
+    <span class="ruby-identifier">name</span> = <span 
class="ruby-keyword">case</span> <span class="ruby-identifier">task</span>
+           <span class="ruby-keyword">when</span> <span 
class="ruby-constant">Project</span> <span class="ruby-keyword">then</span> 
<span class="ruby-identifier">task</span>.<span 
class="ruby-identifier">name</span>
+           <span class="ruby-keyword">when</span> <span 
class="ruby-constant">Rake</span><span class="ruby-operator">::</span><span 
class="ruby-constant">Task</span> <span class="ruby-keyword">then</span> <span 
class="ruby-identifier">task</span>.<span 
class="ruby-identifier">scope</span>.<span 
class="ruby-identifier">join</span>(<span 
class="ruby-string">&#39;:&#39;</span>)
+           <span class="ruby-keyword">when</span> <span 
class="ruby-keyword">nil</span> <span class="ruby-keyword">then</span> <span 
class="ruby-constant">Buildr</span>.<span 
class="ruby-identifier">application</span>.<span 
class="ruby-identifier">current_scope</span>.<span 
class="ruby-identifier">join</span>(<span 
class="ruby-string">&#39;:&#39;</span>)
+           <span class="ruby-keyword">end</span>
+  <span class="ruby-keyword">end</span>
+  <span class="ruby-identifier">name</span> = <span 
class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>
+  <span class="ruby-keyword">if</span> <span 
class="ruby-identifier">name</span>.<span class="ruby-identifier">size</span> 
<span class="ruby-operator">==</span> <span class="ruby-value">0</span>
+    <span class="ruby-identifier">instance</span> = <span 
class="ruby-constant">ROOT</span>
+  <span class="ruby-keyword">else</span>
+    <span class="ruby-identifier">name</span> = <span 
class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>
+    <span class="ruby-ivar">@instances</span> <span 
class="ruby-operator">||=</span> <span class="ruby-constant">Hash</span>.<span 
class="ruby-identifier">new</span> { <span class="ruby-operator">|</span><span 
class="ruby-identifier">h</span>, <span class="ruby-identifier">k</span><span 
class="ruby-operator">|</span> <span class="ruby-identifier">h</span>[<span 
class="ruby-identifier">k</span>] = <span 
class="ruby-identifier">new</span>(<span class="ruby-identifier">k</span>) }
+    <span class="ruby-identifier">instance</span> = <span 
class="ruby-ivar">@instances</span>[<span class="ruby-identifier">name</span>]
+  <span class="ruby-keyword">end</span>
+  <span class="ruby-keyword">yield</span>(<span 
class="ruby-identifier">instance</span>) <span class="ruby-keyword">if</span> 
<span class="ruby-identifier">block_given?</span>
+  <span class="ruby-identifier">instance</span>
+<span class="ruby-keyword">end</span></pre>
+          </div>
+          
+        </div>
+
+        
+        <div class="aliases">
+          Also aliased as: <a 
href="ArtifactNamespace.html#method-c-5B-5D">[]</a>, <a 
href="ArtifactNamespace.html#method-c-for">for</a>
+        </div>
+        
+
+        
+      </div>
+
+    
+      <div id="method-c-load" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">load</span><span
+            class="method-args">(namespaces = {})</span>
+          
+          <span class="method-click-advice">click to toggle source</span>
+          
+        </div>
+        
+
+        <div class="method-description">
+          
+          <p>Populate namespaces from a hash of hashes. The following example 
uses the
+profiles yaml to achieve this.</p>
+
+<pre>-- profiles.yaml --
+development:
+  artifacts:
+    root:        # root namespace
+      spring:     org.springframework:spring:jar:2.5
+      groovy:     org.codehaus.groovy:groovy:jar:1.5.4
+      logging:    # define a named group
+        - log4j:log4j:jar:1.2.15
+        - commons-logging:commons-logging:jar:1.1.1
+
+    # open Buildr::XMLBeans namespace
+    Buildr::XMLBeans:
+      xmlbeans: 2.2
+
+    # for subproject one:oldie
+    one:oldie:
+      spring:  org.springframework:spring:jar:1.0
+
+-- buildfile --
+ArtifactNamespace.load(Buildr.settings.profile[&#39;artifacts&#39;])</pre>
+          
+          
+
+          
+          <div class="method-source-code" id="load-source">
+            <pre><span class="ruby-comment"># File 
lib/buildr/packaging/artifact_namespace.rb, line 272</span>
+<span class="ruby-keyword">def</span> <span 
class="ruby-identifier">load</span>(<span 
class="ruby-identifier">namespaces</span> = {})
+  <span class="ruby-identifier">namespaces</span>.<span 
class="ruby-identifier">each_pair</span> { <span 
class="ruby-operator">|</span><span class="ruby-identifier">name</span>, <span 
class="ruby-identifier">uses</span><span class="ruby-operator">|</span> <span 
class="ruby-identifier">instance</span>(<span 
class="ruby-identifier">name</span>).<span 
class="ruby-identifier">use</span>(<span class="ruby-identifier">uses</span>) }
+<span class="ruby-keyword">end</span></pre>
+          </div>
+          
+        </div>
+
+        
+
+        
+      </div>
+
+    
+      <div id="method-c-root" class="method-detail ">
+        
+        
+        <div class="method-heading">
+          <span class="method-callseq">
+            root { |ns| ... } &rarr; ns
+          </span>
+          
+          <span class="method-click-advice">click to toggle source</span>
+          
+        </div>
+        
+        
+
+        <div class="method-description">
+          
+          <p>Obtain the root namespace, returns the ROOT constant</p>
+          
+          
+
+          
+          <div class="method-source-code" id="root-source">
+            <pre><span class="ruby-comment"># File 
lib/buildr/packaging/artifact_namespace.rb, line 317</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">root</span>
+  <span class="ruby-keyword">yield</span> <span 
class="ruby-constant">ROOT</span> <span class="ruby-keyword">if</span> <span 
class="ruby-identifier">block_given?</span>
+  <span class="ruby-constant">ROOT</span>
+<span class="ruby-keyword">end</span></pre>
+          </div>
+          
+        </div>
+
+        
+
+        
+      </div>
+
+    
+      <div id="method-c-to_hash" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">to_hash</span><span
+            class="method-args">(spec)</span>
+          
+          <span class="method-click-advice">click to toggle source</span>
+          
+        </div>
+        
+
+        <div class="method-description">
+          
+          <p>Differs from <a
+href="Artifact.html#method-c-to_hash">Buildr::Artifact.to_hash</a> in that
+1) it does not choke when version isn&#39;t present and 2) it assumes that
+if an artifact spec ends with a colon, e.g. “org.example:library:jdk5:” it
+indicates the last segment (“jdk5”) is a classifier.</p>
+          
+          
+
+          
+          <div class="method-source-code" id="to_hash-source">
+            <pre><span class="ruby-comment"># File 
lib/buildr/packaging/artifact_namespace.rb, line 226</span>
+<span class="ruby-keyword">def</span> <span 
class="ruby-identifier">to_hash</span>(<span 
class="ruby-identifier">spec</span>)
+  <span class="ruby-keyword">if</span> <span 
class="ruby-identifier">spec</span>.<span 
class="ruby-identifier">respond_to?</span>(<span 
class="ruby-value">:to_spec</span>)
+    <span class="ruby-identifier">to_hash</span> <span 
class="ruby-identifier">spec</span>.<span class="ruby-identifier">to_spec</span>
+  <span class="ruby-keyword">elsif</span> <span 
class="ruby-constant">Hash</span> <span class="ruby-operator">===</span> <span 
class="ruby-identifier">spec</span>
+    <span class="ruby-keyword">return</span> <span 
class="ruby-identifier">spec</span>
+  <span class="ruby-keyword">elsif</span> <span 
class="ruby-constant">String</span> <span class="ruby-operator">===</span> 
<span class="ruby-identifier">spec</span> <span class="ruby-operator">||</span> 
<span class="ruby-constant">Symbol</span> <span 
class="ruby-operator">===</span> <span class="ruby-identifier">spec</span>
+    <span class="ruby-identifier">spec</span> = <span 
class="ruby-identifier">spec</span>.<span class="ruby-identifier">to_s</span>
+    <span class="ruby-keyword">if</span> <span 
class="ruby-identifier">spec</span>[<span class="ruby-value">-1</span>,<span 
class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span 
class="ruby-string">&#39;:&#39;</span>
+      <span class="ruby-identifier">group</span>, <span 
class="ruby-identifier">id</span>, <span class="ruby-identifier">type</span>, 
<span class="ruby-identifier">classifier</span>, <span 
class="ruby-operator">*</span><span class="ruby-identifier">rest</span> = <span 
class="ruby-identifier">spec</span>.<span 
class="ruby-identifier">split</span>(<span 
class="ruby-string">&#39;:&#39;</span>).<span 
class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span 
class="ruby-identifier">part</span><span class="ruby-operator">|</span> <span 
class="ruby-identifier">part</span>.<span class="ruby-identifier">empty?</span> 
<span class="ruby-operator">?</span> <span class="ruby-keyword">nil</span> 
<span class="ruby-operator">:</span> <span class="ruby-identifier">part</span> }
+    <span class="ruby-keyword">else</span>
+      <span class="ruby-identifier">group</span>, <span 
class="ruby-identifier">id</span>, <span class="ruby-identifier">type</span>, 
<span class="ruby-identifier">version</span>, <span 
class="ruby-operator">*</span><span class="ruby-identifier">rest</span> = <span 
class="ruby-identifier">spec</span>.<span 
class="ruby-identifier">split</span>(<span 
class="ruby-string">&#39;:&#39;</span>).<span 
class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span 
class="ruby-identifier">part</span><span class="ruby-operator">|</span> <span 
class="ruby-identifier">part</span>.<span class="ruby-identifier">empty?</span> 
<span class="ruby-operator">?</span> <span class="ruby-keyword">nil</span> 
<span class="ruby-operator">:</span> <span class="ruby-identifier">part</span> }
+      <span class="ruby-keyword">unless</span> <span 
class="ruby-identifier">rest</span>.<span class="ruby-identifier">empty?</span>
+        <span class="ruby-comment"># Optional classifier comes before 
version.</span>
+        <span class="ruby-identifier">classifier</span>, <span 
class="ruby-identifier">version</span> = <span 
class="ruby-identifier">version</span>, <span 
class="ruby-identifier">rest</span>.<span class="ruby-identifier">shift</span>
+      <span class="ruby-keyword">end</span>
+    <span class="ruby-keyword">end</span>
+    <span class="ruby-identifier">fail</span> <span 
class="ruby-node">&quot;Expecting &lt;group:id:type:version&gt; or 
&lt;group:id:type:classifier:version&gt;, found &lt;#{spec}&gt;&quot;</span> 
<span class="ruby-keyword">unless</span> <span 
class="ruby-identifier">rest</span>.<span class="ruby-identifier">empty?</span>
+    { <span class="ruby-value">:group</span> =<span 
class="ruby-operator">&gt;</span> <span class="ruby-identifier">group</span>, 
<span class="ruby-value">:id</span> =<span class="ruby-operator">&gt;</span> 
<span class="ruby-identifier">id</span>, <span class="ruby-value">:type</span> 
=<span class="ruby-operator">&gt;</span> <span 
class="ruby-identifier">type</span>, <span class="ruby-value">:version</span> 
=<span class="ruby-operator">&gt;</span> <span 
class="ruby-identifier">version</span>, <span 
class="ruby-value">:classifier</span> =<span class="ruby-operator">&gt;</span> 
<span class="ruby-identifier">classifier</span> }.<span 
class="ruby-identifier">reject</span> { <span 
class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span 
class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span 
class="ruby-identifier">v</span> <span class="ruby-operator">==</span> <span 
class="ruby-keyword">nil</span> }
+  <span class="ruby-keyword">else</span>
+    <span class="ruby-identifier">fail</span> <span 
class="ruby-node">&quot;Unexpected artifact spec: #{spec.inspect}&quot;</span>
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div>
+          
+        </div>
+
+        
+
+        
+      </div>
+
+    
+    </section>
+  
+     <section id="public-instance-5Buntitled-5D-method-details" 
class="method-section">
+       <header>
+         <h3>Public Instance Methods</h3>
+       </header>
+
+    
+      <div id="method-i-5B-5D" class="method-detail ">
+        
+        
+        <div class="method-heading">
+          <span class="method-callseq">
+            artifact_ns[:name] &rarr; ArtifactRequirement
+          </span>
+          
+          <span class="method-click-advice">click to toggle source</span>
+          
+        </div>
+        
+        <div class="method-heading">
+          <span class="method-callseq">
+            artifact_ns[:many, :names] &rarr; [ArtifactRequirement]
+          </span>
+          
+        </div>
+        
+        
+
+        <div class="method-description">
+          
+          
+          
+          
+
+          
+          <div class="method-source-code" id="5B-5D-source">
+            <pre><span class="ruby-comment"># File 
lib/buildr/packaging/artifact_namespace.rb, line 778</span>
+<span class="ruby-keyword">def</span> <span 
class="ruby-operator">[]</span>(<span class="ruby-operator">*</span><span 
class="ruby-identifier">names</span>)
+  <span class="ruby-identifier">ary</span> = <span 
class="ruby-identifier">values_at</span>(<span 
class="ruby-operator">*</span><span class="ruby-identifier">names</span>)
+  <span class="ruby-identifier">names</span>.<span 
class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span 
class="ruby-value">1</span> <span class="ruby-operator">?</span> <span 
class="ruby-identifier">ary</span>.<span class="ruby-identifier">first</span> 
<span class="ruby-operator">:</span> <span class="ruby-identifier">ary</span>
+<span class="ruby-keyword">end</span></pre>
+          </div>
+          
+        </div>
+
+        
+
+        
+      </div>
+
+    
+      <div id="method-i-5B-5D-3D" class="method-detail ">
+        
+        
+        <div class="method-heading">
+          <span class="method-callseq">
+            artifact_ns[:name] = &#39;some:cool:jar:1.0.2&#39;
+          </span>
+          
+          <span class="method-click-advice">click to toggle source</span>
+          
+        </div>
+        
+        <div class="method-heading">
+          <span class="method-callseq">
+            artifact_ns[:name] = &#39;1.0.2&#39;
+          </span>
+          
+        </div>
+        
+        
+
+        <div class="method-description">
+          
+          <p>Just like the use method</p>
+          
+          
+
+          
+          <div class="method-source-code" id="5B-5D-3D-source">
+            <pre><span class="ruby-comment"># File 
lib/buildr/packaging/artifact_namespace.rb, line 788</span>
+<span class="ruby-keyword">def</span> <span 
class="ruby-operator">[]=</span>(<span class="ruby-operator">*</span><span 
class="ruby-identifier">names</span>)
+  <span class="ruby-identifier">values</span> = <span 
class="ruby-identifier">names</span>.<span class="ruby-identifier">pop</span>
+  <span class="ruby-identifier">values</span> = [<span 
class="ruby-identifier">values</span>] <span class="ruby-keyword">unless</span> 
<span class="ruby-constant">Array</span> <span class="ruby-operator">===</span> 
<span class="ruby-identifier">values</span>
+  <span class="ruby-identifier">names</span>.<span 
class="ruby-identifier">each_with_index</span> <span 
class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span 
class="ruby-identifier">name</span>, <span 
class="ruby-identifier">i</span><span class="ruby-operator">|</span>
+    <span class="ruby-identifier">use</span> <span 
class="ruby-identifier">name</span> =<span class="ruby-operator">&gt;</span> 
(<span class="ruby-identifier">values</span>[<span 
class="ruby-identifier">i</span>] <span class="ruby-operator">||</span> <span 
class="ruby-identifier">values</span>.<span class="ruby-identifier">last</span>)
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div>
+          
+        </div>
+
+        
+
+        
+      </div>
+
+    
+      <div id="method-i-accessor" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">accessor</span><span
+            class="method-args">(*names)</span>
+          
+          <span class="method-click-advice">click to toggle source</span>
+          
+        </div>
+        
+
+        <div class="method-description">
+          
+          <p>Return an anonymous module</p>
+
+<pre class="ruby"><span class="ruby-comment"># first create a 
requirement</span>
+<span class="ruby-identifier">artifact_ns</span>.<span 
class="ruby-identifier">cool_aid!</span> <span 
class="ruby-string">&#39;cool:aid:jar:&gt;=1.0&#39;</span>
+
+<span class="ruby-comment"># extend an object as a cool_aid delegator</span>
+<span class="ruby-identifier">jars</span> = <span 
class="ruby-constant">Object</span>.<span 
class="ruby-identifier">new</span>.<span 
class="ruby-identifier">extend</span>(<span 
class="ruby-identifier">artifact_ns</span>.<span 
class="ruby-identifier">accessor</span>(:<span 
class="ruby-identifier">cool_aid</span>))
+<span class="ruby-identifier">jars</span>.<span 
class="ruby-identifier">cool_aid</span> = <span 
class="ruby-string">&#39;2.0&#39;</span>
+
+<span class="ruby-identifier">artifact_ns</span>.<span 
class="ruby-identifier">cool_aid</span>.<span 
class="ruby-identifier">version</span> <span class="ruby-comment"># -&gt; 
&#39;2.0&#39;</span>
+</pre>
+          
+          
+
+          
+          <div class="method-source-code" id="accessor-source">
+            <pre><span class="ruby-comment"># File 
lib/buildr/packaging/artifact_namespace.rb, line 951</span>
+<span class="ruby-keyword">def</span> <span 
class="ruby-identifier">accessor</span>(<span 
class="ruby-operator">*</span><span class="ruby-identifier">names</span>)
+  <span class="ruby-identifier">ns</span> = <span 
class="ruby-keyword">self</span>
+  <span class="ruby-constant">Module</span>.<span 
class="ruby-identifier">new</span> <span class="ruby-keyword">do</span>
+    <span class="ruby-identifier">names</span>.<span 
class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span 
class="ruby-operator">|</span><span class="ruby-identifier">name</span><span 
class="ruby-operator">|</span>
+      <span class="ruby-identifier">define_method</span>(<span 
class="ruby-node">&quot;#{name}&quot;</span>) { <span 
class="ruby-identifier">ns</span>.<span 
class="ruby-identifier">send</span>(<span 
class="ruby-node">&quot;#{name}&quot;</span>) }
+      <span class="ruby-identifier">define_method</span>(<span 
class="ruby-node">&quot;#{name}?&quot;</span>) { <span 
class="ruby-identifier">ns</span>.<span 
class="ruby-identifier">send</span>(<span 
class="ruby-node">&quot;#{name}?&quot;</span>) }
+      <span class="ruby-identifier">define_method</span>(<span 
class="ruby-node">&quot;#{name}=&quot;</span>) { <span 
class="ruby-operator">|</span><span class="ruby-identifier">vers</span><span 
class="ruby-operator">|</span> <span class="ruby-identifier">ns</span>.<span 
class="ruby-identifier">send</span>(<span 
class="ruby-node">&quot;#{name}=&quot;</span>, <span 
class="ruby-identifier">vers</span>) }
+    <span class="ruby-keyword">end</span>
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div>
+          
+        </div>
+
+        
+
+        
+      </div>
+
+    
+      <div id="method-i-alias" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">alias</span><span
+            class="method-args">(new_name, old_name)</span>
+          
+          <span class="method-click-advice">click to toggle source</span>
+          
+        </div>
+        
+
+        <div class="method-description">
+          
+          <p>Create an alias for a named requirement.</p>
+          
+          
+
+          
+          <div class="method-source-code" id="alias-source">
+            <pre><span class="ruby-comment"># File 
lib/buildr/packaging/artifact_namespace.rb, line 885</span>
+<span class="ruby-keyword">def</span> <span 
class="ruby-keyword">alias</span>(<span 
class="ruby-identifier">new_name</span>, <span 
class="ruby-identifier">old_name</span>)
+  <span class="ruby-identifier">registry</span>.<span 
class="ruby-identifier">alias</span>(<span 
class="ruby-identifier">new_name</span>, <span 
class="ruby-identifier">old_name</span>) <span class="ruby-keyword">or</span>
+    <span class="ruby-identifier">raise</span> <span 
class="ruby-constant">NameError</span>.<span 
class="ruby-identifier">new</span>(<span class="ruby-node">&quot;Undefined 
artifact name: #{old_name}&quot;</span>)
+<span class="ruby-keyword">end</span></pre>
+          </div>
+          
+        </div>
+
+        
+
+        
+      </div>
+
+    
+      <div id="method-i-artifacts" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">artifacts</span><span
+            class="method-args">(*names)</span>
+          
+          <span class="method-click-advice">click to toggle source</span>
+          
+        </div>
+        
+
+        <div class="method-description">
+          
+          <p>return <a href="Artifact.html">Artifact</a> objects for each 
requirement</p>
+          
+          
+
+          
+          <div class="method-source-code" id="artifacts-source">
+            <pre><span class="ruby-comment"># File 
lib/buildr/packaging/artifact_namespace.rb, line 802</span>
+<span class="ruby-keyword">def</span> <span 
class="ruby-identifier">artifacts</span>(<span 
class="ruby-operator">*</span><span class="ruby-identifier">names</span>)
+  (<span class="ruby-identifier">names</span>.<span 
class="ruby-identifier">empty?</span> <span 
class="ruby-operator">&amp;&amp;</span> <span 
class="ruby-identifier">values</span> <span class="ruby-operator">||</span> 
<span class="ruby-identifier">values_at</span>(<span 
class="ruby-operator">*</span><span 
class="ruby-identifier">names</span>)).<span 
class="ruby-identifier">map</span>(<span 
class="ruby-operator">&amp;</span><span class="ruby-value">:artifact</span>)
+<span class="ruby-keyword">end</span></pre>
+          </div>
+          
+        </div>
+
+        
+
+        
+      </div>
+
+    
+      <div id="method-i-clear" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">clear</span><span
+            class="method-args">()</span>
+          
+          <span class="method-click-advice">click to toggle source</span>
+          
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+          
+
+          
+          <div class="method-source-code" id="clear-source">
+            <pre><span class="ruby-comment"># File 
lib/buildr/packaging/artifact_namespace.rb, line 859</span>
+<span class="ruby-keyword">def</span> <span 
class="ruby-identifier">clear</span>
+  <span class="ruby-identifier">keys</span>.<span 
class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span 
class="ruby-identifier">k</span><span class="ruby-operator">|</span> <span 
class="ruby-identifier">delete</span>(<span class="ruby-identifier">k</span>) }
+<span class="ruby-keyword">end</span></pre>
+          </div>
+          
+        </div>
+
+        
+
+        
+      </div>
+
+    
+      <div id="method-i-delete" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">delete</span><span
+            class="method-args">(name, include_parents = false)</span>
+          
+          <span class="method-click-advice">click to toggle source</span>
+          
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+          
+
+          
+          <div class="method-source-code" id="delete-source">
+            <pre><span class="ruby-comment"># File 
lib/buildr/packaging/artifact_namespace.rb, line 854</span>
+<span class="ruby-keyword">def</span> <span 
class="ruby-identifier">delete</span>(<span 
class="ruby-identifier">name</span>, <span 
class="ruby-identifier">include_parents</span> = <span 
class="ruby-keyword">false</span>)
+  <span class="ruby-identifier">registry</span>.<span 
class="ruby-identifier">delete</span>(<span 
class="ruby-identifier">name</span>, <span 
class="ruby-identifier">include_parents</span>)
+  <span class="ruby-keyword">self</span>
+<span class="ruby-keyword">end</span></pre>
+          </div>
+          
+        </div>
+
+        
+
+        
+      </div>
+
+    
+      <div id="method-i-each" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">each</span><span
+            class="method-args">(&block)</span>
+          
+          <span class="method-click-advice">click to toggle source</span>
+          
+        </div>
+        
+
+        <div class="method-description">
+          
+          <p>yield each <a
+href="ArtifactNamespace/ArtifactRequirement.html">ArtifactRequirement</a></p>
+          
+          
+
+          
+          <div class="method-source-code" id="each-source">
+            <pre><span class="ruby-comment"># File 
lib/buildr/packaging/artifact_namespace.rb, line 797</span>
+<span class="ruby-keyword">def</span> <span 
class="ruby-identifier">each</span>(<span 
class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
+  <span class="ruby-identifier">values</span>.<span 
class="ruby-identifier">each</span>(<span 
class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
+<span class="ruby-keyword">end</span></pre>
+          </div>
+          
+        </div>
+
+        
+
+        
+      </div>
+
+    
+      <div id="method-i-fetch" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">fetch</span><span
+            class="method-args">(name, default = nil, &block)</span>
+          
+          <span class="method-click-advice">click to toggle source</span>
+          
+        </div>
+        
+
+        <div class="method-description">
+          
+          <p>Like Hash#fetch</p>
+          
+          
+
+          
+          <div class="method-source-code" id="fetch-source">
+            <pre><span class="ruby-comment"># File 
lib/buildr/packaging/artifact_namespace.rb, line 769</span>
+<span class="ruby-keyword">def</span> <span 
class="ruby-identifier">fetch</span>(<span class="ruby-identifier">name</span>, 
<span class="ruby-identifier">default</span> = <span 
class="ruby-keyword">nil</span>, <span class="ruby-operator">&amp;</span><span 
class="ruby-identifier">block</span>)
+  <span class="ruby-identifier">block</span> <span 
class="ruby-operator">||=</span> <span class="ruby-identifier">proc</span> { 
<span class="ruby-identifier">raise</span> <span 
class="ruby-constant">IndexError</span>.<span 
class="ruby-identifier">new</span>(<span class="ruby-node">&quot;No artifact 
found by name #{name.inspect} in namespace #{self}&quot;</span>) }
+  <span class="ruby-identifier">real_name</span> = <span 
class="ruby-identifier">name</span>.<span 
class="ruby-identifier">to_s</span>[<span 
class="ruby-regexp">/^[\w\-\.]+$/</span>] <span class="ruby-operator">?</span> 
<span class="ruby-identifier">name</span> <span class="ruby-operator">:</span> 
<span class="ruby-constant">ArtifactRequirement</span>.<span 
class="ruby-identifier">unversioned_spec</span>(<span 
class="ruby-identifier">name</span>)
+  <span class="ruby-identifier">get</span>(<span 
class="ruby-identifier">real_name</span>.<span 
class="ruby-identifier">to_sym</span>) <span class="ruby-operator">||</span> 
<span class="ruby-identifier">default</span> <span 
class="ruby-operator">||</span> <span 
class="ruby-identifier">block</span>.<span 
class="ruby-identifier">call</span>(<span class="ruby-identifier">name</span>)
+<span class="ruby-keyword">end</span></pre>
+          </div>
+          
+        </div>
+
+        
+
+        
+      </div>
+
+    
+      <div id="method-i-group" class="method-detail ">
+        
+        
+        <div class="method-heading">
+          <span class="method-callseq">
+            group :who, :me, :you
+          </span>
+          
+          <span class="method-click-advice">click to toggle source</span>
+          
+        </div>
+        
+        <div class="method-heading">
+          <span class="method-callseq">
+            group :them, :me, :you, :namespace &rarr; ns
+          </span>
+          
+        </div>
+        
+        
+
+        <div class="method-description">
+          
+          <p>Create a virtual group on this namespace. When the namespace is 
asked for
+the <code>who</code> artifact, it&#39;s value is an array made from the
+remaining names. These names are searched by default from the current
+namespace. Second form specified the starting namespace to search from.</p>
+          
+          
+
+          
+          <div class="method-source-code" id="group-source">
+            <pre><span class="ruby-comment"># File 
lib/buildr/packaging/artifact_namespace.rb, line 872</span>
+<span class="ruby-keyword">def</span> <span 
class="ruby-identifier">group</span>(<span 
class="ruby-identifier">group_name</span>, <span 
class="ruby-operator">*</span><span class="ruby-identifier">members</span>)
+  <span class="ruby-identifier">namespace</span> = (<span 
class="ruby-constant">Hash</span> <span class="ruby-operator">===</span> <span 
class="ruby-identifier">members</span>.<span 
class="ruby-identifier">last</span> <span 
class="ruby-operator">&amp;&amp;</span> <span 
class="ruby-identifier">members</span>.<span 
class="ruby-identifier">pop</span>[<span class="ruby-value">:namespace</span>]) 
<span class="ruby-operator">||</span> <span class="ruby-value">:current</span>
+  <span class="ruby-identifier">registry</span>[<span 
class="ruby-identifier">group_name</span>] = <span 
class="ruby-identifier">lambda</span> <span class="ruby-keyword">do</span>
+    <span class="ruby-identifier">artifacts</span> = <span 
class="ruby-keyword">self</span>.<span 
class="ruby-identifier">class</span>[<span 
class="ruby-identifier">namespace</span>].<span 
class="ruby-identifier">values_at</span>(<span 
class="ruby-operator">*</span><span class="ruby-identifier">members</span>)
+    <span class="ruby-identifier">artifacts</span> = <span 
class="ruby-identifier">artifacts</span>.<span 
class="ruby-identifier">first</span> <span class="ruby-keyword">if</span> <span 
class="ruby-identifier">members</span>.<span 
class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span 
class="ruby-value">1</span>
+    <span class="ruby-identifier">artifacts</span>
+  <span class="ruby-keyword">end</span>
+  <span class="ruby-keyword">self</span>
+<span class="ruby-keyword">end</span></pre>
+          </div>
+          
+        </div>
+
+        
+        <div class="aliases">
+          Also aliased as: <a 
href="ArtifactNamespace.html#method-i-virtual">virtual</a>
+        </div>
+        
+
+        
+      </div>
+
+    
+      <div id="method-i-key-3F" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">key?</span><span
+            class="method-args">(name, include_parents = false)</span>
+          
+          <span class="method-click-advice">click to toggle source</span>
+          
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+          
+
+          
+          <div class="method-source-code" id="key-3F-source">
+            <pre><span class="ruby-comment"># File 
lib/buildr/packaging/artifact_namespace.rb, line 845</span>
+<span class="ruby-keyword">def</span> <span 
class="ruby-identifier">key?</span>(<span class="ruby-identifier">name</span>, 
<span class="ruby-identifier">include_parents</span> = <span 
class="ruby-keyword">false</span>)
+  <span class="ruby-identifier">name</span> = <span 
class="ruby-constant">ArtifactRequirement</span>.<span 
class="ruby-identifier">unversioned_spec</span>(<span 
class="ruby-identifier">name</span>) <span class="ruby-keyword">unless</span> 
<span class="ruby-identifier">name</span>.<span 
class="ruby-identifier">to_s</span>[<span 
class="ruby-regexp">/^[\w\-\.]+$/</span>]
+  <span class="ruby-identifier">registry</span>.<span 
class="ruby-identifier">key?</span>(<span class="ruby-identifier">name</span>, 
<span class="ruby-identifier">include_parents</span>)
+<span class="ruby-keyword">end</span></pre>
+          </div>
+          
+        </div>
+
+        
+
+        
+      </div>
+
+    
+      <div id="method-i-keys" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">keys</span><span
+            class="method-args">()</span>
+          
+          <span class="method-click-advice">click to toggle source</span>
+          
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+          
+
+          
+          <div class="method-source-code" id="keys-source">
+            <pre><span class="ruby-comment"># File 
lib/buildr/packaging/artifact_namespace.rb, line 850</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">keys</span>
+  <span class="ruby-identifier">values</span>.<span 
class="ruby-identifier">map</span>(<span 
class="ruby-operator">&amp;</span><span class="ruby-value">:name</span>)
+<span class="ruby-keyword">end</span></pre>
+          </div>
+          
+        </div>
+
+        
+
+        
+      </div>
+
+    
+      <div id="method-i-method_missing" class="method-detail ">
+        
+        
+        <div class="method-heading">
+          <span class="method-callseq">
+            cool_aid!(&#39;cool:aid:jar:2.3.4&#39;, &#39;~&gt;2.3&#39;) &rarr; 
artifact_requirement
+          </span>
+          
+          <span class="method-click-advice">click to toggle source</span>
+          
+        </div>
+        
+        <div class="method-heading">
+          <span class="method-callseq">
+            cool_aid = &#39;2.3.5&#39;
+          </span>
+          
+        </div>
+        
+        <div class="method-heading">
+          <span class="method-callseq">
+            cool_aid  &rarr; artifact_requirement
+          </span>
+          
+        </div>
+        
+        <div class="method-heading">
+          <span class="method-callseq">
+            cool_aid? &rarr; true | false
+          </span>
+          
+        </div>
+        
+        
+
+        <div class="method-description">
+          
+          <p>First form creates an <a
+href="ArtifactNamespace/ArtifactRequirement.html">ArtifactRequirement</a>
+on the namespace. It is equivalent to providing a requirement_spec to the
+<a href="ArtifactNamespace.html#method-i-need">need</a> method:</p>
+
+<pre class="ruby"><span class="ruby-identifier">artifact_ns</span>.<span 
class="ruby-identifier">need</span> <span class="ruby-string">&quot;cool_aid 
-&gt; cool:aid:jar:2.3.4 -&gt; ~&gt;2.3&quot;</span>
+</pre>
+
+<p>the second argument is optional.</p>
+
+<p>Second form can be used to select an artifact version and is equivalent 
to:</p>
+
+<pre class="ruby"><span class="ruby-identifier">artifact_ns</span>.<span 
class="ruby-identifier">use</span> :<span 
class="ruby-identifier">cool_aid</span> =<span 
class="ruby-operator">&gt;</span> <span class="ruby-string">&#39;1.0&#39;</span>
+</pre>
+
+<p>Third form obtains the named <a
+href="ArtifactNamespace/ArtifactRequirement.html">ArtifactRequirement</a>,
+can be used to test if a named requirement has been defined. It is
+equivalent to:</p>
+
+<pre class="ruby"><span class="ruby-identifier">artifact_ns</span>.<span 
class="ruby-identifier">fetch</span>(:<span 
class="ruby-identifier">cool_aid</span>) { <span 
class="ruby-keyword">nil</span> }
+</pre>
+
+<p>Last form tests if the <a
+href="ArtifactNamespace/ArtifactRequirement.html">ArtifactRequirement</a>
+has been defined and a version has been selected for use. It is equivalent
+to:</p>
+
+<pre class="ruby"><span class="ruby-identifier">artifact_ns</span>.<span 
class="ruby-identifier">has_cool_aid?</span>
+<span class="ruby-identifier">artifact_ns</span>.<span 
class="ruby-identifier">values_at</span>(:<span 
class="ruby-identifier">cool_aid</span>).<span 
class="ruby-identifier">flatten</span>.<span 
class="ruby-identifier">all?</span> { <span class="ruby-operator">|</span><span 
class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span 
class="ruby-identifier">a</span> <span class="ruby-operator">&amp;&amp;</span> 
<span class="ruby-identifier">a</span>.<span 
class="ruby-identifier">selected?</span> }
+</pre>
+          
+          
+
+          
+          <div class="method-source-code" id="method_missing-source">
+            <pre><span class="ruby-comment"># File 
lib/buildr/packaging/artifact_namespace.rb, line 921</span>
+<span class="ruby-keyword">def</span> <span 
class="ruby-identifier">method_missing</span>(<span 
class="ruby-identifier">name</span>, <span class="ruby-operator">*</span><span 
class="ruby-identifier">args</span>, <span 
class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
+  <span class="ruby-keyword">case</span> <span 
class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>
+  <span class="ruby-keyword">when</span> <span class="ruby-regexp">/!$/</span> 
<span class="ruby-keyword">then</span>
+    <span class="ruby-identifier">name</span> = <span 
class="ruby-node">$`</span>.<span class="ruby-identifier">intern</span>
+    <span class="ruby-keyword">if</span> <span 
class="ruby-identifier">args</span>.<span class="ruby-identifier">size</span> 
<span class="ruby-operator">&lt;</span> <span class="ruby-value">1</span> <span 
class="ruby-operator">||</span> <span class="ruby-identifier">args</span>.<span 
class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> 
<span class="ruby-value">2</span>
+      <span class="ruby-identifier">raise</span> <span 
class="ruby-constant">ArgumentError</span>.<span 
class="ruby-identifier">new</span>(<span class="ruby-node">&quot;wrong number 
of arguments for #{name}!(spec, version_requirement?)&quot;</span>)
+    <span class="ruby-keyword">end</span>
+    <span class="ruby-identifier">need</span> <span 
class="ruby-identifier">name</span> =<span class="ruby-operator">&gt;</span> 
<span class="ruby-identifier">args</span>.<span 
class="ruby-identifier">first</span>
+    <span class="ruby-identifier">get</span>(<span 
class="ruby-identifier">name</span>).<span class="ruby-identifier">tap</span> { 
<span class="ruby-operator">|</span><span class="ruby-identifier">r</span><span 
class="ruby-operator">|</span> <span class="ruby-identifier">r</span>.<span 
class="ruby-identifier">requirement</span> = <span 
class="ruby-identifier">args</span>.<span class="ruby-identifier">last</span> 
<span class="ruby-keyword">if</span> <span 
class="ruby-identifier">args</span>.<span class="ruby-identifier">size</span> 
<span class="ruby-operator">==</span> <span class="ruby-value">2</span> }
+  <span class="ruby-keyword">when</span> <span class="ruby-regexp">/=$/</span> 
<span class="ruby-keyword">then</span> <span class="ruby-identifier">use</span> 
<span class="ruby-node">$`</span> =<span class="ruby-operator">&gt;</span> 
<span class="ruby-identifier">args</span>.<span 
class="ruby-identifier">first</span>
+  <span class="ruby-keyword">when</span> <span 
class="ruby-regexp">/\?$/</span> <span class="ruby-keyword">then</span>
+    <span class="ruby-identifier">name</span> = <span 
class="ruby-node">$`</span>.<span class="ruby-identifier">gsub</span>(<span 
class="ruby-regexp">/^(has|have)_/</span>, <span 
class="ruby-string">&#39;&#39;</span>).<span 
class="ruby-identifier">intern</span>
+    [<span class="ruby-identifier">get</span>(<span 
class="ruby-identifier">name</span>)].<span 
class="ruby-identifier">flatten</span>.<span 
class="ruby-identifier">all?</span> { <span class="ruby-operator">|</span><span 
class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span 
class="ruby-identifier">a</span> <span class="ruby-operator">&amp;&amp;</span> 
<span class="ruby-identifier">a</span>.<span 
class="ruby-identifier">selected?</span> }
+  <span class="ruby-keyword">else</span>
+    <span class="ruby-keyword">if</span> <span 
class="ruby-identifier">block</span> <span class="ruby-operator">||</span> 
<span class="ruby-identifier">args</span>.<span 
class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> 
<span class="ruby-value">0</span>
+      <span class="ruby-identifier">raise</span> <span 
class="ruby-constant">ArgumentError</span>.<span 
class="ruby-identifier">new</span>(<span class="ruby-node">&quot;wrong number 
of arguments #{args.size} for 0 or block given&quot;</span>)
+    <span class="ruby-keyword">end</span>
+    <span class="ruby-identifier">get</span>(<span 
class="ruby-identifier">name</span>)
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div>
+          
+        </div>
+
+        
+
+        
+      </div>
+
+    
+      <div id="method-i-need" class="method-detail ">
+        
+        
+        <div class="method-heading">
+          <span class="method-callseq">
+            need &#39;name -&gt; org:foo:bar:jar:~&gt;1.2.3 &rarr; 1.2.5&#39;
+          </span>
+          
+          <span class="method-click-advice">click to toggle source</span>
+          
+        </div>
+        
+        <div class="method-heading">
+          <span class="method-callseq">
+            need :name &rarr; &#39;org.foo:bar:jar:1.0&#39;
+          </span>
+          
+        </div>
+        
+        
+
+        <div class="method-description">
+          
+          <p>Create a new <a
+href="ArtifactNamespace/ArtifactRequirement.html">ArtifactRequirement</a>
+on this namespace. <a
+href="ArtifactNamespace.html#method-i-method_missing">#method_missing</a>
+provides syntactic sugar for this.</p>
+          
+          
+
+          
+          <div class="method-source-code" id="need-source">
+            <pre><span class="ruby-comment"># File 
lib/buildr/packaging/artifact_namespace.rb, line 631</span>
+<span class="ruby-keyword">def</span> <span 
class="ruby-identifier">need</span>(<span class="ruby-operator">*</span><span 
class="ruby-identifier">specs</span>)
+  <span class="ruby-identifier">named</span> = <span 
class="ruby-identifier">specs</span>.<span 
class="ruby-identifier">flatten</span>.<span 
class="ruby-identifier">inject</span>({}) <span class="ruby-keyword">do</span> 
<span class="ruby-operator">|</span><span class="ruby-identifier">seen</span>, 
<span class="ruby-identifier">spec</span><span class="ruby-operator">|</span>
+    <span class="ruby-keyword">if</span> <span 
class="ruby-constant">Hash</span> <span class="ruby-operator">===</span> <span 
class="ruby-identifier">spec</span> <span 
class="ruby-operator">&amp;&amp;</span> (<span 
class="ruby-identifier">spec</span>.<span class="ruby-identifier">keys</span> 
<span class="ruby-operator">&amp;</span> <span 
class="ruby-constant">ActsAsArtifact</span><span 
class="ruby-operator">::</span><span 
class="ruby-constant">ARTIFACT_ATTRIBUTES</span>).<span 
class="ruby-identifier">empty?</span>
+      <span class="ruby-identifier">spec</span>.<span 
class="ruby-identifier">each_pair</span> <span class="ruby-keyword">do</span> 
<span class="ruby-operator">|</span><span class="ruby-identifier">name</span>, 
<span class="ruby-identifier">spec</span><span class="ruby-operator">|</span>
+        <span class="ruby-keyword">if</span> <span 
class="ruby-constant">Array</span> <span class="ruby-operator">===</span> <span 
class="ruby-identifier">spec</span> <span class="ruby-comment"># a group</span>
+          <span class="ruby-identifier">seen</span>[<span 
class="ruby-identifier">name</span>] <span class="ruby-operator">||=</span> 
<span class="ruby-identifier">spec</span>.<span 
class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span 
class="ruby-identifier">s</span><span class="ruby-operator">|</span> <span 
class="ruby-constant">ArtifactRequirement</span>.<span 
class="ruby-identifier">new</span>(<span class="ruby-identifier">s</span>) }
+        <span class="ruby-keyword">else</span>
+          <span class="ruby-identifier">artifact</span> = <span 
class="ruby-constant">ArtifactRequirement</span>.<span 
class="ruby-identifier">new</span>(<span class="ruby-identifier">spec</span>)
+          <span class="ruby-identifier">artifact</span>.<span 
class="ruby-identifier">name</span> = <span class="ruby-identifier">name</span>
+          <span class="ruby-identifier">seen</span>[<span 
class="ruby-identifier">artifact</span>.<span 
class="ruby-identifier">name</span>] <span class="ruby-operator">||=</span> 
<span class="ruby-identifier">artifact</span>
+        <span class="ruby-keyword">end</span>
+      <span class="ruby-keyword">end</span>
+    <span class="ruby-keyword">else</span>
+      <span class="ruby-identifier">artifact</span> = <span 
class="ruby-constant">ArtifactRequirement</span>.<span 
class="ruby-identifier">new</span>(<span class="ruby-identifier">spec</span>)
+      <span class="ruby-identifier">seen</span>[<span 
class="ruby-identifier">artifact</span>.<span 
class="ruby-identifier">name</span>] <span class="ruby-operator">||=</span> 
<span class="ruby-identifier">artifact</span>
+    <span class="ruby-keyword">end</span>
+    <span class="ruby-identifier">seen</span>
+  <span class="ruby-keyword">end</span>
+  <span class="ruby-identifier">named</span>.<span 
class="ruby-identifier">each_pair</span> <span class="ruby-keyword">do</span> 
<span class="ruby-operator">|</span><span class="ruby-identifier">name</span>, 
<span class="ruby-identifier">artifact</span><span 
class="ruby-operator">|</span>
+    <span class="ruby-keyword">if</span> <span 
class="ruby-constant">Array</span> <span class="ruby-operator">===</span> <span 
class="ruby-identifier">artifact</span> <span class="ruby-comment"># a 
group</span>
+      <span class="ruby-identifier">artifact</span>.<span 
class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span 
class="ruby-operator">|</span><span class="ruby-identifier">a</span><span 
class="ruby-operator">|</span>
+        <span class="ruby-identifier">unvers</span> = <span 
class="ruby-identifier">a</span>.<span 
class="ruby-identifier">unversioned_spec</span>
+        <span class="ruby-identifier">previous</span> = <span 
class="ruby-identifier">registry</span>[<span 
class="ruby-identifier">unvers</span>]
+        <span class="ruby-keyword">if</span> <span 
class="ruby-identifier">previous</span> <span 
class="ruby-operator">&amp;&amp;</span> <span 
class="ruby-identifier">previous</span>.<span 
class="ruby-identifier">selected?</span> <span 
class="ruby-operator">&amp;&amp;</span> <span 
class="ruby-identifier">a</span>.<span 
class="ruby-identifier">satisfied_by?</span>(<span 
class="ruby-identifier">previous</span>)
+          <span class="ruby-identifier">a</span>.<span 
class="ruby-identifier">version</span> = <span 
class="ruby-identifier">previous</span>.<span 
class="ruby-identifier">version</span>
+        <span class="ruby-keyword">end</span>
+        <span class="ruby-identifier">registry</span>[<span 
class="ruby-identifier">unvers</span>] = <span class="ruby-identifier">a</span>
+      <span class="ruby-keyword">end</span>
+      <span class="ruby-identifier">group</span>(<span 
class="ruby-identifier">name</span>, <span class="ruby-operator">*</span>(<span 
class="ruby-identifier">artifact</span>.<span 
class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span 
class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span 
class="ruby-identifier">a</span>.<span 
class="ruby-identifier">unversioned_spec</span> } <span 
class="ruby-operator">+</span> [{<span class="ruby-value">:namespace</span> 
=<span class="ruby-operator">&gt;</span> <span 
class="ruby-keyword">self</span>}]))
+    <span class="ruby-keyword">else</span>
+      <span class="ruby-identifier">unvers</span> = <span 
class="ruby-identifier">artifact</span>.<span 
class="ruby-identifier">unversioned_spec</span>
+      <span class="ruby-identifier">previous</span> = <span 
class="ruby-identifier">registry</span>.<span 
class="ruby-identifier">get</span>(<span class="ruby-identifier">unvers</span>, 
<span class="ruby-keyword">true</span>)
+      <span class="ruby-keyword">if</span> <span 
class="ruby-identifier">previous</span> <span 
class="ruby-operator">&amp;&amp;</span> <span 
class="ruby-identifier">previous</span>.<span 
class="ruby-identifier">selected?</span> <span 
class="ruby-operator">&amp;&amp;</span> <span 
class="ruby-identifier">artifact</span>.<span 
class="ruby-identifier">satisfied_by?</span>(<span 
class="ruby-identifier">previous</span>)
+        <span class="ruby-identifier">artifact</span>.<span 
class="ruby-identifier">version</span> = <span 
class="ruby-identifier">previous</span>.<span 
class="ruby-identifier">version</span>
+        <span class="ruby-identifier">artifact</span>.<span 
class="ruby-identifier">selected!</span>
+      <span class="ruby-keyword">end</span>
+      <span class="ruby-identifier">registry</span>[<span 
class="ruby-identifier">unvers</span>] = <span 
class="ruby-identifier">artifact</span>
+      <span class="ruby-identifier">registry</span>.<span 
class="ruby-identifier">alias</span> <span class="ruby-identifier">name</span>, 
<span class="ruby-identifier">unvers</span> <span 
class="ruby-keyword">unless</span> <span 
class="ruby-identifier">name</span>.<span 
class="ruby-identifier">to_s</span>[<span class="ruby-regexp">/^\s*$/</span>]
+    <span class="ruby-keyword">end</span>
+  <span class="ruby-keyword">end</span>
+  <span class="ruby-keyword">self</span>
+<span class="ruby-keyword">end</span></pre>
+          </div>
+          
+        </div>
+
+        
+
+        
+      </div>
+
+    
+      <div id="method-i-ns" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">ns</span><span
+            class="method-args">(name, *uses) { |sub| ... }</span>
+          
+          <span class="method-click-advice">click to toggle source</span>
+          
+        </div>
+        
+
+        <div class="method-description">
+          
+          <p>Create a named sub-namespace, sub-namespaces are themselves <a
+href="ArtifactNamespace.html">ArtifactNamespace</a> instances but cannot be
+referenced by the Buildr.artifact_ns, <a
+href="ArtifactNamespace.html#method-c-instance">::instance</a> methods.
+Reference needs to be through this object using the given <code>name</code></p>
+
+<pre class="ruby"><span class="ruby-identifier">artifact_ns</span>(<span 
class="ruby-string">&#39;foo&#39;</span>).<span 
class="ruby-identifier">ns</span>(:<span 
class="ruby-identifier">bar</span>).<span class="ruby-identifier">need</span> 
:<span class="ruby-identifier">thing</span> =<span 
class="ruby-operator">&gt;</span> <span 
class="ruby-string">&#39;some:thing:jar:1.0&#39;</span>
+<span class="ruby-identifier">artifact_ns</span>(<span 
class="ruby-string">&#39;foo&#39;</span>).<span 
class="ruby-identifier">bar</span> <span class="ruby-comment"># =&gt; the 
sub-namespace &#39;foo.bar&#39;</span>
+<span class="ruby-identifier">artifact_ns</span>(<span 
class="ruby-string">&#39;foo&#39;</span>).<span 
class="ruby-identifier">bar</span>.<span class="ruby-identifier">thing</span> 
<span class="ruby-comment"># =&gt; the some thing artifact</span>
+</pre>
+
+<p>See the top level <a href="ArtifactNamespace.html">ArtifactNamespace</a>
+documentation for examples</p>
+          
+          
+
+          
+          <div class="method-source-code" id="ns-source">
+            <pre><span class="ruby-comment"># File 
lib/buildr/packaging/artifact_namespace.rb, line 604</span>
+<span class="ruby-keyword">def</span> <span 
class="ruby-identifier">ns</span>(<span class="ruby-identifier">name</span>, 
<span class="ruby-operator">*</span><span class="ruby-identifier">uses</span>, 
<span class="ruby-operator">&amp;</span><span 
class="ruby-identifier">block</span>)
+  <span class="ruby-identifier">name</span> = <span 
class="ruby-identifier">name</span>.<span class="ruby-identifier">to_sym</span>
+  <span class="ruby-identifier">sub</span> = <span 
class="ruby-identifier">registry</span>[<span 
class="ruby-identifier">name</span>]
+  <span class="ruby-keyword">if</span> <span class="ruby-identifier">sub</span>
+    <span class="ruby-identifier">raise</span> <span 
class="ruby-constant">TypeError</span>.<span 
class="ruby-identifier">new</span>(<span class="ruby-node">&quot;#{name} is not 
a sub namespace of #{self}&quot;</span>) <span 
class="ruby-keyword">unless</span> <span 
class="ruby-identifier">sub</span>.<span 
class="ruby-identifier">kind_of?</span>(<span 
class="ruby-constant">ArtifactNamespace</span>)
+  <span class="ruby-keyword">else</span>
+    <span class="ruby-identifier">sub</span> = <span 
class="ruby-constant">ArtifactNamespace</span>.<span 
class="ruby-identifier">new</span>(<span 
class="ruby-node">&quot;#{self.name}.#{name}&quot;</span>)
+    <span class="ruby-identifier">sub</span>.<span 
class="ruby-identifier">parent</span> = <span class="ruby-keyword">self</span>
+    <span class="ruby-identifier">registry</span>[<span 
class="ruby-identifier">name</span>] = <span class="ruby-identifier">sub</span>
+  <span class="ruby-keyword">end</span>
+  <span class="ruby-identifier">sub</span>.<span 
class="ruby-identifier">use</span>(<span class="ruby-operator">*</span><span 
class="ruby-identifier">uses</span>)
+  <span class="ruby-keyword">yield</span> <span 
class="ruby-identifier">sub</span> <span class="ruby-keyword">if</span> <span 
class="ruby-identifier">block_given?</span>
+  <span class="ruby-identifier">sub</span>
+<span class="ruby-keyword">end</span></pre>
+          </div>
+          
+        </div>
+
+        
+
+        
+      </div>
+
+    
+      <div id="method-i-ns-3F" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">ns?</span><span
+            class="method-args">(name)</span>
+          
+          <span class="method-click-advice">click to toggle source</span>
+          
+        </div>
+        
+
+        <div class="method-description">
+          
+          <p><a href="Test.html">Test</a> if a sub-namespace by the given name 
exists</p>
+          
+          
+
+          
+          <div class="method-source-code" id="ns-3F-source">
+            <pre><span class="ruby-comment"># File 
lib/buildr/packaging/artifact_namespace.rb, line 620</span>
+<span class="ruby-keyword">def</span> <span 
class="ruby-identifier">ns?</span>(<span class="ruby-identifier">name</span>)
+  <span class="ruby-identifier">sub</span> = <span 
class="ruby-identifier">registry</span>[<span 
class="ruby-identifier">name</span>.<span class="ruby-identifier">to_sym</span>]
+  <span class="ruby-constant">ArtifactNamespace</span> <span 
class="ruby-operator">===</span> <span class="ruby-identifier">sub</span>
+<span class="ruby-keyword">end</span></pre>
+          </div>
+          
+        </div>
+
+        
+
+        
+      </div>
+
+    
+      <div id="method-i-parent" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">parent</span><span
+            class="method-args">()</span>
+          
+          <span class="method-click-advice">click to toggle source</span>
+          
+        </div>
+        
+
+        <div class="method-description">
+          
+          <p>ROOT namespace has no parent</p>
+          
+          
+
+          
+          <div class="method-source-code" id="parent-source">
+            <pre><span class="ruby-comment"># File 
lib/buildr/packaging/artifact_namespace.rb, line 567</span>
+<span class="ruby-keyword">def</span> <span 
class="ruby-identifier">parent</span>
+  <span class="ruby-keyword">if</span> <span 
class="ruby-identifier">root?</span>
+    <span class="ruby-keyword">nil</span>
+  <span class="ruby-keyword">elsif</span> <span 
class="ruby-ivar">@parent</span>.<span 
class="ruby-identifier">kind_of?</span>(<span 
class="ruby-constant">ArtifactNamespace</span>)
+    <span class="ruby-ivar">@parent</span>
+  <span class="ruby-keyword">elsif</span> <span 
class="ruby-ivar">@parent</span>
+    <span class="ruby-constant">ArtifactNamespace</span>.<span 
class="ruby-identifier">instance</span>(<span class="ruby-ivar">@parent</span>)
+  <span class="ruby-keyword">elsif</span> <span 
class="ruby-identifier">name</span>
+    <span class="ruby-identifier">parent_name</span> = <span 
class="ruby-identifier">name</span>.<span 
class="ruby-identifier">gsub</span>(<span 
class="ruby-regexp">/::?[^:]+$/</span>, <span 
class="ruby-string">&#39;&#39;</span>)
+    <span class="ruby-identifier">parent_name</span> <span 
class="ruby-operator">==</span> <span class="ruby-identifier">name</span> <span 
class="ruby-operator">?</span> <span class="ruby-identifier">root</span> <span 
class="ruby-operator">:</span> <span 
class="ruby-constant">ArtifactNamespace</span>.<span 
class="ruby-identifier">instance</span>(<span 
class="ruby-identifier">parent_name</span>)
+  <span class="ruby-keyword">else</span>
+    <span class="ruby-identifier">root</span>
+  <span class="ruby-keyword">end</span>
+<span class="ruby-keyword">end</span></pre>
+          </div>
+          
+        </div>
+
+        
+
+        
+      </div>
+
+    
+      <div id="method-i-parent-3D" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">parent=</span><span
+            class="method-args">(other)</span>
+          
+          <span class="method-click-advice">click to toggle source</span>
+          
+        </div>
+        
+
+        <div class="method-description">
+          
+          <p>Set the parent for the current namespace, except if it is ROOT</p>
+          
+          
+
+          
+          <div class="method-source-code" id="parent-3D-source">
+            <pre><span class="ruby-comment"># File 
lib/buildr/packaging/artifact_namespace.rb, line 583</span>
+<span class="ruby-keyword">def</span> <span 
class="ruby-identifier">parent=</span>(<span 
class="ruby-identifier">other</span>)
+  <span class="ruby-identifier">raise</span> <span 
class="ruby-string">&#39;Cannot set parent of root namespace&#39;</span> <span 
class="ruby-keyword">if</span> <span class="ruby-identifier">root?</span>
+  <span class="ruby-ivar">@parent</span> = <span 
class="ruby-identifier">other</span>
+  <span class="ruby-ivar">@registry</span> = <span 
class="ruby-keyword">nil</span>
+<span class="ruby-keyword">end</span></pre>
+          </div>
+          
+        </div>
+
+        
+
+        
+      </div>
+
+    
+      <div id="method-i-root" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">root</span><span
+            class="method-args">() { |ROOT| ... }</span>
+          
+          <span class="method-click-advice">click to toggle source</span>
+          
+        </div>
+        
+
+        <div class="method-description">
+          
+          
+          
+          
+
+          
+          <div class="method-source-code" id="root-source">
+            <pre><span class="ruby-comment"># File 
lib/buildr/packaging/artifact_namespace.rb, line 561</span>
+<span class="ruby-keyword">def</span> <span class="ruby-identifier">root</span>
+  <span class="ruby-keyword">yield</span> <span 
class="ruby-constant">ROOT</span> <span class="ruby-keyword">if</span> <span 
class="ruby-identifier">block_given?</span>
+  <span class="ruby-constant">ROOT</span>
+<span class="ruby-keyword">end</span></pre>
+          </div>
+          
+        </div>
+
+        
+
+        
+      </div>
+
+    
+      <div id="method-i-root-3F" class="method-detail ">
+        
+        <div class="method-heading">
+          <span class="method-name">root?</span><span
+            class="method-args">()</span>
+          
+          <span class="method-click-advice">click to toggle source</span>
+          
+        </div>
+        
+
+        <div class="method-description">
+          
+          <p>Is this the ROOT namespace?</p>
+          
+          
+
+          
+          <div class="method-source-code" id="root-3F-source">
+            <pre><span class="ruby-comment"># File 
lib/buildr/packaging/artifact_namespace.rb, line 590</span>
+<span class="ruby-keyword">def</span> <span 
class="ruby-identifier">root?</span>
+  <span class="ruby-constant">ROOT</span> <span 
class="ruby-operator">==</span> <span class="ruby-keyword">self</span>
+<span class="ruby-keyword">end</span></pre>
+          </div>
+          
+        </div>
+
+        
+
+        
+      </div>
+
+    
+      <div id="method-i-use" class="method-detail ">
+        
+        
+        <div class="method-heading">
+          <span class="method-callseq">
+            use &#39;name &rarr; org:foo:bar:jar:1.2.3&#39;
+          </span>
+          
+          <span class="method-click-advice">click to toggle source</span>
+          
+        </div>
+        
+        <div class="method-heading">
+          <span class="method-callseq">
+            use :name &rarr; &#39;org:foo:bar:jar:1.2.3&#39;
+          </span>
+          
+        </div>
+        
+        <div class="method-heading">
+          <span class="method-callseq">
+            use :name &rarr; &#39;2.5.6&#39;
+          </span>
+          
+        </div>
+        
+        
+
+        <div class="method-description">
+          
+          <p>First and second form are equivalent, the third is used when an <a
+href="ArtifactNamespace/ArtifactRequirement.html">ArtifactRequirement</a>
+has been previously defined with :name, so it just selects the version.</p>
+
+<p><a
+href="ArtifactNamespace.html#method-i-method_missing">#method_missing</a>
+provides syntactic sugar for this.</p>
+          
+          
+
+          
+          <div class="method-source-code" id="use-source">
+            <pre><span class="ruby-comment"># File 
lib/buildr/packaging/artifact_namespace.rb, line 684</span>
+<span class="ruby-keyword">def</span> <span 
class="ruby-identifier">use</span>(<span class="ruby-operator">*</span><span 
class="ruby-identifier">specs</span>)
+  <span class="ruby-identifier">named</span> = <span 
class="ruby-identifier">specs</span>.<span 
class="ruby-identifier">flatten</span>.<span 
class="ruby-identifier">inject</span>({}) <span class="ruby-keyword">do</span> 
<span class="ruby-operator">|</span><span class="ruby-identifier">seen</span>, 
<span class="ruby-identifier">spec</span><span class="ruby-operator">|</span>
+    <span class="ruby-keyword">if</span> <span 
class="ruby-constant">Hash</span> <span class="ruby-operator">===</span> <span 
class="ruby-identifier">spec</span> <span 
class="ruby-operator">&amp;&amp;</span> (<span 
class="ruby-identifier">spec</span>.<span class="ruby-identifier">keys</span> 
<span class="ruby-operator">&amp;</span> <span 
class="ruby-constant">ActsAsArtifact</span><span 
class="ruby-operator">::</span><span 
class="ruby-constant">ARTIFACT_ATTRIBUTES</span>).<span 
class="ruby-identifier">empty?</span>
+      <span class="ruby-identifier">spec</span>.<span 
class="ruby-identifier">each_pair</span> <span class="ruby-keyword">do</span> 
<span class="ruby-operator">|</span><span class="ruby-identifier">name</span>, 
<span class="ruby-identifier">spec</span><span class="ruby-operator">|</span>
+        <span class="ruby-keyword">if</span> <span 
class="ruby-constant">ArtifactNamespace</span> <span 
class="ruby-operator">===</span> <span class="ruby-identifier">spec</span> 
<span class="ruby-comment"># create as subnamespace</span>
+          <span class="ruby-identifier">raise</span> <span 
class="ruby-constant">ArgumentError</span>.<span 
class="ruby-identifier">new</span>(<span class="ruby-string">&quot;Circular 
reference&quot;</span>) <span class="ruby-keyword">if</span> <span 
class="ruby-keyword">self</span> <span class="ruby-operator">==</span> <span 
class="ruby-identifier">spec</span>

[... 223 lines stripped ...]


Reply via email to