From 01a6c769feafec0b57321b976aec1b87bad7b2ec Mon Sep 17 00:00:00 2001 From: Lindsay Holmwood Date: Tue, 26 Apr 2011 21:08:19 +0100 Subject: [PATCH] Prioritise displaying help above running Puppet. Load the bundled rump if available --- bin/rump | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/bin/rump b/bin/rump index a754004..c1f6629 100755 --- a/bin/rump +++ b/bin/rump @@ -1,18 +1,28 @@ #!/usr/bin/env ruby -begin - require 'rump' -rescue LoadError - $: << File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib')) - require 'rump' -end +require 'pathname' +# Show the man page if ARGV.any? {|arg| arg =~ /help|--help|-h/} root = Pathname.new(File.dirname(__FILE__)).parent.expand_path command = "man #{root + 'man' + 'rump.1'}" exec(command) end +# If we are running from the root of a Rump/Puppet repo, load the bundled rump. +rump_binstub = Pathname.new(Dir.pwd) + 'bin' + 'rump' +if rump_binstub.exist? + load rump_binstub +end + +# Otherwise, load rump from a gem as per usual. +begin + require 'rump' +rescue LoadError + $: << File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib')) + require 'rump' +end + command = ARGV.first arguments = ARGV[1..-1]