New Upstream Snapshot - ruby-jekyll-gist
Ready changes
Summary
Merged new upstream version: 1.6.0+git20200413.1.971e9e6 (was: 1.5.0).
Resulting package
Built on 2022-10-04T17:46 (took 1h24m)
The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:
apt install -t fresh-snapshots ruby-jekyll-gist
Lintian Result
Diff
diff --git a/.rubocop.yml b/.rubocop.yml
index e86cc3d..62ba652 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -1,28 +1,11 @@
+inherit_from: .rubocop_todo.yml
+
+require: rubocop-jekyll
inherit_gem:
- jekyll: .rubocop.yml
+ rubocop-jekyll: .rubocop.yml
AllCops:
- TargetRubyVersion: 2.1
+ TargetRubyVersion: 2.3
Exclude:
- vendor/**/*
- spec/*.rb
-
-Lint/IneffectiveAccessModifier:
- Exclude:
- - lib/jekyll-gist/gist_tag.rb
-
-Lint/ShadowedException:
- Exclude:
- - lib/jekyll-gist/gist_tag.rb
-
-Metrics/AbcSize:
- Exclude:
- - lib/jekyll-gist/gist_tag.rb
-
-Metrics/MethodLength:
- Exclude:
- - lib/jekyll-gist/gist_tag.rb
-
-Style/PreferredHashMethods:
- Exclude:
- - lib/jekyll-gist/gist_tag.rb
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
new file mode 100644
index 0000000..3db0a29
--- /dev/null
+++ b/.rubocop_todo.yml
@@ -0,0 +1,21 @@
+# This configuration was generated by
+# `rubocop --auto-gen-config`
+# on 2019-07-16 18:09:04 +0200 using RuboCop version 0.71.0.
+# The point is for the user to remove these configuration records
+# one by one as the offenses are removed from the code base.
+# Note that changes in the inspected code, or installation of new
+# versions of RuboCop, may require this file to be generated again.
+
+# Offense count: 1
+Lint/ShadowedException:
+ Exclude:
+ - 'lib/jekyll-gist/gist_tag.rb'
+
+# Offense count: 1
+Metrics/AbcSize:
+ Max: 24
+
+# Offense count: 1
+# Configuration parameters: CountComments, ExcludedMethods.
+Metrics/MethodLength:
+ Max: 21
diff --git a/.travis.yml b/.travis.yml
index 4eb8a4b..5918f53 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,22 +1,24 @@
language: ruby
+cache: bundler
+rvm:
+ - &latest_ruby 2.7
+ - 2.5
+
script : script/cibuild
-sudo: false
-notifications:
- email: false
+
branches:
only:
- master
-
-rvm:
- - 2.4
- - 2.3
- - 2.2
- - 2.1
env:
- - ""
- - JEKYLL_VERSION=3.6.2
+ matrix:
+ - JEKYLL_VERSION="~> 3.8"
matrix:
include:
- # GitHub Pages
- rvm: 2.4.0
- env: GH_PAGES=true
+ rvm: 2.5.3
+ env: JEKYLL_VERSION="~> 3.8.5"
+ - rvm: *latest_ruby
+ env: JEKYLL_VERSION="~> 4.0"
+
+notifications:
+ email: false
diff --git a/Gemfile b/Gemfile
index c24711a..46cdbf0 100644
--- a/Gemfile
+++ b/Gemfile
@@ -3,8 +3,4 @@
source "https://rubygems.org"
gemspec
-if ENV["GH_PAGES"]
- gem "github-pages"
-elsif ENV["JEKYLL_VERSION"]
- gem "jekyll", "~> #{ENV["JEKYLL_VERSION"]}"
-end
+gem "jekyll", ENV["JEKYLL_VERSION"] if ENV["JEKYLL_VERSION"]
diff --git a/History.markdown b/History.markdown
index 586a6c2..a254054 100644
--- a/History.markdown
+++ b/History.markdown
@@ -1,5 +1,23 @@
## HEAD
+### Development Fixes
+
+ * Test against Ruby 2.5 (#57)
+ * Rely on rubocop-jekyll (#62)
+ * chore(deps): rubocop-jekyll 0.3 (#64)
+ * Refactor GistTag (#65)
+
+### Major Enhancements
+
+ * chore(deps): drop support for Liquid < 4.0 (#66)
+
+### Bug Fixes
+
+ * Re-introduce Ruby 2.3 support and test Jekyll 3.7+ (#72)
+ * Use Liquid::Tag#raw to clarify error message (#73)
+
+## 1.5.0 / 2017-12-03
+
### Documentation
* replace 'plugins' key in config with 'gems' (#46)
@@ -13,7 +31,6 @@
* Inherit Jekyll's rubocop config for consistency (#48)
* define path with __dir__ (#47)
-
## 1.4.1 / 2017-06-21
* Don't ask .empty? until it's a String. (#38)
diff --git a/LICENSE.txt b/LICENSE.txt
index 3ed9f59..9bb9d93 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -1,4 +1,4 @@
-Copyright (c) 2014 Parker Moore
+Copyright (c) 2014-present Parker Moore and jekyll-gist contributors
MIT License
diff --git a/README.md b/README.md
index 9bbba39..c657c5d 100644
--- a/README.md
+++ b/README.md
@@ -53,7 +53,7 @@ This will produce the correct URL to show just the specified file in your post r
## Disabling `noscript` support
-By default, Jekyll Gist will make an HTTP call per Gist to retrieve the raw content of the Gist. This information is used to propagate `noscript` tags for search engines and browsers without Javascript support. If you'd like to disable this feature, for example, to speed up builds locally, add the following to your site's `_config.yml`:
+By default, Jekyll Gist will make an HTTP call per Gist to retrieve the raw content of the Gist. This information is used to propagate `noscript` tags for search engines and browsers without JavaScript support. If you'd like to disable this feature, for example, to speed up builds locally, add the following to your site's `_config.yml`:
```yml
gist:
diff --git a/debian/changelog b/debian/changelog
index 654f8ce..35d63c6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-ruby-jekyll-gist (1.5.0-3) UNRELEASED; urgency=low
+ruby-jekyll-gist (1.6.0+git20200413.1.971e9e6-1) UNRELEASED; urgency=low
[ Debian Janitor ]
* Update standards version to 4.5.1, no changes needed.
@@ -7,7 +7,10 @@ ruby-jekyll-gist (1.5.0-3) UNRELEASED; urgency=low
* d/lintian-brush.conf: Set compat-release to oldstable to prevent dh
bumps.
- -- Debian Janitor <janitor@jelmer.uk> Sat, 18 Jul 2020 07:28:16 -0000
+ [ Debian Janitor ]
+ * New upstream snapshot.
+
+ -- Debian Janitor <janitor@jelmer.uk> Tue, 04 Oct 2022 16:25:39 -0000
ruby-jekyll-gist (1.5.0-2) unstable; urgency=medium
diff --git a/jekyll-gist.gemspec b/jekyll-gist.gemspec
index dfdd91f..ba7a55e 100644
--- a/jekyll-gist.gemspec
+++ b/jekyll-gist.gemspec
@@ -1,9 +1,6 @@
# frozen_string_literal: true
-lib = File.expand_path("lib", __dir__)
-
-$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
-require "jekyll-gist/version"
+require_relative "lib/jekyll-gist/version"
Gem::Specification.new do |spec|
spec.name = "jekyll-gist"
@@ -14,18 +11,18 @@ Gem::Specification.new do |spec|
spec.homepage = "https://github.com/jekyll/jekyll-gist"
spec.license = "MIT"
- spec.required_ruby_version = ">= 2.1"
-
spec.files = `git ls-files -z`.split("\x0")
- spec.executables = spec.files.grep(%r!^bin/!) { |f| File.basename(f) }
- spec.test_files = spec.files.grep(%r!^(test|spec|features)/!)
+ spec.test_files = spec.files.grep(%r!^spec/!)
spec.require_paths = ["lib"]
- spec.add_dependency "octokit", "~> 4.2"
- spec.add_development_dependency "bundler", "~> 1.6"
- spec.add_development_dependency "jekyll", ">= 3.0"
+ spec.required_ruby_version = ">= 2.3.0"
+
+ spec.add_runtime_dependency "jekyll", ">= 3.7", "< 5.0"
+ spec.add_runtime_dependency "octokit", "~> 4.2"
+
+ spec.add_development_dependency "bundler"
spec.add_development_dependency "rake"
spec.add_development_dependency "rspec"
- spec.add_development_dependency "rubocop", "~> 0.51"
+ spec.add_development_dependency "rubocop-jekyll", "~> 0.4"
spec.add_development_dependency "webmock"
end
diff --git a/lib/jekyll-gist/gist_tag.rb b/lib/jekyll-gist/gist_tag.rb
index c265063..ae8ae34 100644
--- a/lib/jekyll-gist/gist_tag.rb
+++ b/lib/jekyll-gist/gist_tag.rb
@@ -10,33 +10,36 @@ Net::ReadTimeout = Class.new(RuntimeError) unless Net.const_defined?(:ReadTimeou
module Jekyll
module Gist
class GistTag < Liquid::Tag
+ def self.client
+ @client ||= Octokit::Client.new :access_token => ENV["JEKYLL_GITHUB_TOKEN"]
+ end
+
def render(context)
@encoding = context.registers[:site].config["encoding"] || "utf-8"
@settings = context.registers[:site].config["gist"]
if (tag_contents = determine_arguments(@markup.strip))
- gist_id = tag_contents[0]
+ gist_id = tag_contents[0]
filename = tag_contents[1]
- if context_contains_key?(context, gist_id)
- gist_id = context[gist_id]
- end
- if context_contains_key?(context, filename)
- filename = context[filename]
- end
+ gist_id = context[gist_id] if context.key?(gist_id)
+ filename = context[filename] if context.key?(filename)
+
noscript_tag = gist_noscript_tag(gist_id, filename)
- script_tag = gist_script_tag(gist_id, filename)
+ script_tag = gist_script_tag(gist_id, filename)
+
"#{noscript_tag}#{script_tag}"
else
- raise ArgumentError, <<-EOS
- Syntax error in tag 'gist' while parsing the following markup:
+ raise ArgumentError, <<~ERROR
+ Syntax error in tag 'gist' while parsing the following markup:
- #{@markup}
+ '{% #{raw.strip} %}'
- Valid syntax:
- {% gist user/1234567 %}
- {% gist user/1234567 foo.js %}
- {% gist 28949e1d5ee2273f9fd3 %}
- {% gist 28949e1d5ee2273f9fd3 best.md %}
- EOS
+ Valid syntax:
+ {% gist user/1234567 %}
+ {% gist user/1234567 foo.js %}
+ {% gist 28949e1d5ee2273f9fd3 %}
+ {% gist 28949e1d5ee2273f9fd3 best.md %}
+
+ ERROR
end
end
@@ -47,37 +50,25 @@ module Jekyll
[matched[1].strip, matched[2].strip] if matched && matched.length >= 3
end
- private
-
- def context_contains_key?(context, key)
- if context.respond_to?(:has_key?)
- context.has_key?(key)
- else
- context.key?(key)
- end
- end
-
def gist_script_tag(gist_id, filename = nil)
url = "https://gist.github.com/#{gist_id}.js"
url = "#{url}?file=#{filename}" unless filename.to_s.empty?
+
"<script src=\"#{url}\"> </script>"
end
def gist_noscript_tag(gist_id, filename = nil)
return if @settings && @settings["noscript"] == false
+
code = fetch_raw_code(gist_id, filename)
- if !code.nil?
+ if code
code = code.force_encoding(@encoding)
- code = CGI.escapeHTML(code)
-
- # CGI.escapeHTML behavior differs in Ruby < 2.0
- # See https://github.com/jekyll/jekyll-gist/pull/28
- code = code.gsub("'", "'") if RUBY_VERSION < "2.0"
+ code = CGI.escapeHTML(code).gsub("'", "'")
"<noscript><pre>#{code}</pre></noscript>"
else
- Jekyll.logger.warn "Warning:", "The <noscript> tag for your gist #{gist_id} "
- Jekyll.logger.warn "", "could not be generated. This will affect users who do "
+ Jekyll.logger.warn "Warning:", "The <noscript> tag for your gist #{gist_id}"
+ Jekyll.logger.warn "", "could not be generated. This will affect users who do"
Jekyll.logger.warn "", "not have JavaScript enabled in their browsers."
end
end
@@ -88,9 +79,10 @@ module Jekyll
url = "https://gist.githubusercontent.com/#{gist_id}/raw"
url = "#{url}/#{filename}" unless filename.to_s.empty?
uri = URI(url)
+
Net::HTTP.start(uri.host, uri.port,
- :use_ssl => uri.scheme == "https",
- :read_timeout => 3, :open_timeout => 3) do |http|
+ :use_ssl => uri.scheme == "https",
+ :read_timeout => 3, :open_timeout => 3) do |http|
request = Net::HTTP::Get.new uri.to_s
response = http.request(request)
response.body
@@ -99,11 +91,8 @@ module Jekyll
nil
end
- private
-
def code_from_api(gist_id, filename = nil)
gist = GistTag.client.gist gist_id
-
file = if filename.to_s.empty?
# No file specified, return the value of the first key/value pair
gist.files.first[1]
@@ -117,10 +106,6 @@ module Jekyll
file[:content] if file
end
-
- def self.client
- @client ||= Octokit::Client.new :access_token => ENV["JEKYLL_GITHUB_TOKEN"]
- end
end
end
end
diff --git a/lib/jekyll-gist/version.rb b/lib/jekyll-gist/version.rb
index 0de8671..2bef474 100644
--- a/lib/jekyll-gist/version.rb
+++ b/lib/jekyll-gist/version.rb
@@ -2,6 +2,6 @@
module Jekyll
module Gist
- VERSION = "1.5.0".freeze
+ VERSION = "1.5.0"
end
end
diff --git a/spec/gist_tag_spec.rb b/spec/gist_tag_spec.rb
index f04618c..b889220 100644
--- a/spec/gist_tag_spec.rb
+++ b/spec/gist_tag_spec.rb
@@ -168,7 +168,7 @@ describe(Jekyll::Gist::GistTag) do
let(:gist) { "" }
it "raises an error" do
- expect(-> { output }).to raise_error
+ expect(-> { output }).to raise_error(ArgumentError)
end
end
end
Debdiff
File lists identical (after any substitutions)
Control files: lines which differ (wdiff format)
Ruby-Versions: all