Skip to content

Commit

Permalink
Merge pull request #1017 from publify/move-nokogiri-dependency-to-gem
Browse files Browse the repository at this point in the history
Move nokogiri dependency to gem
  • Loading branch information
mvz committed Oct 2, 2021
2 parents 0df8d58 + 56073ff commit f75965d
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 40 deletions.
2 changes: 1 addition & 1 deletion .rubocop.yml
Expand Up @@ -21,7 +21,7 @@ AllCops:
- 'db/schema.rb'
- 'vendor/bundle/**/*'
NewCops: enable
TargetRubyVersion: 2.4
TargetRubyVersion: 2.5

Rails:
Enabled: true
Expand Down
3 changes: 0 additions & 3 deletions Gemfile
Expand Up @@ -28,9 +28,6 @@ gem "non-digest-assets", "~> 1.0"
gem "rake", "~> 13.0"
gem "reverse_markdown", "~> 2.0"

# Force minimum nokogiri version to avoid security issues
gem "nokogiri", ">= 1.12.5"

# Force older sprockets
gem "sprockets", "~> 3.0"

Expand Down
2 changes: 1 addition & 1 deletion publify_amazon_sidebar/.rubocop.yml
Expand Up @@ -9,7 +9,7 @@ AllCops:
- 'spec/dummy/bin/*'
- 'spec/dummy/db/schema.rb'
NewCops: enable
TargetRubyVersion: 2.4
TargetRubyVersion: 2.5

Rails:
Enabled: true
Expand Down
2 changes: 1 addition & 1 deletion publify_amazon_sidebar/publify_amazon_sidebar.gemspec
Expand Up @@ -16,7 +16,7 @@ Gem::Specification.new do |s|
s.description = "Amazon sidebar for the Publify blogging system."
s.license = "MIT"

s.required_ruby_version = ">= 2.4.0"
s.required_ruby_version = ">= 2.5.0"

s.files = File.open("Manifest.txt").readlines.map(&:chomp)

Expand Down
2 changes: 1 addition & 1 deletion publify_core/.rubocop.yml
Expand Up @@ -9,7 +9,7 @@ AllCops:
- 'spec/dummy/bin/*'
- 'spec/dummy/db/schema.rb'
NewCops: enable
TargetRubyVersion: 2.4
TargetRubyVersion: 2.5

Rails:
Enabled: true
Expand Down
16 changes: 7 additions & 9 deletions publify_core/lib/spam_protection.rb
Expand Up @@ -82,16 +82,14 @@ def scan_uris(uris = [])
def query_rbls(rbls, *subdomains)
rbls.each do |rbl|
subdomains.uniq.each do |d|
begin
response = IPSocket.getaddress([d, rbl].join("."))
if response.start_with?("127.0.0.")
throw :hit,
"#{rbl} positively resolved subdomain #{d} => #{response}"
end
rescue SocketError
# NXDOMAIN response => negative: d is not in RBL
next
response = IPSocket.getaddress([d, rbl].join("."))
if response.start_with?("127.0.0.")
throw :hit,
"#{rbl} positively resolved subdomain #{d} => #{response}"
end
rescue SocketError
# NXDOMAIN response => negative: d is not in RBL
next
end
end
false
Expand Down
4 changes: 3 additions & 1 deletion publify_core/publify_core.gemspec
Expand Up @@ -19,7 +19,7 @@ Gem::Specification.new do |s|

s.files = File.open("Manifest.txt").readlines.map(&:chomp)

s.required_ruby_version = ">= 2.4.0"
s.required_ruby_version = ">= 2.5.0"

s.add_dependency "aasm", "~> 5.0"
s.add_dependency "akismet", "~> 3.0"
Expand All @@ -35,6 +35,8 @@ Gem::Specification.new do |s|
s.add_dependency "jquery-ui-rails", "~> 6.0.1"
s.add_dependency "kaminari", ["~> 1.2", ">= 1.2.1"]
s.add_dependency "mini_magick", ["~> 4.9", ">= 4.9.4"]
# Force minimum nokogiri version to avoid security issues
s.add_dependency "nokogiri", ">= 1.12.5"
s.add_dependency "rack", ">= 2.2.3"
s.add_dependency "rails", "~> 5.2.6"
s.add_dependency "rails_autolink", "~> 1.1.0"
Expand Down
36 changes: 16 additions & 20 deletions publify_core/spec/helpers/base_helper_spec.rb
Expand Up @@ -121,29 +121,25 @@ def parse_request(_contents, _request_params)
end

it "returns a link with the creation date and time" do
begin
timezone = Time.zone
Time.zone = "UTC"

expect(get_reply_context_twitter_link(reply)).
to eq '<a href="https://twitter.com/a_screen_name/status/123456789">' \
"23/01/2014 at 13h47</a>"
ensure
Time.zone = timezone
end
timezone = Time.zone
Time.zone = "UTC"

expect(get_reply_context_twitter_link(reply)).
to eq '<a href="https://twitter.com/a_screen_name/status/123456789">' \
"23/01/2014 at 13h47</a>"
ensure
Time.zone = timezone
end

it "displays creation date and time in the current time zone" do
begin
timezone = Time.zone
Time.zone = "Tokyo"

expect(get_reply_context_twitter_link(reply)).
to eq '<a href="https://twitter.com/a_screen_name/status/123456789">' \
"23/01/2014 at 22h47</a>"
ensure
Time.zone = timezone
end
timezone = Time.zone
Time.zone = "Tokyo"

expect(get_reply_context_twitter_link(reply)).
to eq '<a href="https://twitter.com/a_screen_name/status/123456789">' \
"23/01/2014 at 22h47</a>"
ensure
Time.zone = timezone
end
end

Expand Down
2 changes: 1 addition & 1 deletion publify_textfilter_code/.rubocop.yml
Expand Up @@ -9,7 +9,7 @@ AllCops:
- 'spec/dummy/bin/*'
- 'spec/dummy/db/schema.rb'
NewCops: enable
TargetRubyVersion: 2.4
TargetRubyVersion: 2.5

Rails:
Enabled: true
Expand Down
2 changes: 1 addition & 1 deletion publify_textfilter_code/lib/publify_app/textfilter_code.rb
Expand Up @@ -50,7 +50,7 @@ def self.macrofilter(attrib, text = "")
DEFAULT_OPTIONS
end

text = text.to_s.delete("\r").gsub(/\A\n/, "").chomp
text = text.to_s.delete("\r").delete_prefix("\n").chomp

begin
text = CodeRay.scan(text, lang.downcase.to_sym).span(options)
Expand Down
2 changes: 1 addition & 1 deletion publify_textfilter_code/publify_textfilter_code.gemspec
Expand Up @@ -18,7 +18,7 @@ Gem::Specification.new do |s|

s.files = File.open("Manifest.txt").readlines.map(&:chomp)

s.required_ruby_version = ">= 2.4.0"
s.required_ruby_version = ">= 2.5.0"

s.add_dependency "coderay", "~> 1.1.0"
s.add_dependency "htmlentities", "~> 4.3"
Expand Down

0 comments on commit f75965d

Please sign in to comment.