webgen 1.7.2 → 1.7.3

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: c6697ca3880193603f4c4d88579cc87bafb3826646f1aa062c62c2db21ffe3af
4
- data.tar.gz: 509d1c0b3868faef7805ac47c69216df4c855f7b98595a653f6ca523a66daefd
3
+ metadata.gz: abf6f162be63a2724a21ba9d446637813047ce78d9b8ecd7677bdd994d0cb0f4
4
+ data.tar.gz: 41767d022e9e0370ad086954fa26682b45cf11760b8f437ea49f6ede05d9a66c
5
5
  SHA512:
6
- metadata.gz: 999375fd6b0fa4640bb7185e674e36d5f77a51f08e5bfe1d10f6acfb328de69526fe3fef7edf8f758d61a818dcdaffd52cfa9947cbfbe699879f8a5e82b288ae
7
- data.tar.gz: fd21ea49579e6e89d790cc54110584de387d49633db1662dc7bbc394d5ca9c1579615a66ab42eabb52fa6dfed7769d5ee474cb66281dc1c9cb8a4337771dcdb7
6
+ metadata.gz: 5986a587fe071fbc943afe55c2e95b3e63f303d702aabf6fb0d647dea437ca573969eb4d8bcd11b6e56094589064f50107d3945b5429f329349573d1ce17fd72
7
+ data.tar.gz: de5270884ef504f193eddd0c92dda36b21cdfd9f469c58e9e93c0f50c380bddf907c8dc5e6c14b62d6437e7acf4b4678c62fc853c1e4280ad199850cf31ef6b3
data/Rakefile CHANGED
@@ -107,6 +107,7 @@ EOF
107
107
 
108
108
  s.required_ruby_version = '>= 2.6.0'
109
109
 
110
+ s.add_dependency('psych', '~> 5.1')
110
111
  s.add_dependency('cmdparse', '~> 3.0', '>= 3.0.1')
111
112
  s.add_dependency('systemu', '~> 2.5')
112
113
  s.add_dependency('kramdown', '~> 2.3')
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.7.2
1
+ 1.7.3
@@ -1,8 +1,8 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
3
  require 'rbconfig'
4
- require 'yaml'
5
4
  require 'webgen/error'
5
+ require 'webgen/utils'
6
6
 
7
7
  module Webgen
8
8
 
@@ -59,7 +59,7 @@ module Webgen
59
59
  if info_file.nil?
60
60
  @infos[:bundles][bundle] = {}
61
61
  else
62
- infos = YAML.load(File.read(info_file))
62
+ infos = Utils.yaml_load(File.read(info_file))
63
63
  [:extensions, :options].each do |type|
64
64
  if data = infos.delete(type.to_s)
65
65
  data.each do |name, hash|
@@ -134,7 +134,7 @@ module Webgen
134
134
 
135
135
  info_file = File.join(File.dirname(file), 'info.yaml')
136
136
  next unless File.file?(info_file)
137
- next unless (begin YAML.load(File.read(info_file))['autoload']; rescue Exception; false end)
137
+ next unless (begin Utils.yaml_load(File.read(info_file))['autoload']; rescue Exception; false end)
138
138
 
139
139
  load(bundle_name)
140
140
  end
@@ -1,6 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
3
  require 'webgen/cli/utils'
4
+ require 'webgen/utils'
4
5
 
5
6
  module Webgen
6
7
  module CLI
@@ -32,7 +33,7 @@ DESC
32
33
  populate_hash = lambda do |file|
33
34
  bundle_name = File.basename(File.dirname(file))
34
35
  info_file = File.join(File.dirname(file), 'info.yaml')
35
- bundles[bundle_name] ||= (File.file?(info_file) ? YAML.load(File.read(info_file)) : {})
36
+ bundles[bundle_name] ||= (File.file?(info_file) ? Utils.yaml_load(File.read(info_file)) : {})
36
37
  bundles[bundle_name][:state] ||= :available
37
38
  bundles[bundle_name]
38
39
  end
data/lib/webgen/cli.rb CHANGED
@@ -10,6 +10,7 @@ require 'webgen/cli/commands/generate'
10
10
  require 'webgen/cli/commands/show'
11
11
  require 'webgen/cli/commands/create'
12
12
  require 'webgen/cli/commands/install'
13
+ require 'webgen/utils'
13
14
 
14
15
  module Webgen
15
16
 
@@ -129,7 +130,7 @@ module Webgen
129
130
  opts.on("-o", "--option CONFIG_OPTION", String, "Specify a simple configuration option (key=value)") do |v|
130
131
  k, v = v.split('=')
131
132
  begin
132
- @config_options[k.to_s] = YAML.load(v.to_s)
133
+ @config_options[k.to_s] = Utils.yaml_load(v.to_s)
133
134
  rescue YAML::SyntaxError
134
135
  raise ConfigurationOptionError.new("Couldn't parse value for '#{k}': #{$!}")
135
136
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'yaml'
4
4
  require 'webgen/error'
5
+ require 'webgen/utils'
5
6
 
6
7
  module Webgen
7
8
 
@@ -171,7 +172,7 @@ module Webgen
171
172
  def load_from_file(filename)
172
173
  data = if String === filename || filename.respond_to?(:read)
173
174
  begin
174
- YAML::load(String === filename ? File.read(filename) : filename.read) || {}
175
+ Utils.yaml_load(String === filename ? File.read(filename) : filename.read) || {}
175
176
  rescue RuntimeError, ArgumentError, SyntaxError, YAML::SyntaxError => e
176
177
  raise Error, "Problem parsing configuration data (it needs to contain a YAML hash): #{e.message}", e.backtrace
177
178
  end
data/lib/webgen/node.rb CHANGED
@@ -94,7 +94,10 @@ module Webgen
94
94
 
95
95
  @level = -1
96
96
  @tree = @parent
97
- (@level += 1; @tree = @tree.parent) while @tree.kind_of?(Webgen::Node)
97
+ while @tree.kind_of?(Webgen::Node)
98
+ @level += 1
99
+ @tree = @tree.parent
100
+ end
98
101
 
99
102
  @tree.register_node(self)
100
103
  @parent.children << self unless @parent == @tree
data/lib/webgen/page.rb CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'yaml'
4
4
  require 'webgen/error'
5
+ require 'webgen/utils'
5
6
 
6
7
  module Webgen
7
8
 
@@ -49,7 +50,7 @@ module Webgen
49
50
  {}
50
51
  else
51
52
  begin
52
- meta_info = YAML::load(mi_data.to_s)
53
+ meta_info = Utils.yaml_load(mi_data.to_s)
53
54
  unless meta_info.kind_of?(Hash)
54
55
  raise FormatError, "Invalid structure of meta information block: expected YAML hash but found #{meta_info.class}"
55
56
  end
@@ -78,7 +79,7 @@ module Webgen
78
79
  else
79
80
  md = RE_BLOCKS_START_COMPLEX.match(options.to_s)
80
81
  raise(FormatError, "Found invalid blocks starting line for block #{index}: #{options}") if content =~ /\A---/ || md.nil?
81
- options = Hash[*md[1].to_s.scan(/(\w+):([^\s]*)/).map {|k,v| [k, (v == '' ? nil : YAML::load(v))]}.flatten]
82
+ options = Hash[*md[1].to_s.scan(/(\w+):([^\s]*)/).map {|k,v| [k, (v == '' ? nil : Utils.yaml_load(v))]}.flatten]
82
83
  end
83
84
 
84
85
  name = options.delete('name') || (index == 1 ? 'content' : 'block' + (index).to_s)
@@ -226,7 +226,7 @@ module Webgen
226
226
  # fragments.
227
227
  def create_fragment_nodes_for_methods(api_path, klass_node, klass)
228
228
  ["Class", "Instance"].each do |type|
229
- method_list = klass.send("#{type.downcase}_method_list")
229
+ method_list = type == 'Class' ? klass.class_method_list : klass.instance_methods
230
230
  next if method_list.empty?
231
231
  meth_url = "#{klass_node.alcn}##{type}-Methods"
232
232
  path = Webgen::Path.new(meth_url,
@@ -5,6 +5,7 @@ require 'set'
5
5
  require 'yaml'
6
6
  require 'webgen/path_handler/base'
7
7
  require 'webgen/path_handler/page_utils'
8
+ require 'webgen/utils'
8
9
 
9
10
  module Webgen
10
11
  class PathHandler
@@ -44,7 +45,7 @@ module Webgen
44
45
  # Add the data from the given page block to the hash.
45
46
  def add_data(path, content, block_name)
46
47
  entries = []
47
- if content && (data = YAML::load(content))
48
+ if content && (data = Utils.yaml_load(content))
48
49
  data.each do |(*keys), value|
49
50
  value = Marshal.dump(value)
50
51
  keys.each {|key| entries << [Webgen::Path.append(path.parent_path, key), value]}
@@ -4,6 +4,7 @@ require 'yaml'
4
4
  require 'webgen/path'
5
5
  require 'webgen/path_handler/base'
6
6
  require 'webgen/path_handler/page_utils'
7
+ require 'webgen/utils'
7
8
 
8
9
  module Webgen
9
10
  class PathHandler
@@ -65,7 +66,7 @@ module Webgen
65
66
  def read_entries(blocks)
66
67
  blocks.each do |name, content|
67
68
  begin
68
- data = YAML::load(content)
69
+ data = Utils.yaml_load(content)
69
70
  rescue RuntimeError, ArgumentError, SyntaxError, YAML::SyntaxError => e
70
71
  raise RuntimeError, "Problem parsing block '#{name}' (it needs to contain a YAML hash): #{e.message}", e.backtrace
71
72
  end
@@ -3,6 +3,7 @@
3
3
  require 'yaml'
4
4
  require 'strscan'
5
5
  require 'webgen/error'
6
+ require 'webgen/utils'
6
7
 
7
8
  module Webgen
8
9
  module Utils
@@ -113,7 +114,7 @@ module Webgen
113
114
 
114
115
  # Parse the parameter string and return the result.
115
116
  def parse_params(param_string, tag)
116
- YAML::load("--- #{param_string}")
117
+ Utils.yaml_load("--- #{param_string}")
117
118
  rescue ArgumentError, SyntaxError, YAML::SyntaxError => e
118
119
  raise Error.new("Could not parse parameter string '#{param_string}' for tag '#{tag}': #{e.message}")
119
120
  end
data/lib/webgen/utils.rb CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'rbconfig'
4
4
  require 'webgen/core_ext'
5
+ require 'yaml'
5
6
 
6
7
  module Webgen
7
8
 
@@ -34,6 +35,11 @@ module Webgen
34
35
  str
35
36
  end
36
37
 
38
+ # Load the YAML string.
39
+ def self.yaml_load(str)
40
+ YAML.load(str, aliases: true, permitted_classes: [Symbol, Time])
41
+ end
42
+
37
43
  end
38
44
 
39
45
  end
@@ -3,6 +3,6 @@
3
3
  module Webgen
4
4
 
5
5
  # The version of webgen.
6
- VERSION = '1.7.2'
6
+ VERSION = '1.7.3'
7
7
 
8
8
  end
@@ -7,7 +7,7 @@ require 'webgen/item_tracker/file'
7
7
  class TestItemTrackerFile < Minitest::Test
8
8
 
9
9
  def setup
10
- @website = MiniTest::Mock.new
10
+ @website = Minitest::Mock.new
11
11
  @obj = Webgen::ItemTracker::File.new(@website)
12
12
  end
13
13
 
@@ -37,7 +37,7 @@ class TestItemTrackerNodes < Minitest::Test
37
37
 
38
38
  def test_item_changed?
39
39
  setup_default_nodes(@website.tree)
40
- @website.ext.item_tracker = MiniTest::Mock.new
40
+ @website.ext.item_tracker = Minitest::Mock.new
41
41
  2.times do
42
42
  @website.ext.item_tracker.expect(:item_changed?, false, [:node_meta_info, @website.tree['/file.en.html']])
43
43
  @website.ext.item_tracker.expect(:item_changed?, false, [:node_meta_info, @website.tree['/file.de.html']])
@@ -18,10 +18,10 @@ class TestSourceStacked < Minitest::Test
18
18
  end
19
19
 
20
20
  def test_paths
21
- path1 = MiniTest::Mock.new
21
+ path1 = Minitest::Mock.new
22
22
  path1.expect(:mount_at, 'path1', ['/'])
23
23
  path1.expect(:hash, 'path1'.hash)
24
- path2 = MiniTest::Mock.new
24
+ path2 = Minitest::Mock.new
25
25
  path2.expect(:mount_at, 'path2', ['/hallo/'])
26
26
  path2.expect(:hash, 'path2'.hash)
27
27
 
@@ -10,7 +10,7 @@ class TestTagTikz < Minitest::Test
10
10
  require 'webgen/tag/tikz' rescue skip($!.message)
11
11
 
12
12
  setup_context
13
- @website.ext.path_handler = MiniTest::Mock.new
13
+ @website.ext.path_handler = Minitest::Mock.new
14
14
 
15
15
  root = Webgen::Node.new(@website.tree.dummy_root, '/', '/')
16
16
  node = Webgen::Node.new(root, 'file.page', '/file.html')
@@ -62,7 +62,7 @@ class TestContext < Minitest::Test
62
62
 
63
63
  def test_tags_methods
64
64
  context = Webgen::Context.new(@website)
65
- tag = MiniTest::Mock.new
65
+ tag = Minitest::Mock.new
66
66
  tag.expect(:call, 'value', ['mytag', {'opt' => 'val'}, 'body', context])
67
67
  @website.ext.tag = tag
68
68
 
@@ -12,7 +12,7 @@ end
12
12
  class TestDestination < Minitest::Test
13
13
 
14
14
  def setup
15
- @website = MiniTest::Mock.new
15
+ @website = Minitest::Mock.new
16
16
  @dest = Webgen::Destination.new(@website)
17
17
  end
18
18
 
@@ -26,7 +26,7 @@ class TestError < Minitest::Test
26
26
 
27
27
  def test_class_error_line
28
28
  begin
29
- eval("5 =")
29
+ eval("5 =", binding, "(eval)", 1)
30
30
  rescue SyntaxError => e
31
31
  assert_equal(1, Webgen::Error.error_line(e))
32
32
  end
@@ -40,7 +40,7 @@ class TestError < Minitest::Test
40
40
 
41
41
  def test_class_error_file
42
42
  begin
43
- eval("5 =")
43
+ eval("5 =", binding, "(eval)")
44
44
  rescue SyntaxError => e
45
45
  assert_equal('(eval)', Webgen::Error.error_file(e))
46
46
  end
@@ -79,7 +79,7 @@ class TestRenderError < Minitest::Test
79
79
  assert_match(/Error at location in <\/error:~5> while rendering <\/path>/, e.message)
80
80
 
81
81
  begin
82
- eval("5 =")
82
+ eval("5 =", binding, "(eval)", 1)
83
83
  rescue SyntaxError
84
84
  e = Webgen::RenderError.new($!, 'location', '/path', '/error')
85
85
  assert_equal("/error", e.error_path)
@@ -111,7 +111,7 @@ class TestNode < Minitest::Test
111
111
  assert_equal(tree['/dir2/index.en.html'], tree['/dir2/'].proxy_node('en'))
112
112
  assert_equal(tree['/dir2/index.en.html'], tree['/dir2/'].proxy_node('en'))
113
113
 
114
- @website.ext.item_tracker = MiniTest::Mock.new
114
+ @website.ext.item_tracker = Minitest::Mock.new
115
115
  @website.ext.item_tracker.expect(:add, nil, [:a, :b, :c, :d])
116
116
  tree['/dir/subfile.html'].meta_info['proxy_path'] = 'holla'
117
117
  assert_equal(tree['/dir/subfile.html'], tree['/dir/subfile.html'].proxy_node('pt'))
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webgen
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.2
4
+ version: 1.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Leitner
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-07 00:00:00.000000000 Z
11
+ date: 2024-01-01 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: psych
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '5.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '5.1'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: cmdparse
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -516,8 +530,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
516
530
  - !ruby/object:Gem::Version
517
531
  version: '0'
518
532
  requirements: []
519
- rubygems_version: 3.2.3
520
- signing_key:
533
+ rubygems_version: 3.5.3
534
+ signing_key:
521
535
  specification_version: 4
522
536
  summary: webgen is a fast, powerful, and extensible static website generator.
523
537
  test_files: []
538
+ ...