zarchitect 1.6.0 → 1.7.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: d3c85171bc5002d2fc4d485b41efdd70ab1031c4b028766a2c2d534c50ec0f6a
4
- data.tar.gz: cceb00da64b1ed2d61f6c4be6f6c2375e43dc7a51b9426383457b74524c6d9e6
3
+ metadata.gz: 872696fbcc1fdcac5bbe6f4e797c66f1a11a40ef3a09156f2f95841224c11fc4
4
+ data.tar.gz: 556377e367f457acc7e9a6381e141a17f5bebf028c2f6bd9efafba149cef3e93
5
5
  SHA512:
6
- metadata.gz: 8ff57eaf919aae4fbfd9e1e98814794adbc2832c81ca446dbb89a998fb9371be779eb16062485657ba6eb76e00c2a83a47856f87686f94daaf1983ff6d9d409a
7
- data.tar.gz: e0ff271242382ed66211c997c9b98c82b075ea1e6a2e340552bd4095151a31b8a0c254fce70074683d22258884b33ff0b5ba21fd701c606367afe786eff81c58
6
+ metadata.gz: 635a6add041ba9cf2e9ed5c862796e80eb107c66526f12aeeb75d026513f6b301b6c22716d7724703d2f36fb947a05cf565b7d1c12e4075619ed733b92a2b2e1
7
+ data.tar.gz: 55197b4d53a57c1003e177a5d33d0504f282d3fdd7adeaa2c1635caa3a898f65e59c2e6271bbc76457a9c7f28cc1b63592f9bc0375f416b0f87741349f33c6c4
@@ -205,6 +205,9 @@ class Config
205
205
 
206
206
  def validate_zrconf
207
207
  GPI.print "Validating #{@file}."
208
+ unless @hash.has_key?("symlink_assets")
209
+ @hash["symlink_assets"] = false
210
+ end
208
211
  unless @hash.has_key?("url")
209
212
  GPI.print "config key [url] missing in _config/_zarchitect.yaml."
210
213
  GPI.quit
@@ -20,6 +20,7 @@ class FileManager < Zarchitect
20
20
  Util.mkdir(realpath) if File.directory?(fullpath)
21
21
  next if File.directory?(fullpath)
22
22
  # file handling
23
+ rrealpath = File.join(Dir.getwd, fullpath)
23
24
  # handle file types embedded in posts
24
25
  if Image.is_valid?(fullpath)
25
26
  GPI.print "processing #{fullpath} as image file",
@@ -40,9 +41,20 @@ class FileManager < Zarchitect
40
41
  end
41
42
  # create symlink in _html/files to physical files _files (if process did
42
43
  # not abort)
43
- unless File.symlink?(realpath)
44
- rrealpath = File.join(Dir.getwd, fullpath)
45
- symlink(rrealpath, realpath)
44
+ unless File.exist?(realpath)
45
+ if Zarchitect.conf.symlink_assets
46
+ symlink(rrealpath, realpath)
47
+ else
48
+ copy(rrealpath, realpath)
49
+ end
50
+ else
51
+ if File.stat(rrealpath).mtime > File.stat(realpath).mtime
52
+ if Zarchitect.conf.symlink_assets
53
+ symlink(rrealpath, realpath)
54
+ else
55
+ copy(rrealpath, realpath)
56
+ end
57
+ end
46
58
  end
47
59
 
48
60
  end
@@ -56,6 +68,15 @@ class FileManager < Zarchitect
56
68
  GPI::CLU.check_option('v')
57
69
  end
58
70
 
71
+ def copy(from, to)
72
+ cmd = "cp #{from} #{to}"
73
+ GPI.print cmd, GPI::CLU.check_option('v')
74
+ unless system(cmd)
75
+ GPI.print "failed to copy '#{from}' to '#{to}'"
76
+ GPI.quit
77
+ end
78
+ end
79
+
59
80
  def clean
60
81
  # remove all files in _html/files
61
82
  %x{rm -r _html/files/*}
data/lib/zarchitect.rb CHANGED
@@ -9,7 +9,7 @@ require 'sitemap_generator'
9
9
 
10
10
  class Zarchitect
11
11
 
12
- VERSION = "1.6.0"
12
+ VERSION = "1.7.0"
13
13
  HTMLDIR = "_html"
14
14
  BUILDIR = "_build"
15
15
  NODEDIR = "_build/nodes"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zarchitect
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ryu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-21 00:00:00.000000000 Z
11
+ date: 2023-06-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Yet another static website generator
14
14
  email: ryu@tohya.net