carto/build/carto.tmbundle/Commands/preview.tmCommand

41 lines
1.1 KiB
Plaintext
Raw Normal View History

2011-02-08 04:22:46 +08:00
<?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
2011-02-08 04:22:46 +08:00
2011-05-12 06:27:50 +08:00
nvmdir = File.expand_path('~/.nvm')
localdir = "/usr/local/bin/"
2011-05-12 06:27:50 +08:00
if File.directory?nvmdir then
cartos = Dir.glob(nvmdir + '/*/bin/mapnik-render.js')
carto = cartos.pop() if cartos
node = carto.gsub('/bin/mapnik-render.js', '/bin/node')
elsif File.exist?localdir + "mapnik-render.js"
carto = localdir + "mapnik-render.js"
node = localdir + "node"
2011-05-12 06:27:50 +08:00
end
2011-05-12 06:27:50 +08:00
if carto
`#{node} #{carto} #{ENV['TM_FILEPATH']} /tmp/test.png`
else
puts 'node and mapnik-render.js could not be found'
2011-05-12 06:27:50 +08:00
end
</string>
2011-02-08 04:22:46 +08:00
<key>input</key>
<string>none</string>
<key>keyEquivalent</key>
<string>^~@p</string>
<key>name</key>
<string>Preview</string>
2011-02-08 04:22:46 +08:00
<key>output</key>
<string>showAsHTML</string>
<key>scope</key>
<string>source.mml</string>
<key>uuid</key>
<string>4A0B3C2B-5F11-4D70-AFF4-EC4A4A042D66</string>
</dict>
</plist>