lib/language_pack/ruby.rb
# runs bundler to install the dependencies
runs bundler to install the dependencies
runs bundler to install the dependencies
def build_bundler(default_bundle_without)
    instrument 'ruby.build_bundler' do
      log("bundle") do
        bundle_without = env("BUNDLE_WITHOUT") || default_bundle_without
        bundle_bin     = "bundle"
        bundle_command = "#{bundle_bin} install --without #{bundle_without} --path vendor/bundle --binstubs #{bundler_binstubs_path}"
        bundle_command << " -j4"
        if File.exist?("#{Dir.pwd}/.bundle/config")
          warn(<<-WARNING, inline: true)
You have the `.bundle/config` file checked into your repository
 It contains local state like the location of the installed bundle
 as well as configured git local gems, and other settings that should
not be shared between multiple checkouts of a single repo. Please
remove the `.bundle/` folder from your repo and add it to your `.gitignore` file.
https://devcenter.heroku.com/articles/bundler-configuration
WARNING
        end
        if bundler.windows_gemfile_lock?
          warn(<<-WARNING, inline: true)
Removing `Gemfile.lock` because it was generated on Windows.
Bundler will do a full resolve so native gems are handled properly.
This may result in unexpected gem versions being used in your app.
In rare occasions Bundler may not be able to resolve your dependencies at all.
https://devcenter.heroku.com/articles/bundler-windows-gemfile
WARNING
          log("bundle", "has_windows_gemfile_lock")
          File.unlink("Gemfile.lock")
        else
          bundle_command += " --deployment"
        end
        topic("Installing dependencies using bundler #{bundler.version}")
        load_bundler_cache
        bundler_output = ""
        bundle_time    = nil
        Dir.mktmpdir("libyaml-") do |tmpdir|
          libyaml_dir = "#{tmpdir}/#{LIBYAML_PATH}"
          install_libyaml(libyaml_dir)
          yaml_include   = File.expand_path("#{libyaml_dir}/include").shellescape
          yaml_lib       = File.expand_path("#{libyaml_dir}/lib").shellescape
          pwd            = Dir.pwd
          bundler_path   = "#{pwd}/#{slug_vendor_base}/gems/#{bundler.dir_name}/lib"
          env_vars       = {
            "BUNDLE_GEMFILE"                => "#{pwd}/Gemfile",
            "BUNDLE_CONFIG"                 => "#{pwd}/.bundle/config",
            "CPATH"                         => noshellescape("#{yaml_include}:$CPATH"),
            "CPPATH"                        => noshellescape("#{yaml_include}:$CPPATH"),
            "LIBRARY_PATH"                  => noshellescape("#{yaml_lib}:$LIBRARY_PATH"),
            "RUBYOPT"                       => syck_hack,
            "NOKOGIRI_USE_SYSTEM_LIBRARIES" => "true",
            "BUNDLE_DISABLE_VERSION_CHECK"  => "true"
          }
          env_vars["JAVA_HOME"]                    = noshellescape("#{pwd}/$JAVA_HOME") if ruby_version.jruby?
          env_vars["BUNDLER_LIB_PATH"]             = "#{bundler_path}" if ruby_version.ruby_version == "1.8.7"
          env_vars["BUNDLE_DISABLE_VERSION_CHECK"] = "true"
          puts "Running: #{bundle_command}"
          instrument "ruby.bundle_install" do
            bundle_time = Benchmark.realtime do
              bundler_output << pipe("#{bundle_command} --no-clean", out: "2>&1", env: env_vars, user_env: true)
            end
          end
        end
        if $?.success?
          puts "Bundle completed (#{"%.2f" % bundle_time}s)"
          log "bundle", :status => "success"
          puts "Cleaning up the bundler cache."
          instrument "ruby.bundle_clean" do
            if load_default_cache?
              run("#{bundle_bin} clean > /dev/null", user_env: true)
            else
              pipe("#{bundle_bin} clean", out: "2> /dev/null", user_env: true)
            end
          end
          @bundler_cache.store
          FileUtils.rm_rf("#{slug_vendor_base}/cache")
        else
          mcount "fail.bundle.install"
          log "bundle", :status => "failure"
          error_message = "Failed to install gems via Bundler."
          puts "Bundler Output: #{bundler_output}"
          if bundler_output.match(/An error occurred while installing sqlite3/)
            mcount "fail.sqlite3"
            error_message += <<-ERROR
Detected sqlite3 gem which is not supported on Heroku:
https://devcenter.heroku.com/articles/sqlite3
            ERROR
          end
          if bundler_output.match(/but your Gemfile specified/)
            mcount "fail.ruby_version_mismatch"
            error_message += <<-ERROR
Detected a mismatch between your Ruby version installed and
Ruby version specified in Gemfile or Gemfile.lock. You can
correct this by running:
    $ bundle update --ruby
    $ git add Gemfile.lock
    $ git commit -m "update ruby version"
If this does not solve the issue please see this documentation:
https://devcenter.heroku.com/articles/ruby-versions#your-ruby-version-is-x-but-your-gemfile-specified-y
            ERROR
          end
          error error_message
        end
      end
    end
  end
