Created
October 15, 2008 11:24
-
-
Save youpy/16893 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
config | |
This file contains hidden or 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
require 'rake' | |
include FileUtils::Verbose | |
SRC = FileList.new | |
Dir.glob(File.join('config', '**', '*'), File::FNM_DOTMATCH).each do |path| | |
if File.file?(path) && path !~ /\.svn/ | |
SRC.add(path) | |
end | |
end | |
DST = SRC.gsub(/^config/, '') | |
SRC.zip(DST) do |src, dst| | |
desc "Deploy #{dst}" | |
file dst => src do | |
cp src, dst | |
end | |
end | |
desc "Add file (rake add FILE=filename)" | |
task :add do | |
dst = ENV['FILE'] | |
raise "Not a file" unless File.file?(dst) | |
src = File.join('config', dst) | |
mkdir_p File.dirname(src) | |
cp dst, src | |
end | |
desc "Remove file (rake remove FILE=filename)" | |
task :remove do | |
SRC.zip(DST) do |src, dst| | |
if ENV['FILE'] == dst | |
rm src | |
break | |
end | |
end | |
end | |
desc "List files under management" | |
task :list do | |
puts DST.join("\n") | |
end | |
task :default => DST |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment