Skip to content

Instantly share code, notes, and snippets.

@henrik
Created October 21, 2009 07:55
Show Gist options
  • Save henrik/214959 to your computer and use it in GitHub Desktop.
Save henrik/214959 to your computer and use it in GitHub Desktop.
TextMate command to deploy a Jekyll site through a tasks/deploy shell script.
<?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>bundleUUID</key>
<string>C9BD1ADE-4FD9-4842-A641-DFB373B7D42C</string>
<key>command</key>
<string>#!/usr/bin/env ruby
%w{ui web_preview escape exit_codes}.each { |lib| require "%s/lib/%s" % [ENV['TM_SUPPORT_PATH'], lib] }
confirmed = TextMate::UI.request_confirmation(
:title =&gt; "About to deploy Jekyll.",
:prompt =&gt; "Please confirm.",
:button1 =&gt; "Deploy")
if confirmed
Dir.chdir ENV["TM_PROJECT_DIRECTORY"]
html_header("Deploying Jekyll…", ENV["TM_PROJECT_DIRECTORY"])
IO.popen("tasks/deploy") do |pipe|
pipe.each_with_index do |line, index|
puts %{&lt;p id="line-#{index}" style="margin:0"&gt;#{htmlize line}&lt;/p&gt;}
puts %{&lt;script&gt;location.hash = "#line-#{index}";&lt;/script&gt;}
STDOUT.flush
end
end
puts %{&lt;p id="done" style="color:#0c0; font-weight:bold; margin-top:2em"&gt;Done!&lt;/p&gt;}
puts %{&lt;script&gt;location.hash = "#done";&lt;/script&gt;}
html_footer
else
TextMate.exit_discard
end
</string>
<key>input</key>
<string>none</string>
<key>keyEquivalent</key>
<string>^@j</string>
<key>name</key>
<string>Deploy</string>
<key>output</key>
<string>showAsHTML</string>
<key>uuid</key>
<string>E1AFD717-CE39-492E-8BEF-BB11505BACAC</string>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment