Skip to content

Instantly share code, notes, and snippets.

@pete
Created November 7, 2008 05:20
Show Gist options
  • Save pete/22782 to your computer and use it in GitHub Desktop.
Save pete/22782 to your computer and use it in GitHub Desktop.
diff --git a/bin/waves b/bin/waves
index 3b5d1ec..f94694a 100755
--- a/bin/waves
+++ b/bin/waves
@@ -9,14 +9,21 @@ WAVES = "#{File.dirname(__FILE__)}/.." unless defined? WAVES
waves = [
WAVES, ENV['WAVES'], './waves'
-].compact.map { |dir| File.join(dir, 'lib') }.find( &File.method( :directory? )
+].compact.map { |dir| File.join(dir, 'lib') }.find { |d|
+ File.exist? File.join( d, 'waves.rb' )
+}
if waves
$: << waves
waves = File.join( waves, 'waves' )
else
waves = 'waves'
end
-require waves
+
+begin
+ require waves
+rescue LoadError
+ require 'waves'
+end
puts "** Waves #{Waves.version} **"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment