jekyll-theme-isotc211-helpers 0.5.2 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 672496e5515f844b6d91482f451ed981d9234bef537698d9f6f2ffcea08bf507
4
- data.tar.gz: 5ec3cce6fbbb5d49e1d4d6672518f59e841d80212638d6a6f7a42c2108570df1
3
+ metadata.gz: 0d66de8033f6c81ce930a1498d893186a1e9bf25e6b0917518edc3285e62e3b1
4
+ data.tar.gz: bb53dcd757c6e62e03fd7b777b9f0ed5713ec1244785fb4af9181f2e68c52df9
5
5
  SHA512:
6
- metadata.gz: c68c08388e36007e3e5aa70251214773e05db5d3cfa4ad9e526832c845adfebfe260ba41361674497cb43cc8dd06325f6f7c71f220672e82387a94e799609fc8
7
- data.tar.gz: fa898a9b4241dc5d7e8f34e55b65df1d01302f22ddbcc1a7c3e9964e6ce903b2272e5d9a35a13a25d4d981218981b6bc1015fa7257809fd32bf6d831c00788af
6
+ metadata.gz: 7aeedbc5592294485f3f56cc7542b251334253568e87ba0841fbe28b0c84b099b43199aa7752644511e57ce7fb835b3fb8e3c04242b728088d1710bbd5c62e26
7
+ data.tar.gz: 7f83319536064471e24407f308934bcba4bbc6c54f9f44c15a1e143da6167f49f3004a0734be3a18800b30d12350edcffbbf47b15107ff2f14e74ebbc30ebc0f
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ # Uncomment to enable the "spec" task
5
+ # RSpec::Core::RakeTask.new(:spec)
6
+ #
7
+ # task :default => :spec
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'jekyll-theme-isotc211-helpers'
5
- s.version = '0.5.2'
5
+ s.version = '0.6.2'
6
6
  s.authors = ['Ribose Inc.']
7
7
  s.email = ['open.source@ribose.com']
8
8
 
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r!^(test|spec|features)/!) }
14
14
 
15
- s.add_runtime_dependency 'jekyll', '~> 3.8'
15
+ s.add_runtime_dependency 'jekyll', '~> 4.0'
16
16
  s.add_development_dependency 'rake', '~> 12.0'
17
17
  s.add_development_dependency 'rubocop', '~> 0.50'
18
18
 
@@ -1,4 +1,5 @@
1
1
  require 'jekyll-theme-isotc211-helpers/resource_listing'
2
+ require 'jekyll-theme-isotc211-helpers/resource_copy'
2
3
 
3
4
 
4
5
  module Jekyll
@@ -0,0 +1,13 @@
1
+ # Copies resource contents as is to site destination, bypassing Jekyll’s conversion
2
+
3
+ Jekyll::Hooks.register :site, :post_write do |site|
4
+ if site.config.key?('resource_listings')
5
+ site.config['resource_listings'].each do |listing_id, cfg|
6
+ copy_resource_contents(cfg, site.config['destination'])
7
+ end
8
+ end
9
+ end
10
+
11
+ def copy_resource_contents(resource_cfg, site_dest)
12
+ FileUtils.cp_r("#{resource_cfg['resource_root']}/.", "#{site_dest}/#{resource_cfg['index_url']}")
13
+ end
@@ -75,34 +75,36 @@ module Jekyll
75
75
  contents_tree)
76
76
  end
77
77
 
78
+ # Returns a data structure representing a tree of resource subdirectories & files
78
79
  def read_resource_contents(dir, id, listing_id)
79
80
  cfg = self.config['resource_listings'][listing_id]
80
- return directory_hash(dir, "#{cfg['resource_label'].capitalize} #{id}")
81
+ directory_hash(dir, "#{cfg['resource_label'].capitalize} #{id}")
81
82
  end
82
83
 
83
84
  def generate_resource_pages
84
- if self.config.key?('resource_listings')
85
+ return unless self.config.key?('resource_listings')
85
86
 
86
- self.config['resource_listings'].each do |listing_id, cfg|
87
- resources = {}
87
+ self.config['resource_listings'].each do |listing_id, cfg|
88
+ resources = {}
88
89
 
89
- Pathname(cfg['resource_root']).children.each do |resource_dir|
90
- basename = File.basename(resource_dir)
91
- if basename[0] == '.'
92
- # Ignore dot-directories
93
- next
94
- end
90
+ Pathname(cfg['resource_root']).children.sort.each do |resource_dir|
95
91
 
96
- id = basename
97
- resources[id] = {} # Empty hash can in future be resource metadata
98
- contents = self.read_resource_contents(resource_dir.to_s, id, listing_id)
99
- self.write_resource_page(listing_id, id, contents)
100
- end
92
+ # Ignore non-directories
93
+ next unless File.directory?(resource_dir)
94
+ basename = File.basename(resource_dir)
101
95
 
102
- self.write_resource_listing_page(listing_id, resources)
96
+ # Ignore dot-directories
97
+ next if basename[0] == '.'
98
+
99
+ id = basename
100
+ resources[id] = {} # Empty hash can in future be resource metadata
101
+ contents = self.read_resource_contents(resource_dir.to_s, id, listing_id)
102
+ self.write_resource_page(listing_id, id, contents)
103
103
  end
104
104
 
105
+ self.write_resource_listing_page(listing_id, resources)
105
106
  end
107
+
106
108
  end
107
109
 
108
110
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-theme-isotc211-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-18 00:00:00.000000000 Z
11
+ date: 2021-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '3.8'
19
+ version: '4.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '3.8'
26
+ version: '4.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -52,7 +52,7 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0.50'
55
- description:
55
+ description:
56
56
  email:
57
57
  - open.source@ribose.com
58
58
  executables: []
@@ -61,15 +61,17 @@ extra_rdoc_files: []
61
61
  files:
62
62
  - LICENSE.txt
63
63
  - README.md
64
+ - Rakefile
64
65
  - develop/release
65
66
  - jekyll-theme-isotc211-helpers.gemspec
66
67
  - lib/jekyll-theme-isotc211-helpers.rb
68
+ - lib/jekyll-theme-isotc211-helpers/resource_copy.rb
67
69
  - lib/jekyll-theme-isotc211-helpers/resource_listing.rb
68
70
  homepage: https://github.com/riboseinc/jekyll-theme-isotc211-helpers/
69
71
  licenses:
70
72
  - MIT
71
73
  metadata: {}
72
- post_install_message:
74
+ post_install_message:
73
75
  rdoc_options: []
74
76
  require_paths:
75
77
  - lib
@@ -84,9 +86,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
84
86
  - !ruby/object:Gem::Version
85
87
  version: '0'
86
88
  requirements: []
87
- rubyforge_project:
88
- rubygems_version: 2.7.6.2
89
- signing_key:
89
+ rubygems_version: 3.0.3
90
+ signing_key:
90
91
  specification_version: 4
91
92
  summary: Helpers for the ISO/TC 211 Jekyll theme
92
93
  test_files: []