jekyll-hardlinks 0.1.0 → 0.2.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: 4a3161df29dbe2b1779f02516bd50f4e3d6ee73a18a31c59756c66de8fee0ff7
4
- data.tar.gz: d498293c91c9204f54ad0cc31d72a2c08061869241a69a2f787cd6fc5623bbff
3
+ metadata.gz: 7504da2189fb3f8b93a566070c7050a6018499bd02e492bf67644bea4421b20d
4
+ data.tar.gz: 7ed4d75490fdd602be7317ba49f894b667cb401f2d997266d3f162f23ccd2f07
5
5
  SHA512:
6
- metadata.gz: 1872658460aad0d47bf8bf76faef30ec7ef90dd6dbb17614c874492babdc2a7bbc1f48ff6a9ad98dc1590ee4952e7c1b3f08d2ecb0aa625670de57e5df69eab2
7
- data.tar.gz: 6ddeaae29b8d9cde8d8ba0a5ab6701927e9860c1b736d0f171397fd68f88a559e0c2b62b23add7ccb72d7df5bda3ade5f8dcf982c903f3339a3f8d92ebe6bb71
6
+ metadata.gz: b6520877b559881e52c8c58389444fda1d9943545455f21d7b45df7f7e1c1ae0cef223ee49f295ee554c67777d31051066a9536dbaee104e078101732bc63803
7
+ data.tar.gz: 10d0f22b7fd62d38695b846b114278a80598164a3571ae2c6c1072b9c21ee182eaba4eb93df387b910328b02bd536516c2b9c4034c2e7283c5d8cc764ed3817a
data/README.md CHANGED
@@ -4,8 +4,8 @@ Jekyll copies static files and duplicates storage use. Hard links point
4
4
  to the same file instead of making copies, thus saving storage.
5
5
 
6
6
  **This plugin only works on file systems that support hard links.** It
7
- won't work if you're generating the site in another filesystem, since
8
- cross-filesystem hard links aren't possible.
7
+ will fallback to copying files if you're generating the site in another
8
+ filesystem, since cross-filesystem hard links aren't possible.
9
9
 
10
10
  ## Installation
11
11
 
@@ -6,12 +6,32 @@ module Jekyll
6
6
  # the file
7
7
  def write(dest)
8
8
  dest_path = destination(dest)
9
- return if File.exist? dest_path
9
+
10
+ # If the file exists but it's not a hardlink, we remove it and
11
+ # replace it with one. This is useful when migrating from a site
12
+ # already built without this plugin.
13
+ if File.exist? dest_path
14
+ return if hardlink? dest_path, path
15
+ FileUtils.rm dest_path
16
+ end
10
17
 
11
18
  self.class.mtimes[path] = mtime
12
19
 
13
20
  FileUtils.mkdir_p(File.dirname(dest_path))
14
- FileUtils.ln(path, dest_path)
21
+
22
+ begin
23
+ FileUtils.ln(path, dest_path)
24
+ rescue Errno::EXDEV
25
+ Jekyll.logger.warn 'Jekyll::StaticFile', "Cross-device link found, copying to #{dest_path} instead"
26
+ copy_file(dest_path)
27
+ end
28
+ end
29
+
30
+ private
31
+
32
+ # Verifies the files are the same by checking their inode
33
+ def hardlink?(dest_path, path)
34
+ File.stat(path).ino == File.stat(dest_path).ino
15
35
  end
16
36
  end
17
37
  end
metadata CHANGED
@@ -1,90 +1,76 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-hardlinks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - f
8
- autorequire:
9
- bindir: exe
8
+ autorequire:
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-01 00:00:00.000000000 Z
11
+ date: 2022-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: bundler
14
+ name: jekyll
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.0'
20
- type: :development
19
+ version: '4'
20
+ type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '2.0'
27
- - !ruby/object:Gem::Dependency
28
- name: rake
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '10.0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '10.0'
26
+ version: '4'
41
27
  description: Jekyll copies static files and duplicates storage use. Hard links point
42
28
  to the same file instead of making copies, thus saving storage.
43
29
  email:
44
30
  - f@sutty.nl
45
31
  executables: []
46
32
  extensions: []
47
- extra_rdoc_files: []
33
+ extra_rdoc_files:
34
+ - README.md
35
+ - LICENSE.txt
48
36
  files:
49
- - ".gitignore"
50
- - ".travis.yml"
51
- - CODE_OF_CONDUCT.md
52
- - Gemfile
53
37
  - LICENSE.txt
54
38
  - README.md
55
- - Rakefile
56
- - bin/console
57
- - bin/setup
58
- - jekyll-hardlinks.gemspec
59
39
  - lib/jekyll-hardlinks.rb
