-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRakefile
More file actions
54 lines (43 loc) · 1.33 KB
/
Rakefile
File metadata and controls
54 lines (43 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Rakefile for wtsnjp/platexcheat
require 'rake/clean'
require 'pathname'
# basics
PKG_VERSION = "3.1"
PKG_NAME = "platexcheat-#{PKG_VERSION}"
# woking/temporaly dirs
REPO_ROOT = Pathname.pwd
TMP_DIR = REPO_ROOT + "tmp"
# cleaning
CLEAN.include(["*.aux", "*.dvi", "*.log", "*.synctex.gz", "tmp"])
CLOBBER.include(["*.pdf", "*.zip"])
# deault
task default: :doc
desc "Typeset all contents"
task :doc do
sh "llmk"
end
desc "Create an archive for CTAN"
task :ctan => :doc do
# initialize the target
TARGET_DIR = TMP_DIR + PKG_NAME
rm_rf TARGET_DIR
mkdir_p TARGET_DIR
# copy all required files
pkg_files = ["LICENSE", "README.md", Dir.glob("*.tex"), Dir.glob("*.pdf")].flatten
cp pkg_files, TARGET_DIR
# add short English introduction to the README.md
intro_en = <<~INTRO
# pLaTeX2e cheat sheet
This is a translation to Japanese of Winston Chang's LaTeX cheat sheet (a reference sheet for writing scientific papers). It has been adapted to Japanese standards using pLaTeX, and also attached additional information of "standard LaTeX" (especially about math-mode).
INTRO
File.open(TARGET_DIR + "README.md", "r+") do |f|
content = f.read
f.seek 0
f.write intro_en + "\n"
f.write content
end
# create zip archive
cd TMP_DIR
sh "zip -q -r #{PKG_NAME}.zip #{PKG_NAME}"
mv "#{PKG_NAME}.zip", REPO_ROOT
end