jekyll-theme-isotc211-helpers 0.5.1 → 0.6.1

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: 1c5b041f658699fea2969ab9729d9490b21b0d201f9fb7540a8f8941bff3ae21
4
- data.tar.gz: 02a24661763d78d12166cb4a73e41d6d845704e6d71cca4091f4b9f00292bc3a
3
+ metadata.gz: 18514a72710e52ab9e597cdaaf04d060c861d4577654ede701b0917b033441a2
4
+ data.tar.gz: 4cc8d131a4372a249589ee3adbfd2515091b414281379c6ace7bd32a0778c519
5
5
  SHA512:
6
- metadata.gz: 3e4134fdbf47e434d4ed3870a25278a2335434c5fbd06063887af7f3e804b8511773f0b47e545bbc4e1a9993b7046aa890d31e993c6791bc5c380d616f8e5e45
7
- data.tar.gz: 3a372d303a4d28bc66d26625044c802eed19554dc93bf04cb0e09d836325e5c179f92de2266b302861696249f30b6461062e39d7aa79714f463d5c41f6d23f70
6
+ metadata.gz: ff143f23193ea76f1976212b07ec0e4d6ac6a5271f8b3e291168a77aba8ebe735a834f4c5bc9e8f470f66bca2c083f38a0ed3fb026bde512b2f1aaad96913534
7
+ data.tar.gz: 1d76bde595eb14cb513ee658249385d7f139a290367111d63fafbb8719917bdf9aacd9a96a95eb2c54065af243a405d62ee00014c3233d81edad27a159438c8d
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.1'
5
+ s.version = '0.6.1'
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
@@ -20,6 +20,8 @@ module Jekyll
20
20
 
21
21
  self.process(@name)
22
22
 
23
+ puts resources
24
+
23
25
  self.data = {
24
26
  'layout' => layout || 'resource-index',
25
27
  'title' => header,
@@ -75,34 +77,36 @@ module Jekyll
75
77
  contents_tree)
76
78
  end
77
79
 
80
+ # Returns a data structure representing a tree of resource subdirectories & files
78
81
  def read_resource_contents(dir, id, listing_id)
79
82
  cfg = self.config['resource_listings'][listing_id]
80
- return directory_hash(dir, "#{cfg['resource_label'].capitalize} #{id}")
83
+ directory_hash(dir, "#{cfg['resource_label'].capitalize} #{id}")
81
84
  end
82
85
 
83
86
  def generate_resource_pages
84
- if self.config.key?('resource_listings')
87
+ return unless self.config.key?('resource_listings')
88
+
89
+ self.config['resource_listings'].each do |listing_id, cfg|
90
+ resources = {}
85
91
 
86
- self.config['resource_listings'].each do |listing_id, cfg|
87
- resources = {}
92
+ Pathname(cfg['resource_root']).children.sort.each do |resource_dir|
88
93
 
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
94
+ # Ignore non-directories
95
+ next unless File.directory?(resource_dir)
96
+ basename = File.basename(resource_dir)
95
97
 
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
98
+ # Ignore dot-directories
99
+ next if basename[0] == '.'
101
100
 
102
- self.write_resource_listing_page(listing_id, resources)
101
+ id = basename
102
+ resources[id] = {} # Empty hash can in future be resource metadata
103
+ contents = self.read_resource_contents(resource_dir.to_s, id, listing_id)
104
+ self.write_resource_page(listing_id, id, contents)
103
105
  end
104
106
 
107
+ self.write_resource_listing_page(listing_id, resources)
105
108
  end
109
+
106
110
  end
107
111
 
108
112
  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.1
4
+ version: 0.6.1
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: []