#! /usr/bin/env ruby

# * George Moschovitis  <gm@navel.gr>
# (c) 2004-2005 Navel, all rights reserved.
# $Id$

require 'fileutils'

$NITRO_NO_ENVIRONMENT = true

require 'nitro'

# gmosx, TODO: move to a library

def ll_r(path, &block)
  Dir.foreach(path) do |f|
		next if [".", ".."].include?(f)  
		fullname = path + "/" + f
		yield(fullname) 
		ll_r(fullname, &block) if FileTest.directory?fullname and not FileTest.symlink?fullname
  end
end

proto_dir = File.join(Nitro::LibPath, '..', 'proto')

if base_dir = ARGV[0]

# remove the trailing '/' if it exists. 

base_dir = base_dir.gsub(/\/$/, '')

# the following code is win32 compatible.

FileUtils.cp_r proto_dir, base_dir
ll_r(base_dir) { |f| FileUtils.rm_rf(f) if /\.svn$/ =~ f } 

else

puts %{
USAGE:
	nitrogen base_dir
}

end
