zarchitect 1.6.0 → 1.7.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: d3c85171bc5002d2fc4d485b41efdd70ab1031c4b028766a2c2d534c50ec0f6a
4
- data.tar.gz: cceb00da64b1ed2d61f6c4be6f6c2375e43dc7a51b9426383457b74524c6d9e6
3
+ metadata.gz: 9aa34b3381e8c7c34dc36062a92864e84a0e98db1c5ad21a0fc2e0c941c6eb43
4
+ data.tar.gz: 7aca9ff4c0b761fdcdc10a48a06684352f1ea7541a10a8299441e9e6839481db
5
5
  SHA512:
6
- metadata.gz: 8ff57eaf919aae4fbfd9e1e98814794adbc2832c81ca446dbb89a998fb9371be779eb16062485657ba6eb76e00c2a83a47856f87686f94daaf1983ff6d9d409a
7
- data.tar.gz: e0ff271242382ed66211c997c9b98c82b075ea1e6a2e340552bd4095151a31b8a0c254fce70074683d22258884b33ff0b5ba21fd701c606367afe786eff81c58
6
+ metadata.gz: ddcd6a76992a79454ed31aee8998f0b97b1212a9322ed1053883985ae65c6b5c0b037630d6975d28b54166d6c7d30bd13cf085886c3a30cbc8c52db349b0c749
7
+ data.tar.gz: 26e342e8984e2cbc696ff6d3d1f7f228f191a7903bed77477b3881f85b31349fd5d2b0aa585a409f8062a7914eada020f30185536170dc402771c71ed7dcbd22
@@ -8,8 +8,11 @@ class Assets < Zarchitect
8
8
  end
9
9
 
10
10
  def update
11
- Dir[ File.join(@from, '**', '*') ].reject do |fullpath|
11
+ Dir.glob(File.join(@from, '**', '*'), File::FNM_DOTMATCH).reject do |fullpath|
12
12
  path = fullpath[(@from.length)..-1]
13
+ next if path[-1] == '.'
14
+ next if path.include?('.sass-cache')
15
+
13
16
  if path.include?(HTMLDIR)
14
17
  realpath = path[1..-1]
15
18
  else
@@ -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_files")
209
+ @hash["symlink_files"] = true
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
@@ -12,14 +12,16 @@ class FileManager < Zarchitect
12
12
 
13
13
  def run
14
14
  # iterate FROM
15
- Dir[ File.join(@from, '**', '*') ].reject do |fullpath|
15
+ Dir.glob(File.join(@from, '**', '*'), File::FNM_DOTMATCH).reject do |fullpath|
16
16
  path = fullpath[(@from.length)..-1]
17
+ next if path[-1] == '.'
17
18
  realpath = File.join(@to, path) # path of new dir/symlink
18
19
 
19
20
  # dir handling / create copies in TO
20
21
  Util.mkdir(realpath) if File.directory?(fullpath)
21
22
  next if File.directory?(fullpath)
22
23
  # file handling
24
+ rrealpath = File.join(Dir.getwd, fullpath)
23
25
  # handle file types embedded in posts
24
26
  if Image.is_valid?(fullpath)
25
27
  GPI.print "processing #{fullpath} as image file",
@@ -40,9 +42,20 @@ class FileManager < Zarchitect
40
42
  end
41
43
  # create symlink in _html/files to physical files _files (if process did
42
44
  # not abort)
43
- unless File.symlink?(realpath)
44
- rrealpath = File.join(Dir.getwd, fullpath)
45
- symlink(rrealpath, realpath)
45
+ unless File.exist?(realpath)
46
+ if Zarchitect.conf.symlink_files
47
+ symlink(rrealpath, realpath)
48
+ else
49
+ copy(rrealpath, realpath)
50
+ end
51
+ else
52
+ if File.stat(rrealpath).mtime > File.stat(realpath).mtime
53
+ if Zarchitect.conf.symlink_files
54
+ symlink(rrealpath, realpath)
55
+ else
56
+ copy(rrealpath, realpath)
57
+ end
58
+ end
46
59
  end
47
60
 
48
61
  end
@@ -56,6 +69,15 @@ class FileManager < Zarchitect
56
69
  GPI::CLU.check_option('v')
57
70
  end
58
71
 
72
+ def copy(from, to)
73
+ cmd = "cp #{from} #{to}"
74
+ GPI.print cmd, GPI::CLU.check_option('v')
75
+ unless system(cmd)
76
+ GPI.print "failed to copy '#{from}' to '#{to}'"
77
+ GPI.quit
78
+ end
79
+ end
80
+
59
81
  def clean
60
82
  # remove all files in _html/files
61
83
  %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.2"
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.2
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