instiki/vendor/plugins/bundler/doc/bundler-1.0.0/rdoc/Bundler/SharedHelpers.html

744 lines
35 KiB
HTML
Raw Normal View History

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Module: Bundler::SharedHelpers</title>
<link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
<script src="../js/jquery.js" type="text/javascript"
charset="utf-8"></script>
<script src="../js/thickbox-compressed.js" type="text/javascript"
charset="utf-8"></script>
<script src="../js/quicksearch.js" type="text/javascript"
charset="utf-8"></script>
<script src="../js/darkfish.js" type="text/javascript"
charset="utf-8"></script>
</head>
<body class="module">
<div id="metadata">
<div id="home-metadata">
<div id="home-section" class="section">
<h3 class="section-header">
<a href="../index.html">Home</a>
<a href="../index.html#classes">Classes</a>
<a href="../index.html#methods">Methods</a>
</h3>
</div>
</div>
<div id="file-metadata">
<div id="file-list-section" class="section">
<h3 class="section-header">In Files</h3>
<div class="section-body">
<ul>
<li><a href="../lib/bundler/shared_helpers_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
class="thickbox" title="lib/bundler/shared_helpers.rb">lib/bundler/shared_helpers.rb</a></li>
</ul>
</div>
</div>
</div>
<div id="class-metadata">
<!-- Parent Class -->
<!-- Namespace Contents -->
<div id="namespace-list-section" class="section">
<h3 class="section-header">Namespace</h3>
<ul class="link-list">
<li><span class="type">MODULE</span> <a href="SharedHelpers/Gem.html">Bundler::SharedHelpers::Gem</a></li>
<li><span class="type">MODULE</span> <a href="SharedHelpers/Gem/SourceIndex.html">Bundler::SharedHelpers::Gem::SourceIndex</a></li>
</ul>
</div>
<!-- Method Quickref -->
<div id="method-list-section" class="section">
<h3 class="section-header">Methods</h3>
<ul class="link-list">
<li><a href="#method-i-clean_load_path">#clean_load_path</a></li>
<li><a href="#method-i-cripple_rubygems">#cripple_rubygems</a></li>
<li><a href="#method-i-default_gemfile">#default_gemfile</a></li>
<li><a href="#method-i-default_lockfile">#default_lockfile</a></li>
<li><a href="#method-i-find_gemfile">#find_gemfile</a></li>
<li><a href="#method-i-gem">#gem</a></li>
<li><a href="#method-i-in_bundle%3F">#in_bundle?</a></li>
<li><a href="#method-i-reverse_rubygems_kernel_mixin">#reverse_rubygems_kernel_mixin</a></li>
</ul>
</div>
<!-- Included Modules -->
</div>
<div id="project-metadata">
<div id="fileindex-section" class="section project-section">
<h3 class="section-header">Files</h3>
<ul>
<li class="file"><a href="../lib/bundler/man/bundle.html">bundle</a></li>
<li class="file"><a href="../lib/bundler/man/bundle-config.html">bundle-config</a></li>
<li class="file"><a href="../lib/bundler/man/bundle-config_txt.html">bundle-config.txt</a></li>
<li class="file"><a href="../lib/bundler/man/bundle-exec.html">bundle-exec</a></li>
<li class="file"><a href="../lib/bundler/man/bundle-exec_txt.html">bundle-exec.txt</a></li>
<li class="file"><a href="../lib/bundler/man/bundle-install.html">bundle-install</a></li>
<li class="file"><a href="../lib/bundler/man/bundle-install_txt.html">bundle-install.txt</a></li>
<li class="file"><a href="../lib/bundler/man/bundle-package.html">bundle-package</a></li>
<li class="file"><a href="../lib/bundler/man/bundle-package_txt.html">bundle-package.txt</a></li>
<li class="file"><a href="../lib/bundler/man/bundle-update.html">bundle-update</a></li>
<li class="file"><a href="../lib/bundler/man/bundle-update_txt.html">bundle-update.txt</a></li>
<li class="file"><a href="../lib/bundler/man/bundle_txt.html">bundle.txt</a></li>
<li class="file"><a href="../lib/bundler/man/gemfile_5_txt.html">gemfile.5.txt</a></li>
<li class="file"><a href="../lib/bundler/templates/Gemfile.html">Gemfile</a></li>
</ul>
</div>
<div id="classindex-section" class="section project-section">
<h3 class="section-header">Class Index
<span class="search-toggle"><img src="../images/find.png"
height="16" width="16" alt="[+]"
title="show/hide quicksearch" /></span></h3>
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
<fieldset>
<legend>Quicksearch</legend>
<input type="text" name="quicksearch" value=""
class="quicksearch-field" />
</fieldset>
</form>
<ul class="link-list">
<li><a href="../Bundler.html">Bundler</a></li>
<li><a href="../Bundler/BundlerError.html">Bundler::BundlerError</a></li>
<li><a href="../Bundler/CLI.html">Bundler::CLI</a></li>
<li><a href="../Bundler/Definition.html">Bundler::Definition</a></li>
<li><a href="../Bundler/DepProxy.html">Bundler::DepProxy</a></li>
<li><a href="../Bundler/Dependency.html">Bundler::Dependency</a></li>
<li><a href="../Bundler/DeprecatedError.html">Bundler::DeprecatedError</a></li>
<li><a href="../Bundler/Dsl.html">Bundler::Dsl</a></li>
<li><a href="../Bundler/DslError.html">Bundler::DslError</a></li>
<li><a href="../Bundler/Environment.html">Bundler::Environment</a></li>
<li><a href="../Bundler/GemHelper.html">Bundler::GemHelper</a></li>
<li><a href="../Bundler/GemHelpers.html">Bundler::GemHelpers</a></li>
<li><a href="../Bundler/GemNotFound.html">Bundler::GemNotFound</a></li>
<li><a href="../Bundler/GemfileError.html">Bundler::GemfileError</a></li>
<li><a href="../Bundler/GemfileNotFound.html">Bundler::GemfileNotFound</a></li>
<li><a href="../Bundler/GemspecError.html">Bundler::GemspecError</a></li>
<li><a href="../Bundler/GitError.html">Bundler::GitError</a></li>
<li><a href="../Bundler/Graph.html">Bundler::Graph</a></li>
<li><a href="../Bundler/GraphNode.html">Bundler::GraphNode</a></li>
<li><a href="../Bundler/Index.html">Bundler::Index</a></li>
<li><a href="../Bundler/Installer.html">Bundler::Installer</a></li>
<li><a href="../Bundler/InvalidOption.html">Bundler::InvalidOption</a></li>
<li><a href="../Bundler/InvalidSpecSet.html">Bundler::InvalidSpecSet</a></li>
<li><a href="../Bundler/LazySpecification.html">Bundler::LazySpecification</a></li>
<li><a href="../Bundler/LockfileParser.html">Bundler::LockfileParser</a></li>
<li><a href="../Bundler/MatchPlatform.html">Bundler::MatchPlatform</a></li>
<li><a href="../Bundler/PathError.html">Bundler::PathError</a></li>
<li><a href="../Bundler/ProductionError.html">Bundler::ProductionError</a></li>
<li><a href="../Bundler/RemoteSpecification.html">Bundler::RemoteSpecification</a></li>
<li><a href="../Bundler/Resolver.html">Bundler::Resolver</a></li>
<li><a href="../Bundler/Resolver/SpecGroup.html">Bundler::Resolver::SpecGroup</a></li>
<li><a href="../Bundler/Runtime.html">Bundler::Runtime</a></li>
<li><a href="../Bundler/Settings.html">Bundler::Settings</a></li>
<li><a href="../Bundler/SharedHelpers.html">Bundler::SharedHelpers</a></li>
<li><a href="../Bundler/SharedHelpers/Gem.html">Bundler::SharedHelpers::Gem</a></li>
<li><a href="../Bundler/SharedHelpers/Gem/SourceIndex.html">Bundler::SharedHelpers::Gem::SourceIndex</a></li>
<li><a href="../Bundler/Source.html">Bundler::Source</a></li>
<li><a href="../Bundler/Source/Git.html">Bundler::Source::Git</a></li>
<li><a href="../Bundler/Source/Path.html">Bundler::Source::Path</a></li>
<li><a href="../Bundler/Source/Path/Installer.html">Bundler::Source::Path::Installer</a></li>
<li><a href="../Bundler/Source/Rubygems.html">Bundler::Source::Rubygems</a></li>
<li><a href="../Bundler/SpecSet.html">Bundler::SpecSet</a></li>
<li><a href="../Bundler/UI.html">Bundler::UI</a></li>
<li><a href="../Bundler/UI/RGProxy.html">Bundler::UI::RGProxy</a></li>
<li><a href="../Bundler/UI/Shell.html">Bundler::UI::Shell</a></li>
<li><a href="../Bundler/VersionConflict.html">Bundler::VersionConflict</a></li>
<li><a href="../Thor.html">Thor</a></li>
<li><a href="../Thor/Actions.html">Thor::Actions</a></li>
<li><a href="../Thor/Actions/ClassMethods.html">Thor::Actions::ClassMethods</a></li>
<li><a href="../Thor/Base.html">Thor::Base</a></li>
<li><a href="../Thor/Base/ClassMethods.html">Thor::Base::ClassMethods</a></li>
<li><a href="../Thor/DynamicTask.html">Thor::DynamicTask</a></li>
<li><a href="../Thor/Error.html">Thor::Error</a></li>
<li><a href="../Thor/HiddenTask.html">Thor::HiddenTask</a></li>
<li><a href="../Thor/Invocation.html">Thor::Invocation</a></li>
<li><a href="../Thor/Invocation/ClassMethods.html">Thor::Invocation::ClassMethods</a></li>
<li><a href="../Thor/InvocationError.html">Thor::InvocationError</a></li>
<li><a href="../Thor/MalformattedArgumentError.html">Thor::MalformattedArgumentError</a></li>
<li><a href="../Thor/RequiredArgumentMissingError.html">Thor::RequiredArgumentMissingError</a></li>
<li><a href="../Thor/Shell.html">Thor::Shell</a></li>
<li><a href="../Thor/Shell/Basic.html">Thor::Shell::Basic</a></li>
<li><a href="../Thor/Shell/Color.html">Thor::Shell::Color</a></li>
<li><a href="../Thor/Shell/HTML.html">Thor::Shell::HTML</a></li>
<li><a href="../Thor/Task.html">Thor::Task</a></li>
<li><a href="../Thor/UndefinedTaskError.html">Thor::UndefinedTaskError</a></li>
<li><a href="../Thor/UnknownArgumentError.html">Thor::UnknownArgumentError</a></li>
<li><a href="../Thor/Util.html">Thor::Util</a></li>
<li><a href="../Gem.html">Gem</a></li>
<li><a href="../Gem/Dependency.html">Gem::Dependency</a></li>
<li><a href="../Gem/Platform.html">Gem::Platform</a></li>
<li><a href="../Gem/Specification.html">Gem::Specification</a></li>
</ul>
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
</div>
</div>
</div>
<div id="documentation">
<h1 class="module">Bundler::SharedHelpers</h1>
<div id="description">
</div>
<!-- Constants -->
<!-- Attributes -->
<div id="attribute-method-details" class="method-section section">
<h3 class="section-header">Attributes</h3>
<div id="gem-loaded-attribute-method" class="method-detail">
<a name="gem_loaded"></a>
<a name="gem_loaded="></a>
<div class="method-heading attribute-method-heading">
<span class="method-name">gem_loaded</span><span
class="attribute-access-type">[RW]</span>
</div>
<div class="method-description">
</div>
</div>
</div>
<!-- Methods -->
<div id="public-instance-method-details" class="method-section section">
<h3 class="section-header">Public Instance Methods</h3>
<div id="default-gemfile-method" class="method-detail ">
<a name="method-i-default_gemfile"></a>
<div class="method-heading">
<span class="method-name">default_gemfile</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="default-gemfile-source">
<pre>
<span class="ruby-comment cmt"># File lib/bundler/shared_helpers.rb, line 19</span>
19: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">default_gemfile</span>
20: <span class="ruby-identifier">gemfile</span> = <span class="ruby-identifier">find_gemfile</span>
21: <span class="ruby-identifier">gemfile</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">raise</span> <span class="ruby-constant">GemfileNotFound</span>, <span class="ruby-value str">&quot;Could not locate Gemfile&quot;</span>
22: <span class="ruby-constant">Pathname</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">gemfile</span>)
23: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div id="default-lockfile-method" class="method-detail ">
<a name="method-i-default_lockfile"></a>
<div class="method-heading">
<span class="method-name">default_lockfile</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="default-lockfile-source">
<pre>
<span class="ruby-comment cmt"># File lib/bundler/shared_helpers.rb, line 25</span>
25: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">default_lockfile</span>
26: <span class="ruby-constant">Pathname</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;#{default_gemfile}.lock&quot;</span>)
27: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div id="in-bundle--method" class="method-detail ">
<a name="method-i-in_bundle%3F"></a>
<div class="method-heading">
<span class="method-name">in_bundle?</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="in-bundle--source">
<pre>
<span class="ruby-comment cmt"># File lib/bundler/shared_helpers.rb, line 29</span>
29: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">in_bundle?</span>
30: <span class="ruby-identifier">find_gemfile</span>
31: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
</div>
<div id="private-instance-method-details" class="method-section section">
<h3 class="section-header">Private Instance Methods</h3>
<div id="clean-load-path-method" class="method-detail ">
<a name="method-i-clean_load_path"></a>
<div class="method-heading">
<span class="method-name">clean_load_path</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="clean-load-path-source">
<pre>
<span class="ruby-comment cmt"># File lib/bundler/shared_helpers.rb, line 48</span>
48: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">clean_load_path</span>
49: <span class="ruby-comment cmt"># handle 1.9 where system gems are always on the load path</span>
50: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">defined?</span>(<span class="ruby-operator">::</span><span class="ruby-constant">Gem</span>)
51: <span class="ruby-identifier">me</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-value str">&quot;../../&quot;</span>, <span class="ruby-keyword kw">__FILE__</span>)
52: <span class="ruby-identifier">$LOAD_PATH</span>.<span class="ruby-identifier">reject!</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span>
53: <span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">p</span>).<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">me</span>)
54: <span class="ruby-identifier">p</span> <span class="ruby-operator">!=</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-keyword kw">__FILE__</span>) <span class="ruby-operator">&amp;&amp;</span>
55: <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">path</span>.<span class="ruby-identifier">any?</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">gp</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">gp</span>) }
56: <span class="ruby-keyword kw">end</span>
57: <span class="ruby-identifier">$LOAD_PATH</span>.<span class="ruby-identifier">uniq!</span>
58: <span class="ruby-keyword kw">end</span>
59: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div id="cripple-rubygems-method" class="method-detail ">
<a name="method-i-cripple_rubygems"></a>
<div class="method-heading">
<span class="method-name">cripple_rubygems</span><span
class="method-args">(specs)</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<div class="method-source-code"
id="cripple-rubygems-source">
<pre>
<span class="ruby-comment cmt"># File lib/bundler/shared_helpers.rb, line 73</span>
73: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cripple_rubygems</span>(<span class="ruby-identifier">specs</span>)
74: <span class="ruby-identifier">reverse_rubygems_kernel_mixin</span>
75:
76: <span class="ruby-identifier">executables</span> = <span class="ruby-identifier">specs</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-identifier">s</span>.<span class="ruby-identifier">executables</span> }.<span class="ruby-identifier">flatten</span>
77: <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">source_index</span> <span class="ruby-comment cmt"># ensure RubyGems is fully loaded</span>
78:
79: <span class="ruby-operator">::</span><span class="ruby-constant">Kernel</span>.<span class="ruby-identifier">class_eval</span> <span class="ruby-keyword kw">do</span>
80: <span class="ruby-identifier">private</span>
81: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">gem</span>(*) ; <span class="ruby-keyword kw">end</span>
82: <span class="ruby-keyword kw">end</span>
83:
84: <span class="ruby-operator">::</span><span class="ruby-constant">Kernel</span>.<span class="ruby-identifier">send</span>(<span class="ruby-value">:define_method</span>, <span class="ruby-value">:gem</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">dep</span>, *<span class="ruby-identifier">reqs</span><span class="ruby-operator">|</span>
85: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">executables</span>.<span class="ruby-identifier">include?</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-identifier">caller</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">':'</span>).<span class="ruby-identifier">first</span>)
86: <span class="ruby-keyword kw">return</span>
87: <span class="ruby-keyword kw">end</span>
88: <span class="ruby-identifier">opts</span> = <span class="ruby-identifier">reqs</span>.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">reqs</span>.<span class="ruby-identifier">pop</span> <span class="ruby-operator">:</span> {}
89:
90: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">dep</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:name</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">dep</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:requirement</span>)
91: <span class="ruby-identifier">dep</span> = <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Dependency</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">dep</span>, <span class="ruby-identifier">reqs</span>)
92: <span class="ruby-keyword kw">end</span>
93:
94: <span class="ruby-identifier">spec</span> = <span class="ruby-identifier">specs</span>.<span class="ruby-identifier">find</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span> <span class="ruby-identifier">s</span>.<span class="ruby-identifier">name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">dep</span>.<span class="ruby-identifier">name</span> }
95:
96: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">nil?</span>
97: <span class="ruby-identifier">e</span> = <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">LoadError</span>.<span class="ruby-identifier">new</span> <span class="ruby-node">&quot;#{dep.name} is not part of the bundle. Add it to Gemfile.&quot;</span>
98: <span class="ruby-identifier">e</span>.<span class="ruby-identifier">name</span> = <span class="ruby-identifier">dep</span>.<span class="ruby-identifier">name</span>
99: <span class="ruby-identifier">e</span>.<span class="ruby-identifier">version_requirement</span> = <span class="ruby-identifier">dep</span>.<span class="ruby-identifier">requirement</span>
100: <span class="ruby-identifier">raise</span> <span class="ruby-identifier">e</span>
101: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">dep</span> <span class="ruby-operator">!~</span> <span class="ruby-identifier">spec</span>
102: <span class="ruby-identifier">e</span> = <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">LoadError</span>.<span class="ruby-identifier">new</span> <span class="ruby-node">&quot;can't activate #{dep}, already activated #{spec.full_name}. &quot;</span> <span class="ruby-value str">&quot;Make sure all dependencies are added to Gemfile.&quot;</span>
103: <span class="ruby-identifier">e</span>.<span class="ruby-identifier">name</span> = <span class="ruby-identifier">dep</span>.<span class="ruby-identifier">name</span>
104: <span class="ruby-identifier">e</span>.<span class="ruby-identifier">version_requirement</span> = <span class="ruby-identifier">dep</span>.<span class="ruby-identifier">requirement</span>
105: <span class="ruby-identifier">raise</span> <span class="ruby-identifier">e</span>
106: <span class="ruby-keyword kw">end</span>
107:
108: <span class="ruby-keyword kw">true</span>
109: <span class="ruby-keyword kw">end</span>
110:
111: <span class="ruby-comment cmt"># === Following hacks are to improve on the generated bin wrappers ===</span>
112:
113: <span class="ruby-comment cmt"># Yeah, talk about a hack</span>
114: <span class="ruby-identifier">source_index_class</span> = (<span class="ruby-keyword kw">class</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">SourceIndex</span> ; <span class="ruby-keyword kw">self</span> ; <span class="ruby-keyword kw">end</span>)
115: <span class="ruby-identifier">source_index_class</span>.<span class="ruby-identifier">send</span>(<span class="ruby-value">:define_method</span>, <span class="ruby-value">:from_gems_in</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span>*<span class="ruby-identifier">args</span><span class="ruby-operator">|</span>
116: <span class="ruby-identifier">source_index</span> = <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">SourceIndex</span>.<span class="ruby-identifier">new</span>
117: <span class="ruby-identifier">source_index</span>.<span class="ruby-identifier">spec_dirs</span> = *<span class="ruby-identifier">args</span>
118: <span class="ruby-identifier">source_index</span>.<span class="ruby-identifier">add_specs</span>(*<span class="ruby-identifier">specs</span>)
119: <span class="ruby-identifier">source_index</span>
120: <span class="ruby-keyword kw">end</span>
121:
122: <span class="ruby-comment cmt"># OMG more hacks</span>
123: <span class="ruby-identifier">gem_class</span> = (<span class="ruby-keyword kw">class</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">Gem</span> ; <span class="ruby-keyword kw">self</span> ; <span class="ruby-keyword kw">end</span>)
124: <span class="ruby-identifier">gem_class</span>.<span class="ruby-identifier">send</span>(<span class="ruby-value">:define_method</span>, <span class="ruby-value">:refresh</span>) { }
125: <span class="ruby-identifier">gem_class</span>.<span class="ruby-identifier">send</span>(<span class="ruby-value">:define_method</span>, <span class="ruby-value">:bin_path</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span>, *<span class="ruby-identifier">args</span><span class="ruby-operator">|</span>
126: <span class="ruby-identifier">exec_name</span>, *<span class="ruby-identifier">reqs</span> = <span class="ruby-identifier">args</span>
127:
128: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">exec_name</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'bundle'</span>
129: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'BUNDLE_BIN_PATH'</span>]
130: <span class="ruby-keyword kw">end</span>
131:
132: <span class="ruby-identifier">spec</span> = <span class="ruby-keyword kw">nil</span>
133:
134: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">exec_name</span>
135: <span class="ruby-identifier">spec</span> = <span class="ruby-identifier">specs</span>.<span class="ruby-identifier">find</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span> <span class="ruby-identifier">s</span>.<span class="ruby-identifier">executables</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">exec_name</span>) }
136: <span class="ruby-identifier">spec</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">raise</span> <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Exception</span>, <span class="ruby-node">&quot;can't find executable #{exec_name}&quot;</span>
137: <span class="ruby-keyword kw">else</span>
138: <span class="ruby-identifier">spec</span> = <span class="ruby-identifier">specs</span>.<span class="ruby-identifier">find</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span> <span class="ruby-identifier">s</span>.<span class="ruby-identifier">name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">name</span> }
139: <span class="ruby-identifier">exec_name</span> = <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">default_executable</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">raise</span> <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Exception</span>, <span class="ruby-node">&quot;no default executable for #{spec.full_name}&quot;</span>
140: <span class="ruby-keyword kw">end</span>
141:
142: <span class="ruby-identifier">gem_bin</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">spec</span>.<span class="ruby-identifier">full_gem_path</span>, <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">bindir</span>, <span class="ruby-identifier">exec_name</span>)
143: <span class="ruby-identifier">gem_from_path_bin</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-identifier">spec</span>.<span class="ruby-identifier">loaded_from</span>), <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">bindir</span>, <span class="ruby-identifier">exec_name</span>)
144: <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">gem_bin</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">gem_bin</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">gem_from_path_bin</span>
145: <span class="ruby-keyword kw">end</span>
146:
147: <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">clear_paths</span>
148: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div id="find-gemfile-method" class="method-detail ">
<a name="method-i-find_gemfile"></a>
<div class="method-heading">
<span class="method-name">find_gemfile</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="find-gemfile-source">
<pre>
<span class="ruby-comment cmt"># File lib/bundler/shared_helpers.rb, line 35</span>
35: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">find_gemfile</span>
36: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'BUNDLE_GEMFILE'</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'BUNDLE_GEMFILE'</span>]
37:
38: <span class="ruby-identifier">previous</span> = <span class="ruby-keyword kw">nil</span>
39: <span class="ruby-identifier">current</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-constant">Dir</span>.<span class="ruby-identifier">pwd</span>)
40:
41: <span class="ruby-keyword kw">until</span> <span class="ruby-operator">!</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-identifier">current</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">current</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">previous</span>
42: <span class="ruby-identifier">filename</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">current</span>, <span class="ruby-value str">'Gemfile'</span>)
43: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">filename</span> <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">file?</span>(<span class="ruby-identifier">filename</span>)
44: <span class="ruby-identifier">current</span>, <span class="ruby-identifier">previous</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-value str">&quot;..&quot;</span>, <span class="ruby-identifier">current</span>), <span class="ruby-identifier">current</span>
45: <span class="ruby-keyword kw">end</span>
46: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div id="gem-method" class="method-detail ">
<a name="method-i-gem"></a>
<div class="method-heading">
<span class="method-name">gem</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="gem-source">
<pre>
<span class="ruby-comment cmt"># File lib/bundler/shared_helpers.rb, line 81</span>
81: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">gem</span>(*) ; <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
<div id="reverse-rubygems-kernel-mixin-method" class="method-detail ">
<a name="method-i-reverse_rubygems_kernel_mixin"></a>
<div class="method-heading">
<span class="method-name">reverse_rubygems_kernel_mixin</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="reverse-rubygems-kernel-mixin-source">
<pre>
<span class="ruby-comment cmt"># File lib/bundler/shared_helpers.rb, line 61</span>
61: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reverse_rubygems_kernel_mixin</span>
62: <span class="ruby-comment cmt"># Disable rubygems' gem activation system</span>
63: <span class="ruby-operator">::</span><span class="ruby-constant">Kernel</span>.<span class="ruby-identifier">class_eval</span> <span class="ruby-keyword kw">do</span>
64: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">private_method_defined?</span>(<span class="ruby-value">:gem_original_require</span>)
65: <span class="ruby-keyword kw">alias</span> <span class="ruby-identifier">rubygems_require</span> <span class="ruby-identifier">require</span>
66: <span class="ruby-keyword kw">alias</span> <span class="ruby-identifier">require</span> <span class="ruby-identifier">gem_original_require</span>
67: <span class="ruby-keyword kw">end</span>
68:
69: <span class="ruby-keyword kw">undef</span> <span class="ruby-identifier">gem</span>
70: <span class="ruby-keyword kw">end</span>
71: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
</div>
</div>
<div id="rdoc-debugging-section-dump" class="debugging-section">
<p>Disabled; run with --debug to generate this.</p>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
Rdoc Generator</a> 1.1.6</small>.</p>
</div>
</body>
</html>