From 0e75f189004e3d33006f50a549948f3d95366fd7 Mon Sep 17 00:00:00 2001 From: Stefan Lance Date: Fri, 20 Mar 2015 15:04:42 -0500 Subject: [PATCH] Remove bundle_ruby --- bin/bundle_ruby | 56 ------------- spec/other/bundle_ruby_spec.rb | 142 --------------------------------- spec/support/helpers.rb | 17 ---- 3 files changed, 215 deletions(-) delete mode 100755 bin/bundle_ruby delete mode 100644 spec/other/bundle_ruby_spec.rb diff --git a/bin/bundle_ruby b/bin/bundle_ruby deleted file mode 100755 index 1e02c57501d..00000000000 --- a/bin/bundle_ruby +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env ruby - -Signal.trap("INT") { exit 1 } - -require 'bundler/ruby_version' -require 'bundler/ruby_dsl' -require 'bundler/shared_helpers' - -module Bundler - class GemfileError < RuntimeError; end - 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") { |f| f.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, &blk) - 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 739c3d0ffba..00000000000 --- a/spec/other/bundle_ruby_spec.rb +++ /dev/null @@ -1,142 +0,0 @@ -require "spec_helper" - -describe "bundle_ruby" 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 eq("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 eq("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 eq("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 eq("ruby 1.8.7 (rbx 1.2.4)") - 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 :exitstatus => true - expect(exitstatus).not_to eq(0) if exitstatus - - bundle_ruby - expect(out).to eq("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 :exitstatus => true - expect(exitstatus).not_to eq(0) if exitstatus - - bundle_ruby - expect(out).to eq("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 :exitstatus => true - expect(exitstatus).not_to eq(0) if exitstatus - - bundle_ruby - expect(out).to eq("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 eq("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 eq("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 eq("ruby 1.9.3p392 (jruby 1.7.4)") - end - end -end diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb index e5774f12a33..089ae583d2a 100644 --- a/spec/support/helpers.rb +++ b/spec/support/helpers.rb @@ -76,23 +76,6 @@ def bundle(cmd, options = {}) sys_exec(cmd, expect_err){|i| yield i if block_given? } end - def bundle_ruby(options = {}) - expect_err = options.delete(:expect_err) - options["no-color"] = true unless options.key?("no-color") - - bundle_bin = File.expand_path('../../../bin/bundle_ruby', __FILE__) - - requires = options.delete(:requires) || [] - requires << File.expand_path('../fakeweb/'+options.delete(:fakeweb)+'.rb', __FILE__) if options.key?(:fakeweb) - requires << File.expand_path('../artifice/'+options.delete(:artifice)+'.rb', __FILE__) if options.key?(:artifice) - requires_str = requires.map{|r| "-r#{r}"}.join(" ") - - env = (options.delete(:env) || {}).map{|k, v| "#{k}='#{v}' "}.join - cmd = "#{env}#{Gem.ruby} -I#{lib} #{requires_str} #{bundle_bin}" - - sys_exec(cmd, expect_err){|i| yield i if block_given? } - end - def ruby(ruby, options = {}) expect_err = options.delete(:expect_err) env = (options.delete(:env) || {}).map{|k, v| "#{k}='#{v}' "}.join