diff --git a/Rakefile b/Rakefile index 569cc91..7e0429c 100644 --- a/Rakefile +++ b/Rakefile @@ -60,13 +60,18 @@ namespace :styles do end -desc "Generate a new project at dir=foo" -task :generate do - # Generate the new 'dir' if it's not already created - system "mkdir #{(ENV['dir'])}" unless File.exists?(ENV['dir']) +# NOTE: if using zsh shell, call task as following to have zsh avoid the [] +# rake 'generate[~/path/myproject]' +desc "Generate a new project at given path/to/project" +task :generate, [:project_path] do |t, args| + args.with_defaults(:project_path => "demo-serve") + folder = args[:project_path] + + # Generate the new 'folder' if it's not already created + system "mkdir #{folder}" unless File.exists?(folder) - # Archive the current HEAD to 'dir' - system "git archive HEAD | (cd #{ENV['dir']} && tar -xvf -)" + # Archive the current HEAD to 'folder' + system "git archive HEAD | (cd #{folder} && tar -xvf -)" - puts "\n *** A new project has been generated at: #{(ENV['dir'])} ***" + puts "\n *** A new project has been generated at: '#{folder}' ***" end \ No newline at end of file