From 551f8b751fbe1da8c920ecfd81cf747ce3c1ed74 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Thu, 18 Feb 2016 16:56:39 -0800 Subject: [PATCH] `jekyll new` should create a Gemfile which is educational --- lib/jekyll/commands/new.rb | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/lib/jekyll/commands/new.rb b/lib/jekyll/commands/new.rb index 433d33b7..0af8553b 100644 --- a/lib/jekyll/commands/new.rb +++ b/lib/jekyll/commands/new.rb @@ -35,6 +35,10 @@ module Jekyll 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 end Jekyll.logger.info "New jekyll site installed in #{new_blog_path}." @@ -59,6 +63,27 @@ module Jekyll end private + + def gemfile_contents + <<-RUBY +source 'https://rubygems.org' + +# Hello! This is where you manage which Jekyll version is used to run. +# When you wwant to use a different version, change it below, save the +# file and run `bundle install`. Run Jekyll with `bundle exec`, like so: +# +# bundle exec jekyll serve +# +# This will help ensure the proper Jekyll version is running. +# Happy Jekylling! +gem 'jekyll', '#{Jekyll::VERSION}' + +# If you have any plugins, put them here! +# group :jekyll_plugins do +# gem 'jekyll-github-metadata', '~> 1.0' +# end +RUBY + end def preserve_source_location?(path, options) !options["force"] && !Dir["#{path}/**/*"].empty?