[TxMt] What is wrong with this script?

Tommy Nordgren tommy.nordgren at comhem.se
Sun Apr 12 21:23:12 UTC 2009


#!/usr/bin/ruby -w

require "#{ENV['TM_SUPPORT_PATH']}/lib/setuplibs"
require 'svn_diff_directory'
require 'shellwords'
#require 'exit_codes'

def get_dirs()
   dirs = []
   if ENV['TM_SELECTED_FILES']
     dirs = Shellwords.shellwords(ENV['TM_SELECTED_FILES']).delete_if  
{ |file|
       (! File.directory?(file)) or (! File.directory?(file+'/.svn'))
     }
   end
   if dirs.empty? and ENV['TM_PROJECT_DIRECTORY']
     dirs = [ENV['TM_PROJECT_DIRECTORY']].delete_if { |file|
       (! File.directory?(file)) or (! File.directory?(file+'/.svn'))
     }
   end
   if dirs.empty?
     TextMate.exit_show_tool_tip "Neither the selected directories nor  
the Project directory are versioned"
   end
   dirs
end

STDOUT.sync = true
dirs = get_dirs()

dirs.each() { |d|
   Dir.chdir(d)
   svn = ENV['TM_SVN']? ENV['TM_SVN']:'svn'

   puts `#{svn} diff -r 1 .`
}

This script is supposed to generate a full svn diff for the currently  
selected directory.
However, it generates no output.
I've set input to none, and output to new document
------------------------------------------------------
"Home is not where you are born, but where your heart finds peace" -
Tommy Nordgren, "The dying old crone"
tommy.nordgren at comhem.se





More information about the textmate mailing list