Created
January 14, 2011 15:31
-
-
Save macournoyer/779735 to your computer and use it in GitHub Desktop.
Reveal in GitHub TextMate command
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Reveal in GitHub TextMate command | |
require 'pathname' | |
path = Pathname.new(ENV["TM_FILEPATH"]).relative_path_from(Pathname.new(ENV["TM_PROJECT_DIRECTORY"])) | |
repo_path = `/usr/local/bin/git remote show origin`[/Fetch URL: git@(.*)\.git$/, 1].tr(":", "/") | |
branch = `/usr/local/bin/git symbolic-ref HEAD`[/refs\/heads\/(.*)$/, 1] | |
exec "open 'http://#{repo_path}/blob/#{branch}/#{path}'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment