jekyll-shorts 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4e3da7798de2799f22b31f8b3577fa64b463f0752c69ee1245e50c3504b751b1
4
- data.tar.gz: 05d91a265d00d1e224e24f56545f791d49c9e399ca44a6b6975c277f16d06daf
3
+ metadata.gz: ac906426e58ece9954aaad571009ae1ba16f00bcbf3727dcbcc9577a90750daa
4
+ data.tar.gz: 3af8f4e79b61334e857338bb6005557ae73c66b354640851d6166cd5fd7087bf
5
5
  SHA512:
6
- metadata.gz: b7058a47b552c15da5bbdd67a3181bf1ead73e38155e02a666f4142a1b77ee0a290703f4e1973c777e2b8735a4c1042de15d9fe3dc191a2ce5d110f14707ebcd
7
- data.tar.gz: a7d4c9fef312a2fdef994a030c92bcf3afc0d358f1c3a7a8afa50962807bae92e20917c3c4ff61f8c6431b2a44ea34eba47d44e129654ec1b08fa41d6dfa6faf
6
+ metadata.gz: 4dc03afd1f1d490fc670068fcd6dd3abc10cf350bea8b223f919732f514af098f16b0fe5a1017455b25752ded2cf8c17dc03ccca94e0e9c3311471e0b1d1519d
7
+ data.tar.gz: 518a229f1c3f4cbb698c730e53a0b9308f2c518e54ba8e46d9328dfe04fabf8f607e4f992bf94da9ab6e98055562ead84161d5dfc1553ac401490fcd67cfca6b
@@ -28,7 +28,7 @@ Gem::Specification.new do |s|
28
28
  s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
29
29
  s.required_ruby_version = '>= 2.6'
30
30
  s.name = 'jekyll-shorts'
31
- s.version = '0.0.2'
31
+ s.version = '0.0.3'
32
32
  s.license = 'MIT'
33
33
  s.summary = 'Automatically generates short links for Jekyll website'
34
34
  s.description = [
@@ -74,9 +74,22 @@ class JekyllShorts::Generator < Jekyll::Generator
74
74
 
75
75
  def write(_dest)
76
76
  FileUtils.mkdir_p(File.dirname(path))
77
- html = "<html><head><meta http-equiv='refresh' content='#{@long}'/></head></html>"
78
- File.write(path, html)
79
- Jekyll.logger.debug("HTML #{path.inspect} -> #{@long.inspect}")
77
+ html = "<html><head><meta charset='utf-8'/>\
78
+ <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>\
79
+ <meta http-equiv='refresh' content='#{@long}'/></head></html>"
80
+ if File.exist?(path)
81
+ before = File.read(path)
82
+ if before != after
83
+ raise "It's impossible to generate a short link at #{path.inspect}, \
84
+ because the file already exists and the content \
85
+ of the it differs from what we are going to write into it now (#{long}). This most \
86
+ probably means that previously generated short link will point to a different location \
87
+ than before. Try to run 'jekyll clean', it will help, if you know what you are doing."
88
+ end
89
+ else
90
+ File.write(path, html)
91
+ Jekyll.logger.debug("HTML #{path.inspect} -> #{@long.inspect}")
92
+ end
80
93
  true
81
94
  end
82
95
  end
@@ -23,5 +23,5 @@
23
23
  # SOFTWARE.
24
24
 
25
25
  module JekyllShorts
26
- VERSION = '0.0.2'
26
+ VERSION = '0.0.3'
27
27
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-shorts
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko