jekyll-octopod 0.16.1 → 0.17.0

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 +46 -2
  3. data/lib/octopod/version.rb +2 -2
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1e97c76791da4caf394541907199b2009985f42854b547c8644321d057f1ca36
4
- data.tar.gz: 0e0b22eba05771002edc86a2894dbae32fa67ad1bda9d9b348b601d5c794b006
3
+ metadata.gz: 7d33c0f33b30138d1e974e99cd5823ee64e35de94210b180b8d2fa5c34c5bece
4
+ data.tar.gz: d4e7c2abaf6ba064c022ed455b0ac077716bd6e36fbfd005b1d90b94c992c705
5
5
  SHA512:
6
- metadata.gz: b5bef749f76e82144d8b4755339710ff8a87392e8bfea9f0c30899c7fbc67c22913c6f4b100a0ad2a05b91f68a2817d1759ca7a52c169c1370dd0e123e248601
7
- data.tar.gz: 65125e024416c0d9218ca8543fc4c641fd1dbefa1af2d9b2f9ba67a3a7f875825ef08be5adf5c711c2d47ed2c034843fe709d2714e1da792e5661ce5f285ebc3
6
+ metadata.gz: a66245f2206986d49d319fd4edd0384123cddcf5964229564c108ba35955c132af238ca8c55f52972a4926f6a997fea9442266a29efc439062854efde4c5e960
7
+ data.tar.gz: a21441985a2cdbfe4f2ebaa6571c6b2ad2fe1879e946781a0c8142aaafb42fc228689ee347665353b8763a1b60af1db53905c9b162419ab6d4f633aa53f7d374
data/bin/octopod CHANGED
@@ -2,7 +2,8 @@
2
2
  # require "byebug"
3
3
  PWD = Dir.pwd
4
4
 
5
- GEM_DIR = Gem::Specification.find_by_name("jekyll-octopod").gem_dir
5
+ GEM_SPEC = Gem::Specification.find_by_name("jekyll-octopod")
6
+ GEM_DIR = GEM_SPEC.gem_dir
6
7
  # HAS20170501 disgusting hack for development
7
8
  # GEM_DIR = "/home/user/jekyll/jekyll-octopod/"
8
9
 
@@ -28,6 +29,11 @@ Basic Command Line Usage:
28
29
  Additional Octopod commands:
29
30
  octopod episode # adds a template for a new episode
30
31
  octopod deploy # deploys your site
32
+ octopod update # updates template files from an existing setup to
33
+ # the currently installed jekyll-octopod version,
34
+ # without touching posts, imprint.md or index.md,
35
+ # and rewrites the old '{% podigee_player %}' tag
36
+ # to '{% podlove_player %}' wherever it's still used
31
37
 
32
38
  See 'octopod <command> --help' for more information on a specific command.
33
39
 
@@ -110,7 +116,7 @@ def get_stdin(message)
110
116
  STDIN.gets.chomp
111
117
  end
112
118
 
113
- if ARGV.size > 0 && (ARGV[0] == 'episode' || ARGV[0] == 'deploy' || ARGV[0] == 'setup')
119
+ if ARGV.size > 0 && (ARGV[0] == 'episode' || ARGV[0] == 'deploy' || ARGV[0] == 'setup' || ARGV[0] == 'update')
114
120
  options = YAML.load_file(File.join(PWD, '_config.yml'))
115
121
  options['posts_dir'] = File.join(PWD, '_posts')
116
122
 
@@ -271,6 +277,44 @@ if ARGV.size > 0 && (ARGV[0] == 'episode' || ARGV[0] == 'deploy' || ARGV[0] == '
271
277
  FileUtils.cp(GEM_DIR + "/assets/_config.yml.sample", PWD + "/_config.yml", verbose: true)
272
278
  end
273
279
  puts "===== ... done ===== ", ""
280
+
281
+ when 'update'
282
+ # Paths that are always left alone: real posts, hand-written content pages, and the gem's
283
+ # demo episode audio. Unlike 'setup', these are skipped outright rather than offered as a
284
+ # per-file prompt, since this command targets sites that are already live.
285
+ skip_on_update = %w[_posts imprint.md index.md episodes]
286
+
287
+ update_file = lambda do |file|
288
+ relative = file.split(GEM_DIR + "/assets")[1]
289
+ next if skip_on_update.any? { |skip| relative == "/#{skip}" || relative.start_with?("/#{skip}/") }
290
+ copy_file_or_create_dir(file)
291
+ end
292
+
293
+ puts "", "===== Updating template files to jekyll-octopod #{GEM_SPEC.version} ... ====="
294
+ puts "_posts/, imprint.md, index.md and the demo episodes/ directory are left untouched."
295
+ puts "You'll be asked before any other existing file gets overwritten.", ""
296
+
297
+ Dir.glob(GEM_DIR + "/assets/**/*").each(&update_file)
298
+ Dir.glob(GEM_DIR + "/assets/**/.*").each(&update_file)
299
+ puts "===== ... done ===== ", ""
300
+
301
+ puts "", "===== Rewriting the old '{% podigee_player %}' tag to '{% podlove_player %}' ... ====="
302
+ podigee_player_tag = /\{%-?\s*podigee_player\b.*?-?%\}/
303
+ updated_posts = Dir.glob(File.join(options['posts_dir'], '**', '*')).select do |post_file|
304
+ next false unless File.file?(post_file)
305
+ content = File.read(post_file)
306
+ next false unless content.match?(podigee_player_tag)
307
+ File.write(post_file, content.gsub(podigee_player_tag, '{% podlove_player %}'))
308
+ true
309
+ end
310
+
311
+ if updated_posts.empty?
312
+ puts "No posts used the old 'podigee_player' tag."
313
+ else
314
+ puts "Updated:"
315
+ updated_posts.each { |post_file| puts " #{post_file}" }
316
+ end
317
+ puts "===== ... done ===== ", ""
274
318
  end
275
319
  else
276
320
  puts octopod_help if ARGV.size > 0 && ARGV[0] == '--help'
@@ -2,8 +2,8 @@ module Jekyll
2
2
  class Octopod
3
3
  module VERSION #:nodoc:
4
4
  MAJOR = 0
5
- MINOR = 16
6
- TINY = 1
5
+ MINOR = 17
6
+ TINY = 0
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.16.1
4
+ version: 0.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arne Eilermann