diff options
author | Ryan Davis <ryand@zenspider.com> | 2011-02-05 13:27:03 -0800 |
---|---|---|
committer | Ryan Davis <ryand@zenspider.com> | 2011-02-05 13:27:03 -0800 |
commit | a280db387dfc9e5331fa6ee9a292e89d4dfa912e (patch) | |
tree | 913fbaa1112889001a1a3bdaa72dc51f5fe718ba /bin | |
parent | 6f502db95869c15169ab5539de568ab6b8094f43 (diff) | |
download | hoe-a280db387dfc9e5331fa6ee9a292e89d4dfa912e.tar.gz |
- Fixed sow when passed no args. [erikh]
+ Sow now creates all template directories before dealing with anything else
[git-p4: depot-paths = "//src/hoe/dev/": change = 6152]
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/sow | 33 |
1 files changed, 20 insertions, 13 deletions
@@ -6,6 +6,8 @@ require 'hoe' require 'fileutils' require 'erb' +XIF = 'FI' + 'X' # prevents extra hits on my TAG reporter + option = { :style => "default", :subdir => nil, @@ -18,7 +20,9 @@ def check_subdir end end -OptionParser.new do |opts| +opts = OptionParser.new do |opts| + opts.banner = "Usage: sow [options] project_name" + opts.separator "Standard options:" opts.on("-t", "--trunk", "Add project to subdir under 'trunk'.") do @@ -39,25 +43,20 @@ OptionParser.new do |opts| puts opts exit end -end.parse! +end + +opts.parse! # TODO: fail if both dev and trunk include FileUtils::Verbose -project = ARGV.shift - -abort "Project #{project} seems to exist" if test ?d, project - # variables for erb: -XIF = 'FI' + 'X' # prevents extra hits on my TAG reporter -project, file_name, klass = Hoe.normalize_names project -template_dir = File.expand_path("~/.hoe_template") -template_path = File.join template_dir, option[:style] -source_path = File.join(File.dirname(File.dirname(__FILE__)), - "template") +template_dir = File.expand_path("~/.hoe_template") +template_path = File.join template_dir, option[:style] +source_path = File.join(File.dirname(File.dirname(__FILE__)), "template") +default_dir = File.join template_dir, "default" -default_dir = File.join template_dir, "default" if File.directory? template_dir and not File.directory? default_dir then warn "Detected old #{template_dir}" warn "Moving to #{default_dir}" @@ -69,6 +68,7 @@ end unless File.directory? template_path then warn "Creating missing #{option[:style]} template." + FileUtils.mkdir_p File.dirname(template_path) FileUtils.cp_r source_path, template_path paths = (Dir["#{template_path}/**/*"] + Dir["#{template_path}/**/.*"]).select { |f| File.file? f } @@ -76,6 +76,13 @@ unless File.directory? template_path then FileUtils.chmod 0755, paths.grep(/bin\//) end +project = ARGV.shift + +abort opts.to_s unless project +abort "Project #{project} seems to exist" if test ?d, project + +project, file_name, klass = Hoe.normalize_names project + FileUtils.cp_r template_path, project Dir.chdir project do |