/usr/lib/ruby/vendor_ruby/bundler/env.rb is in ruby-bundler 1.13.6-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | # frozen_string_literal: true
require "bundler/rubygems_integration"
require "bundler/source/git/git_proxy"
module Bundler
class Env
def write(io)
io.write report(:print_gemfile => true, :print_gemspecs => true)
end
def report(options = {})
print_gemfile = options.delete(:print_gemfile)
print_gemspecs = options.delete(:print_gemspecs)
out = String.new("Environment\n\n")
out << " Bundler #{Bundler::VERSION}\n"
out << " Rubygems #{Gem::VERSION}\n"
out << " Ruby #{ruby_version}"
out << " GEM_HOME #{ENV["GEM_HOME"]}\n" unless ENV["GEM_HOME"].nil? || ENV["GEM_HOME"].empty?
out << " GEM_PATH #{ENV["GEM_PATH"]}\n" unless ENV["GEM_PATH"] == ENV["GEM_HOME"]
out << " RVM #{ENV["rvm_version"]}\n" if ENV["rvm_version"]
out << " Git #{git_version}\n"
%w(rubygems-bundler open_gem).each do |name|
specs = Bundler.rubygems.find_name(name)
out << " #{name} (#{specs.map(&:version).join(",")})\n" unless specs.empty?
end
out << "\nBundler settings\n\n" unless Bundler.settings.all.empty?
Bundler.settings.all.each do |setting|
out << " " << setting << "\n"
Bundler.settings.pretty_values_for(setting).each do |line|
out << " " << line << "\n"
end
end
if print_gemfile
out << "\n#{Bundler.default_gemfile.relative_path_from(SharedHelpers.pwd)}\n\n"
out << " " << read_file(Bundler.default_gemfile).gsub(/\n/, "\n ") << "\n"
out << "\n#{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)}\n\n"
out << " " << read_file(Bundler.default_lockfile).gsub(/\n/, "\n ") << "\n"
end
if print_gemspecs
dsl = Dsl.new.tap {|d| d.eval_gemfile(Bundler.default_gemfile) }
dsl.gemspecs.each do |gs|
out << "\n#{File.basename(gs.loaded_from)}"
out << "\n\n " << read_file(gs.loaded_from).gsub(/\n/, "\n ") << "\n"
end
end
out
end
private
def read_file(filename)
File.read(filename.to_s).strip
rescue Errno::ENOENT
"<No #{filename} found>"
rescue => e
"#{e.class}: #{e.message}"
end
def ruby_version
str = String.new("#{RUBY_VERSION}")
if RUBY_VERSION < "1.9"
str << " (#{RUBY_RELEASE_DATE}"
str << " patchlevel #{RUBY_PATCHLEVEL}" if defined? RUBY_PATCHLEVEL
str << ") [#{RUBY_PLATFORM}]\n"
else
str << "p#{RUBY_PATCHLEVEL}" if defined? RUBY_PATCHLEVEL
str << " (#{RUBY_RELEASE_DATE} revision #{RUBY_REVISION}) [#{RUBY_PLATFORM}]\n"
end
end
def git_version
Bundler::Source::Git::GitProxy.new(nil, nil, nil).full_version
rescue Bundler::Source::Git::GitNotInstalledError
"not installed"
end
end
end
|