pagemaster 2.0.0 → 2.0.1

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 (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/pagemaster.rb +11 -10
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1cc95d2a656139e4ac5f4487d2ee34259e953a949021a1b3885a2e4ee3124250
4
- data.tar.gz: 3270dd906aae58e82ec50dab84b98a45dfee552583de3e2636e14d3ef362748e
3
+ metadata.gz: 27df4bed4b0e582657fc8a230c85eccfa46374437c0d985e6b8bb6a22b7caeb4
4
+ data.tar.gz: c78b9cab7ddd6cbe15f767454b099a17bedf02854606e70a3bfb1800c520e263
5
5
  SHA512:
6
- metadata.gz: 91177001b1b99318b88324b8cc20fffd16eb3fc6756cecb08bf405f45aac74122dcf845fd9e3737f5a86ef0c49acb6d20ae34c9db805ac07c13d0205831c45da
7
- data.tar.gz: a44434fefa5681e38ba6405243d2930a3076a02724756d738289a1f94f19676b63e5fb29a8d0cd59f51881d6ad00f0ce89cbb314f74fd95baf8b2a719e6efd58
6
+ metadata.gz: 7718f1fe806f588f726ef289144fc33e34810dff0fd80fcc4f127fd5aca7df8cc479916dcc67c29314cffd11e271d0ed4dcc712040ab4d6e068d5f43ebc633d3
7
+ data.tar.gz: b954ed10efd104d6ed3643f4f7844033fd1f6d7f133c2798ed6b697405362635228bd79a31ed0ebfeba97be66c93b95ecd5f9b46363418adbe24b2609422e11d
@@ -1,25 +1,26 @@
1
- include FileUtils
2
1
  require 'csv'
3
2
  require 'yaml'
4
3
  require 'json'
5
4
 
5
+ include FileUtils
6
+
6
7
  # Jekyll comand to generate markdown collection pages from CSV/YML/JSON records
7
8
  class Pagemaster < Jekyll::Command
8
9
  class << self
9
10
  def init_with_program(prog)
10
- prog.command(:pagemaster) do |command|
11
- command.syntax 'pagemaster [options]'
12
- command.description 'Generate md pages from collection data.'
13
- command.action do |args|
14
- execute(args)
15
- end
11
+ prog.command(:pagemaster) do |c|
12
+ c.syntax 'pagemaster [options] [args]'
13
+ c.description 'Generate md pages from collection data.'
14
+ c.option 'no-perma', '--no-permalink', 'Skips adding hard-coded permalink'
15
+ c.action { |args, options| execute(args, options) }
16
16
  end
17
17
  end
18
18
 
19
- def execute(args)
19
+ def execute(args, options)
20
20
  config = YAML.load_file('_config.yml')
21
21
  abort 'Cannot find collections in config' unless config.key?('collections')
22
- perma = config['permalink'] == 'pretty' ? '/' : '.html'
22
+ perma = false
23
+ perma = config['permalink'] == 'pretty' ? '/' : '.html' unless options.key? 'no-perma'
23
24
  args.each do |name|
24
25
  abort "Cannot find #{name} in collection config" unless config['collections'].key? name
25
26
  meta = {
@@ -62,7 +63,7 @@ class Pagemaster < Jekyll::Command
62
63
  data.each do |item|
63
64
  pagename = slug(item.fetch(meta['id_key']))
64
65
  pagepath = dir + '/' + pagename + '.md'
65
- item['permalink'] = '/' + name + '/' + pagename + perma
66
+ item['permalink'] = '/' + name + '/' + pagename + perma if perma
66
67
  item['layout'] = meta['layout']
67
68
  if File.exist?(pagepath)
68
69
  puts "#{pagename}.md already exits. Skipping."
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pagemaster
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marii Nyröp