Added a --blank command which scaffolds empty files.

This commit is contained in:
zachgersh 2013-06-02 13:21:41 -07:00
parent 58dacf796f
commit a21031eae9
2 changed files with 7 additions and 0 deletions

View File

@ -38,6 +38,7 @@ command :new do |c|
c.description = 'Creates a new Jekyll site scaffold in PATH'
c.option '--force', 'Force creation even if PATH already exists'
c.option '--blank', 'Creates scaffolding but with empty files'
c.action do |args, options|
Jekyll::Commands::New.process(args, options.__hash__)

View File

@ -18,6 +18,12 @@ module Jekyll
File.open(File.expand_path(self.initialized_post_name, new_blog_path), "w") do |f|
f.write(self.scaffold_post_content(site_template))
end
if options[:blank]
files_to_clear = Dir.glob("#{new_blog_path}/**/*.*")
files_to_clear.each {|file| File.truncate("#{file}", 0)}
end
puts "New jekyll site installed in #{new_blog_path}."
end