Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Refactored the generate rake task to be more user friendly and verbose

  • Loading branch information...
commit a8319df71cabd0f38b70398f3b0a6cfefbbdbd03 1 parent 789d2ed
Adam Stacoviak authored
Showing with 11 additions and 6 deletions.
  1. +11 −6 tasks/generate.rake
View
17 tasks/generate.rake
@@ -1,9 +1,14 @@
-desc 'Start a new project (specify DIR)'
-task :generate do
- puts "Invalid directory" unless File.exists?(ENV['DIR'])
+desc 'Generate a new project at dir=foo'
- sh "git archive HEAD | (cd #{ENV['DIR']} && tar -xvf -)"
+task :generate do
+ # Generate the new 'dir' if it's not already created
+ system "mkdir #{(ENV['dir'])}" unless File.exists?(ENV['dir'])
- # remove this rake task from the new project
- sh "cd #{ENV['DIR']}; rm #{File.join("tasks", "generate.rake")}"
+ # Archive the current HEAD to 'dir'
+ system "git archive HEAD | (cd #{ENV['dir']} && tar -xvf -)"
+
+ # Remove this rake task from the newly generated project
+ system "cd #{ENV['dir']}; rm #{File.join("tasks", "generate.rake")}"
+
+ puts "\n *** A new project has been generated at: #{(ENV['dir'])} ***"
end
Please sign in to comment.
Something went wrong with that request. Please try again.