Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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