Hello community,
here is the log from the commit of package rubygem-addressable for
openSUSE:Factory checked in at 2019-02-13 10:03:05
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-addressable (Old)
and /work/SRC/openSUSE:Factory/.rubygem-addressable.new.28833 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-addressable"
Wed Feb 13 10:03:05 2019 rev:18 rq:673388 version:2.6.0
Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-addressable/rubygem-addressable.changes
2017-09-04 12:37:04.681134276 +0200
+++
/work/SRC/openSUSE:Factory/.rubygem-addressable.new.28833/rubygem-addressable.changes
2019-02-13 10:03:20.849591758 +0100
@@ -1,0 +2,15 @@
+Fri Feb 8 11:24:50 UTC 2019 - [email protected]
+
+- updated to version 2.6.0
+
+ * added `tld=` method to allow assignment to the public suffix
+ * most `heuristic_parse` patterns are now case-insensitive
+ * `heuristic_parse` handles more `file://` URI variations
+ * fixes bug in `heuristic_parse` when uri starts with digit
+ * fixes bug in `request_uri=` with query strings
+ * fixes template issues with `nil` and `?` operator
+ * `frozen_string_literal` pragmas added
+ * minor performance improvements in regexps
+ * fixes to eliminate warnings
+
+-------------------------------------------------------------------
Old:
----
addressable-2.5.2.gem
New:
----
addressable-2.6.0.gem
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ rubygem-addressable.spec ++++++
--- /var/tmp/diff_new_pack.0eHHTB/_old 2019-02-13 10:03:22.093591449 +0100
+++ /var/tmp/diff_new_pack.0eHHTB/_new 2019-02-13 10:03:22.101591448 +0100
@@ -1,7 +1,7 @@
#
# spec file for package rubygem-addressable
#
-# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -24,7 +24,7 @@
#
Name: rubygem-addressable
-Version: 2.5.2
+Version: 2.6.0
Release: 0
%define mod_name addressable
%define mod_full_name %{mod_name}-%{version}
@@ -34,7 +34,7 @@
BuildRequires: %{rubygem rdoc > 3.10}
BuildRequires: ruby-macros >= 5
Url: https://github.com/sporkmonger/addressable
-Source: http://rubygems.org/gems/%{mod_full_name}.gem
+Source: https://rubygems.org/gems/%{mod_full_name}.gem
Source1: gem2rpm.yml
Summary: URI Implementation
License: Apache-2.0
++++++ addressable-2.5.2.gem -> addressable-2.6.0.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md
--- old/CHANGELOG.md 2017-08-25 02:00:11.000000000 +0200
+++ new/CHANGELOG.md 2019-01-18 08:16:17.000000000 +0100
@@ -1,3 +1,14 @@
+# Addressable 2.6.0
+- added `tld=` method to allow assignment to the public suffix
+- most `heuristic_parse` patterns are now case-insensitive
+- `heuristic_parse` handles more `file://` URI variations
+- fixes bug in `heuristic_parse` when uri starts with digit
+- fixes bug in `request_uri=` with query strings
+- fixes template issues with `nil` and `?` operator
+- `frozen_string_literal` pragmas added
+- minor performance improvements in regexps
+- fixes to eliminate warnings
+
# Addressable 2.5.2
- better support for frozen string literals
- fixed bug w/ uppercase characters in scheme
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Gemfile new/Gemfile
--- old/Gemfile 2017-08-25 02:00:11.000000000 +0200
+++ new/Gemfile 2019-01-18 08:16:17.000000000 +0100
@@ -3,7 +3,7 @@
gemspec
group :test do
- gem 'rspec', '~> 3.0'
+ gem 'rspec', '~> 3.5'
gem 'rspec-its', '~> 1.1'
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/README.md new/README.md
--- old/README.md 2017-08-25 02:00:11.000000000 +0200
+++ new/README.md 2019-01-18 08:16:17.000000000 +0100
@@ -9,13 +9,11 @@
[][gem]
[][travis]
-[][gemnasium]
[][coveralls]
[][inch]
[gem]: https://rubygems.org/gems/addressable
[travis]: http://travis-ci.org/sporkmonger/addressable
-[gemnasium]: https://gemnasium.com/sporkmonger/addressable
[coveralls]: https://coveralls.io/r/sporkmonger/addressable
[inch]: http://inch-ci.org/github/sporkmonger/addressable
@@ -58,7 +56,7 @@
require "addressable/template"
-template = Addressable::Template.new("http://example.com/{?query*}/")
+template = Addressable::Template.new("http://example.com/{?query*}")
template.expand({
"query" => {
'foo' => 'bar',
@@ -105,7 +103,7 @@
# Semantic Versioning
-This project uses sementic versioning. You can (and should) specify your
+This project uses [Semantic Versioning](https://semver.org/). You can (and
should) specify your
dependency using a pessimistic version constraint covering the major and minor
values:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Rakefile new/Rakefile
--- old/Rakefile 2017-08-25 02:00:11.000000000 +0200
+++ new/Rakefile 2019-01-18 08:16:17.000000000 +0100
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'rubygems'
require 'rake'
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/addressable/idna/native.rb
new/lib/addressable/idna/native.rb
--- old/lib/addressable/idna/native.rb 2017-08-25 02:00:11.000000000 +0200
+++ new/lib/addressable/idna/native.rb 2019-01-18 08:16:17.000000000 +0100
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# encoding:utf-8
#--
# Copyright (C) Bob Aman
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/addressable/idna/pure.rb
new/lib/addressable/idna/pure.rb
--- old/lib/addressable/idna/pure.rb 2017-08-25 02:00:11.000000000 +0200
+++ new/lib/addressable/idna/pure.rb 2019-01-18 08:16:17.000000000 +0100
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# encoding:utf-8
#--
# Copyright (C) Bob Aman
@@ -146,16 +148,13 @@
starter_cc = 256 if starter_cc != 0
for i in 1...length
ch = unpacked[i]
- cc = lookup_unicode_combining_class(ch)
if (starter_cc == 0 &&
(composite = unicode_compose_pair(starter, ch)) != nil)
starter = composite
- startercc = lookup_unicode_combining_class(composite)
else
unpacked_result << starter
starter = ch
- startercc = cc
end
end
unpacked_result << starter
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/addressable/idna.rb new/lib/addressable/idna.rb
--- old/lib/addressable/idna.rb 2017-08-25 02:00:11.000000000 +0200
+++ new/lib/addressable/idna.rb 2019-01-18 08:16:17.000000000 +0100
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# encoding:utf-8
#--
# Copyright (C) Bob Aman
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/addressable/template.rb
new/lib/addressable/template.rb
--- old/lib/addressable/template.rb 2017-08-25 02:00:11.000000000 +0200
+++ new/lib/addressable/template.rb 2019-01-18 08:16:17.000000000 +0100
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# encoding:utf-8
#--
# Copyright (C) Bob Aman
@@ -728,54 +730,32 @@
normalize_values = true)
_, operator, varlist = *capture.match(EXPRESSION)
- vars = varlist.split(',')
+ vars = varlist.split(",")
- if '?' == operator
+ if operator == "?"
# partial expansion of form style query variables sometimes requires a
# slight reordering of the variables to produce a valid url.
first_to_expand = vars.find { |varspec|
_, name, _ = *varspec.match(VARSPEC)
- mapping.key? name
+ mapping.key?(name) && !mapping[name].nil?
}
vars = [first_to_expand] + vars.reject {|varspec| varspec ==
first_to_expand} if first_to_expand
end
- vars
- .zip(operator_sequence(operator).take(vars.length))
- .reduce("".dup) do |acc, (varspec, op)|
+ vars.
+ inject("".dup) do |acc, varspec|
_, name, _ = *varspec.match(VARSPEC)
-
- acc << if mapping.key? name
- transform_capture(mapping, "{#{op}#{varspec}}",
- processor, normalize_values)
- else
- "{#{op}#{varspec}}"
- end
- end
- end
-
- ##
- # Creates a lazy Enumerator of the operators that should be used to expand
- # variables in a varlist starting with `operator`. For example, an operator
- # `"?"` results in the sequence `"?","&","&"...`
- #
- # @param [String] operator from which to generate a sequence
- #
- # @return [Enumerator] sequence of operators
- def operator_sequence(operator)
- rest_operator = if "?" == operator
- "&"
- else
- operator
- end
- head_operator = operator
-
- Enumerator.new do |y|
- y << head_operator.to_s
- while true
- y << rest_operator.to_s
- end
+ next_val = if mapping.key? name
+ transform_capture(mapping, "{#{operator}#{varspec}}",
+ processor, normalize_values)
+ else
+ "{#{operator}#{varspec}}"
+ end
+ # If we've already expanded at least one '?' operator with non-empty
+ # value, change to '&'
+ operator = "&" if (operator == "?") && (next_val != "")
+ acc << next_val
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/addressable/uri.rb new/lib/addressable/uri.rb
--- old/lib/addressable/uri.rb 2017-08-25 02:00:11.000000000 +0200
+++ new/lib/addressable/uri.rb 2019-01-18 08:16:17.000000000 +0100
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# encoding:utf-8
#--
# Copyright (C) Bob Aman
@@ -122,9 +124,9 @@
user = userinfo.strip[/^([^:]*):?/, 1]
password = userinfo.strip[/:(.*)$/, 1]
end
- host = authority.gsub(
+ host = authority.sub(
/^([^\[\]]*)@/, EMPTY_STR
- ).gsub(
+ ).sub(
/:([^:@\[\]]*?)$/, EMPTY_STR
)
port = authority[/:([^:@\[\]]*?)$/, 1]
@@ -182,18 +184,24 @@
:scheme => "http"
}.merge(hints)
case uri
- when /^http:\/+/
- uri.gsub!(/^http:\/+/, "http://")
- when /^https:\/+/
- uri.gsub!(/^https:\/+/, "https://")
- when /^feed:\/+http:\/+/
- uri.gsub!(/^feed:\/+http:\/+/, "feed:http://")
- when /^feed:\/+/
- uri.gsub!(/^feed:\/+/, "feed://")
- when /^file:\/+/
- uri.gsub!(/^file:\/+/, "file:///")
+ when /^http:\//i
+ uri.sub!(/^http:\/+/i, "http://")
+ when /^https:\//i
+ uri.sub!(/^https:\/+/i, "https://")
+ when /^feed:\/+http:\//i
+ uri.sub!(/^feed:\/+http:\/+/i, "feed:http://")
+ when /^feed:\//i
+ uri.sub!(/^feed:\/+/i, "feed://")
+ when %r[^file:/{4}]i
+ uri.sub!(%r[^file:/+]i, "file:////")
+ when %r[^file://localhost/]i
+ uri.sub!(%r[^file://localhost/+]i, "file:///")
+ when %r[^file:/+]i
+ uri.sub!(%r[^file:/+]i, "file:///")
when /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/
- uri.gsub!(/^/, hints[:scheme] + "://")
+ uri.sub!(/^/, hints[:scheme] + "://")
+ when /\A\d+\..*:\d+\z/
+ uri = "#{hints[:scheme]}://#{uri}"
end
match = uri.match(URIREGEX)
fragments = match.captures
@@ -202,6 +210,7 @@
new_authority = authority.gsub(/\\/, '/').gsub(/ /, '%20')
# NOTE: We want offset 4, not 3!
offset = match.offset(4)
+ uri = uri.dup
uri[offset[0]...offset[1]] = new_authority
end
parsed = self.parse(uri)
@@ -212,7 +221,7 @@
new_host = parsed.path[/^([^\/]+\.[^\/]*)/, 1]
if new_host
parsed.defer_validation do
- new_path = parsed.path.gsub(
+ new_path = parsed.path.sub(
Regexp.new("^" + Regexp.escape(new_host)), EMPTY_STR)
parsed.host = new_host
parsed.path = new_path
@@ -263,19 +272,19 @@
# Otherwise, convert to a String
path = path.to_str.strip
- path.gsub!(/^file:\/?\/?/, EMPTY_STR) if path =~ /^file:\/?\/?/
+ path.sub!(/^file:\/?\/?/, EMPTY_STR) if path =~ /^file:\/?\/?/
path = SLASH + path if path =~ /^([a-zA-Z])[\|:]/
uri = self.parse(path)
if uri.scheme == nil
# Adjust windows-style uris
- uri.path.gsub!(/^\/?([a-zA-Z])[\|:][\\\/]/) do
+ uri.path.sub!(/^\/?([a-zA-Z])[\|:][\\\/]/) do
"/#{$1.downcase}:/"
end
uri.path.gsub!(/\\/, SLASH)
if File.exist?(uri.path) &&
File.stat(uri.path).directory?
- uri.path.gsub!(/\/$/, EMPTY_STR)
+ uri.path.sub!(/\/$/, EMPTY_STR)
uri.path = uri.path + '/'
end
@@ -1169,6 +1178,15 @@
end
##
+ # Sets the top-level domain for this URI.
+ #
+ # @param [String, #to_str] new_tld The new top-level domain.
+ def tld=(new_tld)
+ replaced_tld = domain.sub(/#{tld}\z/, new_tld)
+ self.host = PublicSuffix::Domain.new(replaced_tld).to_s
+ end
+
+ ##
# Returns the public suffix domain for this host.
#
# @example
@@ -1235,9 +1253,9 @@
new_user = new_userinfo.strip[/^([^:]*):?/, 1]
new_password = new_userinfo.strip[/:(.*)$/, 1]
end
- new_host = new_authority.gsub(
+ new_host = new_authority.sub(
/^([^\[\]]*)@/, EMPTY_STR
- ).gsub(
+ ).sub(
/:([^:@\[\]]*?)$/, EMPTY_STR
)
new_port =
@@ -1544,7 +1562,7 @@
# @return [String] The path's basename.
def basename
# Path cannot be nil
- return File.basename(self.path).gsub(/;[^\/]*$/, EMPTY_STR)
+ return File.basename(self.path).sub(/;[^\/]*$/, EMPTY_STR)
end
##
@@ -1744,7 +1762,7 @@
"Cannot set an HTTP request URI for a non-HTTP URI."
end
new_request_uri = new_request_uri.to_str
- path_component = new_request_uri[/^([^\?]*)\?(?:.*)$/, 1]
+ path_component = new_request_uri[/^([^\?]*)\??(?:.*)$/, 1]
query_component = new_request_uri[/^(?:[^\?]*)\?(.*)$/, 1]
path_component = path_component.to_s
path_component = (!path_component.empty? ? path_component : SLASH)
@@ -1900,7 +1918,7 @@
#
# Removes the right-most path segment from the base path.
if base_path =~ /\//
- base_path.gsub!(/\/[^\/]+$/, SLASH)
+ base_path.sub!(/\/[^\/]+$/, SLASH)
else
base_path = EMPTY_STR
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/addressable/version.rb
new/lib/addressable/version.rb
--- old/lib/addressable/version.rb 2017-08-25 02:00:11.000000000 +0200
+++ new/lib/addressable/version.rb 2019-01-18 08:16:17.000000000 +0100
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# encoding:utf-8
#--
# Copyright (C) Bob Aman
@@ -21,8 +23,8 @@
module Addressable
module VERSION
MAJOR = 2
- MINOR = 5
- TINY = 2
+ MINOR = 6
+ TINY = 0
STRING = [MAJOR, MINOR, TINY].join('.')
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/addressable.rb new/lib/addressable.rb
--- old/lib/addressable.rb 2017-08-25 02:00:11.000000000 +0200
+++ new/lib/addressable.rb 2019-01-18 08:16:17.000000000 +0100
@@ -1,2 +1,4 @@
+# frozen_string_literal: true
+
require 'addressable/uri'
require 'addressable/template'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata 2017-08-25 02:00:11.000000000 +0200
+++ new/metadata 2019-01-18 08:16:17.000000000 +0100
@@ -1,14 +1,14 @@
--- !ruby/object:Gem::Specification
name: addressable
version: !ruby/object:Gem::Version
- version: 2.5.2
+ version: 2.6.0
platform: ruby
authors:
- Bob Aman
autorequire:
bindir: bin
cert_chain: []
-date: 2017-08-25 00:00:00.000000000 Z
+date: 2019-01-18 00:00:00.000000000 Z
dependencies:
- !ruby/object:Gem::Dependency
name: public_suffix
@@ -34,16 +34,22 @@
name: bundler
requirement: !ruby/object:Gem::Requirement
requirements:
- - - "~>"
+ - - ">="
- !ruby/object:Gem::Version
version: '1.0'
+ - - "<"
+ - !ruby/object:Gem::Version
+ version: '3.0'
type: :development
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
- - - "~>"
+ - - ">="
- !ruby/object:Gem::Version
version: '1.0'
+ - - "<"
+ - !ruby/object:Gem::Version
+ version: '3.0'
description: |
Addressable is a replacement for the URI implementation that is part of
Ruby's standard library. It more closely conforms to the relevant RFCs and
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/spec/addressable/idna_spec.rb
new/spec/addressable/idna_spec.rb
--- old/spec/addressable/idna_spec.rb 2017-08-25 02:00:11.000000000 +0200
+++ new/spec/addressable/idna_spec.rb 2019-01-18 08:16:17.000000000 +0100
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# coding: utf-8
# Copyright (C) Bob Aman
#
@@ -26,9 +28,9 @@
expect(Addressable::IDNA.to_ascii("www.google.com")).to
eq("www.google.com")
end
- LONG =
'AcinusFallumTrompetumNullunCreditumVisumEstAtCuadLongumEtCefallum.com'
- it "should convert '#{LONG}' correctly" do
- expect(Addressable::IDNA.to_ascii(LONG)).to eq(LONG)
+ long =
'AcinusFallumTrompetumNullunCreditumVisumEstAtCuadLongumEtCefallum.com'
+ it "should convert '#{long}' correctly" do
+ expect(Addressable::IDNA.to_ascii(long)).to eq(long)
end
it "should convert 'www.詹姆斯.com' correctly" do
@@ -148,9 +150,9 @@
end
shared_examples_for "converting from ASCII to unicode" do
- LONG =
'AcinusFallumTrompetumNullunCreditumVisumEstAtCuadLongumEtCefallum.com'
- it "should convert '#{LONG}' correctly" do
- expect(Addressable::IDNA.to_unicode(LONG)).to eq(LONG)
+ long =
'AcinusFallumTrompetumNullunCreditumVisumEstAtCuadLongumEtCefallum.com'
+ it "should convert '#{long}' correctly" do
+ expect(Addressable::IDNA.to_unicode(long)).to eq(long)
end
it "should return the identity conversion when punycode decode fails" do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/spec/addressable/net_http_compat_spec.rb
new/spec/addressable/net_http_compat_spec.rb
--- old/spec/addressable/net_http_compat_spec.rb 2017-08-25
02:00:11.000000000 +0200
+++ new/spec/addressable/net_http_compat_spec.rb 2019-01-18
08:16:17.000000000 +0100
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# coding: utf-8
# Copyright (C) Bob Aman
#
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/spec/addressable/rack_mount_compat_spec.rb
new/spec/addressable/rack_mount_compat_spec.rb
--- old/spec/addressable/rack_mount_compat_spec.rb 2017-08-25
02:00:11.000000000 +0200
+++ new/spec/addressable/rack_mount_compat_spec.rb 2019-01-18
08:16:17.000000000 +0100
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# coding: utf-8
# Copyright (C) Bob Aman
#
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/spec/addressable/security_spec.rb
new/spec/addressable/security_spec.rb
--- old/spec/addressable/security_spec.rb 2017-08-25 02:00:11.000000000
+0200
+++ new/spec/addressable/security_spec.rb 2019-01-18 08:16:17.000000000
+0100
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# coding: utf-8
# Copyright (C) Bob Aman
#
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/spec/addressable/template_spec.rb
new/spec/addressable/template_spec.rb
--- old/spec/addressable/template_spec.rb 2017-08-25 02:00:11.000000000
+0200
+++ new/spec/addressable/template_spec.rb 2019-01-18 08:16:17.000000000
+0100
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# coding: utf-8
# Copyright (C) Bob Aman
#
@@ -82,7 +84,7 @@
:hello => 1234,
:nothing => nil,
:sym => :symbolic,
- :decimal => BigDecimal.new('1')
+ :decimal => BigDecimal('1')
}
}
@@ -949,6 +951,36 @@
)
end
end
+ context "issue #307 - partial_expand form query with nil params" do
+ subject do
+ Addressable::Template.new("http://example.com/{?one,two,three}/")
+ end
+ it "builds a new pattern with two=nil" do
+ expect(subject.partial_expand(two: nil).pattern).to eq(
+ "http://example.com/{?one}{&three}/"
+ )
+ end
+ it "builds a new pattern with one=nil and two=nil" do
+ expect(subject.partial_expand(one: nil, two: nil).pattern).to eq(
+ "http://example.com/{?three}/"
+ )
+ end
+ it "builds a new pattern with one=1 and two=nil" do
+ expect(subject.partial_expand(one: 1, two: nil).pattern).to eq(
+ "http://example.com/?one=1{&three}/"
+ )
+ end
+ it "builds a new pattern with one=nil and two=2" do
+ expect(subject.partial_expand(one: nil, two: 2).pattern).to eq(
+ "http://example.com/?two=2{&three}/"
+ )
+ end
+ it "builds a new pattern with one=nil" do
+ expect(subject.partial_expand(one: nil).pattern).to eq(
+ "http://example.com/{?two}{&three}/"
+ )
+ end
+ end
context "partial_expand with query string" do
subject {
Addressable::Template.new("http://example.com/{?two,one}/")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/spec/addressable/uri_spec.rb
new/spec/addressable/uri_spec.rb
--- old/spec/addressable/uri_spec.rb 2017-08-25 02:00:11.000000000 +0200
+++ new/spec/addressable/uri_spec.rb 2019-01-18 08:16:17.000000000 +0100
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# coding: utf-8
# Copyright (C) Bob Aman
#
@@ -1985,6 +1987,20 @@
end
it "should have the correct request URI after assignment" do
+ @uri.request_uri = "/pub/WWW/TheProject.html?"
+ expect(@uri.request_uri).to eq("/pub/WWW/TheProject.html?")
+ expect(@uri.path).to eq("/pub/WWW/TheProject.html")
+ expect(@uri.query).to eq("")
+ end
+
+ it "should have the correct request URI after assignment" do
+ @uri.request_uri = "/some/where/else.html"
+ expect(@uri.request_uri).to eq("/some/where/else.html")
+ expect(@uri.path).to eq("/some/where/else.html")
+ expect(@uri.query).to eq(nil)
+ end
+
+ it "should have the correct request URI after assignment" do
@uri.request_uri = "/some/where/else.html?query?string"
expect(@uri.request_uri).to eq("/some/where/else.html?query?string")
expect(@uri.path).to eq("/some/where/else.html")
@@ -5490,6 +5506,31 @@
end
end
+describe Addressable::URI, "when given the tld " do
+ it "'uk' should have a tld of 'uk'" do
+ uri = Addressable::URI.parse("http://example.com")
+ uri.tld = "uk"
+
+ expect(uri.tld).to eq("uk")
+ end
+
+ context "which " do
+ let (:uri) { Addressable::URI.parse("http://comrade.net/path/to/source/") }
+
+ it "contains a subdomain" do
+ uri.tld = "co.uk"
+
+ expect(uri.to_s).to eq("http://comrade.co.uk/path/to/source/")
+ end
+
+ it "is part of the domain" do
+ uri.tld = "com"
+
+ expect(uri.to_s).to eq("http://comrade.com/path/to/source/")
+ end
+ end
+end
+
describe Addressable::URI, "when given the path " +
"'c:\\windows\\My Documents 100%20\\foo.txt'" do
before do
@@ -6227,6 +6268,18 @@
end
end
+describe Addressable::URI, "when given the input which "\
+ "start with digits and has specified port" do
+ before do
+ @input = "7777.example.org:8089"
+ end
+
+ it "should heuristically parse to 'http://7777.example.org:8089'" do
+ uri = Addressable::URI.heuristic_parse(@input)
+ expect(uri.to_s).to eq("http://7777.example.org:8089")
+ end
+end
+
describe Addressable::URI, "when given the input " +
"'feed:///example.com'" do
before do
@@ -6240,6 +6293,18 @@
end
describe Addressable::URI, "when given the input " +
+ "'file://localhost/path/to/resource/'" do
+ before do
+ @input = "file://localhost/path/to/resource/"
+ end
+
+ it "should heuristically parse to 'file:///path/to/resource/'" do
+ @uri = Addressable::URI.heuristic_parse(@input)
+ expect(@uri.to_s).to eq("file:///path/to/resource/")
+ end
+end
+
+describe Addressable::URI, "when given the input " +
"'file://path/to/resource/'" do
before do
@input = "file://path/to/resource/"
@@ -6251,6 +6316,18 @@
end
end
+describe Addressable::URI, "when given the input " +
+ "'file://///path/to/resource/'" do
+ before do
+ @input = "file:///////path/to/resource/"
+ end
+
+ it "should heuristically parse to 'file:////path/to/resource/'" do
+ @uri = Addressable::URI.heuristic_parse(@input)
+ expect(@uri.to_s).to eq("file:////path/to/resource/")
+ end
+end
+
describe Addressable::URI, "when given the input " +
"'feed://http://example.com'" do
before do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/spec/spec_helper.rb new/spec/spec_helper.rb
--- old/spec/spec_helper.rb 2017-08-25 02:00:11.000000000 +0200
+++ new/spec/spec_helper.rb 2019-01-18 08:16:17.000000000 +0100
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'bundler/setup'
require 'rspec/its'
@@ -18,4 +20,5 @@
RSpec.configure do |config|
config.warnings = true
+ config.filter_run_when_matching :focus
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/tasks/clobber.rake new/tasks/clobber.rake
--- old/tasks/clobber.rake 2017-08-25 02:00:11.000000000 +0200
+++ new/tasks/clobber.rake 2019-01-18 08:16:17.000000000 +0100
@@ -1,2 +1,4 @@
+# frozen_string_literal: true
+
desc "Remove all build products"
task "clobber"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/tasks/gem.rake new/tasks/gem.rake
--- old/tasks/gem.rake 2017-08-25 02:00:11.000000000 +0200
+++ new/tasks/gem.rake 2019-01-18 08:16:17.000000000 +0100
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "rubygems/package_task"
namespace :gem do
@@ -21,7 +23,7 @@
s.required_ruby_version = '>= 2.0'
s.add_runtime_dependency 'public_suffix', '>= 2.0.2', '< 4.0'
- s.add_development_dependency 'bundler', '~> 1.0'
+ s.add_development_dependency 'bundler', '>= 1.0', '< 3.0'
s.require_path = "lib"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/tasks/git.rake new/tasks/git.rake
--- old/tasks/git.rake 2017-08-25 02:00:11.000000000 +0200
+++ new/tasks/git.rake 2019-01-18 08:16:17.000000000 +0100
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
namespace :git do
namespace :tag do
desc "List tags from the Git repository"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/tasks/metrics.rake new/tasks/metrics.rake
--- old/tasks/metrics.rake 2017-08-25 02:00:11.000000000 +0200
+++ new/tasks/metrics.rake 2019-01-18 08:16:17.000000000 +0100
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
namespace :metrics do
task :lines do
lines, codelines, total_lines, total_codelines = 0, 0, 0, 0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/tasks/rspec.rake new/tasks/rspec.rake
--- old/tasks/rspec.rake 2017-08-25 02:00:11.000000000 +0200
+++ new/tasks/rspec.rake 2019-01-18 08:16:17.000000000 +0100
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "rspec/core/rake_task"
namespace :spec do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/tasks/yard.rake new/tasks/yard.rake
--- old/tasks/yard.rake 2017-08-25 02:00:11.000000000 +0200
+++ new/tasks/yard.rake 2019-01-18 08:16:17.000000000 +0100
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "rake"
begin