<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -20,18 +20,19 @@ OptionParser.new do |opts|
   end
 end.parse!
 
-APPLICATION_COMMANDS = %w(status start stop restart unmonitor quit)
+APPLICATION_COMMANDS = %w(status start stop restart unmonitor quit log)
 
 controller = Bluepill::Controller.new(options.slice(:base_dir))
 
-if controller.list.include?(ARGV.first)
+if controller.running_applications.include?(ARGV.first)
+  # the first arg is the application name
   options[:application] = ARGV.shift 
 elsif APPLICATION_COMMANDS.include?(ARGV.first)
-  if controller.list.length == 1
-    options[:application] = controller.list.first
-  elsif controller.list.length &gt; 1
-    $stderr.puts &quot;You must specify an application name. Here's the list:&quot;
-    controller.list.each_with_index do |app, index|
+  if controller.running_applications.length == 1
+    options[:application] = controller.running_applications.first
+  elsif controller.running_applications.length &gt; 1
+    $stderr.puts &quot;You must specify an application name. Here's the list of running applications:&quot;
+    controller.running_applications.each_with_index do |app, index|
       $stderr.puts &quot;  #{index + 1}. #{app}&quot;
     end
     $stderr.puts &quot;Usage: bluepill [app] cmd [options]&quot;
@@ -47,20 +48,23 @@ options[:command] = ARGV.shift
 case options[:command]
 when &quot;load&quot;
   file = ARGV.shift
-  eval(File.read(file))
-  
+  if File.exists?(file)
+    eval(File.read(file))
+  else
+    $stderr.puts &quot;Can't find file: #{file}&quot;
+  end
 when &quot;log&quot;
   orig_pattern = pattern = ARGV.shift
   pattern = controller.send_cmd(options[:application], :grep_pattern, pattern)
   
   cmd = &quot;tail -n 100 -f #{options[:log_file]} | grep -E '#{pattern}'&quot;
-  cmd = &quot;echo 'Tailing log for #{orig_pattern}...'; #{cmd}&quot;
+  puts &quot;Tailing log for #{orig_pattern}...&quot;
   Kernel.exec(cmd)
 
 when *APPLICATION_COMMANDS
   process_or_group_name = ARGV.shift
   puts controller.send_cmd(options[:application], options[:command], process_or_group_name)
-
+  
 else
   puts &quot;Unknown command `%s` (or application `%s` has not been loaded yet)&quot; % [options[:command], options[:command]]
 end
\ No newline at end of file</diff>
      <filename>bin/bluepill</filename>
    </modified>
    <modified>
      <diff>@@ -14,12 +14,19 @@ module Bluepill
       cleanup
     end
     
-    def list
+    def running_applications
       Dir[File.join(sockets_dir, &quot;*.sock&quot;)].map{|x| File.basename(x, &quot;.sock&quot;)}
     end
     
+    def send_cmd(application, command, *args)
+      applications[application] ||= Application.new(application, {:base_dir =&gt; base_dir})
+      applications[application].send(command.to_sym, *args.compact)
+    end
+    
+    private
+    
     def cleanup
-      self.list.each do |app|
+      self.running_applications.each do |app|
         pid = pid_for(app)
         if !pid || !alive?(pid)
           pid_file = File.join(self.pids_dir, &quot;#{app}.pid&quot;)
@@ -30,19 +37,11 @@ module Bluepill
       end
     end
     
-    def send_cmd(application, command, *args)
-      applications[application] ||= Application.new(application, {:base_dir =&gt; base_dir})
-      applications[application].send(command.to_sym, *args.compact)
-    end
-    
-    private
-    
     def pid_for(app)
       pid_file = File.join(self.pids_dir, &quot;#{app}.pid&quot;)
       File.exists?(pid_file) &amp;&amp; File.read(pid_file).to_i
     end
     
-    
     def alive?(pid)
       begin
         ::Process.kill(0, pid)</diff>
      <filename>lib/bluepill/controller.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>f72d323d98d58ee58482816f7b33b5914395f6cd</id>
    </parent>
  </parents>
  <author>
    <name>Arya Asemanfar</name>
    <email>arya.asemanfar@gmail.com</email>
  </author>
  <url>http://github.com/arya/bluepill/commit/a86d5a238f1783782624bc37ecc5aad3fd9bc23c</url>
  <id>a86d5a238f1783782624bc37ecc5aad3fd9bc23c</id>
  <committed-date>2009-11-06T14:30:41-08:00</committed-date>
  <authored-date>2009-11-06T14:30:41-08:00</authored-date>
  <message>cleaned up bin a little bit</message>
  <tree>fe781753118ad5ae2d1032d7b22fa10faa5a82d4</tree>
  <committer>
    <name>Arya Asemanfar</name>
    <email>arya.asemanfar@gmail.com</email>
  </committer>
</commit>
