-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
オリジナル言語を作る : Domain-Specific Languages #86
・16.9 内部DSLの実例 EFROR-73
- Loading branch information
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |