Skip to content
This repository has been archived by the owner on Nov 2, 2019. It is now read-only.

Commit

Permalink
Only call Bundler.setup, if the scripts are being ran from a git repo.
Browse files Browse the repository at this point in the history
  • Loading branch information
postmodern committed Jul 7, 2012
1 parent 1bb5d32 commit f063526
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 15 deletions.
22 changes: 17 additions & 5 deletions bin/furnace-avm2
@@ -1,12 +1,24 @@
#!/usr/bin/env ruby

require "rubygems"
begin
require "bundler/setup"
rescue LoadError

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

$: << File.join(File.dirname(__FILE__), '..', 'lib')
lib_dir = File.join(root_dir,'lib')
$LOAD_PATH << lib_dir unless $LOAD_PATH.include?(lib_dir)

require "trollop"
require "furnace-avm2"
Expand Down Expand Up @@ -238,4 +250,4 @@ if opts[:output]
File.open(opts[:output], "w") do |file|
abc.write(file)
end
end
end
22 changes: 17 additions & 5 deletions bin/furnace-avm2-decompiler
@@ -1,12 +1,24 @@
#!/usr/bin/env ruby

require "rubygems"
begin
require "bundler/setup"
rescue LoadError

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

$: << File.join(File.dirname(__FILE__), '..', 'lib')
lib_dir = File.join(root_dir,'lib')
$LOAD_PATH << lib_dir unless $LOAD_PATH.include?(lib_dir)

require "trollop"
require "furnace-avm2"
Expand Down Expand Up @@ -215,4 +227,4 @@ unless opts[:no_output]
puts code.gsub(/ +$/, '')
puts
end
end
end
22 changes: 17 additions & 5 deletions bin/furnace-avm2-shell
@@ -1,12 +1,24 @@
#!/usr/bin/env ruby

require "rubygems"
begin
require "bundler/setup"
rescue LoadError

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

$: << File.join(File.dirname(__FILE__), '..', 'lib')
lib_dir = File.join(root_dir,'lib')
$LOAD_PATH << lib_dir unless $LOAD_PATH.include?(lib_dir)

require "furnace-avm2"

Expand All @@ -33,4 +45,4 @@ end
# > abc = load_file("filename.abc")
# Records can be examined via #to_hash.

binding.pry
binding.pry

0 comments on commit f063526

Please sign in to comment.