Added a --blank command which scaffolds empty files.
This commit is contained in:
parent
58dacf796f
commit
a21031eae9
|
@ -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__)
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue