jekyll-octopod 0.18.1 → 0.18.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/octopod +35 -2
  3. data/lib/octopod/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9da6ebdac9915e6402bcda7c71a9c944ece4c004bd031220c733f49c3dfb47ec
4
- data.tar.gz: b7052cf7e51011da39291849d35b14bedfa27caca156dd09a97c7957dee1ad3c
3
+ metadata.gz: 3e95c321128dfae975297d56250d21c9f7f47183ee0a4e54aaad16dd2541d210
4
+ data.tar.gz: 7cab5b2868fece52002befdef60aa5a286fdcd87584e004cf06d3462598090f1
5
5
  SHA512:
6
- metadata.gz: 2a054d404659a2434861da157840782ba71175259f8d5bd864da5f2369e599ad3fe69ae8aae7b6b547fa80d91d24de0682d9bf925b0329e19b3abdd849c5af78
7
- data.tar.gz: 031da38de9086d544004abf870553125926d839186c6873cda4a00cab5e83161bdb973f95c3adcb1bc0798785d990bd79eb6bd1496db9bb5635ce7b371caaf2a
6
+ metadata.gz: 3331337c0ff0ee9b95376ab00899364f7032b549711bf8a6fa4e556c5d61a190fd495e08b4fa73e2847890b4a161eac4614ec6ab0f7a3cb490dc38d509d52836
7
+ data.tar.gz: 52d377821ee236e2d25e578835e742811a2aa25d93f517a7898f542c4cc23e474a5e3812fae2164c6d8e91d7ab8b893b149a6f1f15268329d74985b1ff8ae4eb
data/bin/octopod CHANGED
@@ -120,9 +120,42 @@ def remove_theme_served_path(path)
120
120
  FileUtils.rmdir(path, verbose: true) if Dir.exist?(path) && Dir.empty?(path)
121
121
  elsif !path.end_with?('.md')
122
122
  FileUtils.rm(path, verbose: true)
123
+ # Clean up now-empty parent directories this file leaves behind (e.g. img/logo/ once every
124
+ # generic favicon file under it is gone), but never touch PWD itself and never remove a
125
+ # directory that still holds real, unrelated content (a site's own photos alongside the
126
+ # generic ones, say) - Dir.empty? guards that.
127
+ parent = File.dirname(path)
128
+ while parent != PWD && Dir.exist?(parent) && Dir.empty?(parent)
129
+ FileUtils.rmdir(parent, verbose: true)
130
+ parent = File.dirname(parent)
131
+ end
123
132
  end
124
133
  end
125
134
 
135
+ # 'now_theme_served' used to list '_layouts' and 'img' wholesale, on the assumption that a legacy
136
+ # site's copies of those directories were 100% gem output. That's wrong whenever a site added its
137
+ # own files alongside them - a custom '_layouts/presentation.html' with no gem equivalent, or real
138
+ # content photos dropped into 'img/' - since a whole-directory delete has no way to tell those apart
139
+ # from the generic files it's supposed to clean up. This instead lists the theme gem's *actual*
140
+ # shipped filenames in those two directories, read from the installed jekyll-octopod-bulma gem
141
+ # itself (same reasoning as the version-constraint lookup in update_gemfile_and_theme_config: read
142
+ # from the gem so this can't drift out of sync as its shipped file list changes) - so 'update' only
143
+ # ever removes a file that's actually theme content, and leaves anything else in place.
144
+ def theme_shipped_generic_files
145
+ theme_gem_dir = begin
146
+ Gem::Specification.find_by_name('jekyll-octopod-bulma').gem_dir
147
+ rescue Gem::MissingSpecError
148
+ nil
149
+ end
150
+ return [] unless theme_gem_dir
151
+
152
+ layouts = Dir.glob(File.join(theme_gem_dir, '_layouts', '*')).map { |f| "_layouts/#{File.basename(f)}" }
153
+ img = Dir.glob(File.join(theme_gem_dir, 'assets', 'img', '**', '*'), File::FNM_DOTMATCH)
154
+ .reject { |f| File.directory?(f) }
155
+ .map { |f| f.sub("#{theme_gem_dir}/assets/", '') }
156
+ layouts + img
157
+ end
158
+
126
159
  # Points a site's Gemfile and _config.yml at jekyll-octopod-bulma instead of the old direct
127
160
  # jekyll-bulma dependency/theme setting. Mirrors the version constraint this gem itself declares on
128
161
  # jekyll-octopod-bulma (see jekyll-octopod.gemspec) rather than hardcoding one here, so it can't
@@ -371,8 +404,8 @@ if ARGV.size > 0 && (ARGV[0] == 'episode' || ARGV[0] == 'deploy' || ARGV[0] == '
371
404
  # point at it - so 'update' removes them outright, same "trust git diff, don't special-case"
372
405
  # philosophy as the rest of this command. Any '.md' file is kept no matter where it's found,
373
406
  # since that's real content, never theme boilerplate.
374
- now_theme_served = %w[
375
- _layouts podlove-player subscribe-button img favicon.ico apple-touch-icon-precomposed.png
407
+ now_theme_served = theme_shipped_generic_files + %w[
408
+ podlove-player subscribe-button favicon.ico apple-touch-icon-precomposed.png
376
409
  _includes/sidebar.html _includes/post_header.html _includes/post.html _includes/post_line.html
377
410
  _includes/disqus_thread.html _includes/disqus_count.html _includes/isso_thread.html
378
411
  ]
@@ -3,7 +3,7 @@ module Jekyll
3
3
  module VERSION #:nodoc:
4
4
  MAJOR = 0
5
5
  MINOR = 18
6
- TINY = 1
6
+ TINY = 2
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY].join('.')
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-octopod
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.1
4
+ version: 0.18.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arne Eilermann