[TxMt] Ruby (Un)Comment command

Chris Thomas chris at cjack.com
Wed Dec 22 16:55:37 UTC 2004


If Ruby 1.8 isn't installed in /usr/bin, you'll need to specify the 
full path to it. Ruby's default install location is /usr/local, so I'd 
guess that you need:

  /usr/local/bin/ruby -s ...

Or, you could try pasting this compatibility code in at the top of the 
file:

  require 'rbconfig'

  major = Config::CONFIG['MAJOR'].to_i
  minor = Config::CONFIG['MINOR'].to_i

  # Check for Ruby less than 1.7
  if (major < 2) and (minor < 7) then
  class File
  def File.extname(str)
  m = /.*\./.match(File.basename(str))
  if m != nil; then "." + m.post_match ; else "" ; end
  end
  end
  end

Chris

On Dec 22, 2004, at 9:17 AM, William D. Neumann wrote:



> I'm trying to get the ruby version of the (Un)comment command running 
> on my box, and I'm getting the following error:
>
> /Users/wneuman/Library/Dev/TextMate/comment.rb:1: undefined method 
> `extname' for File:Class (NameError)
>
> You say that the script requires Ruby 1.8, and I should be fine there 
> as I've got 1.8.1 installed...
>
> Of course, the amount of Ruby I know would fit handily in my back 
> pocket -- even if I had stuffed my back pocket full of marbles. 
> handkercheifs, and gum wrappers beforehand, so I might just be doing 
> something stupid here. Any ideas on how to fix this?
>
> William D. Neumann
>
>
> ---
>
> "There's just so many extra children, we could just feed the
> children to these tigers. We don't need them, we're not doing anything 
> with them.
>
> Tigers are noble and sleek; children are loud and messy."
>
>  -- Neko Case
>
>  Think of XML as Lisp for COBOL programmers.
>
>  -- Tony-A (some guy on /.)
> _______________________________________________
> textmate mailing list
> textmate at lists.macromates.com
> http://lists.macromates.com/mailman/listinfo/textmate
>



More information about the textmate mailing list