Hello community,
here is the log from the commit of package rubygem-validate_url for
openSUSE:Factory checked in at 2019-03-27 16:17:26
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-validate_url (Old)
and /work/SRC/openSUSE:Factory/.rubygem-validate_url.new.25356 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-validate_url"
Wed Mar 27 16:17:26 2019 rev:2 rq:685118 version:1.0.6
Changes:
--------
---
/work/SRC/openSUSE:Factory/rubygem-validate_url/rubygem-validate_url.changes
2018-01-10 23:31:33.962164981 +0100
+++
/work/SRC/openSUSE:Factory/.rubygem-validate_url.new.25356/rubygem-validate_url.changes
2019-03-27 16:17:27.779579033 +0100
@@ -1,0 +2,12 @@
+Thu Mar 14 11:08:38 UTC 2019 - Stephan Kulow <[email protected]>
+
+- updated to version 1.0.6
+ no changelog found
+
+-------------------------------------------------------------------
+Sat Mar 2 15:41:55 UTC 2019 - Stephan Kulow <[email protected]>
+
+- updated to version 1.0.4
+ no changelog found
+
+-------------------------------------------------------------------
Old:
----
validate_url-1.0.2.gem
New:
----
validate_url-1.0.6.gem
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ rubygem-validate_url.spec ++++++
--- /var/tmp/diff_new_pack.R1sLKv/_old 2019-03-27 16:17:28.715578838 +0100
+++ /var/tmp/diff_new_pack.R1sLKv/_new 2019-03-27 16:17:28.719578837 +0100
@@ -1,7 +1,7 @@
#
# spec file for package rubygem-validate_url
#
-# Copyright (c) 2016 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
@@ -12,7 +12,7 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
@@ -24,16 +24,16 @@
#
Name: rubygem-validate_url
-Version: 1.0.2
+Version: 1.0.6
Release: 0
%define mod_name validate_url
%define mod_full_name %{mod_name}-%{version}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-BuildRequires: ruby-macros >= 5
-BuildRequires: %{ruby}
BuildRequires: %{rubygem gem2rpm}
+BuildRequires: %{ruby}
+BuildRequires: ruby-macros >= 5
Url: http://github.com/perfectline/validates_url/tree/master
-Source: http://rubygems.org/gems/%{mod_full_name}.gem
+Source: https://rubygems.org/gems/%{mod_full_name}.gem
Source1: gem2rpm.yml
Summary: Library for validating urls in Rails
License: MIT
++++++ validate_url-1.0.2.gem -> validate_url-1.0.6.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/README.md new/README.md
--- old/README.md 2015-07-21 10:45:38.000000000 +0200
+++ new/README.md 2019-03-13 07:19:03.000000000 +0100
@@ -1,10 +1,10 @@
# Validates URL
-This gem adds the capability of validating URLs to ActiveRecord and
ActiveModel (Rails 3).
+This gem adds the capability of validating URLs to ActiveRecord and
ActiveModel.
## Installation
-
-```
+
+```
# add this to your Gemfile
gem "validate_url"
@@ -16,19 +16,25 @@
### With ActiveRecord
-```ruby
+```ruby
class Pony < ActiveRecord::Base
# standard validation
- validates :homepage, :url => true
+ validates :homepage, url: true
# with allow_nil
- validates :homepage, :url => {:allow_nil => true}
+ validates :homepage, url: { allow_nil: true }
# with allow_blank
- validates :homepage, :url => {:allow_blank => true}
+ validates :homepage, url: { allow_blank: true }
# without local hostnames
- validates :homepage, :url => {:no_local => true}
+ validates :homepage, url: { no_local: true }
+
+ # with custom schemes
+ validates :homepage, url: { schemes: ['https'] }
+
+ # with public suffix database https://publicsuffix.org/
+ validates :homepage, url: { public_suffix: true }
end
```
@@ -41,14 +47,14 @@
attr_accessor :homepage
# with legacy syntax (the syntax above works also)
- validates_url :homepage, :allow_blank => true
+ validates_url :homepage, allow_blank: true
end
```
### I18n
-The default error message `is not valid url`.
-You can pass the `:message => "my custom error"` option to your validation to
define your own, custom message.
+The default error message `is not a valid URL`.
+You can pass the `message: "my custom error"` option to your validation to
define your own, custom message.
## Contributing
@@ -63,4 +69,4 @@
## License
Validates URL is Copyright © 2010-2014
[PerfectLine](http://www.perfectline.co), LLC. It is free software, and may be
-redistributed under the terms specified in the LICENSE file.
\ No newline at end of file
+redistributed under the terms specified in the LICENSE file.
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/locale/fr.yml new/lib/locale/fr.yml
--- old/lib/locale/fr.yml 1970-01-01 01:00:00.000000000 +0100
+++ new/lib/locale/fr.yml 2019-03-13 07:19:03.000000000 +0100
@@ -0,0 +1,4 @@
+fr:
+ errors:
+ messages:
+ url: "n'est pas une URL valide"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/locale/km.yml new/lib/locale/km.yml
--- old/lib/locale/km.yml 1970-01-01 01:00:00.000000000 +0100
+++ new/lib/locale/km.yml 2019-03-13 07:19:03.000000000 +0100
@@ -0,0 +1,4 @@
+km:
+ errors:
+ messages:
+ url: "មិនត្រឹមត្រូវ"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/locale/ro.yml new/lib/locale/ro.yml
--- old/lib/locale/ro.yml 1970-01-01 01:00:00.000000000 +0100
+++ new/lib/locale/ro.yml 2019-03-13 07:19:03.000000000 +0100
@@ -0,0 +1,4 @@
+ro:
+ errors:
+ messages:
+ url: nu este un URL valid
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/locale/ru.yml new/lib/locale/ru.yml
--- old/lib/locale/ru.yml 1970-01-01 01:00:00.000000000 +0100
+++ new/lib/locale/ru.yml 2019-03-13 07:19:03.000000000 +0100
@@ -0,0 +1,4 @@
+ru:
+ errors:
+ messages:
+ url: некорректный URL
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/locale/zh-CN.yml new/lib/locale/zh-CN.yml
--- old/lib/locale/zh-CN.yml 1970-01-01 01:00:00.000000000 +0100
+++ new/lib/locale/zh-CN.yml 2019-03-13 07:19:03.000000000 +0100
@@ -0,0 +1,4 @@
+zh-CN:
+ errors:
+ messages:
+ url: '网址格式不正确'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/locale/zh-TW.yml new/lib/locale/zh-TW.yml
--- old/lib/locale/zh-TW.yml 1970-01-01 01:00:00.000000000 +0100
+++ new/lib/locale/zh-TW.yml 2019-03-13 07:19:03.000000000 +0100
@@ -0,0 +1,4 @@
+zh-TW:
+ errors:
+ messages:
+ url: '網址格式不正確'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/rspec_matcher.rb new/lib/rspec_matcher.rb
--- old/lib/rspec_matcher.rb 1970-01-01 01:00:00.000000000 +0100
+++ new/lib/rspec_matcher.rb 2019-03-13 07:19:03.000000000 +0100
@@ -0,0 +1,12 @@
+RSpec::Matchers.define :validate_url_of do |attribute|
+ match do
+ actual = subject.is_a?(Class) ? subject.new : subject
+ actual.send(:"#{attribute}=", "htp://invalidurl")
+ expect(actual).to be_invalid
+ @expected_message ||= I18n.t("errors.messages.url")
+ expect(actual.errors.messages[attribute.to_sym]).to
include(@expected_message)
+ end
+ chain :with_message do |message|
+ @expected_message = message
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/validate_url.rb new/lib/validate_url.rb
--- old/lib/validate_url.rb 2015-07-21 10:45:38.000000000 +0200
+++ new/lib/validate_url.rb 2019-03-13 07:19:03.000000000 +0100
@@ -1,18 +1,18 @@
-require 'addressable/uri'
require 'active_model'
require 'active_support/i18n'
-I18n.load_path << File.dirname(__FILE__) + '/locale/en.yml'
-I18n.load_path << File.dirname(__FILE__) + '/locale/tr.yml'
-I18n.load_path << File.dirname(__FILE__) + '/locale/ja.yml'
+require 'public_suffix'
+I18n.load_path += Dir[File.dirname(__FILE__) + "/locale/*.yml"]
module ActiveModel
module Validations
class UrlValidator < ActiveModel::EachValidator
+ RESERVED_OPTIONS = [:schemes, :no_local]
def initialize(options)
- options.reverse_merge!(:schemes => %w(http https))
- options.reverse_merge!(:message => :url)
- options.reverse_merge!(:no_local => false)
+ options.reverse_merge!(schemes: %w(http https))
+ options.reverse_merge!(message: :url)
+ options.reverse_merge!(no_local: false)
+ options.reverse_merge!(public_suffix: false)
super(options)
end
@@ -20,14 +20,29 @@
def validate_each(record, attribute, value)
schemes = [*options.fetch(:schemes)].map(&:to_s)
begin
- uri = Addressable::URI.parse(value)
- unless uri && uri.host && schemes.include?(uri.scheme) &&
(!options.fetch(:no_local) || uri.host.include?('.'))
- record.errors.add(attribute, options.fetch(:message), :value =>
value)
+ uri = URI.parse(URI.escape(value))
+ host = uri && uri.host
+ scheme = uri && uri.scheme
+
+ valid_suffix = !options.fetch(:public_suffix) || (host &&
PublicSuffix.valid?(host, :default_rule => nil))
+ valid_no_local = !options.fetch(:no_local) || (host &&
host.include?('.'))
+ valid_scheme = host && scheme && schemes.include?(scheme)
+
+ unless valid_scheme && valid_no_local && valid_suffix
+ record.errors.add(attribute, options.fetch(:message), value: value)
end
- rescue Addressable::URI::InvalidURIError
- record.errors.add(attribute, options.fetch(:message), :value =>
value)
+ rescue URI::InvalidURIError
+ record.errors.add(attribute, :url, filtered_options(value))
end
end
+
+ protected
+
+ def filtered_options(value)
+ filtered = options.except(*RESERVED_OPTIONS)
+ filtered[:value] = value
+ filtered
+ end
end
module ClassMethods
@@ -36,8 +51,8 @@
# class Unicorn
# include ActiveModel::Validations
# attr_accessor :homepage, :ftpsite
- # validates_url :homepage, :allow_blank => true
- # validates_url :ftpsite, :schemes => ['ftp']
+ # validates_url :homepage, allow_blank: true
+ # validates_url :ftpsite, schemes: ['ftp']
# end
# Configuration options:
# * <tt>:message</tt> - A custom error message (default is: "is not a
valid URL").
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata 2015-07-21 10:45:38.000000000 +0200
+++ new/metadata 2019-03-13 07:19:03.000000000 +0100
@@ -1,7 +1,7 @@
--- !ruby/object:Gem::Specification
name: validate_url
version: !ruby/object:Gem::Version
- version: 1.0.2
+ version: 1.0.6
platform: ruby
authors:
- Tanel Suurhans
@@ -10,30 +10,44 @@
autorequire:
bindir: bin
cert_chain: []
-date: 2015-07-21 00:00:00.000000000 Z
+date: 2019-03-13 00:00:00.000000000 Z
dependencies:
- !ruby/object:Gem::Dependency
- name: activemodel
+ name: jeweler
requirement: !ruby/object:Gem::Requirement
requirements:
- - ">="
- !ruby/object:Gem::Version
- version: 3.0.0
- type: :runtime
+ version: '0'
+ type: :development
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
- - ">="
- !ruby/object:Gem::Version
- version: 3.0.0
+ version: '0'
- !ruby/object:Gem::Dependency
- name: addressable
+ name: sqlite3
requirement: !ruby/object:Gem::Requirement
requirements:
- - ">="
- !ruby/object:Gem::Version
version: '0'
- type: :runtime
+ type: :development
+ prerelease: false
+ version_requirements: !ruby/object:Gem::Requirement
+ requirements:
+ - - ">="
+ - !ruby/object:Gem::Version
+ version: '0'
+- !ruby/object:Gem::Dependency
+ name: activerecord
+ requirement: !ruby/object:Gem::Requirement
+ requirements:
+ - - ">="
+ - !ruby/object:Gem::Version
+ version: '0'
+ type: :development
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
@@ -68,6 +82,34 @@
- - ">="
- !ruby/object:Gem::Version
version: 1.1.2
+- !ruby/object:Gem::Dependency
+ name: activemodel
+ requirement: !ruby/object:Gem::Requirement
+ requirements:
+ - - ">="
+ - !ruby/object:Gem::Version
+ version: 3.0.0
+ type: :runtime
+ prerelease: false
+ version_requirements: !ruby/object:Gem::Requirement
+ requirements:
+ - - ">="
+ - !ruby/object:Gem::Version
+ version: 3.0.0
+- !ruby/object:Gem::Dependency
+ name: public_suffix
+ requirement: !ruby/object:Gem::Requirement
+ requirements:
+ - - ">="
+ - !ruby/object:Gem::Version
+ version: '0'
+ type: :runtime
+ prerelease: false
+ version_requirements: !ruby/object:Gem::Requirement
+ requirements:
+ - - ">="
+ - !ruby/object:Gem::Version
+ version: '0'
description: Library for validating urls in Rails.
email:
- [email protected]
@@ -85,10 +127,17 @@
- install.rb
- lib/locale/de.yml
- lib/locale/en.yml
+- lib/locale/fr.yml
- lib/locale/it.yml
- lib/locale/ja.yml
+- lib/locale/km.yml
- lib/locale/pt-BR.yml
+- lib/locale/ro.yml
+- lib/locale/ru.yml
- lib/locale/tr.yml
+- lib/locale/zh-CN.yml
+- lib/locale/zh-TW.yml
+- lib/rspec_matcher.rb
- lib/validate_url.rb
homepage: http://github.com/perfectline/validates_url/tree/master
licenses: []
@@ -109,7 +158,7 @@
version: '0'
requirements: []
rubyforge_project:
-rubygems_version: 2.4.5
+rubygems_version: 2.4.5.1
signing_key:
specification_version: 4
summary: Library for validating urls in Rails.