pbsimply 3.2.0 → 3.2.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: e5daf76d579a8b8d21f8b893977d3790b6e6691556767bdabcdde407dffc59a6
4
- data.tar.gz: 0c13965208a4a164af7bc42b15dc21a0384e7f237c68ce838b5acdbd7153d2d9
3
+ metadata.gz: 3d16b9549a41896f788b13064b3b607d4433c005ddadba170c6a23c1aec990fb
4
+ data.tar.gz: 5343f01a9003f2e0262d3799436e9ade3532fe8001d24646a08647a8bab737de
5
5
  SHA512:
6
- metadata.gz: 64fe31554280fb22e7102888d921cf726902b17b35c72cf1aa864bf808ff52be0c28bc2148d1a3d86829cfb889d93f121c38b8cd01e88befb2ae96f69717e45a
7
- data.tar.gz: 6a3837dd70a72e487d71e5f882ce87ff1644e9025d978301ca99165bb0d9cbbbec070076642ae40ff99867dafd0686f2edd7c9d262cfffc3cd4cc27188668c45
6
+ metadata.gz: e7e81643c7623fd45cbd20578a5d0c38cb73692ab721131d1d57e7a44ad84c17481784c1e7c578bd3eb21137b001d79643a874b622ff9a4010790df35950f01f
7
+ data.tar.gz: 4281c06376bc8ea4acf81ac38236a2760f5bd641f22c649c3494cec72f1a40f037f7453421ad7a6fd4943a7a2289b8c4d549c6c6a196c6d6a4f435f8e97d7de6
data/bin/pbsimply CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'pbsimply'
4
4
 
5
+ PBSimply.find_docroot
5
6
  config = PBSimply.load_config
6
7
 
7
8
  pbs_class = case config["pbsimply_processor"]
@@ -15,13 +15,13 @@ class PBSimply
15
15
  # Abstruct super class.
16
16
  class DocDB
17
17
  def dump(object)
18
- File.open(File.join(@dir, ".indexes.#{@ext}"), "w") do |f|
18
+ File.open(File.join(@dir, ".indexes.#{@ext}"), wmode) do |f|
19
19
  f.write @store_class.dump(object)
20
20
  end
21
21
  end
22
22
 
23
23
  def load
24
- File.open(File.join(@dir, ".indexes.#{@ext}"), "r") do |f|
24
+ File.open(File.join(@dir, ".indexes.#{@ext}"), rmode) do |f|
25
25
  next @store_class.load(f)
26
26
  end
27
27
  end
@@ -38,6 +38,14 @@ class PBSimply
38
38
  @store_class.load(@store_class.dump(frontmatter))
39
39
  end
40
40
 
41
+ def wmode
42
+ "w"
43
+ end
44
+
45
+ def rmode
46
+ "r"
47
+ end
48
+
41
49
  # Use Ruby Marshal
42
50
  class Marshal < DocDB
43
51
  def initialize(dir)
@@ -49,6 +57,14 @@ class PBSimply
49
57
  def cmp_obj(frontmatter)
50
58
  frontmatter.dup
51
59
  end
60
+
61
+ def wmode
62
+ "wb"
63
+ end
64
+
65
+ def rmode
66
+ "rb"
67
+ end
52
68
  end
53
69
 
54
70
  # Use JSON with bundled library
@@ -56,10 +56,11 @@ class PBSimply
56
56
  File.open(@workfile_frontmatter, "w") {|f| YAML.dump(frontmatter, f)}
57
57
 
58
58
  # Go Pandoc
59
- pandoc_cmdline = ["pandoc"]
60
- pandoc_cmdline += ["-d", @workfile_pandoc_defaultfiles, "--metadata-file", @workfile_frontmatter, "-M", "title:#{frontmatter["title"]}"]
59
+ pandoc_cmdline = [(@config["pandoc_command"] || "pandoc")]
60
+ pandoc_cmdline += ["-d", @workfile_pandoc_defaultfiles, "--metadata-file", @workfile_frontmatter, "-M", "title:#{frontmatter["title"]}", "-w", "html5"]
61
61
  pandoc_cmdline += ["-f", frontmatter["input_format"]] if frontmatter["input_format"]
62
62
  pandoc_cmdline += [ procdoc ]
63
+ pp pandoc_cmdline if ENV["DEBUG"] == "yes"
63
64
  IO.popen((pandoc_cmdline)) do |io|
64
65
  doc = io.read
65
66
  end
@@ -59,8 +59,9 @@ class PBSimply::Hooks
59
59
  end
60
60
  end
61
61
 
62
- def initialize(pbsimply)
62
+ def initialize(pbsimply, config)
63
63
  @pbsimply = pbsimply
64
+ @config = config
64
65
  @hooks_loaded = false
65
66
 
66
67
  # Called first phase before generate. This hooks called before blessing.
@@ -111,4 +112,6 @@ class PBSimply::Hooks
111
112
  attr :delete
112
113
  attr :post
113
114
  attr :accs
115
+
116
+ attr :config
114
117
  end
data/lib/pbsimply.rb CHANGED
@@ -37,6 +37,17 @@ class PBSimply
37
37
  # SETUP FUNCTIONS #
38
38
  ###############################################
39
39
 
40
+ def self.find_docroot
41
+ lastwd = nil
42
+ until File.exist?(".pbsimply.yaml")
43
+ Dir.chdir ".."
44
+ if lastwd == Dir.pwd
45
+ abort "PureBuilder Simply document root not found."
46
+ end
47
+ lastwd = Dir.pwd
48
+ end
49
+ end
50
+
40
51
  # Load config file.
41
52
  def self.load_config
42
53
  config = nil
@@ -74,6 +85,8 @@ class PBSimply
74
85
  DocDB::JSON.new(dir)
75
86
  when "oj"
76
87
  DocDB::Oj.new(dir)
88
+ when "marshal"
89
+ DocDB::Marshal.new(dir)
77
90
  else
78
91
  DocDB::Marshal.new(dir)
79
92
  end
@@ -106,7 +119,7 @@ class PBSimply
106
119
  @accs = nil
107
120
  @accs_index = {}
108
121
  @now = Time.now
109
- @hooks = PBSimply::Hooks.new(self)
122
+ @hooks = PBSimply::Hooks.new(self, @config)
110
123
  end
111
124
 
112
125
  # Process command-line
@@ -334,9 +347,6 @@ class PBSimply
334
347
 
335
348
  @accs = true if File.exist?(File.join(@dir, ".accs.yaml"))
336
349
 
337
- # Check existing in indexes.
338
- @indexes.delete_if {|k,v| ! File.exist?([@dir, k].join("/")) }
339
-
340
350
  proc_dir
341
351
  end
342
352
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pbsimply
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masaki Haruka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-28 00:00:00.000000000 Z
11
+ date: 2024-03-30 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Pre compile, static serving website builder.
14
14
  email: