diff --git a/jekyll-hardlinks.gemspec b/jekyll-hardlinks.gemspec index ec71047c0abdbd3d00b18511b4774b9f5fbacf87..547dae4bfa79bad8b077c51a1cc06f6ff5f53d50 100644 --- a/jekyll-hardlinks.gemspec +++ b/jekyll-hardlinks.gemspec @@ -1,6 +1,6 @@ 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 diff --git a/lib/jekyll/static_file.rb b/lib/jekyll/static_file.rb index d60d56cf9109d0990ed745e9ba6589b24236d7cd..b4d32a6a41ea168b31116d261813b2b6dd9e2067 100644 --- a/lib/jekyll/static_file.rb +++ b/lib/jekyll/static_file.rb @@ -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