Refactor if/else for new.rb process method

This commit is contained in:
TheLucasMoore 2016-05-13 15:10:59 -05:00
parent 465e7dd8b0
commit b64b6aa526
1 changed files with 12 additions and 12 deletions

View File

@ -28,7 +28,11 @@ module Jekyll
"#{new_blog_path} exists and is not empty." "#{new_blog_path} exists and is not empty."
end 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}." Jekyll.logger.info "New jekyll site installed in #{new_blog_path}."
end end
@ -79,19 +83,15 @@ gem "jekyll", "#{Jekyll::VERSION}"
RUBY RUBY
end end
def if_options_blank(new_blog_path, options) def create_site(new_blog_path)
if options["blank"] create_sample_files new_blog_path
create_blank_site new_blog_path
else
create_sample_files new_blog_path
File.open(File.expand_path(initialized_post_name, new_blog_path), "w") do |f| File.open(File.expand_path(initialized_post_name, new_blog_path), "w") do |f|
f.write(scaffold_post_content) f.write(scaffold_post_content)
end end
File.open(File.expand_path("Gemfile", new_blog_path), "w") do |f| File.open(File.expand_path("Gemfile", new_blog_path), "w") do |f|
f.write(gemfile_contents) f.write(gemfile_contents)
end
end end
end end