middleman-blog + LinCastor

fukayatsu Advent Calendar 2013 - #24

middleman-blogでローカル環境のみでmy-blog://new?name=sushiのようなリンクを埋込み、
LinCastorでそれをhandlingするようにした。

LinCastorは任意のapple script/shell/appの実行ができるので、応用範囲が広そう。

エディタに関しては、asuth/subl-handlerを使っている。

LinCastorの設定

(* apple script *)
on handle_url(args)
    tell application "iTerm"
        activate
        try
            set _session to current session of current terminal
        on error
            set _term to (make new terminal)
            tell _term
                launch session "Default"
                set _session to current session
            end tell
        end try

        tell _session
            write text "cd " & |URL_QUERY_DIR| of args
            write text "clear"
            write text "git st"
        end tell
    end tell
end handle_url
#!/usr/local/bin/zsh

source ~/.zshrc
cd /Users/fukayatsu/github/fukayatsu.github.io

if [[ $URL_HOST = new ]]; then
  bundle exec middleman article $URL_QUERY_NAME
elif [[ $URL_HOST = publish ]]; then
  git checkout source
  git add .
  git commit -m "Update Posts [button]"
  git push origin source
else
  exit 1
fi

exit 0