summaryrefslogtreecommitdiff
path: root/lib/bundler08/commands/exec_command.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bundler08/commands/exec_command.rb')
-rw-r--r--lib/bundler08/commands/exec_command.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/lib/bundler08/commands/exec_command.rb b/lib/bundler08/commands/exec_command.rb
new file mode 100644
index 0000000000..15e98c80cc
--- /dev/null
+++ b/lib/bundler08/commands/exec_command.rb
@@ -0,0 +1,36 @@
+if exec = ARGV.index("exec")
+ $command = ARGV[(exec + 1)..-1]
+ ARGV.replace ARGV[0..exec]
+end
+
+class Gem::Commands::ExecCommand < Gem::Command
+
+ def initialize
+ super('exec', 'Run a command in context of a gem bundle', {:manifest => nil})
+
+ add_option('-m', '--manifest MANIFEST', "Specify the path to the manifest file") do |manifest, options|
+ options[:manifest] = manifest
+ end
+ end
+
+ def usage
+ "#{program_name} COMMAND"
+ end
+
+ def arguments # :nodoc:
+ "COMMAND command to run in context of the gem bundle"
+ end
+
+ def description # :nodoc:
+ <<-EOF.gsub(' ', '')
+ Run in context of a bundle
+ EOF
+ end
+
+ def execute
+ # Prevent the bundler from getting required unless it is actually being used
+ require 'bundler08'
+ Bundler::CLI.run(:exec, options)
+ end
+
+end \ No newline at end of file