jekyll-root-directory 0.0.4
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 +7 -0
- data/lib/jekyll-root-directory.rb +36 -0
- metadata +48 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 15854310f075e4a8b2ba1dfb51f277c096c3a117b7ef6f75758af7b68976bb25
|
4
|
+
data.tar.gz: d64ff69ba4a6f8aa3f4edee6be389bafed9ec07176451164b7b0be181feacf14
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f56f133774260e83d19f86e1b02c8d8a1993318a68110371fffc2424bd5209bd64c0b1c0cafa83d83495dcb183f1a2a6aa96f085d99b303b5837055f965b6ac8
|
7
|
+
data.tar.gz: 963ee264e2280bdffa2de0439e56815e3aabec81e4cc80d4da3019057d280e7ec675e9000934f18e7132f75b4bb77f180f307b1a0c33ab296959acbaeba4c585
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require "find"
|
2
|
+
|
3
|
+
module Jekyll
|
4
|
+
Hooks.register :site, :post_write do |site|
|
5
|
+
root_dir = "#{site.source}/_root"
|
6
|
+
|
7
|
+
Find.find("#{root_dir}").select do |filename|
|
8
|
+
filename = filename.gsub("#{root_dir}/", "")
|
9
|
+
path = "#{root_dir}/#{filename}"
|
10
|
+
|
11
|
+
if File.file?("#{path}")
|
12
|
+
# There doesn't seem to be a native Jekyll method to copy + flatten a subfolder :|
|
13
|
+
# This means we need to do it manually.
|
14
|
+
|
15
|
+
# We can't use StaticFile as it keeps the subfolder used, but we need it for modify times
|
16
|
+
sFile = Jekyll::StaticFile.new(site, site.source, "_root", filename)
|
17
|
+
|
18
|
+
dest_path = "#{site.config['destination']}/#{filename}"
|
19
|
+
|
20
|
+
FileUtils.mkdir_p(File.dirname(dest_path))
|
21
|
+
FileUtils.rm(dest_path) if File.exist?(dest_path)
|
22
|
+
|
23
|
+
# https://github.com/jekyll/jekyll/blob/22a974200d21a5476e92ee9e33312c583f001271/lib/jekyll/static_file.rb#L192
|
24
|
+
if @site.safe || Jekyll.env == "production"
|
25
|
+
FileUtils.cp(path, dest_path)
|
26
|
+
else
|
27
|
+
FileUtils.copy_entry(path, dest_path)
|
28
|
+
end
|
29
|
+
|
30
|
+
unless File.symlink?(dest_path)
|
31
|
+
File.utime(sFile.class.mtimes[path], sFile.class.mtimes[path], dest_path)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
metadata
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jekyll-root-directory
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.4
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Angus Johnston
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-10-30 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Adds a _root directory to Jekyll, allowing you to move static root site
|
14
|
+
files away from the root jekyll directory.
|
15
|
+
email:
|
16
|
+
- admin+rubygems@codeanimu.net
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- lib/jekyll-root-directory.rb
|
22
|
+
homepage: https://github.com/DakuTree/jekyll-root-directory
|
23
|
+
licenses:
|
24
|
+
- MIT
|
25
|
+
metadata:
|
26
|
+
homepage_uri: https://github.com/DakuTree/jekyll-root-directory
|
27
|
+
source_code_uri: https://github.com/DakuTree/jekyll-root-directory
|
28
|
+
changelog_uri: https://github.com/DakuTree/jekyll-root-directory/blob/master/CHANGELOG.md
|
29
|
+
post_install_message:
|
30
|
+
rdoc_options: []
|
31
|
+
require_paths:
|
32
|
+
- lib
|
33
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0'
|
43
|
+
requirements: []
|
44
|
+
rubygems_version: 3.0.3
|
45
|
+
signing_key:
|
46
|
+
specification_version: 4
|
47
|
+
summary: Adds a _root directory to Jekyll.
|
48
|
+
test_files: []
|