60
- - lib/jekyll/hardlinks/version.rb
61
40
  - lib/jekyll/static_file.rb
62
41
  homepage: https://0xacab.org/sutty/jekyll/jekyll-hardlinks
63
42
  licenses:
64
43
  - GPL-3.0
65
44
  metadata:
66
- allowed_push_host: https://rubygems.org
45
+ bug_tracker_uri: https://0xacab.org/sutty/jekyll/jekyll-hardlinks/issues
67
46
  homepage_uri: https://0xacab.org/sutty/jekyll/jekyll-hardlinks
68
47
  source_code_uri: https://0xacab.org/sutty/jekyll/jekyll-hardlinks
69
- changelog_uri: https://0xacab.org/sutty/jekyll/jekyll-hardlinks
70
- post_install_message:
71
- rdoc_options: []
48
+ changelog_uri: https://0xacab.org/sutty/jekyll/jekyll-hardlinks/-/blob/master/CHANGELOG.md
49
+ documentation_uri: https://rubydoc.info/gems/jekyll-hardlinks
50
+ post_install_message:
51
+ rdoc_options:
52
+ - "--title"
53
+ - jekyll-hardlinks - Saves space by using hard links for static files
54
+ - "--main"
55
+ - README.md
56
+ - "--line-numbers"
57
+ - "--inline-source"
58
+ - "--quiet"
72
59
  require_paths:
73
60
  - lib
74
61
  required_ruby_version: !ruby/object:Gem::Requirement
75
62
  requirements:
76
63
  - - ">="
77
64
  - !ruby/object:Gem::Version
78
- version: '0'
65
+ version: '2.6'
79
66
  required_rubygems_version: !ruby/object:Gem::Requirement
80
67
  requirements:
81
68
  - - ">="
82
69
  - !ruby/object:Gem::Version
83
70
  version: '0'
84
71
  requirements: []
85
- rubyforge_project:
86
- rubygems_version: 2.7.6.2
87
- signing_key:
72
+ rubygems_version: 3.3.8
73
+ signing_key:
88
74
  specification_version: 4
89
75
  summary: Saves space by using hard links for static files
90
76
  test_files: []
data/.gitignore DELETED
@@ -1,8 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
data/.travis.yml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- sudo: false
3
- language: ruby
4
- cache: bundler
5
- rvm:
6
- - 2.5.5
7
- before_install: gem install bundler -v 2.0.2
data/CODE_OF_CONDUCT.md DELETED
@@ -1,7 +0,0 @@
1
- # Códigos para compartir
2
-
3
- <https://sutty.nl/es/codigo-de-convivencia/>
4
-
5
- # Code of conduct
6
-
7
- <https://sutty.nl/en/code-of-conduct>
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- # Specify your gem's dependencies in jekyll-hardlinks.gemspec
4
- gemspec
data/Rakefile DELETED
@@ -1,10 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rake/testtask"
3
-
4
- Rake::TestTask.new(:test) do |t|
5
- t.libs << "test"
6
- t.libs << "lib"
7
- t.test_files = FileList["test/**/*_test.rb"]
8
- end
9
-
10
- task :default => :test
data/bin/console DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "jekyll/hardlinks"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start(__FILE__)
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
@@ -1,33 +0,0 @@
1
- lib = File.expand_path('lib', __dir__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require 'jekyll/hardlinks/version'
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = 'jekyll-hardlinks'
7
- spec.version = Jekyll::Hardlinks::VERSION
8
- spec.authors = ['f']
9
- spec.email = ['f@sutty.nl']
10
-
11
- spec.summary = 'Saves space by using hard links for static files'
12
- spec.description = 'Jekyll copies static files and duplicates storage use. Hard links point to the same file instead of making copies, thus saving storage.'
13
- spec.homepage = 'https://0xacab.org/sutty/jekyll/jekyll-hardlinks'
14
- spec.license = 'GPL-3.0'
15
-
16
- spec.metadata['allowed_push_host'] = 'https://rubygems.org'
17
-
18
- spec.metadata['homepage_uri'] = spec.homepage
19
- spec.metadata['source_code_uri'] = spec.homepage
20
- spec.metadata['changelog_uri'] = spec.homepage
21
-
22
- # Specify which files should be added to the gem when it is released.
23
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
24
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
25
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
- end
27
- spec.bindir = 'exe'
28
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
- spec.require_paths = ['lib']
30
-
31
- spec.add_development_dependency 'bundler', '~> 2.0'
32
- spec.add_development_dependency 'rake', '~> 10.0'
33
- end
@@ -1,5 +0,0 @@
1
- module Jekyll
2
- module Hardlinks
3
- VERSION = "0.1.0"
4
- end
5
- end