pbsimply 3.0.0 → 3.0.2

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: 7687be75df33cb36e8e9f7f694d3bc9639ef6c90cd82a14f321188315dfa56f1
4
- data.tar.gz: ff4499686dde84ac858f4f30ce25c1a2aee14167ab3ff9c2ede36f058dd1c5b2
3
+ metadata.gz: 6d2c58cce236dac5c8dc0d62c29d34dd3896b904a39a0fd2f4d6923e34e8a8bc
4
+ data.tar.gz: 555eb53df299fa68a5ec20a739660c071639a94a50072a52b8ac07031ba04be3
5
5
  SHA512:
6
- metadata.gz: efa4bcaeb69f92002b2aec97058af9b7594a1b25022e12ed80a41c8d0b4f41b00117c9459f7179d74ca5d3f12357747ca479fb736a6e657089ca2bf4eaa2ba6f
7
- data.tar.gz: b6ee58f40592e3e88c5009f0cbfe0f9556df9beff62b55dbe59aae8e03c2621f9e85558f2c45198276e27049d6a0783a1736d263231db04e768baa3f1982daff
6
+ metadata.gz: 8330d449dea9be67096f09a024bbdcdb9ece542b308bef14992bee4f58702fb538ffe025b4d6a1828c70f15033c8503be65caeaf12ed34057223f7ac198edbc1
7
+ data.tar.gz: f552fe4085b49ed57ff51fd51ec146c7b1b4bcd549c6e27b3e0d0586bb528eaebcc70fd778d4c85415f39f02080c4799b3a8f63d14eac2880b38ef371bce2f14
@@ -187,7 +187,6 @@ module PBSimply::Frontmatter
187
187
 
188
188
  frontmatter["_size"] = fsize
189
189
  frontmatter["_mtime"] = mtime
190
- frontmatter["_last_proced"] = @now.to_i
191
190
 
192
191
  if File.extname(filename) == ".md"
193
192
  frontmatter["_docformat"] = "Markdown"
data/lib/pbsimply.rb CHANGED
@@ -221,7 +221,7 @@ class PBSimply
221
221
  # Exclude unchanged documents.
222
222
  if @indexes && @indexes_orig
223
223
  STDERR.puts "Checking modification..."
224
- target_docs.delete_if {|filename, frontmatter, pos| !check_modify([@dir, filename], frontmatter)}
224
+ target_docs.delete_if {|filename, frontmatter, pos| !check_modify(filename, frontmatter)}
225
225
  end
226
226
 
227
227
  # Modify frontmatter `BLESSING'
@@ -386,29 +386,32 @@ class PBSimply
386
386
  private
387
387
 
388
388
  # Check is the article modified? (or force update?)
389
- def check_modify(path, frontmatter)
389
+ def check_modify(filename, frontmatter)
390
390
  modify = true
391
- index = @indexes_orig[path[1]].dup || {}
392
- frontmatter = @db.cmp_obj(frontmatter)
393
-
394
- # Remove unstable metadata for compartion.
395
- index.delete("_last_proced")
396
- index.delete("source_path")
397
- index.delete("source_directory")
398
- index.delete("dest_path")
399
- frontmatter.delete("_last_proced")
400
- frontmatter.delete("source_path")
401
- frontmatter.delete("source_directory")
402
- frontmatter.delete("dest_path")
403
-
404
- if index == frontmatter
405
- STDERR.puts "#{path[1]} is not modified."
406
- modify = false
391
+ index = @indexes_orig[filename]&.dup || {}
392
+
393
+ case @config["detect_modification"]
394
+ when "changes"
395
+ # Use "changes"
396
+ modify = false if frontmatter["changes"] == index["changes"]
397
+ when "mtimesize"
398
+ # Use mtime and file size.
399
+ modify = false if frontmatter["_mtime"] <= (index["_last_proced"] || 0) && frontmatter["_size"] == index["_size"]
407
400
  else
408
- STDERR.puts "#{path[1]} last modified at #{frontmatter["_mtime"]}, last processed at #{@indexes_orig[path[1]]&.[]("_last_proced") || 0}"
409
- frontmatter["last_update"] = @now.strftime("%Y-%m-%d %H:%M:%S")
401
+ # Default method, use mtime.
402
+ modify = false if frontmatter["_mtime"] <= (index["_last_proced"] || 0)
410
403
  end
411
404
 
405
+
406
+ if modify
407
+ STDERR.puts "#{filename} last modified at #{frontmatter["_mtime"]}, last processed at #{@indexes_orig[filename]&.[]("_last_proced") || 0}"
408
+ else
409
+ STDERR.puts "#{filename} is not modified."
410
+ end
411
+
412
+ frontmatter["_last_proced"] = @now.to_i
413
+ frontmatter["last_update"] = @now.strftime("%Y-%m-%d %H:%M:%S")
414
+
412
415
  if @refresh
413
416
  # Refresh (force update) mode.
414
417
  true
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.0.0
4
+ version: 3.0.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-10 00:00:00.000000000 Z
11
+ date: 2023-10-15 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Pre compile, static serving website builder.
14
14
  email: