jekyll 3.9.1 → 4.0.0.pre.alpha1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +27 -50
  3. data/LICENSE +1 -1
  4. data/README.markdown +46 -17
  5. data/lib/blank_template/_config.yml +3 -0
  6. data/lib/blank_template/_layouts/default.html +12 -0
  7. data/lib/blank_template/_sass/main.scss +9 -0
  8. data/lib/blank_template/assets/css/main.scss +4 -0
  9. data/lib/blank_template/index.md +8 -0
  10. data/lib/jekyll.rb +5 -0
  11. data/lib/jekyll/cache.rb +183 -0
  12. data/lib/jekyll/cleaner.rb +2 -1
  13. data/lib/jekyll/collection.rb +78 -8
  14. data/lib/jekyll/command.rb +31 -6
  15. data/lib/jekyll/commands/build.rb +11 -20
  16. data/lib/jekyll/commands/clean.rb +2 -0
  17. data/lib/jekyll/commands/doctor.rb +15 -8
  18. data/lib/jekyll/commands/help.rb +1 -1
  19. data/lib/jekyll/commands/new.rb +37 -39
  20. data/lib/jekyll/commands/new_theme.rb +30 -28
  21. data/lib/jekyll/commands/serve.rb +46 -80
  22. data/lib/jekyll/commands/serve/live_reload_reactor.rb +6 -10
  23. data/lib/jekyll/commands/serve/servlet.rb +9 -11
  24. data/lib/jekyll/configuration.rb +26 -26
  25. data/lib/jekyll/converters/identity.rb +18 -0
  26. data/lib/jekyll/converters/markdown.rb +49 -40
  27. data/lib/jekyll/converters/markdown/kramdown_parser.rb +1 -10
  28. data/lib/jekyll/converters/smartypants.rb +34 -14
  29. data/lib/jekyll/convertible.rb +11 -13
  30. data/lib/jekyll/deprecator.rb +1 -3
  31. data/lib/jekyll/document.rb +44 -41
  32. data/lib/jekyll/drops/collection_drop.rb +2 -3
  33. data/lib/jekyll/drops/document_drop.rb +2 -1
  34. data/lib/jekyll/drops/drop.rb +3 -6
  35. data/lib/jekyll/drops/excerpt_drop.rb +4 -0
  36. data/lib/jekyll/drops/site_drop.rb +4 -13
  37. data/lib/jekyll/drops/unified_payload_drop.rb +1 -0
  38. data/lib/jekyll/drops/url_drop.rb +1 -0
  39. data/lib/jekyll/entry_filter.rb +2 -1
  40. data/lib/jekyll/excerpt.rb +45 -34
  41. data/lib/jekyll/external.rb +10 -5
  42. data/lib/jekyll/filters.rb +72 -31
  43. data/lib/jekyll/filters/date_filters.rb +6 -3
  44. data/lib/jekyll/filters/grouping_filters.rb +1 -2
  45. data/lib/jekyll/filters/url_filters.rb +6 -1
  46. data/lib/jekyll/frontmatter_defaults.rb +35 -19
  47. data/lib/jekyll/hooks.rb +2 -3
  48. data/lib/jekyll/liquid_extensions.rb +0 -2
  49. data/lib/jekyll/liquid_renderer.rb +13 -1
  50. data/lib/jekyll/liquid_renderer/file.rb +14 -3
  51. data/lib/jekyll/liquid_renderer/table.rb +67 -65
  52. data/lib/jekyll/log_adapter.rb +5 -1
  53. data/lib/jekyll/page.rb +10 -11
  54. data/lib/jekyll/page_without_a_file.rb +0 -4
  55. data/lib/jekyll/plugin.rb +5 -11
  56. data/lib/jekyll/plugin_manager.rb +2 -0
  57. data/lib/jekyll/reader.rb +38 -8
  58. data/lib/jekyll/readers/data_reader.rb +7 -9
  59. data/lib/jekyll/readers/layout_reader.rb +2 -12
  60. data/lib/jekyll/readers/post_reader.rb +29 -17
  61. data/lib/jekyll/readers/static_file_reader.rb +1 -1
  62. data/lib/jekyll/readers/theme_assets_reader.rb +7 -5
  63. data/lib/jekyll/regenerator.rb +4 -12
  64. data/lib/jekyll/renderer.rb +14 -25
  65. data/lib/jekyll/site.rb +78 -34
  66. data/lib/jekyll/static_file.rb +47 -11
  67. data/lib/jekyll/stevenson.rb +2 -3
  68. data/lib/jekyll/tags/highlight.rb +22 -52
  69. data/lib/jekyll/tags/include.rb +22 -38
  70. data/lib/jekyll/tags/link.rb +11 -7
  71. data/lib/jekyll/tags/post_url.rb +17 -16
  72. data/lib/jekyll/theme.rb +12 -23
  73. data/lib/jekyll/theme_builder.rb +91 -89
  74. data/lib/jekyll/url.rb +3 -2
  75. data/lib/jekyll/utils.rb +5 -4
  76. data/lib/jekyll/utils/ansi.rb +1 -1
  77. data/lib/jekyll/utils/exec.rb +0 -1
  78. data/lib/jekyll/utils/internet.rb +2 -4
  79. data/lib/jekyll/utils/platforms.rb +8 -8
  80. data/lib/jekyll/utils/thread_event.rb +1 -5
  81. data/lib/jekyll/utils/win_tz.rb +1 -1
  82. data/lib/jekyll/version.rb +1 -1
  83. data/lib/site_template/.gitignore +2 -0
  84. data/lib/site_template/404.html +1 -0
  85. data/lib/site_template/_config.yml +17 -5
  86. data/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb +5 -1
  87. data/lib/site_template/{about.md → about.markdown} +0 -0
  88. data/lib/site_template/{index.md → index.markdown} +0 -0
  89. data/lib/theme_template/gitignore.erb +1 -0
  90. data/rubocop/jekyll/assert_equal_literal_actual.rb +149 -0
  91. metadata +85 -51
  92. data/lib/jekyll/converters/markdown/rdiscount_parser.rb +0 -37
  93. data/lib/jekyll/converters/markdown/redcarpet_parser.rb +0 -112
  94. data/lib/jekyll/utils/rouge.rb +0 -22
@@ -3,7 +3,7 @@
3
3
  module Jekyll
4
4
  # Handles the cleanup of a site's destination before it is built.
5
5
  class Cleaner
6
- HIDDEN_FILE_REGEX = %r!\/\.{1,2}$!
6
+ HIDDEN_FILE_REGEX = %r!\/\.{1,2}$!.freeze
7
7
  attr_reader :site
8
8
 
9
9
  def initialize(site)
@@ -45,6 +45,7 @@ module Jekyll
45
45
 
46
46
  Utils.safe_glob(site.in_dest_dir, ["**", "*"], File::FNM_DOTMATCH).each do |file|
47
47
  next if file =~ HIDDEN_FILE_REGEX || file =~ regex || dirs.include?(file)
48
+
48
49
  files << file
49
50
  end
50
51
 
@@ -35,7 +35,7 @@ module Jekyll
35
35
  def method_missing(method, *args, &blck)
36
36
  if docs.respond_to?(method.to_sym)
37
37
  Jekyll.logger.warn "Deprecation:",
38
- "#{label}.#{method} should be changed to #{label}.docs.#{method}."
38
+ "#{label}.#{method} should be changed to #{label}.docs.#{method}."
39
39
  Jekyll.logger.warn "", "Called by #{caller(0..0)}."
40
40
  docs.public_send(method.to_sym, *args, &blck)
41
41
  else
@@ -58,13 +58,14 @@ module Jekyll
58
58
  filtered_entries.each do |file_path|
59
59
  full_path = collection_dir(file_path)
60
60
  next if File.directory?(full_path)
61
+
61
62
  if Utils.has_yaml_header? full_path
62
63
  read_document(full_path)
63
64
  else
64
65
  read_static_file(file_path, full_path)
65
66
  end
66
67
  end
67
- docs.sort!
68
+ sort_docs!
68
69
  end
69
70
 
70
71
  # All the entries in this collection.
@@ -73,6 +74,7 @@ module Jekyll
73
74
  # relative to the collection's directory
74
75
  def entries
75
76
  return [] unless exists?
77
+
76
78
  @entries ||=
77
79
  Utils.safe_glob(collection_dir, ["**", "*"], File::FNM_DOTMATCH).map do |entry|
78
80
  entry["#{collection_dir}/"] = ""
@@ -86,6 +88,7 @@ module Jekyll
86
88
  # Returns a list of filtered entry paths.
87
89
  def filtered_entries
88
90
  return [] unless exists?
91
+
89
92
  @filtered_entries ||=
90
93
  Dir.chdir(directory) do
91
94
  entry_filter.filter(entries).reject do |f|
@@ -124,6 +127,7 @@ module Jekyll
124
127
  # is stored on the filesystem.
125
128
  def collection_dir(*files)
126
129
  return directory if files.empty?
130
+
127
131
  site.in_source_dir(container, relative_directory, *files)
128
132
  end
129
133
 
@@ -149,7 +153,7 @@ module Jekyll
149
153
  #
150
154
  # Returns the inspect string
151
155
  def inspect
152
- "#<Jekyll::Collection @label=#{label} docs=#{docs}>"
156
+ "#<#{self.class} @label=#{label} docs=#{docs}>"
153
157
  end
154
158
 
155
159
  # Produce a sanitized label name
@@ -207,17 +211,83 @@ module Jekyll
207
211
  @container ||= site.config["collections_dir"]
208
212
  end
209
213
 
210
- private
211
-
212
214
  def read_document(full_path)
213
215
  doc = Document.new(full_path, :site => site, :collection => self)
214
216
  doc.read
215
- if site.unpublished || doc.published?
216
- docs << doc
217
+ docs << doc if site.unpublished || doc.published?
218
+ end
219
+
220
+ def sort_docs!
221
+ if metadata["order"].is_a?(Array)
222
+ rearrange_docs!
223
+ elsif metadata["sort_by"].is_a?(String)
224
+ sort_docs_by_key!
225
+ else
226
+ docs.sort!
217
227
  end
218
228
  end
219
229
 
220
- private
230
+ # A custom sort function based on Schwartzian transform
231
+ # Refer https://byparker.com/blog/2017/schwartzian-transform-faster-sorting/ for details
232
+ def sort_docs_by_key!
233
+ meta_key = metadata["sort_by"]
234
+ # Modify `docs` array to cache document's property along with the Document instance
235
+ docs.map! { |doc| [doc.data[meta_key], doc] }.sort! do |apples, olives|
236
+ order = determine_sort_order(meta_key, apples, olives)
237
+
238
+ # Fall back to `Document#<=>` if the properties were equal or were non-sortable
239
+ # Otherwise continue with current sort-order
240
+ if order.zero? || order.nil?
241
+ apples[-1] <=> olives[-1]
242
+ else
243
+ order
244
+ end
245
+
246
+ # Finally restore the `docs` array with just the Document objects themselves
247
+ end.map!(&:last)
248
+ end
249
+
250
+ def determine_sort_order(sort_key, apples, olives)
251
+ apple_property, apple_document = apples
252
+ olive_property, olive_document = olives
253
+
254
+ if apple_property.nil? && !olive_property.nil?
255
+ order_with_warning(sort_key, apple_document, 1)
256
+ elsif !apple_property.nil? && olive_property.nil?
257
+ order_with_warning(sort_key, olive_document, -1)
258
+ else
259
+ apple_property <=> olive_property
260
+ end
261
+ end
262
+
263
+ def order_with_warning(sort_key, document, order)
264
+ Jekyll.logger.warn "Sort warning:", "'#{sort_key}' not defined in #{document.relative_path}"
265
+ order
266
+ end
267
+
268
+ # Rearrange documents within the `docs` array as listed in the `metadata["order"]` array.
269
+ #
270
+ # Involves converting the two arrays into hashes based on relative_paths as keys first, then
271
+ # merging them to remove duplicates and finally retrieving the Document instances from the
272
+ # merged array.
273
+ def rearrange_docs!
274
+ docs_table = {}
275
+ custom_order = {}
276
+
277
+ # pre-sort to normalize default array across platforms and then proceed to create a Hash
278
+ # from that sorted array.
279
+ docs.sort.each do |doc|
280
+ docs_table[doc.relative_path] = doc
281
+ end
282
+
283
+ metadata["order"].each do |entry|
284
+ custom_order[File.join(relative_directory, entry)] = nil
285
+ end
286
+
287
+ result = Jekyll::Utils.deep_merge_hashes(custom_order, docs_table).values
288
+ result.compact!
289
+ self.docs = result
290
+ end
221
291
 
222
292
  def read_static_file(file_path, full_path)
223
293
  relative_dir = Jekyll.sanitized_path(
@@ -40,6 +40,7 @@ module Jekyll
40
40
  # Returns a full Jekyll configuration
41
41
  def configuration_from_options(options)
42
42
  return options if options.is_a?(Jekyll::Configuration)
43
+
43
44
  Jekyll.configuration(options)
44
45
  end
45
46
 
@@ -51,28 +52,52 @@ module Jekyll
51
52
  # rubocop:disable Metrics/MethodLength
52
53
  def add_build_options(cmd)
53
54
  cmd.option "config", "--config CONFIG_FILE[,CONFIG_FILE2,...]",
54
- Array, "Custom configuration file"
55
+ Array, "Custom configuration file"
55
56
  cmd.option "destination", "-d", "--destination DESTINATION",
56
- "The current folder will be generated into DESTINATION"
57
+ "The current folder will be generated into DESTINATION"
57
58
  cmd.option "source", "-s", "--source SOURCE", "Custom source directory"
58
59
  cmd.option "future", "--future", "Publishes posts with a future date"
59
60
  cmd.option "limit_posts", "--limit_posts MAX_POSTS", Integer,
60
- "Limits the number of posts to parse and publish"
61
+ "Limits the number of posts to parse and publish"
61
62
  cmd.option "watch", "-w", "--[no-]watch", "Watch for changes and rebuild"
62
63
  cmd.option "baseurl", "-b", "--baseurl URL",
63
- "Serve the website from the given base URL"
64
+ "Serve the website from the given base URL"
64
65
  cmd.option "force_polling", "--force_polling", "Force watch to use polling"
65
66
  cmd.option "lsi", "--lsi", "Use LSI for improved related posts"
66
67
  cmd.option "show_drafts", "-D", "--drafts", "Render posts in the _drafts folder"
67
68
  cmd.option "unpublished", "--unpublished",
68
- "Render posts that were marked as unpublished"
69
+ "Render posts that were marked as unpublished"
69
70
  cmd.option "quiet", "-q", "--quiet", "Silence output."
70
71
  cmd.option "verbose", "-V", "--verbose", "Print verbose output."
71
72
  cmd.option "incremental", "-I", "--incremental", "Enable incremental rebuild."
72
73
  cmd.option "strict_front_matter", "--strict_front_matter",
73
- "Fail if errors are present in front matter"
74
+ "Fail if errors are present in front matter"
74
75
  end
75
76
  # rubocop:enable Metrics/MethodLength
77
+
78
+ # Run ::process method in a given set of Jekyll::Command subclasses and suggest
79
+ # re-running the associated command with --trace switch to obtain any additional
80
+ # information or backtrace regarding the encountered Exception.
81
+ #
82
+ # cmd - the Jekyll::Command to be handled
83
+ # options - configuration overrides
84
+ # klass - an array of Jekyll::Command subclasses associated with the command
85
+ #
86
+ # Note that all exceptions are rescued..
87
+ # rubocop: disable RescueException
88
+ def process_with_graceful_fail(cmd, options, *klass)
89
+ klass.each { |k| k.process(options) if k.respond_to?(:process) }
90
+ rescue Exception => e
91
+ raise e if cmd.trace
92
+
93
+ msg = " Please append `--trace` to the `#{cmd.name}` command "
94
+ dashes = "-" * msg.length
95
+ Jekyll.logger.error "", dashes
96
+ Jekyll.logger.error "Jekyll #{Jekyll::VERSION} ", msg
97
+ Jekyll.logger.error "", " for any additional information or backtrace. "
98
+ Jekyll.logger.abort_with "", dashes
99
+ end
100
+ # rubocop: enable RescueException
76
101
  end
77
102
  end
78
103
  end
@@ -15,7 +15,7 @@ module Jekyll
15
15
 
16
16
  c.action do |_, options|
17
17
  options["serving"] = false
18
- Jekyll::Commands::Build.process(options)
18
+ process_with_graceful_fail(c, options, self)
19
19
  end
20
20
  end
21
21
  end
@@ -31,14 +31,14 @@ module Jekyll
31
31
 
32
32
  if options.fetch("skip_initial_build", false)
33
33
  Jekyll.logger.warn "Build Warning:", "Skipping the initial build." \
34
- " This may result in an out-of-date site."
34
+ " This may result in an out-of-date site."
35
35
  else
36
36
  build(site, options)
37
37
  end
38
38
 
39
39
  if options.fetch("detach", false)
40
40
  Jekyll.logger.info "Auto-regeneration:",
41
- "disabled when running server detached."
41
+ "disabled when running server detached."
42
42
  elsif options.fetch("watch", false)
43
43
  watch(site, options)
44
44
  else
@@ -54,13 +54,13 @@ module Jekyll
54
54
  # Returns nothing.
55
55
  def build(site, options)
56
56
  t = Time.now
57
- source = options["source"]
58
- destination = options["destination"]
57
+ source = File.expand_path(options["source"])
58
+ destination = File.expand_path(options["destination"])
59
59
  incremental = options["incremental"]
60
60
  Jekyll.logger.info "Source:", source
61
61
  Jekyll.logger.info "Destination:", destination
62
62
  Jekyll.logger.info "Incremental build:",
63
- (incremental ? "enabled" : "disabled. Enable with --incremental")
63
+ (incremental ? "enabled" : "disabled. Enable with --incremental")
64
64
  Jekyll.logger.info "Generating..."
65
65
  process_site(site)
66
66
  Jekyll.logger.info "", "done in #{(Time.now - t).round(3)} seconds."
@@ -76,25 +76,16 @@ module Jekyll
76
76
  # Warn Windows users that they might need to upgrade.
77
77
  if Utils::Platforms.bash_on_windows?
78
78
  Jekyll.logger.warn "",
79
- "Auto-regeneration may not work on some Windows versions."
79
+ "Auto-regeneration may not work on some Windows versions."
80
80
  Jekyll.logger.warn "",
81
- "Please see: https://github.com/Microsoft/BashOnWindows/issues/216"
81
+ "Please see: https://github.com/Microsoft/BashOnWindows/issues/216"
82
82
  Jekyll.logger.warn "",
83
- "If it does not work, please upgrade Bash on Windows or "\
84
- "run Jekyll with --no-watch."
83
+ "If it does not work, please upgrade Bash on Windows or "\
84
+ "run Jekyll with --no-watch."
85
85
  end
86
86
 
87
87
  External.require_with_graceful_fail "jekyll-watch"
88
- watch_method = Jekyll::Watcher.method(:watch)
89
- if watch_method.parameters.size == 1
90
- watch_method.call(
91
- options
92
- )
93
- else
94
- watch_method.call(
95
- options, site
96
- )
97
- end
88
+ Jekyll::Watcher.watch(options, site)
98
89
  end
99
90
  end
100
91
  end
@@ -22,10 +22,12 @@ module Jekyll
22
22
  options = configuration_from_options(options)
23
23
  destination = options["destination"]
24
24
  metadata_file = File.join(options["source"], ".jekyll-metadata")
25
+ cache_dir = File.join(options["source"], options["cache_dir"])
25
26
  sass_cache = ".sass-cache"
26
27
 
27
28
  remove(destination, :checker_func => :directory?)
28
29
  remove(metadata_file, :checker_func => :file?)
30
+ remove(cache_dir, :checker_func => :directory?)
29
31
  remove(sass_cache, :checker_func => :directory?)
30
32
  end
31
33
 
@@ -11,7 +11,7 @@ module Jekyll
11
11
  c.alias(:hyde)
12
12
 
13
13
  c.option "config", "--config CONFIG_FILE[,CONFIG_FILE2,...]", Array,
14
- "Custom configuration file"
14
+ "Custom configuration file"
15
15
 
16
16
  c.action do |_, options|
17
17
  Jekyll::Commands::Doctor.process(options)
@@ -45,22 +45,23 @@ module Jekyll
45
45
 
46
46
  def properly_gathered_posts?(site)
47
47
  return true if site.config["collections_dir"].empty?
48
+
48
49
  posts_at_root = site.in_source_dir("_posts")
49
50
  return true unless File.directory?(posts_at_root)
51
+
50
52
  Jekyll.logger.warn "Warning:",
51
- "Detected '_posts' directory outside custom `collections_dir`!"
53
+ "Detected '_posts' directory outside custom `collections_dir`!"
52
54
  Jekyll.logger.warn "",
53
- "Please move '#{posts_at_root}' into the custom directory at " \
55
+ "Please move '#{posts_at_root}' into the custom directory at " \
54
56
  "'#{site.in_source_dir(site.config["collections_dir"])}'"
55
57
  false
56
58
  end
57
59
 
58
60
  def deprecated_relative_permalinks(site)
59
61
  if site.config["relative_permalinks"]
60
- Jekyll::Deprecator.deprecation_message "Your site still uses relative" \
61
- " permalinks, which was removed in" \
62
- " Jekyll v3.0.0."
63
- return true
62
+ Jekyll::Deprecator.deprecation_message "Your site still uses relative permalinks," \
63
+ " which was removed in Jekyll v3.0.0."
64
+ true
64
65
  end
65
66
  end
66
67
 
@@ -71,6 +72,7 @@ module Jekyll
71
72
  urls = collect_urls(urls, site.posts.docs, site.dest)
72
73
  urls.each do |url, paths|
73
74
  next unless paths.size > 1
75
+
74
76
  conflicting_urls = true
75
77
  Jekyll.logger.warn "Conflict:", "The URL '#{url}' is the destination" \
76
78
  " for the following pages: #{paths.join(", ")}"
@@ -80,6 +82,7 @@ module Jekyll
80
82
 
81
83
  def fsnotify_buggy?(_site)
82
84
  return true unless Utils::Platforms.osx?
85
+
83
86
  if Dir.pwd != `pwd`.strip
84
87
  Jekyll.logger.error " " + <<-STR.strip.gsub(%r!\n\s+!, "\n ")
85
88
  We have detected that there might be trouble using fsevent on your
@@ -99,6 +102,7 @@ module Jekyll
99
102
  urls = case_insensitive_urls(site.pages + site.docs_to_write, site.dest)
100
103
  urls.each_value do |real_urls|
101
104
  next unless real_urls.uniq.size > 1
105
+
102
106
  urls_only_differ_by_case = true
103
107
  Jekyll.logger.warn "Warning:", "The following URLs only differ" \
104
108
  " by case. On a case-insensitive file system one of the URLs" \
@@ -117,6 +121,7 @@ module Jekyll
117
121
  end
118
122
 
119
123
  private
124
+
120
125
  def collect_urls(urls, things, destination)
121
126
  things.each do |thing|
122
127
  dest = thing.destination(destination)
@@ -138,6 +143,7 @@ module Jekyll
138
143
 
139
144
  def url_exists?(url)
140
145
  return true unless url.nil? || url.empty?
146
+
141
147
  Jekyll.logger.warn "Warning:", "You didn't set an URL in the config file, "\
142
148
  "you may encounter problems with some plugins."
143
149
  false
@@ -155,7 +161,8 @@ module Jekyll
155
161
  end
156
162
 
157
163
  def url_absolute(url)
158
- return true if Addressable::URI.parse(url).absolute?
164
+ return true if url.is_a?(String) && Addressable::URI.parse(url).absolute?
165
+
159
166
  Jekyll.logger.warn "Warning:", "Your site URL does not seem to be absolute, "\
160
167
  "check the value of `url` in your config file."
161
168
  false
@@ -25,7 +25,7 @@ module Jekyll
25
25
 
26
26
  def invalid_command(prog, cmd)
27
27
  Jekyll.logger.error "Error:",
28
- "Hmm... we don't know what the '#{cmd}' command is."
28
+ "Hmm... we don't know what the '#{cmd}' command is."
29
29
  Jekyll.logger.info "Valid commands:", prog.commands.keys.join(", ")
30
30
  end
31
31
  end
@@ -41,10 +41,16 @@ module Jekyll
41
41
  after_install(new_blog_path, options)
42
42
  end
43
43
 
44
+ def blank_template
45
+ File.expand_path("../../blank_template", __dir__)
46
+ end
47
+
44
48
  def create_blank_site(path)
49
+ FileUtils.cp_r blank_template + "/.", path
50
+ FileUtils.chmod_R "u+w", path
51
+
45
52
  Dir.chdir(path) do
46
- FileUtils.mkdir(%w(_layouts _posts _drafts))
47
- FileUtils.touch("index.html")
53
+ FileUtils.mkdir(%w(_data _drafts _includes _posts))
48
54
  end
49
55
  end
50
56
 
@@ -62,46 +68,38 @@ module Jekyll
62
68
  private
63
69
 
64
70
  def gemfile_contents
65
- <<-RUBY
66
- source "https://rubygems.org"
67
-
68
- # Hello! This is where you manage which Jekyll version is used to run.
69
- # When you want to use a different version, change it below, save the
70
- # file and run `bundle install`. Run Jekyll with `bundle exec`, like so:
71
- #
72
- # bundle exec jekyll serve
73
- #
74
- # This will help ensure the proper Jekyll version is running.
75
- # Happy Jekylling!
76
- gem "jekyll", "~> #{Jekyll::VERSION}"
77
-
78
- # This is the default theme for new Jekyll sites. You may change this to anything you like.
79
- gem "minima", "~> 2.0"
80
-
81
- # If you want to use GitHub Pages, remove the "gem "jekyll"" above and
82
- # uncomment the line below. To upgrade, run `bundle update github-pages`.
83
- # gem "github-pages", group: :jekyll_plugins
84
-
85
- # If you have any plugins, put them here!
86
- group :jekyll_plugins do
87
- gem "jekyll-feed", "~> 0.6"
88
- end
89
-
90
- # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
91
- # and associated library.
92
- install_if -> { RUBY_PLATFORM =~ %r!mingw|mswin|java! } do
93
- gem "tzinfo", "~> 1.2"
94
- gem "tzinfo-data"
95
- end
71
+ <<~RUBY
72
+ source "https://rubygems.org"
73
+ # Hello! This is where you manage which Jekyll version is used to run.
74
+ # When you want to use a different version, change it below, save the
75
+ # file and run `bundle install`. Run Jekyll with `bundle exec`, like so:
76
+ #
77
+ # bundle exec jekyll serve
78
+ #
79
+ # This will help ensure the proper Jekyll version is running.
80
+ # Happy Jekylling!
81
+ gem "jekyll", "~> #{Jekyll::VERSION}"
82
+ # This is the default theme for new Jekyll sites. You may change this to anything you like.
83
+ gem "minima", "~> 2.0"
84
+ # If you want to use GitHub Pages, remove the "gem "jekyll"" above and
85
+ # uncomment the line below. To upgrade, run `bundle update github-pages`.
86
+ # gem "github-pages", group: :jekyll_plugins
87
+ # If you have any plugins, put them here!
88
+ group :jekyll_plugins do
89
+ gem "jekyll-feed", "~> 0.6"
90
+ end
96
91
 
97
- # Performance-booster for watching directories on Windows
98
- gem "wdm", "~> 0.1.0", :install_if => Gem.win_platform?
92
+ # Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem
93
+ # and associated library.
94
+ install_if -> { RUBY_PLATFORM =~ %r!mingw|mswin|java! } do
95
+ gem "tzinfo", "~> 1.2"
96
+ gem "tzinfo-data"
97
+ end
99
98
 
100
- # kramdown v2 ships without the gfm parser by default. If you're using
101
- # kramdown v1, comment out this line.
102
- gem "kramdown-parser-gfm"
99
+ # Performance-booster for watching directories on Windows
100
+ gem "wdm", "~> 0.1.1", :install_if => Gem.win_platform?
103
101
 
104
- RUBY
102
+ RUBY
105
103
  end
106
104
 
107
105
  def create_site(new_blog_path)