def build_bundler ( default_bundle_without ) instrument 'ruby.build_bundler' do log ( "bundle" ) do bundle_without = env ( "BUNDLE_WITHOUT" ) || default_bundle_without bundle_bin = "bundle" bundle_command = "#{bundle_bin} install --without #{bundle_without} --path vendor/bundle --binstubs #{bundler_binstubs_path}" bundle_command << " -j4" if File . exist? ( "#{Dir.pwd}/.bundle/config" ) warn ( <<-WARNING , inline : true ) 
You have the `.bundle/config` file checked into your repository
 It contains local state like the location of the installed bundle
 as well as configured git local gems, and other settings that should
not be shared between multiple checkouts of a single repo. Please
remove the `.bundle/` folder from your repo and add it to your `.gitignore` file.
https://devcenter.heroku.com/articles/bundler-configuration
 WARNING end if bundler . windows_gemfile_lock? warn ( <<-WARNING , inline : true ) 
Removing `Gemfile.lock` because it was generated on Windows.
Bundler will do a full resolve so native gems are handled properly.
This may result in unexpected gem versions being used in your app.
In rare occasions Bundler may not be able to resolve your dependencies at all.
https://devcenter.heroku.com/articles/bundler-windows-gemfile
 WARNING log ( "bundle" , "has_windows_gemfile_lock" ) File . unlink ( "Gemfile.lock" ) else bundle_command += " --deployment" end topic ( "Installing dependencies using bundler #{bundler.version}" ) load_bundler_cache bundler_output = "" bundle_time = nil Dir . mktmpdir ( "libyaml-" ) do | tmpdir | libyaml_dir = "#{tmpdir}/#{LIBYAML_PATH}" install_libyaml ( libyaml_dir ) yaml_include = File . expand_path ( "#{libyaml_dir}/include" ) . shellescape yaml_lib = File . expand_path ( "#{libyaml_dir}/lib" ) . shellescape pwd = Dir . pwd bundler_path = "#{pwd}/#{slug_vendor_base}/gems/#{bundler.dir_name}/lib" env_vars = { "BUNDLE_GEMFILE" => "#{pwd}/Gemfile" , "BUNDLE_CONFIG" => "#{pwd}/.bundle/config" , "CPATH" => noshellescape ( "#{yaml_include}:$CPATH" ) , "CPPATH" => noshellescape ( "#{yaml_include}:$CPPATH" ) , "LIBRARY_PATH" => noshellescape ( "#{yaml_lib}:$LIBRARY_PATH" ) , "RUBYOPT" => syck_hack , "NOKOGIRI_USE_SYSTEM_LIBRARIES" => "true" , "BUNDLE_DISABLE_VERSION_CHECK" => "true" } env_vars [ "JAVA_HOME" ] = noshellescape ( "#{pwd}/$JAVA_HOME" ) if ruby_version . jruby? env_vars [ "BUNDLER_LIB_PATH" ] = "#{bundler_path}" if ruby_version . ruby_version == "1.8.7" env_vars [ "BUNDLE_DISABLE_VERSION_CHECK" ] = "true" puts "Running: #{bundle_command}" instrument "ruby.bundle_install" do bundle_time = Benchmark . realtime do bundler_output << pipe ( "#{bundle_command} --no-clean" , out : "2>&1" , env : env_vars , user_env : true ) end end end if $? . success? puts "Bundle completed (#{"%.2f" % bundle_time}s)" log "bundle" , :status => "success" puts "Cleaning up the bundler cache." instrument "ruby.bundle_clean" do if load_default_cache? run ( "#{bundle_bin} clean > /dev/null" , user_env : true ) else pipe ( "#{bundle_bin} clean" , out : "2> /dev/null" , user_env : true ) end end @bundler_cache . store FileUtils . rm_rf ( "#{slug_vendor_base}/cache" ) else mcount "fail.bundle.install" log "bundle" , :status => "failure" error_message = "Failed to install gems via Bundler." puts "Bundler Output: #{bundler_output}" if bundler_output . match ( / An error occurred while installing sqlite3 / ) mcount "fail.sqlite3" error_message += <<-ERROR 

Detected sqlite3 gem which is not supported on Heroku:
https://devcenter.heroku.com/articles/sqlite3
             ERROR end if bundler_output . match ( / but your Gemfile specified / ) mcount "fail.ruby_version_mismatch" error_message += <<-ERROR 

Detected a mismatch between your Ruby version installed and
Ruby version specified in Gemfile or Gemfile.lock. You can
correct this by running:

    $ bundle update --ruby
    $ git add Gemfile.lock
    $ git commit -m "update ruby version"

If this does not solve the issue please see this documentation:

https://devcenter.heroku.com/articles/ruby-versions#your-ruby-version-is-x-but-your-gemfile-specified-y
             ERROR end error error_message end end end end
runs bundler to install the dependencies
runs bundler to install the dependencies
# using --deployment is preferred if we can # need to setup compile environment for the psych gem # we need to set BUNDLE_CONFIG and BUNDLE_GEMFILE for # codon since it uses bundler. # Only show bundle clean output when not using default cache # Keep gem cache out of the slug
default_bundle_without
<not_specific>