Last active
August 29, 2015 14:06
-
-
Save estum/fce2aecd9917b6d40bda to your computer and use it in GitHub Desktop.
Textmate commands to open gems from Gemfiles and gemspecs.
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>beforeRunningCommand</key> | |
<string>nop</string> | |
<key>command</key> | |
<string>#!/usr/bin/env ruby -wU | |
unless ENV['TM_FILENAME'] =~ /^(?:Gemfile|.*\.gemspec)$/ | |
abort | |
end | |
require 'shellwords' | |
project_path = Shellwords.shellescape(ENV['TM_PROJECT_DIRECTORY']) | |
line = ENV['TM_CURRENT_LINE'].strip | |
if /(?:gem|add\w*_dependency) +['"](?<gem_name>[\w-]+)['"]/i =~ line | |
system '/bin/bash', '-l', '-c', %{cd #{project_path}; open `gem specification #{gem_name} homepage --marshal | ruby -e 'puts Marshal.load(gets)'`} | |
end | |
puts nil</string> | |
<key>input</key> | |
<string>line</string> | |
<key>inputFormat</key> | |
<string>text</string> | |
<key>keyEquivalent</key> | |
<string>$</string> | |
<key>name</key> | |
<string>Open gem homepage</string> | |
<key>outputCaret</key> | |
<string>afterOutput</string> | |
<key>outputFormat</key> | |
<string>text</string> | |
<key>outputLocation</key> | |
<string>discard</string> | |
<key>scope</key> | |
<string>source.ruby</string> | |
<key>uuid</key> | |
<string>FF4CC9C1-E91B-485B-B0AF-C431802EB38F</string> | |
<key>version</key> | |
<integer>2</integer> | |
</dict> | |
</plist> |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>beforeRunningCommand</key> | |
<string>nop</string> | |
<key>command</key> | |
<string>#!/usr/bin/env ruby -wU | |
unless ENV['TM_FILENAME'] =~ /^(?:Gemfile|.*\.gemspec)$/ | |
abort | |
end | |
require 'shellwords' | |
project_path = Shellwords.shellescape(ENV['TM_PROJECT_DIRECTORY']) | |
line = ENV['TM_CURRENT_LINE'].strip | |
if /(?:gem|add\w*_dependency) +['"](?<gem_name>[\w-]+)['"]/i =~ line | |
spawn '/bin/bash', '-l', '-c', %{cd #{project_path}; mate \"$(gem contents #{gem_name} --show-install-dir)\" --no-wait} | |
end | |
exit</string> | |
<key>input</key> | |
<string>line</string> | |
<key>inputFormat</key> | |
<string>text</string> | |
<key>keyEquivalent</key> | |
<string>$</string> | |
<key>name</key> | |
<string>Open gem in editor</string> | |
<key>outputCaret</key> | |
<string>afterOutput</string> | |
<key>outputFormat</key> | |
<string>text</string> | |
<key>outputLocation</key> | |
<string>discard</string> | |
<key>scope</key> | |
<string>source.ruby</string> | |
<key>uuid</key> | |
<string>F16D4451-D239-4556-9355-14CF2D5E93FD</string> | |
<key>version</key> | |
<integer>2</integer> | |
</dict> | |
</plist> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment