wax_tasks 0.0.43 → 0.0.44

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 663fec6c7f6714d5820f714984802c4c8c819b35
4
- data.tar.gz: 5cd9d2a76deac5d812b37d72d6b606262c1da182
2
+ SHA256:
3
+ metadata.gz: 73578c3b4f1e973aba2a8711a1bb9645f6b8131e9e8a308fec30584fe24e8d7e
4
+ data.tar.gz: f61a4bb823051d5209bc329214786d00fa7799456f0d670fd80e97026e389f27
5
5
  SHA512:
6
- metadata.gz: 780afa502819d993e5d69cec6340800018ea8e738a89f08551ab37a5b4ae2d60bcf3c4ed2820abd6f0cddb18489079b3eacefa377d8f69aee67bdc088fb89409
7
- data.tar.gz: e800f98df5f37d13ef796b2fd9c24c14e427517b2851c38d6a95850ad26b5dd5a1ad7e9869e7d070de529088b7da7e4c6f96c1036f4a7005635ec0f4c0ea5578
6
+ metadata.gz: 2159d0aca76085381c4c919321dfa6652c976b7963a0a342011924a743fc44a5833a4a2fc5fed1842fa7ea83da1337cf9138a65bc956b0194383974308379097
7
+ data.tar.gz: 2ad40f5d9f8f34bdf34501d1c7e5091df3a3cfe2de909a2d59e45a44662f50e33bdfcb6895236ab98fa74a279d3ebe759401ecf3d2deecbdf7b2cfed9c085155
@@ -1,3 +1,4 @@
1
+ include FileUtils
1
2
  require 'wax_tasks'
2
3
  require 'jekyll'
3
4
 
@@ -5,7 +6,7 @@ namespace :wax do
5
6
  desc 'build site with gh-baseurl and publish to gh-pages branch'
6
7
  task :ghbranch do
7
8
  config = read_config
8
- FileUtils.rm_rf('_site')
9
+ rm_rf('_site')
9
10
 
10
11
  opts = {
11
12
  'source' => '.',
data/lib/tasks/iiif.rake CHANGED
@@ -1,3 +1,4 @@
1
+ include FileUtils
1
2
  require 'wax_tasks'
2
3
  require 'iiif_s3'
3
4
 
@@ -8,17 +9,12 @@ namespace :wax do
8
9
 
9
10
  abort "You must specify a collections after 'bundle exec rake wax:iiif'.".magenta if argv.empty?
10
11
 
11
- FileUtils.mkdir './iiif'
12
+ mkdir_p('./iiif')
12
13
 
13
14
  all_records = []
14
15
  id_counter = 0
16
+ build_opts = build_options(config)
15
17
 
16
- build_opts = {
17
- :base_url => config['baseurl'] + '/iiif',
18
- :output_dir => './iiif',
19
- :tile_scale_factors => [1, 2],
20
- :verbose => true
21
- }
22
18
  argv.each do |a|
23
19
  id_counter += 1
24
20
  inpath = './_data/iiif/' + a
@@ -33,6 +29,14 @@ namespace :wax do
33
29
  end
34
30
  end
35
31
 
32
+ def build_options(config)
33
+ {
34
+ :base_url => config['baseurl'] + '/iiif',
35
+ :output_dir => './iiif',
36
+ :verbose => true
37
+ }
38
+ end
39
+
36
40
  def make_records(collection_name, inpath, paged, config)
37
41
  counter = 1
38
42
  collection_records = []
@@ -1,3 +1,4 @@
1
+ include FileUtils
1
2
  require 'wax_tasks'
2
3
  require 'jekyll'
3
4
 
@@ -14,6 +14,7 @@ class Collection
14
14
  @src = '_data/' + collection.fetch('source')
15
15
  @layout = File.basename(collection.fetch('layout'), '.*')
16
16
  @dir = cdir + '_' + @name
17
+ @order = collection.key?('keep_order') ? collection.fetch('keep_order') : false
17
18
  end
18
19
 
19
20
  def valid_collection_config
@@ -45,15 +46,17 @@ class Collection
45
46
  perma_ext = @config['permalink'] == 'pretty' ? '/' : '.html'
46
47
  completed = 0
47
48
  skipped = 0
48
- data.each do |item|
49
+ data.each_with_index do |item, index|
49
50
  pagename = slug(item.fetch('pid'))
50
51
  pagepath = @dir + '/' + pagename + '.md'
51
- permalink = '/' + @name + '/' + pagename + perma_ext
52
+ item['permalink'] = '/' + @name + '/' + pagename + perma_ext
53
+ item['layout'] = @layout
54
+ item['order'] = padded_int(index, data.length) if @order
52
55
  if File.exist?(pagepath)
53
56
  puts "#{pagename}.md already exits. Skipping."
54
57
  skipped += 1
55
58
  else
56
- File.open(pagepath, 'w') { |file| file.write(item.to_yaml.to_s + "permalink: #{permalink}\nlayout: #{@layout}\n---") }
59
+ File.open(pagepath, 'w') { |file| file.write(item.to_yaml.to_s + '---') }
57
60
  completed += 1
58
61
  end
59
62
  end
@@ -32,3 +32,7 @@ def read_argv
32
32
  argv.each { |a| task a.to_sym }
33
33
  argv
34
34
  end
35
+
36
+ def padded_int(index, max_idx)
37
+ index.to_s.rjust(Math.log10(max_idx).to_i + 1, "0")
38
+ end
@@ -23,14 +23,14 @@ class Lunr
23
23
  total_fields.uniq
24
24
  end
25
25
 
26
- def page_hash(page, c_fields, c, count)
26
+ def page_hash(page, c_fields, collection, count)
27
27
  yaml = YAML.load_file(page)
28
28
  hash = {
29
29
  'lunr_id' => count,
30
30
  'link' => "{{'" + yaml.fetch('permalink') + "' | relative_url }}"
31
31
  }
32
32
  c_fields.each { |f| hash[f] = rm_diacritics(thing2string(yaml[f])) }
33
- hash['content'] = rm_diacritics(clean(File.read(page))) if c[1]['lunr_index']['content']
33
+ hash['content'] = rm_diacritics(clean(File.read(page))) if collection[1]['lunr_index']['content']
34
34
  hash
35
35
  end
36
36
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wax_tasks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.43
4
+ version: 0.0.44
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marii Nyrop
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-02 00:00:00.000000000 Z
11
+ date: 2018-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -128,14 +128,14 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '0.52'
131
+ version: '0.53'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '0.52'
138
+ version: '0.53'
139
139
  description: Rake tasks for minimal iiif exhibition sites with Jekyll.
140
140
  email:
141
141
  - m.nyrop@columbia.edu
@@ -177,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
177
177
  version: '0'
178
178
  requirements: []
179
179
  rubyforge_project:
180
- rubygems_version: 2.6.14
180
+ rubygems_version: 2.7.6
181
181
  signing_key:
182
182
  specification_version: 4
183
183
  summary: Rake tasks for minimal exhibitions.