raise ArgumentError if no args. rename sample post
This commit is contained in:
parent
b306835ce0
commit
099fcc27d6
|
@ -3,8 +3,9 @@ require 'erb'
|
||||||
module Jekyll
|
module Jekyll
|
||||||
module Commands
|
module Commands
|
||||||
class New < Command
|
class New < Command
|
||||||
|
|
||||||
def self.process(args)
|
def self.process(args)
|
||||||
|
raise ArgumentError.new('You must specify a path.') if args.empty?
|
||||||
|
|
||||||
new_blog_path = File.expand_path(args.join(" "), Dir.pwd)
|
new_blog_path = File.expand_path(args.join(" "), Dir.pwd)
|
||||||
FileUtils.mkdir_p new_blog_path
|
FileUtils.mkdir_p new_blog_path
|
||||||
|
|
||||||
|
@ -28,23 +29,22 @@ module Jekyll
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
def self.create_sample_files!(path)
|
||||||
|
FileUtils.cp_r sample_files, path
|
||||||
|
FileUtils.rm File.expand_path(scaffold_path, path)
|
||||||
|
end
|
||||||
|
|
||||||
def self.create_sample_files!(path)
|
def self.sample_files
|
||||||
FileUtils.cp_r sample_files, path
|
Dir.glob("#{template_site}/**/*")
|
||||||
FileUtils.rm File.expand_path(scaffold_path, path)
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def self.sample_files
|
def self.template_site
|
||||||
Dir.glob("#{template_site}/**/*")
|
File.expand_path("../../site_template", File.dirname(__FILE__))
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.template_site
|
def self.scaffold_path
|
||||||
File.expand_path("../../site_template", File.dirname(__FILE__))
|
"_posts/0000-00-00-welcome-to-jekyll.markdown.erb"
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.scaffold_path
|
|
||||||
"_posts/0000-00-00-sample_post.markdown.erb"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue