public
Description: Rubinius, the Ruby VM
Homepage: http://rubini.us
Clone URL: git://github.com/evanphx/rubinius.git
Search Repo:
Modify loader to look for #{$:.first}/bin/<command> directly
evanphx (author)
Fri Jun 06 00:30:31 -0700 2008
commit  e8505a517ce1a694bcaafc1383310321552b4d2a
tree    e075bb3b847c1645c29e25edcccc396f2aef43fe
parent  c03b8e5b42ffd50c32a2f8f1f68e2a10846dc9df
...
79
80
81
 
 
 
82
83
84
...
108
109
110
111
112
113
114
115
116
...
226
227
228
229
230
 
 
231
232
233
234
235
 
 
 
236
237
238
...
253
254
255
256
 
 
 
 
 
 
 
257
258
259
...
79
80
81
82
83
84
85
86
87
...
111
112
113
 
 
 
114
115
116
...
226
227
228
 
 
229
230
231
 
 
 
 
232
233
234
235
236
237
...
252
253
254
 
255
256
257
258
259
260
261
262
263
264
0
@@ -79,6 +79,9 @@ if ENV['RUBYLIB'] and not ENV['RUBYLIB'].empty? then
0
   $LOAD_PATH.unshift(*ENV['RUBYLIB'].split(':'))
0
 end
0
 
0
+# Pull it out now so that later unshifts don't obsure it.
0
+main_lib = $LOAD_PATH.first
0
+
0
 # Allow system wide code preloading
0
 
0
 ['/etc/rbxrc',"#{ENV['HOME']}/.rbxrc",ENV['RBX_PRELOAD']].each do |file|
0
@@ -108,9 +111,6 @@ Options:
0
   -rlibrary Require library before execution.
0
   -w Enable warnings. (currently does nothing--compatibility)
0
   -v Display the version and set $VERBOSE to true.
0
- --shark Wait for Shark to start after loading Rubinius.
0
- --valgrind Execute under the watchful eyes of Valgrind.
0
- --dtrace Wait for DTrace to start after loading Rubinius.
0
 END
0
 
0
 $VERBOSE = false
0
@@ -226,13 +226,12 @@ begin
0
         puts "Unable to find '#{arg}'"
0
         exit! 1
0
       else
0
- prog = "bin/#{arg}"
0
- begin
0
+ prog = File.join main_lib, "bin", arg
0
+ if File.exists? prog
0
           $0 = prog
0
- require prog
0
- rescue LoadError => e
0
- puts "Unable to find program '#{arg}' ('#{prog}'): #{e.message} (#{e.class})"
0
- exit! 1
0
+ load prog
0
+ else
0
+ raise LoadError, "Unable to find a script '#{arg}' to run"
0
         end
0
       end
0
     end
0
@@ -253,7 +252,13 @@ begin
0
       unless ran or version_requested
0
         repr = ENV['RBX_REPR'] || "bin/irb"
0
         $0 = repr
0
- require repr
0
+ prog = File.join main_lib, repr
0
+ begin
0
+ load prog
0
+ rescue LoadError => e
0
+ STDERR.puts "Unable to find repr named '#{repr}' to load."
0
+ exit 1
0
+ end
0
       end
0
     else
0
       $0 = "(eval)"

Comments

    No one has commented yet.