Skip to content
This repository has been archived by the owner on Dec 22, 2018. It is now read-only.

Commit

Permalink
Prioritise displaying help above running Puppet. Load the bundled rum…
Browse files Browse the repository at this point in the history
…p if available
  • Loading branch information
auxesis committed Apr 26, 2011
1 parent e8f384e commit 01a6c76
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions 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]

Expand Down

0 comments on commit 01a6c76

Please sign in to comment.