Permalink
Browse files

Only call Bundler.setup if someone is running furnace-swf from a git …

…clone.
  • Loading branch information...
1 parent 484fa67 commit b05e9feaf9d07e33f409f3546df35b41158c53e5 @postmodern postmodern committed Jul 7, 2012
Showing with 18 additions and 3 deletions.
  1. +18 −3 bin/furnace-swf
View
@@ -1,9 +1,24 @@
#!/usr/bin/env ruby
require "rubygems"
-require "bundler/setup"
-$: << File.join(File.dirname(__FILE__), '..', 'lib')
+root_dir = File.expand_path(File.join(File.dirname(__FILE__),'..'))
+if File.directory?(File.join(root_dir,'.git'))
+ Dir.chdir(root_dir) do |path|
+ require 'bundler'
+
+ begin
+ Bundler.setup(:default)
+ rescue Bundler::BundlerError => e
+ warn e.message
+ warn "Run `bundle install` to install missing gems"
+ exit e.status_code
+ end
+ end
+end
+
+lib_dir = File.join(root_dir,'lib')
+$LOAD_PATH << lib_dir unless $LOAD_PATH.include?(lib_dir)
require "trollop"
require "furnace-swf"
@@ -93,4 +108,4 @@ when 'abcreplace'
puts "Tag #{subopts[:name].inspect} was not found"
exit 1
end
-end
+end

0 comments on commit b05e9fe

Please sign in to comment.