1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/env ruby

require "#{ENV['TM_SUPPORT_PATH']}/lib/progress"

TextMate.call_with_progress({ }) do
  path = ENV['TM_DROPPED_FILE']
  file = File.basename(path)
  date = Time.now.strftime("%Y-%m-%d")

  dst = "images/blog/#{date}_#{file}"
  %x{ scp "#{path}" "mm:mm/#{dst}" }

  alt = file.split('.').first.gsub(/[_-]/, ' ').gsub(/\w+/) { |m| m.capitalize }
  print "![#{alt}](http://macromates.com/#{dst})"
end