Skip to content

Commit

Permalink
オリジナル言語を作る : Domain-Specific Languages #86
Browse files Browse the repository at this point in the history
・16.9 内部DSLの実例

EFROR-73
  • Loading branch information
k2works committed Aug 29, 2017
1 parent fee3cd6 commit 55f45de
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions lib/tasks/pack_rat.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#
# 私の音楽コレクション用ディレクトリ
#
OldiesDir = '/home/russ/oldies'
NewiesDir = '/home/russ/newies'

#
# バックアップ用ディレクトリ
#
BackupDir = '/tmp/backup'

#
# コピー用の一意なディレクトリ名
#
timestamp=Time.new.to_s.tr(" :", "_")

#
# rakeタスク
#
task :default => [:backup_oldies, :backup_newies]

task :backup_oldies do
backup_dir = File.join(BackupDir, timestamp, OldiesDir)
mkdir_p File.dirname(backup_dir)
cp_r OldiesDir, backup_dir
end

task :backup_newies do
backup_dir = File.join(BackupDir, timestamp, NewiesDir)
mkdir_p File.dirname(backup_dir)
cp_r NewiesDir, backup_dir
end

0 comments on commit 55f45de

Please sign in to comment.