validates_ip_format_of 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +26 -0
- data/.rvmrc +38 -0
- data/.travis.yml +7 -0
- data/Appraisals +16 -0
- data/Gemfile +3 -14
- data/Guardfile +9 -0
- data/LICENSE.md +24 -0
- data/README.md +48 -0
- data/Rakefile +7 -46
- data/lib/validates_ip_format_of/version.rb +3 -0
- data/spec/spec_helper.rb +17 -10
- data/spec/validates_ip_format_of_spec.rb +5 -5
- data/validates_ip_format_of.gemspec +21 -60
- metadata +109 -41
- data/LICENSE.txt +0 -20
- data/README.markdown +0 -54
- data/VERSION +0 -1
data/.gitignore
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
gemfiles/
|
7
|
+
Gemfile.lock
|
8
|
+
InstalledFiles
|
9
|
+
_yardoc
|
10
|
+
coverage
|
11
|
+
doc/
|
12
|
+
lib/bundler/man
|
13
|
+
pkg
|
14
|
+
rdoc
|
15
|
+
spec/reports
|
16
|
+
test/tmp
|
17
|
+
test/version_tmp
|
18
|
+
tmp
|
19
|
+
|
20
|
+
# YARD artifacts
|
21
|
+
.yardoc
|
22
|
+
_yardoc
|
23
|
+
doc/
|
24
|
+
|
25
|
+
# OSX artifacts
|
26
|
+
.DS_Store
|
data/.rvmrc
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
# This is an RVM Project .rvmrc file, used to automatically load the ruby
|
4
|
+
# development environment upon cd'ing into the directory
|
5
|
+
|
6
|
+
# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
|
7
|
+
# Only full ruby name is supported here, for short names use:
|
8
|
+
# echo "rvm use 1.9.3" > .rvmrc
|
9
|
+
environment_id="ruby-1.9.3-p194@validates_ip_format_of"
|
10
|
+
|
11
|
+
# Uncomment the following lines if you want to verify rvm version per project
|
12
|
+
# rvmrc_rvm_version="1.14.11 (stable)" # 1.10.1 seams as a safe start
|
13
|
+
# eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
|
14
|
+
# echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
|
15
|
+
# return 1
|
16
|
+
# }
|
17
|
+
|
18
|
+
# First we attempt to load the desired environment directly from the environment
|
19
|
+
# file. This is very fast and efficient compared to running through the entire
|
20
|
+
# CLI and selector. If you want feedback on which environment was used then
|
21
|
+
# insert the word 'use' after --create as this triggers verbose mode.
|
22
|
+
if [[ -d "${rvm_path:-$HOME/.rvm}/environments"
|
23
|
+
&& -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
|
24
|
+
then
|
25
|
+
\. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
|
26
|
+
[[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]] &&
|
27
|
+
\. "${rvm_path:-$HOME/.rvm}/hooks/after_use" || true
|
28
|
+
if [[ $- == *i* ]] # check for interactive shells
|
29
|
+
then echo "Using: $(tput setaf 2)$GEM_HOME$(tput sgr0)" # show the user the ruby and gemset they are using in green
|
30
|
+
else echo "Using: $GEM_HOME" # don't use colors in non-interactive shells
|
31
|
+
fi
|
32
|
+
else
|
33
|
+
# If the environment file has not yet been created, use the RVM CLI to select.
|
34
|
+
rvm --create use "$environment_id" || {
|
35
|
+
echo "Failed to create RVM environment '${environment_id}'."
|
36
|
+
return 1
|
37
|
+
}
|
38
|
+
fi
|
data/.travis.yml
ADDED
data/Appraisals
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
appraise "activerecord-3.0.x" do
|
2
|
+
gem "activerecord", "~> 3.0.0"
|
3
|
+
end
|
4
|
+
|
5
|
+
appraise "activerecord-3.1.x" do
|
6
|
+
gem "activerecord", "~> 3.1.0"
|
7
|
+
end
|
8
|
+
|
9
|
+
appraise "activerecord-3.2.x" do
|
10
|
+
gem "activerecord", "~> 3.2.0"
|
11
|
+
end
|
12
|
+
|
13
|
+
appraise "activerecord-master" do
|
14
|
+
gem "activerecord", git: "https://github.com/rails/rails.git", require: "activerecord"
|
15
|
+
gem "activerecord-deprecated_finders", git: "https://github.com/rails/activerecord-deprecated_finders.git"
|
16
|
+
end
|
data/Gemfile
CHANGED
@@ -1,15 +1,4 @@
|
|
1
|
-
source "
|
2
|
-
# Add dependencies required to use your gem here.
|
3
|
-
# Example:
|
4
|
-
# gem "activesupport", ">= 2.3.5"
|
1
|
+
source "https://rubygems.org"
|
5
2
|
|
6
|
-
#
|
7
|
-
|
8
|
-
group :development do
|
9
|
-
gem "faker", "~> 0.9.5"
|
10
|
-
gem "activerecord", "~> 3.0.8"
|
11
|
-
gem "rspec", "~> 2.3.0"
|
12
|
-
gem "bundler", "~> 1.0.0"
|
13
|
-
gem "jeweler", "~> 1.6.2"
|
14
|
-
gem "rcov", "~> 0.9.9"
|
15
|
-
end
|
3
|
+
# Specify your gem's dependencies in validates_ip_format_of.gemspec
|
4
|
+
gemspec
|
data/Guardfile
ADDED
data/LICENSE.md
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
|
2
|
+
Copyright (c) 2012 Ryan Lovelett ( [@rlovelett](http://twitter.com/#!/rlovelett) )
|
3
|
+
=================================================================================================
|
4
|
+
|
5
|
+
The "validates_ip_format_of" RubyGem is released under the **MIT LICENSE**
|
6
|
+
----------------------------------------------------------
|
7
|
+
|
8
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
9
|
+
of this software and associated documentation files (the "Software"), to deal
|
10
|
+
in the Software without restriction, including without limitation the rights
|
11
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
12
|
+
copies of the Software, and to permit persons to whom the Software is
|
13
|
+
furnished to do so, subject to the following conditions:
|
14
|
+
|
15
|
+
The above copyright notice and this permission notice shall be included in
|
16
|
+
all copies or substantial portions of the Software.
|
17
|
+
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
21
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# validates\_ip\_format\_of [![Build Status](https://travis-ci.org/RLovelett/validates_ip_format_of.png?branch=master)](https://travis-ci.org/RLovelett/validates_ip_format_of)
|
2
|
+
|
3
|
+
Rails plugin that provides a `validates_ip_format_of` method to `ActiveRecord` models. IPs are validated by regexp.
|
4
|
+
|
5
|
+
## Support
|
6
|
+
|
7
|
+
Tests are run on all versions listed.
|
8
|
+
|
9
|
+
### Rubies
|
10
|
+
|
11
|
+
* `1.9.2`
|
12
|
+
* `1.9.3`
|
13
|
+
* `head`
|
14
|
+
|
15
|
+
### ActiveRecord
|
16
|
+
|
17
|
+
* `~> 3.0.0`
|
18
|
+
* `~> 3.1.0`
|
19
|
+
* `~> 3.2.0`
|
20
|
+
* `master`
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
After installing the plugin, it's used like
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
class User < ActiveRecord::Base
|
28
|
+
validates_ip_format_of :dhcp,
|
29
|
+
:allow_nil => true,
|
30
|
+
:message => 'is completely unacceptable'
|
31
|
+
end
|
32
|
+
```
|
33
|
+
|
34
|
+
Takes the same arguments as [`validates_format_of`](http://api.rubyonrails.org/classes/ActiveRecord/Validations/ClassMethods.html#M001052) except for the `:with` regexp.
|
35
|
+
|
36
|
+
Please note that the regexp used to validate IPs is not perfect, but hopefully good enough. See the test suite. Patches are very welcome.
|
37
|
+
|
38
|
+
## Limitations and design choices
|
39
|
+
|
40
|
+
Does not handle IPv6.
|
41
|
+
|
42
|
+
By design, the plugin does not allow RFC 1918 IPv4 addresses, e.g., 10.0.0.0, 172.16.0.0, 192.168.0.0, from being input. Also, prevents 127.0.0.1 and 0.0.0.0.
|
43
|
+
|
44
|
+
## Credits and license
|
45
|
+
|
46
|
+
Based on my contributions made to `validates_url_format_of` written by [Henrik Nyh](https://github.com/henrik/validates_url_format_of), which is also released under the MIT license.
|
47
|
+
|
48
|
+
See LICENSE.md
|
data/Rakefile
CHANGED
@@ -1,49 +1,10 @@
|
|
1
|
-
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
require "rubygems"
|
3
|
+
require "bundler/setup"
|
4
|
+
require "bundler/gem_tasks"
|
5
|
+
require "rspec/core/rake_task"
|
6
|
+
require "appraisal"
|
2
7
|
|
3
|
-
|
4
|
-
require 'bundler'
|
5
|
-
begin
|
6
|
-
Bundler.setup(:default, :development)
|
7
|
-
rescue Bundler::BundlerError => e
|
8
|
-
$stderr.puts e.message
|
9
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
-
exit e.status_code
|
11
|
-
end
|
12
|
-
require 'rake'
|
13
|
-
|
14
|
-
require 'jeweler'
|
15
|
-
Jeweler::Tasks.new do |gem|
|
16
|
-
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
-
gem.name = "validates_ip_format_of"
|
18
|
-
gem.homepage = "http://github.com/wahvee/validates_ip_format_of"
|
19
|
-
gem.license = "MIT"
|
20
|
-
gem.summary = %Q{Validate the format of a IP by regexp in Ruby on Rails.}
|
21
|
-
gem.description = %Q{Rails plugin that provides a validates_ip_format_of method to ActiveRecord models. IPs are validated by regexp. IP validation. Validate IP.}
|
22
|
-
gem.email = "ryan@wahvee.com"
|
23
|
-
gem.authors = ["Ryan Lovelett"]
|
24
|
-
# dependencies defined in Gemfile
|
25
|
-
end
|
26
|
-
Jeweler::RubygemsDotOrgTasks.new
|
27
|
-
|
28
|
-
require 'rspec/core'
|
29
|
-
require 'rspec/core/rake_task'
|
30
|
-
RSpec::Core::RakeTask.new(:spec) do |spec|
|
31
|
-
spec.pattern = FileList['spec/**/*_spec.rb']
|
32
|
-
end
|
33
|
-
|
34
|
-
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
35
|
-
spec.pattern = 'spec/**/*_spec.rb'
|
36
|
-
spec.rcov = true
|
37
|
-
end
|
8
|
+
RSpec::Core::RakeTask.new(:spec)
|
38
9
|
|
39
10
|
task :default => :spec
|
40
|
-
|
41
|
-
require 'rake/rdoctask'
|
42
|
-
Rake::RDocTask.new do |rdoc|
|
43
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
44
|
-
|
45
|
-
rdoc.rdoc_dir = 'rdoc'
|
46
|
-
rdoc.title = "validates_ip_format_of #{version}"
|
47
|
-
rdoc.rdoc_files.include('README*')
|
48
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
49
|
-
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,14 +1,21 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require 'rspec'
|
4
|
-
require 'faker'
|
5
|
-
require "#{File.expand_path(File.dirname(__FILE__))}/../init.rb"
|
6
|
-
require 'active_record'
|
1
|
+
require "validates_ip_format_of"
|
2
|
+
require "faker"
|
7
3
|
|
8
|
-
#
|
9
|
-
#
|
10
|
-
|
4
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
5
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
6
|
+
# Require this file using `require "spec_helper"` to ensure that it is only
|
7
|
+
# loaded once.
|
8
|
+
#
|
9
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
11
10
|
|
12
11
|
RSpec.configure do |config|
|
13
|
-
|
12
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
13
|
+
config.run_all_when_everything_filtered = true
|
14
|
+
config.filter_run :focus
|
15
|
+
|
16
|
+
# Run specs in random order to surface order dependencies. If you find an
|
17
|
+
# order dependency and want to debug it, you can fix the order by providing
|
18
|
+
# the seed, which is printed after each run.
|
19
|
+
# --seed 1234
|
20
|
+
config.order = 'random'
|
14
21
|
end
|
@@ -24,8 +24,8 @@ describe ValidatesIpFormatOf do
|
|
24
24
|
end while /^10.*|^172.*|^192.168.*/.match(ip)
|
25
25
|
@model.dhcp = ip
|
26
26
|
@model.valid?.should be_false
|
27
|
-
puts "#{@model.dhcp} fails validation" if @model.errors.
|
28
|
-
@model.errors.should_not
|
27
|
+
puts "#{@model.dhcp} fails validation" if @model.errors.include?(:dhcp)
|
28
|
+
@model.errors.should_not include(:dhcp)
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
@@ -51,7 +51,7 @@ describe ValidatesIpFormatOf do
|
|
51
51
|
].each do |url|
|
52
52
|
@model.dns = url
|
53
53
|
@model.valid?.should be_false
|
54
|
-
@model.errors.should
|
54
|
+
@model.errors.should include(:dns)
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
@@ -63,14 +63,14 @@ describe ValidatesIpFormatOf do
|
|
63
63
|
reserved_ips.each do |url|
|
64
64
|
@model.dhcp = url
|
65
65
|
@model.valid?.should be_false
|
66
|
-
@model.errors.should
|
66
|
+
@model.errors.should include(:dhcp)
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
70
|
it "should override defaults" do
|
71
71
|
@model.custom_ip = 'x'
|
72
72
|
@model.valid?.should be_false
|
73
|
-
@model.errors.should
|
73
|
+
@model.errors.should include(:custom_ip)
|
74
74
|
@model.errors[:custom_ip].should include('custom message')
|
75
75
|
end
|
76
76
|
end
|
@@ -1,66 +1,27 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/validates_ip_format_of/version', __FILE__)
|
5
3
|
|
6
|
-
Gem::Specification.new do |
|
7
|
-
|
8
|
-
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Ryan Lovelett"]
|
6
|
+
gem.email = ["ryan@lovelett.me"]
|
7
|
+
gem.description = %q{Rails plugin that provides a validates_ip_format_of method to ActiveRecord models. IPs are validated by regexp. IP validation. Validate IP.}
|
8
|
+
gem.summary = %q{Validate the format of a IP by regexp in Ruby on Rails.}
|
9
|
+
gem.homepage = "http://github.com/RLovelett/validates_ip_format_of"
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
"LICENSE.txt",
|
17
|
-
"README.markdown"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
".document",
|
21
|
-
".rspec",
|
22
|
-
"Gemfile",
|
23
|
-
"LICENSE.txt",
|
24
|
-
"README.markdown",
|
25
|
-
"Rakefile",
|
26
|
-
"VERSION",
|
27
|
-
"init.rb",
|
28
|
-
"lib/validates_ip_format_of.rb",
|
29
|
-
"spec/spec_helper.rb",
|
30
|
-
"spec/validates_ip_format_of_spec.rb",
|
31
|
-
"validates_ip_format_of.gemspec"
|
32
|
-
]
|
33
|
-
s.homepage = %q{http://github.com/wahvee/validates_ip_format_of}
|
34
|
-
s.licenses = ["MIT"]
|
35
|
-
s.require_paths = ["lib"]
|
36
|
-
s.rubygems_version = %q{1.6.2}
|
37
|
-
s.summary = %q{Validate the format of a IP by regexp in Ruby on Rails.}
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "validates_ip_format_of"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = ValidatesIpFormatOf::VERSION
|
38
17
|
|
39
|
-
|
40
|
-
s.specification_version = 3
|
18
|
+
gem.add_dependency "activerecord", ">= 3.0.0"
|
41
19
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
else
|
50
|
-
s.add_dependency(%q<faker>, ["~> 0.9.5"])
|
51
|
-
s.add_dependency(%q<activerecord>, ["~> 3.0.8"])
|
52
|
-
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
53
|
-
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
54
|
-
s.add_dependency(%q<jeweler>, ["~> 1.6.2"])
|
55
|
-
s.add_dependency(%q<rcov>, ["~> 0.9.9"])
|
56
|
-
end
|
57
|
-
else
|
58
|
-
s.add_dependency(%q<faker>, ["~> 0.9.5"])
|
59
|
-
s.add_dependency(%q<activerecord>, ["~> 3.0.8"])
|
60
|
-
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
61
|
-
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
62
|
-
s.add_dependency(%q<jeweler>, ["~> 1.6.2"])
|
63
|
-
s.add_dependency(%q<rcov>, ["~> 0.9.9"])
|
64
|
-
end
|
20
|
+
gem.add_development_dependency "rake", "~> 0.9.2.2"
|
21
|
+
gem.add_development_dependency "rspec", "~> 2.11.0"
|
22
|
+
gem.add_development_dependency "faker", "~> 1.1.2"
|
23
|
+
gem.add_development_dependency "guard-rspec", "~> 2.1.0"
|
24
|
+
gem.add_development_dependency "rb-fsevent", "~> 0.9.1"
|
25
|
+
gem.add_development_dependency "terminal-notifier-guard", "~> 1.5.3"
|
26
|
+
gem.add_development_dependency "appraisal", "~> 0.5.0"
|
65
27
|
end
|
66
|
-
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: validates_ip_format_of
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,100 +9,163 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
13
|
-
default_executable:
|
12
|
+
date: 2012-11-04 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
17
|
-
requirement:
|
15
|
+
name: activerecord
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 3.0.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 3.0.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rake
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
18
33
|
none: false
|
19
34
|
requirements:
|
20
35
|
- - ~>
|
21
36
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.9.
|
37
|
+
version: 0.9.2.2
|
23
38
|
type: :development
|
24
39
|
prerelease: false
|
25
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.9.2.2
|
26
46
|
- !ruby/object:Gem::Dependency
|
27
|
-
name:
|
28
|
-
requirement:
|
47
|
+
name: rspec
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
29
49
|
none: false
|
30
50
|
requirements:
|
31
51
|
- - ~>
|
32
52
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
53
|
+
version: 2.11.0
|
34
54
|
type: :development
|
35
55
|
prerelease: false
|
36
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.11.0
|
37
62
|
- !ruby/object:Gem::Dependency
|
38
|
-
name:
|
39
|
-
requirement:
|
63
|
+
name: faker
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
40
65
|
none: false
|
41
66
|
requirements:
|
42
67
|
- - ~>
|
43
68
|
- !ruby/object:Gem::Version
|
44
|
-
version:
|
69
|
+
version: 1.1.2
|
45
70
|
type: :development
|
46
71
|
prerelease: false
|
47
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 1.1.2
|
48
78
|
- !ruby/object:Gem::Dependency
|
49
|
-
name:
|
50
|
-
requirement:
|
79
|
+
name: guard-rspec
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
51
81
|
none: false
|
52
82
|
requirements:
|
53
83
|
- - ~>
|
54
84
|
- !ruby/object:Gem::Version
|
55
|
-
version: 1.0
|
85
|
+
version: 2.1.0
|
56
86
|
type: :development
|
57
87
|
prerelease: false
|
58
|
-
version_requirements:
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 2.1.0
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: rb-fsevent
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ~>
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: 0.9.1
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ~>
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 0.9.1
|
59
110
|
- !ruby/object:Gem::Dependency
|
60
|
-
name:
|
61
|
-
requirement:
|
111
|
+
name: terminal-notifier-guard
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
62
113
|
none: false
|
63
114
|
requirements:
|
64
115
|
- - ~>
|
65
116
|
- !ruby/object:Gem::Version
|
66
|
-
version: 1.
|
117
|
+
version: 1.5.3
|
67
118
|
type: :development
|
68
119
|
prerelease: false
|
69
|
-
version_requirements:
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ~>
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 1.5.3
|
70
126
|
- !ruby/object:Gem::Dependency
|
71
|
-
name:
|
72
|
-
requirement:
|
127
|
+
name: appraisal
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
73
129
|
none: false
|
74
130
|
requirements:
|
75
131
|
- - ~>
|
76
132
|
- !ruby/object:Gem::Version
|
77
|
-
version: 0.
|
133
|
+
version: 0.5.0
|
78
134
|
type: :development
|
79
135
|
prerelease: false
|
80
|
-
version_requirements:
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ~>
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: 0.5.0
|
81
142
|
description: Rails plugin that provides a validates_ip_format_of method to ActiveRecord
|
82
143
|
models. IPs are validated by regexp. IP validation. Validate IP.
|
83
|
-
email:
|
144
|
+
email:
|
145
|
+
- ryan@lovelett.me
|
84
146
|
executables: []
|
85
147
|
extensions: []
|
86
|
-
extra_rdoc_files:
|
87
|
-
- LICENSE.txt
|
88
|
-
- README.markdown
|
148
|
+
extra_rdoc_files: []
|
89
149
|
files:
|
90
150
|
- .document
|
151
|
+
- .gitignore
|
91
152
|
- .rspec
|
153
|
+
- .rvmrc
|
154
|
+
- .travis.yml
|
155
|
+
- Appraisals
|
92
156
|
- Gemfile
|
93
|
-
-
|
94
|
-
-
|
157
|
+
- Guardfile
|
158
|
+
- LICENSE.md
|
159
|
+
- README.md
|
95
160
|
- Rakefile
|
96
|
-
- VERSION
|
97
161
|
- init.rb
|
98
162
|
- lib/validates_ip_format_of.rb
|
163
|
+
- lib/validates_ip_format_of/version.rb
|
99
164
|
- spec/spec_helper.rb
|
100
165
|
- spec/validates_ip_format_of_spec.rb
|
101
166
|
- validates_ip_format_of.gemspec
|
102
|
-
|
103
|
-
|
104
|
-
licenses:
|
105
|
-
- MIT
|
167
|
+
homepage: http://github.com/RLovelett/validates_ip_format_of
|
168
|
+
licenses: []
|
106
169
|
post_install_message:
|
107
170
|
rdoc_options: []
|
108
171
|
require_paths:
|
@@ -115,17 +178,22 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
115
178
|
version: '0'
|
116
179
|
segments:
|
117
180
|
- 0
|
118
|
-
hash: -
|
181
|
+
hash: -1043923047998520373
|
119
182
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
183
|
none: false
|
121
184
|
requirements:
|
122
185
|
- - ! '>='
|
123
186
|
- !ruby/object:Gem::Version
|
124
187
|
version: '0'
|
188
|
+
segments:
|
189
|
+
- 0
|
190
|
+
hash: -1043923047998520373
|
125
191
|
requirements: []
|
126
192
|
rubyforge_project:
|
127
|
-
rubygems_version: 1.
|
193
|
+
rubygems_version: 1.8.24
|
128
194
|
signing_key:
|
129
195
|
specification_version: 3
|
130
196
|
summary: Validate the format of a IP by regexp in Ruby on Rails.
|
131
|
-
test_files:
|
197
|
+
test_files:
|
198
|
+
- spec/spec_helper.rb
|
199
|
+
- spec/validates_ip_format_of_spec.rb
|
data/LICENSE.txt
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright (c) 2011 Ryan Lovelett
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.markdown
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
# validates\_ip\_format\_of
|
2
|
-
|
3
|
-
Rails plugin that provides a `validates_ip_format_of` method to `ActiveRecord` models. IPs are validated by regexp.
|
4
|
-
|
5
|
-
Known to be compatible with Ruby 1.9.2.
|
6
|
-
|
7
|
-
Known to be compatible with ActiveRecord 3.0.7.
|
8
|
-
|
9
|
-
|
10
|
-
## Usage
|
11
|
-
|
12
|
-
After installing the plugin, it's used like
|
13
|
-
|
14
|
-
class User < ActiveRecord::Base
|
15
|
-
validates_ip_format_of :dhcp,
|
16
|
-
:allow_nil => true,
|
17
|
-
:message => 'is completely unacceptable'
|
18
|
-
end
|
19
|
-
|
20
|
-
Takes the same arguments as [`validates_format_of`](http://api.rubyonrails.org/classes/ActiveRecord/Validations/ClassMethods.html#M001052) except for the `:with` regexp.
|
21
|
-
|
22
|
-
Please note that the regexp used to validate IPs is not perfect, but hopefully good enough. See the test suite. Patches are very welcome.
|
23
|
-
|
24
|
-
## Limitations and design choices
|
25
|
-
|
26
|
-
Does not handle IPv6.
|
27
|
-
|
28
|
-
By design, the plugin does not allow RFC 1918 IPv4 addresses, e.g., 10.0.0.0, 172.16.0.0, 192.168.0.0, from being input. Also, prevents 127.0.0.1 and 0.0.0.0.
|
29
|
-
|
30
|
-
## Credits and license
|
31
|
-
|
32
|
-
Based on my contributions made to `validates_url_format_of` written by [Henrik Nyh](https://github.com/henrik/validates_url_format_of), which is also released under the MIT license.
|
33
|
-
|
34
|
-
By [Ryan Lovelett](http://www.wahvee.com/) under the MIT license:
|
35
|
-
|
36
|
-
> Copyright (c) 2011 Ryan Lovelett
|
37
|
-
>
|
38
|
-
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
39
|
-
> of this software and associated documentation files (the "Software"), to deal
|
40
|
-
> in the Software without restriction, including without limitation the rights
|
41
|
-
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
42
|
-
> copies of the Software, and to permit persons to whom the Software is
|
43
|
-
> furnished to do so, subject to the following conditions:
|
44
|
-
>
|
45
|
-
> The above copyright notice and this permission notice shall be included in
|
46
|
-
> all copies or substantial portions of the Software.
|
47
|
-
>
|
48
|
-
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
49
|
-
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
50
|
-
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
51
|
-
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
52
|
-
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
53
|
-
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
54
|
-
> THE SOFTWARE.
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
1.0.2
|