Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Rictyフォントを入れる用に作ったRakefile(Mac専用)
# -*- coding: utf-8 -*-
# Rictyフォントを入れるための手順をまとめた、自分用のRakefileです。
# Ricty http://save.sys.t.u-tokyo.ac.jp/~yusa/fonts/ricty.html
#
# Rakefileのフォーマット http://www.kyobashi.org/hf/RakeUserGuide/?RakefileFormat
#
# 2012/11/05 taktamur@gmail.com
# clean/clobberについては http://www2s.biglobe.ne.jp/~idesaku/sss/tech/rake/
require 'rake/clean'
CLEAN.include("Inconsolata.otf",
"migu-1m-bold.ttf",
"migu-1m-regular.ttf",
"migu-1m.zip",
"Ricty-3.2.0.zip",
"Ricty-3.2.0" )
CLOBBER.include( "Ricty-Bold.ttf",
"Ricty-Regular.ttf",
"RictyDiscord-Bold.ttf",
"RictyDiscord-Regular.ttf")
desc "Inconsolata.otf の取得"
# http://levien.com/type/myfonts/inconsolata.html のOpenFontFile
file "Inconsolata.otf" do
sh "curl http://levien.com/type/myfonts/Inconsolata.otf -o Inconsolata.otf"
end
desc "Migu 1M の取得"
# http://mix-mplus-ipa.sourceforge.jp
file "migu-1m.zip" do
sh "curl -L 'http://sourceforge.jp/frs/redir.php?m=jaist&f=%2Fmix-mplus-ipa%2F57240%2Fmigu-1m-20121030.zip' -o migu-1m.zip"
end
desc "Migu 1Mフォントの展開"
rule ".ttf" => "migu-1m.zip" do |t|
sh "unzip -j migu-1m.zip migu-1m-20121030/#{t.name}"
end
# インストール済みかどうかをチェックする
def isNotInstalled name
if open("| which #{name} 2>/dev/null"){|f| f.gets}
then
puts "#{name} is installed."
return false
else
puts "#{name} is not installed."
return true
end
end
desc "FontForgeのインストール macportsを利用"
task :fontforge do
sh "sudo port install fontforge" if isNotInstalled( "fontforge")
end
desc "Ricty生成スクリプトのダウンロード"
file "Ricty-3.2.0/ricty_generator.sh" do
sh "curl -L https://github.com/yascentur/Ricty/archive/3.2.0.zip -o Ricty-3.2.0.zip"
sh "unzip Ricty-3.2.0.zip"
end
desc "Rictyフォントの生成"
task :default => [:fontforge,"Ricty-3.2.0/ricty_generator.sh",
"Inconsolata.otf", "migu-1m-bold.ttf", "migu-1m-regular.ttf" ] do
sh "sh Ricty-3.2.0/ricty_generator.sh auto"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment