zenweb 3.8.0 → 3.9.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
  SHA1:
3
- metadata.gz: a185c37d33e80459bc51dd5385024961b0b50c2b
4
- data.tar.gz: 9f2b9d39c010a89c37571c1c055a9bf1d37e4ae2
3
+ metadata.gz: f182dd306078007adbb5ab6c1e53ad6a6d9ad389
4
+ data.tar.gz: 546e36b5723788433e99824c100e4344a9c3c4f8
5
5
  SHA512:
6
- metadata.gz: 9a74cf97cf4695310f96ab0feccc3c0d7905e5ac5ba2648ac9d3fa1a3ea2e35cbfb03ad7a08225b226c4ab1305c42cdd9d3aece80a75aab316b5de58f8902d62
7
- data.tar.gz: 1c3867c0bd11a4f57c92f528de9f44748955d11585851c8d43f4222b7c04d44ba9769f28f6d21abfce650d3159607bcc050a6b331d44203266de44520d2495f4
6
+ metadata.gz: 1a55442c3989e15e3cf236754bf4c609863be2e40da7c582b7f55ce4fb5202cbf2b5711e4e68abb03ac028bd68ebc36872364f77745cf18a879301438f8807d5
7
+ data.tar.gz: aaab074cb12006a26c8e5a9378c482b50815a3731b31738faafb4e692b54f32558baf709247b654cf864f3a7742463b67cf2538f06bd6e20bda01849f535f5af
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,14 @@
1
+ === 3.9.0 / 2015-12-21
2
+
3
+ * 1 minor enhancement:
4
+
5
+ * Added Page#binary w/ Page#binary? alias.
6
+
7
+ * 2 bug fixes:
8
+
9
+ * Only puts on output if not binary.
10
+ * Only strip body content if not binary.
11
+
1
12
  === 3.8.0 / 2015-12-15
2
13
 
3
14
  * 1 minor enhancement:
@@ -6,7 +6,7 @@ require "time"
6
6
 
7
7
  module Zenweb
8
8
  # duh
9
- VERSION = "3.8.0"
9
+ VERSION = "3.9.0"
10
10
  end
11
11
 
12
12
  require "zenweb/site"
@@ -31,6 +31,12 @@ 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
38
+ alias binary? binary
39
+
34
40
  ##
35
41
  # Returns a regexp that will match file extensions for all known
36
42
  # renderer types.
@@ -49,6 +55,7 @@ module Zenweb
49
55
  # TODO: make sure that creating page /a.html strips leading / from path
50
56
  @site, @path = site, path
51
57
  @config = config if config
58
+ @binary = config
52
59
 
53
60
  self.filetypes.each do |type|
54
61
  send "extend_#{type}" if self.respond_to? "extend_#{type}"
@@ -90,7 +97,11 @@ module Zenweb
90
97
  @body ||= begin
91
98
  thing = File.file?(path) ? path : self
92
99
  _, body = Zenweb::Config.split thing
93
- body.strip
100
+ if self.binary? then
101
+ body
102
+ else
103
+ body.strip
104
+ end
94
105
  end
95
106
  end
96
107
 
@@ -259,7 +270,11 @@ module Zenweb
259
270
  content = self.render
260
271
 
261
272
  open url_path, "w" do |f|
262
- f.puts content
273
+ if binary? then
274
+ f.print content
275
+ else
276
+ f.puts content
277
+ end
263
278
  end
264
279
  end
265
280
 
@@ -163,6 +163,14 @@ class TestZenwebPage < Minitest::Test
163
163
  assert_equal exp, top.sitemap(:title_dated)
164
164
  end
165
165
 
166
+ def test_binary
167
+ page = Zenweb::Page.new site, "blah"
168
+ refute_predicate page, :binary?
169
+
170
+ page = Zenweb::Page.new site, "blah", site.config
171
+ assert_predicate page, :binary?
172
+ end
173
+
166
174
  def test_body
167
175
  assert_equal "Not really much here to see.", page.body
168
176
  end
@@ -263,6 +271,25 @@ class TestZenwebPage < Minitest::Test
263
271
  end
264
272
  end
265
273
 
274
+ def test_generate_binary
275
+ page = Zenweb::Page.new site, "blah", site.config
276
+
277
+ def page.render
278
+ "woot"
279
+ end
280
+
281
+ def page.open path, mode
282
+ yield $stdout
283
+ end
284
+
285
+ out = "woot"
286
+ err = "Rendering .site/blah\n"
287
+
288
+ assert_output out, err do
289
+ page.generate
290
+ end
291
+ end
292
+
266
293
  def test_generate_via_invoke
267
294
  Rake.application = Rake::Application.new
268
295
  site.scan
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zenweb
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.8.0
4
+ version: 3.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
@@ -29,7 +29,7 @@ cert_chain:
29
29
  qx3h45R1CAsObX0SQDIT+rRbQrtKz1GHIZTOFYvEJjUY1XmRTZupD3CJ8Q7sDqSy
30
30
  NLq5jm1fq6Y9Uolu3RJbmycf
31
31
  -----END CERTIFICATE-----
32
- date: 2015-12-15 00:00:00.000000000 Z
32
+ date: 2015-12-21 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: rake
metadata.gz.sig CHANGED
Binary file