diff options
author | Bundlerbot <bot@bundler.io> | 2019-01-23 09:40:57 +0000 |
---|---|---|
committer | Bundlerbot <bot@bundler.io> | 2019-01-23 09:40:57 +0000 |
commit | f5e00a5867d09da235971db0bec4341db3312b29 (patch) | |
tree | 79e7f41b581e1fbf30f1512778f55d7978473d0d | |
parent | 4557124b5ea30821895eb2686874cb4219f404e2 (diff) | |
parent | a98852235bf9080fccf2b0670f817d68c3b5dbaf (diff) | |
download | bundler-f5e00a5867d09da235971db0bec4341db3312b29.tar.gz |
Merge #6793
6793: Removed exe/bundle_ruby and its example. r=hsbt a=hsbt
Originated from #3489
`exe/bundle_ruby` was already removed from bundler's gemspec. We can remove it now.
Co-authored-by: SHIBATA Hiroshi <hsbt@ruby-lang.org>
-rwxr-xr-x | exe/bundle_ruby | 60 | ||||
-rw-r--r-- | spec/other/bundle_ruby_spec.rb | 155 | ||||
-rw-r--r-- | spec/other/major_deprecation_spec.rb | 8 | ||||
-rw-r--r-- | spec/support/helpers.rb | 5 |
4 files changed, 0 insertions, 228 deletions
diff --git a/exe/bundle_ruby b/exe/bundle_ruby deleted file mode 100755 index df6f8cc8a1..0000000000 --- a/exe/bundle_ruby +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -require "bundler/shared_helpers" - -Bundler::SharedHelpers.major_deprecation(2, "the bundle_ruby executable has been removed in favor of `bundle platform --ruby`") - -Signal.trap("INT") { exit 1 } - -require "bundler/errors" -require "bundler/ruby_version" -require "bundler/ruby_dsl" - -module Bundler - class Dsl - include RubyDsl - - attr_accessor :ruby_version - - def initialize - @ruby_version = nil - end - - def eval_gemfile(gemfile, contents = nil) - contents ||= File.open(gemfile, "rb", &:read) - instance_eval(contents, gemfile.to_s, 1) - rescue SyntaxError => e - bt = e.message.split("\n")[1..-1] - raise GemfileError, ["Gemfile syntax error:", *bt].join("\n") - rescue ScriptError, RegexpError, NameError, ArgumentError => e - e.backtrace[0] = "#{e.backtrace[0]}: #{e.message} (#{e.class})" - STDERR.puts e.backtrace.join("\n ") - raise GemfileError, "There was an error in your Gemfile," \ - " and Bundler cannot continue." - end - - def source(source, options = {}) - end - - def gem(name, *args) - end - - def group(*args) - end - end -end - -dsl = Bundler::Dsl.new -begin - dsl.eval_gemfile(Bundler::SharedHelpers.default_gemfile) - ruby_version = dsl.ruby_version - if ruby_version - puts ruby_version - else - puts "No ruby version specified" - end -rescue Bundler::GemfileError => e - puts e.message - exit(-1) -end diff --git a/spec/other/bundle_ruby_spec.rb b/spec/other/bundle_ruby_spec.rb deleted file mode 100644 index a7da9cbec9..0000000000 --- a/spec/other/bundle_ruby_spec.rb +++ /dev/null @@ -1,155 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe "bundle_ruby", :bundler => "< 2" do - context "without patchlevel" do - it "returns the ruby version" do - gemfile <<-G - source "file://#{gem_repo1}" - ruby "1.9.3", :engine => 'ruby', :engine_version => '1.9.3' - - gem "foo" - G - - bundle_ruby - - expect(out).to include("ruby 1.9.3") - end - - it "engine defaults to MRI" do - gemfile <<-G - source "file://#{gem_repo1}" - ruby "1.9.3" - - gem "foo" - G - - bundle_ruby - - expect(out).to include("ruby 1.9.3") - end - - it "handles jruby" do - gemfile <<-G - source "file://#{gem_repo1}" - ruby "1.8.7", :engine => 'jruby', :engine_version => '1.6.5' - - gem "foo" - G - - bundle_ruby - - expect(out).to include("ruby 1.8.7 (jruby 1.6.5)") - end - - it "handles rbx" do - gemfile <<-G - source "file://#{gem_repo1}" - ruby "1.8.7", :engine => 'rbx', :engine_version => '1.2.4' - - gem "foo" - G - - bundle_ruby - - expect(out).to include("ruby 1.8.7 (rbx 1.2.4)") - end - - it "handles truffleruby", :rubygems => ">= 2.1.0" do - gemfile <<-G - source "file://#{gem_repo1}" - ruby "2.5.1", :engine => 'truffleruby', :engine_version => '1.0.0-rc6' - - gem "foo" - G - - bundle_ruby - - expect(out).to include("ruby 2.5.1 (truffleruby 1.0.0-rc6)") - end - - it "raises an error if engine is used but engine version is not" do - gemfile <<-G - source "file://#{gem_repo1}" - ruby "1.8.7", :engine => 'rbx' - - gem "foo" - G - - bundle_ruby - expect(exitstatus).not_to eq(0) if exitstatus - - bundle_ruby - expect(out).to include("Please define :engine_version") - end - - it "raises an error if engine_version is used but engine is not" do - gemfile <<-G - source "file://#{gem_repo1}" - ruby "1.8.7", :engine_version => '1.2.4' - - gem "foo" - G - - bundle_ruby - expect(exitstatus).not_to eq(0) if exitstatus - - bundle_ruby - expect(out).to include("Please define :engine") - end - - it "raises an error if engine version doesn't match ruby version for MRI" do - gemfile <<-G - source "file://#{gem_repo1}" - ruby "1.8.7", :engine => 'ruby', :engine_version => '1.2.4' - - gem "foo" - G - - bundle_ruby - expect(exitstatus).not_to eq(0) if exitstatus - - bundle_ruby - expect(out).to include("ruby_version must match the :engine_version for MRI") - end - - it "should print if no ruby version is specified" do - gemfile <<-G - source "file://#{gem_repo1}" - - gem "foo" - G - - bundle_ruby - - expect(out).to include("No ruby version specified") - end - end - - context "when using patchlevel" do - it "returns the ruby version" do - gemfile <<-G - source "file://#{gem_repo1}" - ruby "1.9.3", :patchlevel => '429', :engine => 'ruby', :engine_version => '1.9.3' - - gem "foo" - G - - bundle_ruby - - expect(out).to include("ruby 1.9.3p429") - end - - it "handles an engine" do - gemfile <<-G - source "file://#{gem_repo1}" - ruby "1.9.3", :patchlevel => '392', :engine => 'jruby', :engine_version => '1.7.4' - - gem "foo" - G - - bundle_ruby - - expect(out).to include("ruby 1.9.3p392 (jruby 1.7.4)") - end - end -end diff --git a/spec/other/major_deprecation_spec.rb b/spec/other/major_deprecation_spec.rb index ce2735ba94..e8de574c79 100644 --- a/spec/other/major_deprecation_spec.rb +++ b/spec/other/major_deprecation_spec.rb @@ -31,14 +31,6 @@ RSpec.describe "major deprecations", :bundler => "< 2" do bundle! "install" end - describe "bundle_ruby" do - it "prints a deprecation" do - bundle_ruby - warnings.gsub! "\nruby #{RUBY_VERSION}", "" - expect(warnings).to have_major_deprecation "the bundle_ruby executable has been removed in favor of `bundle platform --ruby`" - end - end - describe "Bundler" do describe ".clean_env" do it "is deprecated in favor of .unbundled_env" do diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb index 9126256f8e..af6b1c556a 100644 --- a/spec/support/helpers.rb +++ b/spec/support/helpers.rb @@ -174,11 +174,6 @@ module Spec bundle(cmd, options) end - def bundle_ruby(options = {}) - options["bundle_bin"] = bindir.join("bundle_ruby") - bundle("", options) - end - def ruby(ruby, options = {}) env = (options.delete(:env) || {}).map {|k, v| "#{k}='#{v}' " }.join ruby = ruby.gsub(/["`\$]/) {|m| "\\#{m}" } |