Skip to content

Instantly share code, notes, and snippets.

@timuruski
Created August 3, 2011 00:06
Show Gist options
  • Select an option

  • Save timuruski/1121577 to your computer and use it in GitHub Desktop.

Select an option

Save timuruski/1121577 to your computer and use it in GitHub Desktop.
A TextMate command for opening your project's Gemfile
#!/usr/bin/env ruby
require 'pathname'
def find_gemfile(path)
path = Pathname.new(path).parent
gemfile_path = Pathname.new("Gemfile")
unless path.root?
path.entries.include?(gemfile_path) ? path + gemfile_path : find_gemfile(path)
end
end
gemfile = find_gemfile(ENV['TM_FILEPATH'])
exec %Q{open "txmt://open?url=file://#{gemfile}"} if gemfile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment