zenweb 3.11.0 → 3.12.0

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
2
  SHA256:
3
- metadata.gz: 84df6337b405ae77d3a2ed5fb1c6aa940ce2ad08ba6dd904a9b3cde365a47623
4
- data.tar.gz: bc471952a820c258e6704dc1e73039c16978edf51b7016ee12db27514e9eeb2e
3
+ metadata.gz: d5d65b2aa52df8d273f1d9495c817afaec7e29c5628106c28feced37ea7cf988
4
+ data.tar.gz: c8f3ce1cd5a8528ee6d8302a0173c2b3673870378458c0a0dba4b26ad5eb280b
5
5
  SHA512:
6
- metadata.gz: '08fbb2f23c3ebb0ca4323a5a79d0604f84d61f5904c3c758e2c3ef2e5956fc2044cf1eec66b3a3a93b18b914e12fa47247b4bcc7e3a6498750c7201b9d5fa8b7'
7
- data.tar.gz: 26452812d1d9459a0413ca40b8fa9a394372b7c4f2cdcacc6ce7cef7b85bb8a69b4c78e3e7def7e9356ed6f1af2ac584434d9da4465b8b8c861e8c1ea729229d
6
+ metadata.gz: 6170ff66ec3020cd0ec7f268f05a220e799601b8ba1899b0ab15ce769eab9b3ce98ff9ca89ad400109324908444d93e31eb47b116cae01f815f6fdb5d58b8acc
7
+ data.tar.gz: a4dd4c2f449052627667eb862fce8f34f7a74f5d3b2b537cacdfd8b03b0d90d086133bab7d5cd1205c01a460da50636a0878ee0413399eb1a55a24ee011d13c9
checksums.yaml.gz.sig CHANGED
Binary file
data/History.rdoc CHANGED
@@ -1,3 +1,24 @@
1
+ === 3.12.0 / 2026-01-29
2
+
3
+ * 2 minor enhancements:
4
+
5
+ * Added Binary subclass of Page: copies file and preserves dates.
6
+ * Disabled Page#binary and friends.
7
+
8
+ * 2 bug fixes:
9
+
10
+ * Added ability to specify change_frequency in config to force a page's value.
11
+ * Fixed disqus urls to use https.
12
+
13
+ === 3.11.1 / 2024-08-22
14
+
15
+ * 4 bug fixes:
16
+
17
+ * Deleted long dead (~2.0) code.
18
+ * Fixed 2.7 (only?!) frozen string literal bug.
19
+ * Modified 'rake run' task to regenerate more consistently.
20
+ * Removed ancient Enumerable#chunk implementation.
21
+
1
22
  === 3.11.0 / 2023-09-28
2
23
 
3
24
  * 1 minor enhancement:
data/lib/zenweb/config.rb CHANGED
@@ -55,8 +55,7 @@ module Zenweb
55
55
  h.key?(k.to_s) or parent.key?(k)
56
56
  end
57
57
 
58
- UTF_BOM = "\xEF\xBB\xBF"
59
- UTF_BOM.force_encoding "binary" if File::RUBY19
58
+ UTF_BOM = "\xEF\xBB\xBF".b
60
59
 
61
60
  ##
62
61
  # Splits a file and returns the yaml header and body, as applicable.
@@ -75,7 +74,7 @@ module Zenweb
75
74
 
76
75
  yaml_file = File.extname(path) == ".yml"
77
76
 
78
- body.force_encoding "utf-8" if File::RUBY19
77
+ body.force_encoding Encoding::UTF_8
79
78
  else
80
79
  body = path.content
81
80
  end
@@ -10,24 +10,6 @@ def File.each_parent dir, file
10
10
  end
11
11
 
12
12
  module Enumerable
13
- def chunk
14
- bin, result, prev = [], [], Object.new
15
-
16
- each do |o|
17
- curr = yield o
18
-
19
- if prev != curr then
20
- bin = []
21
- result << [curr, bin]
22
- prev = curr
23
- end
24
-
25
- bin << o
26
- end
27
-
28
- result
29
- end unless [].respond_to? :chunk
30
-
31
13
  def multi_group_by
32
14
  r = Hash.new { |h,k| h[k] = [] }
33
15
  each do |o|
@@ -54,20 +36,6 @@ class Array # :nodoc:
54
36
  end
55
37
  end
56
38
 
57
- class File # :nodoc:
58
- RUBY19 = "<3".respond_to? :encoding # :nodoc:
59
-
60
- class << self
61
- alias :binread :read unless RUBY19
62
- end
63
- end
64
-
65
- class String # :nodoc:
66
- def valid_encoding? # :nodoc:
67
- true
68
- end unless File::RUBY19
69
- end
70
-
71
39
  class Time # :nodoc:
72
40
  ##
73
41
  # Format as YYYY-MM-DD
data/lib/zenweb/page.rb CHANGED
@@ -31,11 +31,13 @@ module Zenweb
31
31
 
32
32
  attr_accessor :parent
33
33
 
34
- ##
35
- # Is this file a binary file? Defaults to true if config passed to Page.new.
36
-
37
- attr_accessor :binary
34
+ # :stopdoc:
35
+ def binary = warn "Page#binary is deprecated. Use Zenweb::Binary instead."
36
+ def binary= o
37
+ warn "Page#binary= is deprecated. Use Zenweb::Binary instead."
38
+ end
38
39
  alias binary? binary
40
+ # :startdoc:
39
41
 
40
42
  ##
41
43
  # Returns a regexp that will match file extensions for all known
@@ -98,11 +100,7 @@ module Zenweb
98
100
  @body ||= begin
99
101
  thing = File.file?(path) ? path : self
100
102
  _, body = Zenweb::Config.split thing
101
- if self.binary? then
102
- body
103
- else
104
- body.strip
105
- end
103
+ body.strip
106
104
  end
107
105
  end
108
106
 
@@ -193,6 +191,8 @@ module Zenweb
193
191
  end
194
192
 
195
193
  def change_frequency
194
+ return config["change_frequency"] if config["change_frequency"]
195
+
196
196
  days_old = (Time.now - self.date).to_i / 86400
197
197
 
198
198
  case days_old
@@ -271,11 +271,7 @@ module Zenweb
271
271
  content = self.render
272
272
 
273
273
  open url_path, "w" do |f|
274
- if binary? then
275
- f.print content
276
- else
277
- f.puts content
278
- end
274
+ f.puts content
279
275
  end
280
276
  end
281
277
 
@@ -311,8 +307,7 @@ module Zenweb
311
307
  end
312
308
  @layout
313
309
  rescue => e
314
- e.message.concat " for page #{path.inspect}"
315
- raise e
310
+ raise e.exception "%s for page %p" % [e.message, path]
316
311
  end
317
312
 
318
313
  ##
@@ -505,6 +500,29 @@ module Zenweb
505
500
  attr_accessor :date
506
501
  end
507
502
 
503
+ ##
504
+ # A file representing a binary. This file is not rendered in any
505
+ # way, and doesn't have the usual dependencies because its content
506
+ # would not be modified to changes in config or the like.
507
+
508
+ class Binary < Page
509
+ def generate
510
+ warn "Copying #{url_path}"
511
+ cp path, url_path, preserve:true, verbose: Rake.application.options.trace
512
+ # touch url_path, mtime: date, verbose: Rake.application.options.trace
513
+ end
514
+
515
+ def wire
516
+ file self.path
517
+ directory url_dir
518
+ file url_path => url_dir
519
+ file url_path => path do
520
+ self.generate
521
+ end
522
+ task :site => url_path
523
+ end
524
+ end
525
+
508
526
  ##
509
527
  # Generates a virtual page with an index of all tags on the given pages.
510
528
  # You must subclass and provide a content method.
@@ -5,7 +5,7 @@ class Zenweb::Page
5
5
 
6
6
  def disqus shortname
7
7
  '<div id="disqus_thread"></div>' +
8
- run_js_script("http://#{shortname}.disqus.com/embed.js")
8
+ run_js_script("https://#{shortname}.disqus.com/embed.js")
9
9
  end
10
10
 
11
11
  ##
@@ -13,6 +13,6 @@ class Zenweb::Page
13
13
  # disqus comment counts.
14
14
 
15
15
  def disqus_counts shortname
16
- run_js_script "http://#{shortname}.disqus.com/count.js"
16
+ run_js_script "https://#{shortname}.disqus.com/count.js"
17
17
  end
18
18
  end
data/lib/zenweb/site.rb CHANGED
@@ -197,7 +197,7 @@ module Zenweb
197
197
  when /\.yml$/ then
198
198
  @configs[path] = Config.new self, path
199
199
  when /\.(?:#{self.class.binary_files.join("|")})$/ then
200
- @pages[path] = Page.new self, path, self.config
200
+ @pages[path] = Binary.new self, path, self.config
201
201
  when /\.(?:#{self.class.text_files.join("|")})$/, renderers_re then
202
202
  @pages[path] = Page.new self, path
203
203
  else
@@ -3,7 +3,7 @@ require 'zenweb'
3
3
  task :default => :generate
4
4
 
5
5
  def website
6
- return $website if defined?($website)
6
+ return $website if defined?($website) && $website
7
7
  $website = Zenweb::Site.new
8
8
  $website.scan
9
9
  $website.wire
@@ -153,19 +153,17 @@ task :run do
153
153
 
154
154
  warn "NOTE: No file found for #{url}" unless task
155
155
 
156
- newer = task && task.needed?
156
+ if task then
157
+ if task.needed? then
158
+ unless system "#{Gem.ruby} -S rake -q clean generate" then
159
+ warn "WARNING: couldn't run 'rake clean generate' properly, exited: %p" % [$?]
160
+ end
161
+ end
157
162
 
158
- if newer then
159
- system "rake clean generate"
160
- end
161
-
162
- if task && newer then
163
- @@site = nil
163
+ @@site = $website = nil
164
164
  Rake.application = Rake::Application.new # reset
165
165
  end
166
166
 
167
- task.clear_timestamp if task && target_path =~ /(html|css|js)$/
168
-
169
167
  super
170
168
  end
171
169
  end
data/lib/zenweb.rb CHANGED
@@ -6,7 +6,7 @@ require "time"
6
6
 
7
7
  module Zenweb
8
8
  # duh
9
- VERSION = "3.11.0"
9
+ VERSION = "3.12.0"
10
10
  end
11
11
 
12
12
  require "zenweb/site"
@@ -147,16 +147,18 @@ class TestZenwebPage < Minitest::Test
147
147
  assert_equal exp, top.sitemap(:title_dated)
148
148
  end
149
149
 
150
- def test_binary
151
- page = Zenweb::Page.new site, "blah"
152
- refute_predicate page, :binary?
150
+ def test_body
151
+ assert_equal "Not really much here to see.", page.body
152
+ end
153
153
 
154
- page = Zenweb::Page.new site, "blah", site.config
155
- assert_predicate page, :binary?
154
+ def test_change_frequency
155
+ assert_equal "yearly", page.change_frequency
156
156
  end
157
157
 
158
- def test_body
159
- assert_equal "Not really much here to see.", page.body
158
+ def test_change_frequency__config
159
+ page.config.h["change_frequency"] = "daily"
160
+
161
+ assert_equal "daily", page.change_frequency
160
162
  end
161
163
 
162
164
  def test_breadcrumbs
@@ -256,18 +258,12 @@ class TestZenwebPage < Minitest::Test
256
258
  end
257
259
 
258
260
  def test_generate_binary
259
- page = Zenweb::Page.new site, "blah", site.config
261
+ page = Zenweb::Binary.new site, "blah", site.config
262
+ def page.cp(...) = puts "copy!" # just shows it got called
263
+ def page.date = Time.now
260
264
 
261
- def page.render
262
- "woot"
263
- end
264
-
265
- def page.open path, mode
266
- yield $stdout
267
- end
268
-
269
- out = "woot"
270
- err = "Rendering .site/blah\n"
265
+ out = "copy!\n"
266
+ err = "Copying .site/blah\n"
271
267
 
272
268
  assert_output out, err do
273
269
  page.generate
@@ -359,15 +355,15 @@ class TestZenwebPage < Minitest::Test
359
355
  assert_nil page.method_missing("wtf")
360
356
  end
361
357
 
362
- assert_includes e.message, "undefined method `wtf'"
358
+ assert_match(/undefined method .wtf'/, e.message)
363
359
  end
364
360
 
365
361
  def test_method_missing_render
366
362
  e = assert_raises NoMethodError do
367
363
  assert_nil page.render_wtf
368
364
  end
369
- err = "undefined method `render_wtf' for Page"
370
- assert_includes e.message, err
365
+
366
+ assert_match(/undefined method .render_wtf' for.*?Zenweb::Page/, e.message)
371
367
  end
372
368
 
373
369
  def test_layout_nil_string
@@ -23,7 +23,7 @@ class TestZenwebPageDisqus < Minitest::Test
23
23
  var s = document.createElement('script');
24
24
  s.type = 'text/javascript';
25
25
  s.async = true;
26
- s.src = 'http://myshortname.disqus.com/#{name}.js';
26
+ s.src = 'https://myshortname.disqus.com/#{name}.js';
27
27
  (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(s);
28
28
  })();
29
29
  </script>
@@ -49,13 +49,17 @@ class TestZenwebPageErb < Minitest::Test
49
49
  assert e.backtrace.grep('Page["blog/2012-01-02-page1.html.md"]:1')
50
50
  end
51
51
 
52
+ def prism? # yuck! but prism is injecting ansi codes everywhere!
53
+ RubyVM::InstructionSequence.compile("").to_a[4][:parser] == :prism
54
+ end
55
+
52
56
  def test_erb_syntax_error
53
57
  e = assert_raises SyntaxError do
54
58
  page.erb "this is {{ 1 + }} content", page
55
59
  end
56
60
 
57
61
  # in 2.5 this changes from concat to <<, but the syntax error stays
58
- assert_includes e.message, "(( 1 + ).to_s)"
62
+ assert_includes e.message, "(( 1 + ).to_s)" unless prism?
59
63
  assert e.backtrace.grep('Page["blog/2012-01-02-page1.html.md"]:1')
60
64
  end
61
65
  end
@@ -166,9 +166,9 @@ class TestZenwebSite < Minitest::Test
166
166
 
167
167
  assert_equal exp, site.pages.keys.sort
168
168
 
169
- exp = [Zenweb::Page]
169
+ exp = [Zenweb::Binary, Zenweb::Page]
170
170
 
171
- assert_equal exp, site.pages.values.map(&:class).uniq
171
+ assert_equal exp, site.pages.values.map(&:class).uniq.sort_by(&:name)
172
172
  end
173
173
 
174
174
  def test_pages_by_date
@@ -278,7 +278,7 @@ class TestZenwebSite < Minitest::Test
278
278
  assert_task "css/colors.css.less", %w[_config.yml]
279
279
  assert_task "css/styles.css", %w[_config.yml]
280
280
  assert_task "css/syntax.css", %w[_config.yml]
281
- assert_task "img/bg.png", %w[_config.yml]
281
+ assert_task "img/bg.png"
282
282
  assert_task "js/jquery.js", %w[_config.yml]
283
283
  assert_task "js/site.js", %w[_config.yml]
284
284
  assert_task "sitemap.xml.erb", %w[_config.yml]
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,18 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zenweb
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.11.0
4
+ version: 3.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain:
11
10
  - |
12
11
  -----BEGIN CERTIFICATE-----
13
- MIIDPjCCAiagAwIBAgIBBzANBgkqhkiG9w0BAQsFADBFMRMwEQYDVQQDDApyeWFu
12
+ MIIDPjCCAiagAwIBAgIBCjANBgkqhkiG9w0BAQsFADBFMRMwEQYDVQQDDApyeWFu
14
13
  ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
15
- GRYDY29tMB4XDTIzMDEwMTA3NTExN1oXDTI0MDEwMTA3NTExN1owRTETMBEGA1UE
14
+ GRYDY29tMB4XDTI2MDEwNzAxMDkxNFoXDTI3MDEwNzAxMDkxNFowRTETMBEGA1UE
16
15
  AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
17
16
  JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
18
17
  b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
@@ -22,14 +21,14 @@ cert_chain:
22
21
  qhtV7HJxNKuPj/JFH0D2cswvzznE/a5FOYO68g+YCuFi5L8wZuuM8zzdwjrWHqSV
23
22
  gBEfoTEGr7Zii72cx+sCAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
24
23
  HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/hMA0GCSqGSIb3DQEBCwUAA4IB
25
- AQAkg3y+PBnBAPWdxxITm5sPHqdWQgSyCpRA20o4LTuWr8BWhSXBkfQNa7cY6fOn
26
- xyM34VPzBFbExv6XOGDfOMFBVaYTHuN9peC/5/umL7kLl+nflXzL2QA7K6LYj5Bg
27
- sM574Onr0dZDM6Vn69bzQ7rBIFDfK/OhlPzqKZad4nsdcsVH8ODCiT+ATMIZyz5K
28
- WCnNtqlyiWXI8tdTpahDgcUwfcN/oN7v4K8iU5IbLJX6HQ5DKgmKjfb6XyMth16k
29
- ROfWo9Uyp8ba/j9eVG14KkYRaLydAY1MNQk2yd3R5CGfeOpD1kttxjoypoUJ2dOG
30
- nsNBRuQJ1UfiCG97a6DNm+Fr
24
+ AQA/X8/PKTTc/IkYQEUL6XWtfK8fAfbuLJzmLcz6f2ZWrtBvPsYvqRuwI1bWUtil
25
+ 2ibJEfIuSIHX6BsUTX18+hlaIussf6EWq/YkE7e2BKmgQE42vSOZMce0kCEAPbx0
26
+ rQtqonfWTHQ8UbQ7GqCL3gDQ0QDD2B+HUlb4uaCZ2icxqa/eOtxMvHC2tj+h0xKY
27
+ xL84ipM5kr0bHGf9/MRZJWcw51urueNycBXu1Xh+pEN8qBmYsFRR4SIODLClybAO
28
+ 6cbm2PyPQgKNiqE4H+IQrDVHd9bJs1XgLElk3qoaJBWXc/5fy0J1imYb25UqmiHG
29
+ snGe1hrppvBRdcyEzvhfIPjI
31
30
  -----END CERTIFICATE-----
32
- date: 2023-09-29 00:00:00.000000000 Z
31
+ date: 1980-01-02 00:00:00.000000000 Z
33
32
  dependencies:
34
33
  - !ruby/object:Gem::Dependency
35
34
  name: rake
@@ -141,35 +140,35 @@ dependencies:
141
140
  requirements:
142
141
  - - ">="
143
142
  - !ruby/object:Gem::Version
144
- version: '4.0'
143
+ version: '6.0'
145
144
  - - "<"
146
145
  - !ruby/object:Gem::Version
147
- version: '7'
146
+ version: '8'
148
147
  type: :development
149
148
  prerelease: false
150
149
  version_requirements: !ruby/object:Gem::Requirement
151
150
  requirements:
152
151
  - - ">="
153
152
  - !ruby/object:Gem::Version
154
- version: '4.0'
153
+ version: '6.0'
155
154
  - - "<"
156
155
  - !ruby/object:Gem::Version
157
- version: '7'
156
+ version: '8'
158
157
  - !ruby/object:Gem::Dependency
159
158
  name: hoe
160
159
  requirement: !ruby/object:Gem::Requirement
161
160
  requirements:
162
161
  - - "~>"
163
162
  - !ruby/object:Gem::Version
164
- version: '4.0'
163
+ version: '4.6'
165
164
  type: :development
166
165
  prerelease: false
167
166
  version_requirements: !ruby/object:Gem::Requirement
168
167
  requirements:
169
168
  - - "~>"
170
169
  - !ruby/object:Gem::Version
171
- version: '4.0'
172
- description: |-
170
+ version: '4.6'
171
+ description: |
173
172
  Zenweb is a set of classes/tools for organizing and formating a
174
173
  website. It is website oriented rather than webpage oriented, unlike
175
174
  most rendering tools. It is content oriented, rather than style
@@ -183,6 +182,8 @@ description: |-
183
182
  Zenweb uses rake to handle dependencies. As a result, scanning a
184
183
  website and regenerating incrementally is not just possible, it is
185
184
  blazingly fast.
185
+
186
+ ==== To Install:
186
187
  email:
187
188
  - ryand-ruby@zenspider.com
188
189
  executables: []
@@ -266,7 +267,7 @@ licenses:
266
267
  metadata:
267
268
  homepage_uri: https://github.com/seattlerb/zenweb
268
269
  bug_tracker_uri: https://github.com/seattlerb/zenweb/issues
269
- post_install_message:
270
+ documentation_uri: http://docs.seattlerb.org/zenweb
270
271
  rdoc_options:
271
272
  - "--main"
272
273
  - README.rdoc
@@ -283,8 +284,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
283
284
  - !ruby/object:Gem::Version
284
285
  version: '0'
285
286
  requirements: []
286
- rubygems_version: 3.4.10
287
- signing_key:
287
+ rubygems_version: 3.7.2
288
288
  specification_version: 4
289
289
  summary: Zenweb is a set of classes/tools for organizing and formating a website
290
290
  test_files: []
metadata.gz.sig CHANGED
@@ -1,3 +1 @@
1
- r������2u\5��� 84��f �y�vBϥg� 6!���7�J6;�9!GJ�V�m������
2
- e �6Y/���=�ᢞbN2q�EEE_;�<<0��� �Ƌ*�w� ˚J��cQe� �rU�_�)���>}j-=]�D/Z�x���$E�;I�/��{O�ȭ�*�,���Wɝ S>��0�`��/Y��n�ڴ�C����� �V���R<�C��燅�[Mf��_��4�><;���׸�p{��Y���
3
- �\�)
1
+ v