summaryrefslogtreecommitdiff
path: root/exe
diff options
context:
space:
mode:
authorSamuel E. Giddins <segiddins@segiddins.me>2015-07-06 17:25:18 -0700
committerSamuel E. Giddins <segiddins@segiddins.me>2015-07-15 18:39:52 -0700
commit3abb8229d46993c59c70eb44d6bbd80f55287345 (patch)
tree8a7d5d8f1a4e85ff0b200aee821b5262a76789f7 /exe
parent3a889f0214345f91686cc6a804b49a042eaca824 (diff)
downloadbundler-3abb8229d46993c59c70eb44d6bbd80f55287345.tar.gz
Add new binstubs for rake and rspec in bin, move executables to exe
Diffstat (limited to 'exe')
-rwxr-xr-xexe/bundle21
-rwxr-xr-xexe/bundle_ruby58
-rwxr-xr-xexe/bundler21
3 files changed, 100 insertions, 0 deletions
diff --git a/exe/bundle b/exe/bundle
new file mode 100755
index 0000000000..89c823eae3
--- /dev/null
+++ b/exe/bundle
@@ -0,0 +1,21 @@
+#!/usr/bin/env ruby
+
+# Exit cleanly from an early interrupt
+Signal.trap("INT") { exit 1 }
+
+require 'bundler'
+# Check if an older version of bundler is installed
+$LOAD_PATH.each do |path|
+ if path =~ %r'/bundler-0\.(\d+)' && $1.to_i < 9
+ 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
+end
+
+require 'bundler/friendly_errors'
+Bundler.with_friendly_errors do
+ require 'bundler/cli'
+ Bundler::CLI.start(ARGV, :debug => true)
+end
diff --git a/exe/bundle_ruby b/exe/bundle_ruby
new file mode 100755
index 0000000000..d0cfdc2778
--- /dev/null
+++ b/exe/bundle_ruby
@@ -0,0 +1,58 @@
+#!/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
+
+STDERR.puts "Warning: bundle_ruby will be deprecated in Bundler 2.0.0."
+
+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/exe/bundler b/exe/bundler
new file mode 100755
index 0000000000..89c823eae3
--- /dev/null
+++ b/exe/bundler
@@ -0,0 +1,21 @@
+#!/usr/bin/env ruby
+
+# Exit cleanly from an early interrupt
+Signal.trap("INT") { exit 1 }
+
+require 'bundler'
+# Check if an older version of bundler is installed
+$LOAD_PATH.each do |path|
+ if path =~ %r'/bundler-0\.(\d+)' && $1.to_i < 9
+ 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
+end
+
+require 'bundler/friendly_errors'
+Bundler.with_friendly_errors do
+ require 'bundler/cli'
+ Bundler::CLI.start(ARGV, :debug => true)
+end