bin/new_app.rb in nitro-0.6.0 vs bin/new_app.rb in nitro-0.7.0
- old
+ new
@@ -2,25 +2,47 @@
# = New Project Wizzard
#
# Creates the directory structure for a new project.
#
-#--
# code:
-# George Moschovitis <gm@navel.gr>
+# * George Moschovitis <gm@navel.gr>
#
# (c) 2004 Navel, all rights reserved.
-# $Id: new_app.rb 188 2004-12-10 14:14:17Z gmosx $
-#++
+# $Id: new_app.rb 194 2004-12-20 20:23:57Z gmosx $
+require 'fileutils'
+
+# 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
+
bin_dir = File.dirname(__FILE__)
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 "#{bin_dir}/proto", base_dir
+ll_r(base_dir) { |f| FileUtils.rm_rf(f) if /\.svn$/ =~ f }
+
+=begin
+Unix implementation
%x{
cp -R #{bin_dir}/proto #{base_dir}
find #{base_dir} | grep "\.svn$" | xargs rm -rf
}
+=end
else
puts %{
USAGE: