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,19 +83,15 @@ gem "jekyll", "#{Jekyll::VERSION}"
|
|||
RUBY
|
||||
end
|
||||
|
||||
def if_options_blank(new_blog_path, options)
|
||||
if options["blank"]
|
||||
create_blank_site new_blog_path
|
||||
else
|
||||
create_sample_files new_blog_path
|
||||
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|
|
||||
f.write(scaffold_post_content)
|
||||
end
|
||||
File.open(File.expand_path(initialized_post_name, new_blog_path), "w") do |f|
|
||||
f.write(scaffold_post_content)
|
||||
end
|
||||
|
||||
File.open(File.expand_path("Gemfile", new_blog_path), "w") do |f|
|
||||
f.write(gemfile_contents)
|
||||
end
|
||||
File.open(File.expand_path("Gemfile", new_blog_path), "w") do |f|
|
||||
f.write(gemfile_contents)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue