diff options
author | SHIBATA Hiroshi <hsbt@ruby-lang.org> | 2018-11-20 12:28:17 +0900 |
---|---|---|
committer | SHIBATA Hiroshi <hsbt@ruby-lang.org> | 2018-11-20 12:28:17 +0900 |
commit | 778d5e0ce8f7a5794160a9623c5057286754e306 (patch) | |
tree | f3e5dd311e20f774234b1b84780937655fafdd0c | |
parent | f160d15fe4e1cb25fad6a34ed9abd10b21f587f8 (diff) | |
download | bundler-778d5e0ce8f7a5794160a9623c5057286754e306.tar.gz |
Removed exe/bundle_ruby and its example.
-rwxr-xr-x | exe/bundle_ruby | 60 | ||||
-rw-r--r-- | spec/other/bundle_ruby_spec.rb | 155 | ||||
-rw-r--r-- | spec/support/helpers.rb | 5 |
3 files changed, 0 insertions, 220 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/support/helpers.rb b/spec/support/helpers.rb index 98a4096216..ee5f6fc44d 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}" } |