Skip to content

Commit

Permalink
Remove Postrank::URI
Browse files Browse the repository at this point in the history
PostRank::URI couldn’t handle umlauts.

We will lose the feature to detect urls without protocol “twingly.com”,
but we don’t see the need for this feature.

On the plus side, lots of runtime dependencies are removed (nokogiri!).
  • Loading branch information
jage committed Feb 20, 2014
1 parent a01ac74 commit 19d28c6
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
7 changes: 0 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ PATH
twingly-url-normalizer (0.0.1)
addressable
domainatrix
postrank-uri

GEM
remote: https://rubygems.org/
Expand All @@ -13,12 +12,6 @@ GEM
ansi (1.4.3)
domainatrix (0.0.11)
addressable
nokogiri (1.5.11)
postrank-uri (1.0.17)
addressable (~> 2.3.0)
nokogiri (~> 1.5.5)
public_suffix (~> 1.1.3)
public_suffix (1.1.3)
rake (10.1.1)
shoulda-context (1.1.6)
turn (0.9.6)
Expand Down
3 changes: 1 addition & 2 deletions lib/twingly-url-normalizer.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
require 'postrank-uri'
require 'domainatrix'
require 'addressable/uri'

Expand All @@ -12,7 +11,7 @@ def self.normalize(potential_urls)
end

def self.extract_urls(potential_urls)
PostRank::URI.extract(potential_urls)
Array(potential_urls).map(&:split).flatten
end

def self.normalize_url(url)
Expand Down
5 changes: 5 additions & 0 deletions test/unit/normalization_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,10 @@ class NormalizerTest < Test::Unit::TestCase

assert_equal "http://www.twingly.com/", result
end

should "not be able to normalize url without protocol" do
url = "twingly.com/"
assert_raises(Addressable::URI::InvalidURIError) { @normalizer.normalize_url(url) }
end
end
end
1 change: 0 additions & 1 deletion twingly-url-normalizer.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ Gem::Specification.new do |s|
s.summary = "Ruby library for URL normalization"
s.required_ruby_version = ">= 1.9.3"

s.add_dependency "postrank-uri"
s.add_dependency "domainatrix"
s.add_dependency "addressable"

Expand Down

0 comments on commit 19d28c6

Please sign in to comment.