Skip to content

Instantly share code, notes, and snippets.

@felinebabies
Created August 29, 2016 17:00
Show Gist options
  • Select an option

  • Save felinebabies/51e9e668c30cb2fd2647342d6c741810 to your computer and use it in GitHub Desktop.

Select an option

Save felinebabies/51e9e668c30cb2fd2647342d6c741810 to your computer and use it in GitHub Desktop.
middlemanのビルド結果をgithubpages用ブランチにミラーリングしてtortoisegitのコミット画面を開く
# coding: utf-8
require 'bundler'
Bundler.require
Dotenv.load
currentdir = File.dirname(__FILE__)
builddir = File.join(currentdir, "build")
deploydir = ENV["DEPLOYDIR"]
if(!deploydir) then
puts "DEPLOYDIRが未指定です"
exit
end
tortoisegitexe = ENV["TORTOISEGITPATH"]
if(!tortoisegitexe) then
puts "TORTOISEGITPATHが未指定です"
exit
end
# 現在のmiddlemanプロジェクトをビルドする
print `bundle exec middleman build`
# 指定ディレクトリにビルドファイルをミラーリングする
rbsync = RbSync.new
rbsync.sync(builddir, deploydir)
# tortoisegitのコミット画面を開く
`\"#{tortoisegitexe}\" /command:commit /path:\"#{deploydir}\"`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment