But there is more easy way.
By chance I came across Martin Fowler article about the magic rake utility, used for building projects in ruby. More fifteen minutes of ruby functions googling and voila:
require 'rake'
require 'find'
task :default => :copychanges
task :copychanges do
print "all done"
end
Find.find('src/') do |srcfile|
target = srcfile.sub(/^src/,'data')
changes = srcfile.sub(/^src/,'changes')
file target => srcfile do
if test(?f, srcfile)
cp srcfile, target cp srcfile, changes
else
mkdir_p target mkdir_p changes
end
end
task :copychanges => target
end
Make changes in the folder src/, store the copy in the folder data/, by rake command new changes are moved to the folder changes.
No comments:
Post a Comment