Skip to content
Snippets Groups Projects
Commit 5b2f16f0 authored by fauno's avatar fauno
Browse files

v0.1.2 -- actually check if the files are the same and ruby 3 support

parent 2f746cc9
Branches antifascista
No related tags found
No related merge requests found
Gem::Specification.new do |spec|
spec.name = 'jekyll-hardlinks'
spec.version = '0.1.1'
spec.version = '0.1.2'
spec.authors = %w[f]
spec.email = %w[f@sutty.nl]
......@@ -8,7 +8,6 @@ Gem::Specification.new do |spec|
spec.description = 'Jekyll copies static files and duplicates storage use. Hard links point to the same file instead of making copies, thus saving storage.'
spec.homepage = "https://0xacab.org/sutty/jekyll/#{spec.name}"
spec.license = 'GPL-3.0'
spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
spec.metadata = {
'bug_tracker_uri' => "#{spec.homepage}/issues",
......@@ -30,7 +29,7 @@ Gem::Specification.new do |spec|
'--quiet'
]
spec.required_ruby_version = '~> 2'
spec.required_ruby_version = '>= 2.6'
spec.add_dependency 'jekyll', '~> 4'
end
......@@ -11,7 +11,7 @@ module Jekyll
# replace it with one. This is useful when migrating from a site
# already built without this plugin.
if File.exist? dest_path
return if hardlink? dest_path
return if hardlink? dest_path, path
FileUtils.rm dest_path
end
......@@ -23,9 +23,9 @@ module Jekyll
private
# Verifies the path has hardlinks
def hardlink?(path)
File.stat(path).nlink > 1
# Verifies the files are the same by checking their inode
def hardlink?(dest_path, path)
File.stat(path).ino == File.stat(dest_path).ino
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment