ruby-changes:49299
From: hsbt <ko1@a...>
Date: Sat, 23 Dec 2017 08:08:34 +0900 (JST)
Subject: [ruby-changes:49299] hsbt:r61416 (trunk): Postponing the Bundler merge.
hsbt 2017-12-23 08:08:05 +0900 (Sat, 23 Dec 2017) New Revision: 61416 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61416 Log: Postponing the Bundler merge. I faced a big issue about Bundler with ruby core. I have no time to resolve it issue before 2.5 final release. Removed directories: trunk/lib/bundler/ trunk/spec/bundler/ Removed files: trunk/bin/bundle trunk/bin/bundler trunk/lib/bundler.gemspec trunk/lib/bundler.rb Modified files: trunk/LEGAL trunk/NEWS trunk/common.mk trunk/defs/gmake.mk trunk/doc/maintainers.rdoc trunk/lib/rubygems/test_case.rb trunk/lib/rubygems.rb trunk/spec/README.md trunk/test/rubygems/test_gem.rb trunk/tool/sync_default_gems.rb Index: bin/bundle =================================================================== --- bin/bundle (revision 61415) +++ bin/bundle (nonexistent) @@ -1,31 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/bin/bundle#L0 -#!/usr/bin/env ruby -# frozen_string_literal: true - -# Exit cleanly from an early interrupt -Signal.trap("INT") do - Bundler.ui.debug("\n#{caller.join("\n")}") if defined?(Bundler) - exit 1 -end - -require "bundler" -# Check if an older version of bundler is installed -$LOAD_PATH.each do |path| - next unless path =~ %r{/bundler-0\.(\d+)} && $1.to_i < 9 - err = String.new - err << "Looks like you have a version of bundler that's older than 0.9.\n" - err << "Please remove your old versions.\n" - err << "An easy way to do this is by running `gem cleanup bundler`." - abort(err) -end - -require "bundler/friendly_errors" -Bundler.with_friendly_errors do - require "bundler/cli" - - # Allow any command to use --help flag to show help for that command - help_flags = %w[--help -h] - help_flag_used = ARGV.any? {|a| help_flags.include? a } - args = help_flag_used ? Bundler::CLI.reformatted_help_args(ARGV) : ARGV - - Bundler::CLI.start(args, :debug => true) -end Property changes on: bin/bundle ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -LF \ No newline at end of property Deleted: svn:executable ## -1 +0,0 ## -* \ No newline at end of property Index: bin/bundler =================================================================== --- bin/bundler (revision 61415) +++ bin/bundler (nonexistent) @@ -1,4 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/bin/bundler#L0 -#!/usr/bin/env ruby -# frozen_string_literal: true - -load File.expand_path("../bundle", __FILE__) Property changes on: bin/bundler ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -LF \ No newline at end of property Deleted: svn:executable ## -1 +0,0 ## -* \ No newline at end of property Index: lib/bundler/gem_helper.rb =================================================================== --- lib/bundler/gem_helper.rb (revision 61415) +++ lib/bundler/gem_helper.rb (nonexistent) @@ -1,202 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/lib/bundler/gem_helper.rb#L0 -# frozen_string_literal: true - -require "bundler/vendored_thor" unless defined?(Thor) -require "bundler" - -module Bundler - class GemHelper - include Rake::DSL if defined? Rake::DSL - - class << self - # set when install'd. - attr_accessor :instance - - def install_tasks(opts = {}) - new(opts[:dir], opts[:name]).install - end - - def gemspec(&block) - gemspec = instance.gemspec - block.call(gemspec) if block - gemspec - end - end - - attr_reader :spec_path, :base, :gemspec - - def initialize(base = nil, name = nil) - Bundler.ui = UI::Shell.new - @base = (base ||= SharedHelpers.pwd) - gemspecs = name ? [File.join(base, "#{name}.gemspec")] : Dir[File.join(base, "{,*}.gemspec")] - raise "Unable to determine name from existing gemspec. Use :name => 'gemname' in #install_tasks to manually set it." unless gemspecs.size == 1 - @spec_path = gemspecs.first - @gemspec = Bundler.load_gemspec(@spec_path) - end - - def install - built_gem_path = nil - - desc "Build #{name}-#{version}.gem into the pkg directory." - task "build" do - built_gem_path = build_gem - end - - desc "Build and install #{name}-#{version}.gem into system gems." - task "install" => "build" do - install_gem(built_gem_path) - end - - desc "Build and install #{name}-#{version}.gem into system gems without network access." - task "install:local" => "build" do - install_gem(built_gem_path, :local) - end - - desc "Create tag #{version_tag} and build and push #{name}-#{version}.gem to #{gem_push_host}\n" \ - "To prevent publishing in RubyGems use `gem_push=no rake release`" - task "release", [:remote] => ["build", "release:guard_clean", - "release:source_control_push", "release:rubygem_push"] do - end - - task "release:guard_clean" do - guard_clean - end - - task "release:source_control_push", [:remote] do |_, args| - tag_version { git_push(args[:remote]) } unless already_tagged? - end - - task "release:rubygem_push" do - rubygem_push(built_gem_path) if gem_push? - end - - GemHelper.instance = self - end - - def build_gem - file_name = nil - sh("gem build -V '#{spec_path}'") do - file_name = File.basename(built_gem_path) - SharedHelpers.filesystem_access(File.join(base, "pkg")) {|p| FileUtils.mkdir_p(p) } - FileUtils.mv(built_gem_path, "pkg") - Bundler.ui.confirm "#{name} #{version} built to pkg/#{file_name}." - end - File.join(base, "pkg", file_name) - end - - def install_gem(built_gem_path = nil, local = false) - built_gem_path ||= build_gem - out, _ = sh_with_code("gem install '#{built_gem_path}'#{" --local" if local}") - raise "Couldn't install gem, run `gem install #{built_gem_path}' for more detailed output" unless out[/Successfully installed/] - Bundler.ui.confirm "#{name} (#{version}) installed." - end - - protected - - def rubygem_push(path) - gem_command = "gem push '#{path}'" - gem_command += " --key #{gem_key}" if gem_key - gem_command += " --host #{allowed_push_host}" if allowed_push_host - unless allowed_push_host || Bundler.user_home.join(".gem/credentials").file? - raise "Your rubygems.org credentials aren't set. Run `gem push` to set them." - end - sh(gem_command) - Bundler.ui.confirm "Pushed #{name} #{version} to #{gem_push_host}" - end - - def built_gem_path - Dir[File.join(base, "#{name}-*.gem")].sort_by {|f| File.mtime(f) }.last - end - - def git_push(remote = "") - perform_git_push remote - perform_git_push "#{remote} --tags" - Bundler.ui.confirm "Pushed git commits and tags." - end - - def allowed_push_host - @gemspec.metadata["allowed_push_host"] if @gemspec.respond_to?(:metadata) - end - - def gem_push_host - env_rubygems_host = ENV["RUBYGEMS_HOST"] - env_rubygems_host = nil if - env_rubygems_host && env_rubygems_host.empty? - - allowed_push_host || env_rubygems_host || "rubygems.org" - end - - def perform_git_push(options = "") - cmd = "git push #{options}" - out, code = sh_with_code(cmd) - raise "Couldn't git push. `#{cmd}' failed with the following output:\n\n#{out}\n" unless code == 0 - end - - def already_tagged? - return false unless sh("git tag").split(/\n/).include?(version_tag) - Bundler.ui.confirm "Tag #{version_tag} has already been created." - true - end - - def guard_clean - clean? && committed? || raise("There are files that need to be committed first.") - end - - def clean? - sh_with_code("git diff --exit-code")[1] == 0 - end - - def committed? - sh_with_code("git diff-index --quiet --cached HEAD")[1] == 0 - end - - def tag_version - sh "git tag -m \"Version #{version}\" #{version_tag}" - Bundler.ui.confirm "Tagged #{version_tag}." - yield if block_given? - rescue - Bundler.ui.error "Untagging #{version_tag} due to error." - sh_with_code "git tag -d #{version_tag}" - raise - end - - def version - gemspec.version - end - - def version_tag - "v#{version}" - end - - def name - gemspec.name - end - - def sh(cmd, &block) - out, code = sh_with_code(cmd, &block) - unless code.zero? - raise(out.empty? ? "Running `#{cmd}` failed. Run this command directly for more detailed output." : out) - end - out - end - - def sh_with_code(cmd, &block) - cmd += " 2>&1" - outbuf = String.new - Bundler.ui.debug(cmd) - SharedHelpers.chdir(base) do - outbuf = `#{cmd}` - status = $?.exitstatus - block.call(outbuf) if status.zero? && block - [outbuf, status] - end - end - - def gem_key - Bundler.settings["gem.push_key"].to_s.downcase if Bundler.settings["gem.push_key"] - end - - def gem_push? - !%w[n no nil false off 0].include?(ENV["gem_push"].to_s.downcase) - end - end -end Property changes on: lib/bundler/gem_helper.rb ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -LF \ No newline at end of property Index: lib/bundler/friendly_errors.rb =================================================================== --- lib/bundler/friendly_errors.rb (revision 61415) +++ lib/bundler/friendly_errors.rb (nonexistent) @@ -1,129 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/lib/bundler/friendly_errors.rb#L0 -# encoding: utf-8 -# frozen_string_literal: true - -require "cgi" -require "bundler/vendored_thor" - -module Bundler - module FriendlyErrors - module_function - - def log_error(error) - case error - when YamlSyntaxError - Bundler.ui.error error.message - Bundler.ui.trace error.orig_exception - when Dsl::DSLError, GemspecError - Bundler.ui.error error.message - when GemRequireError - Bundler.ui.error error.message - Bundler.ui.trace error.orig_exception, nil, true - when BundlerError - Bundler.ui.error error.message, :wrap => true - Bundler.ui.trace error - when Thor::Error - Bundler.ui.error error.message - when LoadError - raise error unless error.message =~ /cannot load such file -- openssl|openssl.so|libcrypto.so/ - Bundler.ui.error "\nCould not load OpenSSL." - Bundler.ui.warn <<-WARN, :wrap => true - You must recompile Ruby with OpenSSL support or change the sources in your \ - Gemfile from 'https' to 'http'. Instructions for compiling with OpenSSL \ - using RVM are available at http://rvm.io/packages/openssl. - WARN - Bundler.ui.trace error - when Interrupt - Bundler.ui.error "\nQuitting..." - Bundler.ui.trace error - when Gem::InvalidSpecificationException - Bundler.ui.error error.message, :wrap => true - when SystemExit - when *[defined?(Java::JavaLang::OutOfMemoryError) && Java::JavaLang::OutOfMemoryError].compact - Bundler.ui.error "\nYour JVM has run out of memory, and Bundler cannot continue. " \ - "You can decrease the amount of memory Bundler needs by removing gems from your Gemfile, " \ - "especially large gems. (Gems can be as large as hundreds of megabytes, and Bundler has to read those files!). " \ - "Alternatively, you can increase the amount of memory the JVM is able to use by running Bundler with jruby -J-Xmx1024m -S bundle (JRuby defaults to 500MB)." - else request_issue_report_for(error) - end - end - - def exit_status(error) - case error - when BundlerError then error.status_code - when Thor::Error then 15 - when SystemExit then error.status - else 1 - end - end - - def request_issue_report_for(e) - Bundler.ui.info <<-EOS.gsub(/^ {8}/, "") - --- ERROR REPORT TEMPLATE ------------------------------------------------------- - # Error Report - - ## Questions - - Please fill out answers to these questions, it'll help us figure out - why things are going wrong. - - - **What did you do?** - - I ran the command `#{$PROGRAM_NAME} #{ARGV.join(" ")}` - - - **What did you expect to happen?** - - I expected Bundler to... - - - **What happened instead?** - - Instead, what happened was... - - - **Have you tried any solutions posted on similar issues in our issue tracker, stack overflow, or google?** - - I tried... - - - **Have you read our issues document, https://github.com/bundler/bundler/blob/master/doc/contributing/ISSUES.md?** - - ... - - ## Backtrace - - ``` - #{e.class}: #{e.message} - #{e.backtrace && e.backtrace.join("\n ").chomp} - ``` - - #{Bundler::Env.report} - --- TEMPLATE END ---------------------------------------------------------------- - - EOS - - Bundler.ui.error "Unfortunately, an unexpected error occurred, and Bundler cannot continue." - - Bundler.ui.warn <<-EOS.gsub(/^ {8}/, "") - - First, try this link to see if there are any existing issue reports for this error: - #{issues_url(e)} - - If there aren't any reports for this error yet, please create copy and paste the report template above into a new issue. Don't forget to anonymize any private data! The new issue form is located at: - https://github.com/bundler/bundler/issues/new - EOS - end - - def issues_url(exception) - message = exception.message.lines.first.tr(":", " ").chomp - message = message.split("-").first if exception.is_a?(Errno) - "https://github.com/bundler/bundler/search?q=" \ - "#{CGI.escape(message)}&type=Issues" - end - end - - def self.with_friendly_errors - yield - rescue SignalException - raise - rescue Exception => e - FriendlyErrors.log_error(e) - exit FriendlyErrors.exit_status(e) - end -end Property changes on: lib/bundler/friendly_errors.rb ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -LF \ No newline at end of property Index: lib/bundler/constants.rb =================================================================== --- lib/bundler/constants.rb (revision 61415) +++ lib/bundler/constants.rb (nonexistent) @@ -1,7 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/lib/bundler/constants.rb#L0 -# frozen_string_literal: true - -module Bundler - WINDOWS = RbConfig::CONFIG["host_os"] =~ /(msdos|mswin|djgpp|mingw)/ - FREEBSD = RbConfig::CONFIG["host_os"] =~ /bsd/ - NULL = WINDOWS ? "NUL" : "/dev/null" -end Property changes on: lib/bundler/constants.rb ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -LF \ No newline at end of property Index: lib/bundler/rubygems_ext.rb =================================================================== --- lib/bundler/rubygems_ext.rb (revision 61415) +++ lib/bundler/rubygems_ext.rb (nonexistent) @@ -1,210 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/lib/bundler/rubygems_ext.rb#L0 -# frozen_string_literal: true - -require "pathname" - -if defined?(Gem::QuickLoader) - # Gem Prelude makes me a sad panda :'( - Gem::QuickLoader.load_full_rubygems_library -end - -require "rubygems" -require "rubygems/specification" - -begin - # Possible use in Gem::Specification#source below and require - # shouldn't be deferred. - require "rubygems/source" -rescue LoadError - # Not available before RubyGems 2.0.0, ignore - nil -end - -require "bundler/match_platform" - -module Gem - @loaded_stacks = Hash.new {|h, k| h[k] = [] } - - class Specification - attr_accessor :remote, :location, :relative_loaded_from - - if instance_methods(false).map(&:to_sym).include?(:source) - remove_method :source - attr_writer :source - def source - (defined?(@source) && @source) || Gem::Source::Installed.new - end - else - attr_accessor :source - end - - alias_method :rg_full_gem_path, :full_gem_path - alias_method :rg_loaded_from, :loaded_from - - attr_writer :full_gem_path unless instance_methods.include?(:full_gem_path=) - - def full_gem_path - # this cannot check source.is_a?(Bundler::Plugin::API::Source) - # because that _could_ trip the autoload, and if there are unresolved - # gems at that time, this method could be called inside another require, - # thus raising with that constant being undefined. Better to check a method - if source.respond_to?(:path) || (source.respond_to?(:bundler_plugin_api_source?) && source.bundler_plugin_api_source?) - Pathname.new(loaded_from).dirname.expand_path(source.root).to_s.untaint - else - rg_full_gem_path - end - end - - def loaded_from - if relative_loaded_from - source.path.join(relative_loaded_from).to_s - else - rg_loaded_from - end - end - - def load_paths - return full_require_paths if respond_to?(:full_require_paths) - - require_paths.map do |require_path| - if require_path.include?(full_gem_path) - require_path - else - File.join(full_gem_path, require_path) - end - end - end - - if method_defined?(:extension_dir) - alias_method :rg_extension_dir, :extension_dir - def extension_dir - @bundler_extension_dir ||= if source.respond_to?(:extension_dir_name) - File.expand_path(File.join(extensions_dir, source.extension_dir_name)) - else - rg_extension_dir - end - end - end - - # RubyGems 1.8+ used only. - methods = instance_methods(false) - gem_dir = methods.first.is_a?(String) ? "gem_dir" : :gem_dir - remove_method :gem_dir if methods.include?(gem_dir) - def gem_dir - full_gem_path - end - - def groups - @groups ||= [] - end - - def git_version - return unless loaded_from && source.is_a?(Bundler::Source::Git) - " #{source.revision[0..6]}" - end - - def to_gemfile(path = nil) - gemfile = String.new("source 'https://rubygems.org'\n") - gemfile << dependencies_to_gemfile(nondevelopment_dependencies) - unless development_dependencies.empty? - gemfile << "\n" - gemfile << dependencies_to_gemfile(development_dependencies, :development) - end - gemfile - end - - def nondevelopment_dependencies - dependencies - development_dependencies - end - - private - - def dependencies_to_gemfile(dependencies, group = nil) - gemfile = String.new - if dependencies.any? - gemfile << "group :#{group} do\n" if group - dependencies.each do |dependency| - gemfile << " " if group - gemfile << %(gem "#{dependency.name}") - req = dependency.requirements_list.first - gemfile << %(, "#{req}") if req - gemfile << "\n" - end - gemfile << "end\n" if group - end - gemfile - end - end - - class Dependency - attr_accessor :source, :groups, :all_sources - - alias_method :eql?, :== - - def encode_with(coder) - to_yaml_properties.each do |ivar| - coder[ivar.to_s.sub(/^@/, "")] = instance_variable_get(ivar) - end - end - - def to_yaml_properties - instance_variables.reject {|p| ["@source", "@groups", "@all_sources"].include?(p.to_s) } - end - - def to_lock - out = String.new(" #{name}") - unless requirement.none? - reqs = requirement.requirements.map {|o, v| "#{o} #{v}" }.sort.reverse - out << " (#{reqs.join(", ")})" - end - out - end - - # Backport of performance enhancement added to RubyGems 1.4 - def matches_spec?(spec) - # name can be a Regexp, so use === - return false unless name === spec.name - return true if requirement.none? - - requirement.satisfied_by?(spec.version) - end unless allocate.respond_to?(:matches_spec?) - end - - class Requirement - # Backport of performance enhancement added to RubyGems 1.4 - def none? - # note that it might be tempting to replace with with RubyGems 2.0's - # improved implementation. Don't. It requires `DefaultRequirement` to be - # defined, and more importantantly, these overrides are not used when the - # running RubyGems defines these methods - to_s == ">= 0" - end unle (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/