Permalink
Fetching contributors…
Cannot retrieve contributors at this time
34 lines (26 sloc) 1.15 KB
sym_prefix = ENV["PREFIX"] || ".."
def git_clone(type)
if File.exist? subproject.name then $stderr.puts "#{subproject.name} already exists"
else sh "git clone #{subproject.send type} #{subproject.name}"
end
end
task :gitignore do
files = File.read(".gitignore").split "\n"
files += Subproject.names
File.open(".gitignore", "w") { |f| f.puts files.uniq.sort.join("\n") }
end
project_namespace :setup do
desc "sets up %s as symlink (from #{File.expand_path sym_prefix}, change by setting PATH)"
project_task :symlink => :gitignore do
target = File.join sym_prefix, subproject.name
if File.exist? subproject.name then $stderr.puts "#{subproject.name} already exists"
elsif not File.exist? target then $stderr.puts "#{target} does not exist"
else ln_sf target, subproject.name
end
end
desc "clone read-write version of %s github repo"
project_task(:read_write => :gitignore) { git_clone :private_remote }
desc "clone read-only version of %s github repo"
project_task(:read_only => :gitignore) { git_clone :public_remote }
project_task(:check) { raise "#{subproject.name} is missing" unless File.exist? subproject.name }
end