Refactor if/else for new.rb process method
This commit is contained in:
parent
465e7dd8b0
commit
b64b6aa526
|
@ -28,7 +28,11 @@ module Jekyll
|
|||
"#{new_blog_path} exists and is not empty."
|
||||
end
|
||||
|
||||
if_options_blank(new_blog_path, options)
|
||||
if options["blank"]
|
||||
create_blank_site new_blog_path
|
||||
else
|
||||
create_site new_blog_path
|
||||
end
|
||||
|
||||
Jekyll.logger.info "New jekyll site installed in #{new_blog_path}."
|
||||
end
|
||||
|
@ -79,10 +83,7 @@ gem "jekyll", "#{Jekyll::VERSION}"
|
|||
RUBY
|
||||
end
|
||||
|
||||
def if_options_blank(new_blog_path, options)
|
||||
if options["blank"]
|
||||
create_blank_site new_blog_path
|
||||
else
|
||||
def create_site(new_blog_path)
|
||||
create_sample_files new_blog_path
|
||||
|
||||
File.open(File.expand_path(initialized_post_name, new_blog_path), "w") do |f|
|
||||
|
@ -93,7 +94,6 @@ RUBY
|
|||
f.write(gemfile_contents)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def preserve_source_location?(path, options)
|
||||
!options["force"] && !Dir["#{path}/**/*"].empty?
|
||||
|
|
Loading…
Reference in New Issue