Permalink
Browse files

Rewrite binaries so that they "require 'yard'"

  • Loading branch information...
lsegal committed Jan 10, 2012
1 parent 00e17a8 commit 313d7f8b21b02842bd0a7d76132350f9e36cc997
Showing with 28 additions and 4 deletions.
  1. +9 −1 bin/yard
  2. +9 −1 bin/yardoc
  3. +10 −2 bin/yri
View
@@ -1,4 +1,12 @@
#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../lib/yard'
+
+# We do all this work just to find the proper load path
+path = __FILE__
+while File.symlink?(path)
+ path = File.expand_path(File.readlink(__FILE__), File.dirname(__FILE__))
+end
+$:.unshift(File.join(File.dirname(File.expand_path(path)), '..', 'lib'))
+
+require 'yard'
YARD::CLI::CommandParser.run(*ARGV)
View
@@ -1,4 +1,12 @@
#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../lib/yard'
+
+# We do all this work just to find the proper load path
+path = __FILE__
+while File.symlink?(path)
+ path = File.expand_path(File.readlink(__FILE__), File.dirname(__FILE__))
+end
+$:.unshift(File.join(File.dirname(File.expand_path(path)), '..', 'lib'))
+
+require 'yard'
YARD::CLI::Yardoc.run(*ARGV)
View
12 bin/yri
@@ -1,4 +1,12 @@
#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../lib/yard'
-YARD::CLI::YRI.run(*ARGV)
+# We do all this work just to find the proper load path
+path = __FILE__
+while File.symlink?(path)
+ path = File.expand_path(File.readlink(__FILE__), File.dirname(__FILE__))
+end
+$:.unshift(File.join(File.dirname(File.expand_path(path)), '..', 'lib'))
+
+require 'yard'
+
+YARD::CLI::YRI.run(*ARGV)

0 comments on commit 313d7f8

Please sign in to comment.