HEX
Server: Apache
System: Windows NT MAGNETO-ARM 10.0 build 22000 (Windows 10) AMD64
User: Michel (0)
PHP: 7.4.7
Disabled: NONE
Upload Files
File: C:/Ruby27-x64/share/doc/ruby/html/Bundler/RubyGemsGemInstaller.html
<!DOCTYPE html>

<html>
<head>
<meta charset="UTF-8">

<title>class Bundler::RubyGemsGemInstaller - RDoc Documentation</title>

<script type="text/javascript">
  var rdoc_rel_prefix = "../";
  var index_rel_prefix = "../";
</script>

<script src="../js/navigation.js" defer></script>
<script src="../js/search.js" defer></script>
<script src="../js/search_index.js" defer></script>
<script src="../js/searcher.js" defer></script>
<script src="../js/darkfish.js" defer></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 id="class-metadata">
    
    <div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  
  <p class="link"><a href="../Gem/Installer.html">Gem::Installer</a>
  
</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-at">::at</a>
    
    <li ><a href="#method-i-base64digest-21">#base64digest!</a>
    
    <li class="calls-super" ><a href="#method-i-build_extensions">#build_extensions</a>
    
    <li ><a href="#method-i-check_executable_overwrite">#check_executable_overwrite</a>
    
    <li ><a href="#method-i-checksum_type">#checksum_type</a>
    
    <li ><a href="#method-i-hexdigest-21">#hexdigest!</a>
    
    <li class="calls-super" ><a href="#method-i-pre_install_checks">#pre_install_checks</a>
    
    <li ><a href="#method-i-validate_bundler_checksum">#validate_bundler_checksum</a>
    
  </ul>
</div>

  </div>
</nav>

<main role="main" aria-labelledby="class-Bundler::RubyGemsGemInstaller">
  <h1 id="class-Bundler::RubyGemsGemInstaller" class="class">
    class Bundler::RubyGemsGemInstaller
  </h1>

  <section class="description">
    
  </section>

  
  <section id="5Buntitled-5D" class="documentation-section">
    

    

    

    

    
     <section id="public-class-5Buntitled-5D-method-details" class="method-section">
       <header>
         <h3>Public Class Methods</h3>
       </header>

    
      <div id="method-c-at" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">at</span><span
            class="method-args">(*args)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          
          
          

          
          <div class="method-source-code" id="at-source">
            <pre><span class="ruby-comment"># File lib/bundler/rubygems_gem_installer.rb, line 8</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">at</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
  <span class="ruby-identifier">new</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</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-build_extensions" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">build_extensions</span><span
            class="method-args">()</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          
          
          
            <div class="method-calls-super">
              Calls superclass method
              <a href="../Gem/Installer.html#method-i-build_extensions"><code>Gem::Installer#build_extensions</code></a>
            </div>
          

          
          <div class="method-source-code" id="build_extensions-source">
            <pre><span class="ruby-comment"># File lib/bundler/rubygems_gem_installer.rb, line 21</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">build_extensions</span>
  <span class="ruby-identifier">extension_cache_path</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:bundler_extension_cache_path</span>]
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">super</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">extension_cache_path</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">extension_dir</span> = <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">rubygems</span>.<span class="ruby-identifier">spec_extension_dir</span>(<span class="ruby-identifier">spec</span>)

  <span class="ruby-identifier">extension_dir</span> = <span class="ruby-constant">Pathname</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">extension_dir</span>)
  <span class="ruby-identifier">build_complete</span> = <span class="ruby-constant">SharedHelpers</span>.<span class="ruby-identifier">filesystem_access</span>(<span class="ruby-identifier">extension_cache_path</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot;gem.build_complete&quot;</span>), <span class="ruby-value">:read</span>, <span class="ruby-operator">&amp;</span><span class="ruby-value">:file?</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">build_complete</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-identifier">options</span>[<span class="ruby-value">:force</span>]
    <span class="ruby-constant">SharedHelpers</span>.<span class="ruby-identifier">filesystem_access</span>(<span class="ruby-identifier">extension_dir</span>.<span class="ruby-identifier">parent</span>, <span class="ruby-operator">&amp;</span><span class="ruby-value">:mkpath</span>)
    <span class="ruby-constant">SharedHelpers</span>.<span class="ruby-identifier">filesystem_access</span>(<span class="ruby-identifier">extension_cache_path</span>) <span class="ruby-keyword">do</span>
      <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">cp_r</span> <span class="ruby-identifier">extension_cache_path</span>, <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">extension_dir</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-keyword">super</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">extension_dir</span>.<span class="ruby-identifier">directory?</span> <span class="ruby-comment"># not made for gems without extensions</span>
      <span class="ruby-constant">SharedHelpers</span>.<span class="ruby-identifier">filesystem_access</span>(<span class="ruby-identifier">extension_cache_path</span>.<span class="ruby-identifier">parent</span>, <span class="ruby-operator">&amp;</span><span class="ruby-value">:mkpath</span>)
      <span class="ruby-constant">SharedHelpers</span>.<span class="ruby-identifier">filesystem_access</span>(<span class="ruby-identifier">extension_cache_path</span>) <span class="ruby-keyword">do</span>
        <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">cp_r</span> <span class="ruby-identifier">extension_dir</span>, <span class="ruby-identifier">extension_cache_path</span>
      <span class="ruby-keyword">end</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-check_executable_overwrite" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">check_executable_overwrite</span><span
            class="method-args">(filename)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          
          
          

          
          <div class="method-source-code" id="check_executable_overwrite-source">
            <pre><span class="ruby-comment"># File lib/bundler/rubygems_gem_installer.rb, line 13</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">check_executable_overwrite</span>(<span class="ruby-identifier">filename</span>)
  <span class="ruby-comment"># Bundler needs to install gems regardless of binstub overwriting</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-pre_install_checks" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">pre_install_checks</span><span
            class="method-args">()</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          
          
          
            <div class="method-calls-super">
              Calls superclass method
              <a href="../Gem/Installer.html#method-i-pre_install_checks"><code>Gem::Installer#pre_install_checks</code></a>
            </div>
          

          
          <div class="method-source-code" id="pre_install_checks-source">
            <pre><span class="ruby-comment"># File lib/bundler/rubygems_gem_installer.rb, line 17</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">pre_install_checks</span>
  <span class="ruby-keyword">super</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">validate_bundler_checksum</span>(<span class="ruby-identifier">options</span>[<span class="ruby-value">:bundler_expected_checksum</span>])
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
    </section>
  
     <section id="private-instance-5Buntitled-5D-method-details" class="method-section">
       <header>
         <h3>Private Instance Methods</h3>
       </header>

    
      <div id="method-i-base64digest-21" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">base64digest!</span><span
            class="method-args">(digest)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          
          
          

          
          <div class="method-source-code" id="base64digest-21-source">
            <pre><span class="ruby-comment"># File lib/bundler/rubygems_gem_installer.rb, line 91</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">base64digest!</span>(<span class="ruby-identifier">digest</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">digest</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:base64digest!</span>)
    <span class="ruby-identifier">digest</span>.<span class="ruby-identifier">base64digest!</span>
  <span class="ruby-keyword">else</span>
    [<span class="ruby-identifier">digest</span>.<span class="ruby-identifier">digest!</span>].<span class="ruby-identifier">pack</span>(<span class="ruby-string">&quot;m0&quot;</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-checksum_type" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">checksum_type</span><span
            class="method-args">(checksum)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          
          
          

          
          <div class="method-source-code" id="checksum_type-source">
            <pre><span class="ruby-comment"># File lib/bundler/rubygems_gem_installer.rb, line 79</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">checksum_type</span>(<span class="ruby-identifier">checksum</span>)
  <span class="ruby-keyword">case</span> <span class="ruby-identifier">checksum</span>.<span class="ruby-identifier">length</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">64</span> <span class="ruby-keyword">then</span> <span class="ruby-value">:hexdigest!</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">44</span> <span class="ruby-keyword">then</span> <span class="ruby-value">:base64digest!</span>
  <span class="ruby-keyword">else</span> <span class="ruby-identifier">raise</span> <span class="ruby-constant">InstallError</span>, <span class="ruby-node">&quot;The given checksum for #{spec.full_name} (#{checksum.inspect}) is not a valid SHA256 hexdigest nor base64digest&quot;</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-hexdigest-21" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">hexdigest!</span><span
            class="method-args">(digest)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          
          
          

          
          <div class="method-source-code" id="hexdigest-21-source">
            <pre><span class="ruby-comment"># File lib/bundler/rubygems_gem_installer.rb, line 87</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">hexdigest!</span>(<span class="ruby-identifier">digest</span>)
  <span class="ruby-identifier">digest</span>.<span class="ruby-identifier">hexdigest!</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-validate_bundler_checksum" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">validate_bundler_checksum</span><span
            class="method-args">(checksum)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          
          
          

          
          <div class="method-source-code" id="validate_bundler_checksum-source">
            <pre><span class="ruby-comment"># File lib/bundler/rubygems_gem_installer.rb, line 45</span>
    <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">validate_bundler_checksum</span>(<span class="ruby-identifier">checksum</span>)
      <span class="ruby-keyword">return</span> <span class="ruby-keyword">true</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">Bundler</span>.<span class="ruby-identifier">settings</span>[<span class="ruby-value">:disable_checksum_validation</span>]
      <span class="ruby-keyword">return</span> <span class="ruby-keyword">true</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">checksum</span>
      <span class="ruby-keyword">return</span> <span class="ruby-keyword">true</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">source</span> = <span class="ruby-ivar">@package</span>.<span class="ruby-identifier">instance_variable_get</span>(<span class="ruby-value">:@gem</span>)
      <span class="ruby-keyword">return</span> <span class="ruby-keyword">true</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">source</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:with_read_io</span>)
      <span class="ruby-identifier">digest</span> = <span class="ruby-identifier">source</span>.<span class="ruby-identifier">with_read_io</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">io</span><span class="ruby-operator">|</span>
        <span class="ruby-identifier">digest</span> = <span class="ruby-constant">SharedHelpers</span>.<span class="ruby-identifier">digest</span>(<span class="ruby-value">:SHA256</span>).<span class="ruby-identifier">new</span>
        <span class="ruby-identifier">digest</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">io</span>.<span class="ruby-identifier">read</span>(<span class="ruby-value">16_384</span>) <span class="ruby-keyword">until</span> <span class="ruby-identifier">io</span>.<span class="ruby-identifier">eof?</span>
        <span class="ruby-identifier">io</span>.<span class="ruby-identifier">rewind</span>
        <span class="ruby-identifier">send</span>(<span class="ruby-identifier">checksum_type</span>(<span class="ruby-identifier">checksum</span>), <span class="ruby-identifier">digest</span>)
      <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">unless</span> <span class="ruby-identifier">digest</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">checksum</span>
        <span class="ruby-identifier">raise</span> <span class="ruby-constant">SecurityError</span>, <span class="ruby-identifier">&lt;&lt;-MESSAGE</span>
<span class="ruby-value">          Bundler cannot continue installing #{spec.name} (#{spec.version}).
          The checksum for the downloaded `#{spec.full_name}.gem` does not match \
          the checksum given by the server. This means the contents of the downloaded \
          gem is different from what was uploaded to the server, and could be a potential security issue.

          To resolve this issue:
          1. delete the downloaded gem located at: `#{spec.gem_dir}/#{spec.full_name}.gem`
          2. run `bundle install`

          If you wish to continue installing the downloaded gem, and are certain it does not pose a \
          security issue despite the mismatching checksum, do the following:
          1. run `bundle config set disable_checksum_validation true` to turn off checksum verification
          2. run `bundle install`

          (More info: The expected SHA256 checksum was #{checksum.inspect}, but the \
          checksum for the downloaded gem was #{digest.inspect}.)
</span><span class="ruby-identifier">          MESSAGE</span>
      <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">true</span>
    <span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
    </section>
  
  </section>

</main>


<footer id="validator-badges" role="contentinfo">
  <p><a href="https://validator.w3.org/check/referer">Validate</a>
  <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.2.1.1.
  <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
</footer>