simple_validation 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/CHANGELOG.md +11 -3
- data/LICENSE +1 -1
- data/README.md +13 -1
- data/lib/simple_validation.rb +2 -2
- data/lib/simple_validation/version.rb +2 -2
- data/spec/simple_validation_spec.rb +3 -3
- data/spec/spec_helper.rb +10 -1
- metadata +43 -32
- data/.gitignore +0 -1
- data/Gemfile +0 -4
- data/Rakefile +0 -7
- data/simple_validation.gemspec +0 -25
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
YmJkZGM2N2M1MzI2OTA1YzNkYTEyNjlkYTg2YTU3OTg4ZTNkMTM1NQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
YzQwOTJmZDZlMDZlMDMwOTZkNWRmZmFlNmI1MTM2NTY2YjFmNjIyZg==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
M2QzMzU5NDE0ODc1NGNkYzNmNDkyZWI1YTNiZDBhMzUxMTNiYmZjNGUyNTQ3
|
10
|
+
MjViZTk3MTAyNzRmNTI3NWZjYTIzMjZlMzNmNDc3NDQ2Y2Q5MWZjNmI3NzNh
|
11
|
+
NTM3MGEyM2RhOWIwNWRiM2IwM2E4Yzc3YThhZjIwODUxNjc3YWY=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NTMwMmMzYTAyZjAwMjg0OTNjNjE0MDFlNTczMmNjYWUxNDZlZTZhMDAxOWRl
|
14
|
+
M2NiMTcwMGM5MjgxZjQzNmVlMDc3MjM4NzgwNmZiZjlkMzQ4ZDQ5YjMzODFh
|
15
|
+
ZWQ3NzA3YzBhMTMwNDEwYzM5MWJiMGE0MTAwNTdkMDZhYjE5NzM=
|
data/CHANGELOG.md
CHANGED
@@ -1,15 +1,23 @@
|
|
1
|
+
v0.1.6
|
2
|
+
------
|
3
|
+
|
4
|
+
* Compatible with ruby 1.8
|
5
|
+
* Continuous build with travis
|
6
|
+
* Generate coverage report
|
7
|
+
* Ensure the gem code passes tests without warning
|
8
|
+
|
1
9
|
v0.1.5
|
2
|
-
|
10
|
+
------
|
3
11
|
|
4
12
|
* Don't duplicate errors
|
5
13
|
|
6
14
|
v0.1.4
|
7
|
-
|
15
|
+
------
|
8
16
|
|
9
17
|
* Support conditional validations
|
10
18
|
|
11
19
|
v0.1.3
|
12
|
-
|
20
|
+
------
|
13
21
|
|
14
22
|
* Don't run validations if the object is already validated
|
15
23
|
* #errors validates the object
|
data/LICENSE
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c)
|
1
|
+
Copyright (c) 2012-2013 Chirantan Mitra
|
2
2
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
4
4
|
|
data/README.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
[![Build Status](https://secure.travis-ci.org/chiku/simple_validation.png?branch=master)](https://travis-ci.org/chiku/simple_validation)
|
2
|
+
[![Code Climate](https://codeclimate.com/github/chiku/simple_validation.png)](https://codeclimate.com/github/chiku/simple_validation)
|
3
|
+
|
1
4
|
Overview
|
2
5
|
--------
|
3
6
|
|
@@ -76,7 +79,16 @@ another_invalid_number.value # 17
|
|
76
79
|
Running tests
|
77
80
|
-------------
|
78
81
|
|
79
|
-
Clone the repository and run
|
82
|
+
Clone the repository and run `rake` from the root directory.
|
83
|
+
|
84
|
+
Contributing
|
85
|
+
------------
|
86
|
+
|
87
|
+
* Fork the project.
|
88
|
+
* Make your feature addition or bug fix.
|
89
|
+
* Add tests for it. This is important so I don't break it in a future version unintentionally.
|
90
|
+
* Commit, but do not mess with the VERSION. If you want to have your own version, that is fine but bump the version in a commit by itself in another branch so I can ignore it when I pull.
|
91
|
+
* Send me a pull request.
|
80
92
|
|
81
93
|
License
|
82
94
|
-------
|
data/lib/simple_validation.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# simple_validation.rb
|
2
2
|
#
|
3
3
|
# Created by Chirantan Mitra on 2012-11-20
|
4
|
-
# Copyright 2012.
|
4
|
+
# Copyright 2012-2013. All rights reserved
|
5
5
|
#
|
6
6
|
# See LICENSE for license
|
7
7
|
#
|
@@ -79,7 +79,7 @@ module SimpleValidation
|
|
79
79
|
|
80
80
|
# Run all validations associated with the object
|
81
81
|
def validate # :nodoc:
|
82
|
-
unless @validated
|
82
|
+
unless @validated ||= false
|
83
83
|
@validated = true
|
84
84
|
self.class.validation_methods.each do |method_name, conditions|
|
85
85
|
send method_name if conditions.all? { |condition| send condition }
|
@@ -1,13 +1,13 @@
|
|
1
1
|
# simple_validation_spec.rb
|
2
2
|
#
|
3
3
|
# Created by Chirantan Mitra on 2012-11-20
|
4
|
-
# Copyright 2012.
|
4
|
+
# Copyright 2012-2013. All rights reserved
|
5
5
|
#
|
6
6
|
# See LICENSE for license
|
7
7
|
|
8
|
-
|
8
|
+
require File.expand_path("spec_helper", File.dirname(__FILE__))
|
9
9
|
|
10
|
-
|
10
|
+
require File.expand_path("../lib/simple_validation", File.dirname(__FILE__))
|
11
11
|
|
12
12
|
class TestEntity
|
13
13
|
include SimpleValidation
|
data/spec/spec_helper.rb
CHANGED
@@ -1,9 +1,18 @@
|
|
1
1
|
# spec_helper.rb
|
2
2
|
#
|
3
3
|
# Created by Chirantan Mitra on 2012-11-20
|
4
|
-
# Copyright 2012.
|
4
|
+
# Copyright 2012-2013. All rights reserved
|
5
5
|
#
|
6
6
|
# See LICENSE for license
|
7
7
|
|
8
|
+
begin
|
9
|
+
require 'simplecov'
|
10
|
+
SimpleCov.start do
|
11
|
+
add_filter "/spec|test|vendor/"
|
12
|
+
end
|
13
|
+
rescue LoadError
|
14
|
+
puts "\nPlease install simplecov to generate coverage report!\n\n"
|
15
|
+
end
|
16
|
+
|
8
17
|
require "minitest/autorun"
|
9
18
|
require "minitest/spec"
|
metadata
CHANGED
@@ -1,20 +1,32 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_validation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.6
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Chirantan Mitra
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2013-11-10 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ! '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ! '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
14
27
|
- !ruby/object:Gem::Dependency
|
15
28
|
name: minitest
|
16
29
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
30
|
requirements:
|
19
31
|
- - ! '>='
|
20
32
|
- !ruby/object:Gem::Version
|
@@ -22,7 +34,20 @@ dependencies:
|
|
22
34
|
type: :development
|
23
35
|
prerelease: false
|
24
36
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: simplecov
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
51
|
requirements:
|
27
52
|
- - ! '>='
|
28
53
|
- !ruby/object:Gem::Version
|
@@ -37,51 +62,37 @@ executables: []
|
|
37
62
|
extensions: []
|
38
63
|
extra_rdoc_files: []
|
39
64
|
files:
|
40
|
-
-
|
41
|
-
|
42
|
-
-
|
43
|
-
|
44
|
-
-
|
45
|
-
|
46
|
-
-
|
47
|
-
TElDRU5TRQ==
|
48
|
-
- !binary |-
|
49
|
-
UkVBRE1FLm1k
|
50
|
-
- !binary |-
|
51
|
-
UmFrZWZpbGU=
|
52
|
-
- !binary |-
|
53
|
-
bGliL3NpbXBsZV92YWxpZGF0aW9uLnJi
|
54
|
-
- !binary |-
|
55
|
-
bGliL3NpbXBsZV92YWxpZGF0aW9uL3ZlcnNpb24ucmI=
|
56
|
-
- !binary |-
|
57
|
-
c2ltcGxlX3ZhbGlkYXRpb24uZ2Vtc3BlYw==
|
58
|
-
- !binary |-
|
59
|
-
c3BlYy9zaW1wbGVfdmFsaWRhdGlvbl9zcGVjLnJi
|
60
|
-
- !binary |-
|
61
|
-
c3BlYy9zcGVjX2hlbHBlci5yYg==
|
65
|
+
- lib/simple_validation/version.rb
|
66
|
+
- lib/simple_validation.rb
|
67
|
+
- LICENSE
|
68
|
+
- README.md
|
69
|
+
- CHANGELOG.md
|
70
|
+
- spec/simple_validation_spec.rb
|
71
|
+
- spec/spec_helper.rb
|
62
72
|
homepage: https://github.com/chiku/simple_validation
|
63
73
|
licenses:
|
64
74
|
- MIT
|
75
|
+
metadata: {}
|
65
76
|
post_install_message:
|
66
77
|
rdoc_options: []
|
67
78
|
require_paths:
|
68
79
|
- lib
|
69
80
|
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
-
none: false
|
71
81
|
requirements:
|
72
82
|
- - ! '>='
|
73
83
|
- !ruby/object:Gem::Version
|
74
84
|
version: '0'
|
75
85
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
|
-
none: false
|
77
86
|
requirements:
|
78
87
|
- - ! '>='
|
79
88
|
- !ruby/object:Gem::Version
|
80
89
|
version: '0'
|
81
90
|
requirements: []
|
82
91
|
rubyforge_project: simple_validation
|
83
|
-
rubygems_version: 1.
|
92
|
+
rubygems_version: 2.1.10
|
84
93
|
signing_key:
|
85
|
-
specification_version:
|
94
|
+
specification_version: 4
|
86
95
|
summary: Validations for a ruby object
|
87
|
-
test_files:
|
96
|
+
test_files:
|
97
|
+
- spec/simple_validation_spec.rb
|
98
|
+
- spec/spec_helper.rb
|
data/.gitignore
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
simple_validation-*.gem
|
data/Gemfile
DELETED
data/Rakefile
DELETED
data/simple_validation.gemspec
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
|
-
$:.push File.expand_path("../lib", __FILE__)
|
4
|
-
|
5
|
-
require "simple_validation/version"
|
6
|
-
|
7
|
-
Gem::Specification.new do |s|
|
8
|
-
s.name = "simple_validation"
|
9
|
-
s.version = SimpleValidation::VERSION
|
10
|
-
s.authors = ["Chirantan Mitra"]
|
11
|
-
s.email = ["chirantan.mitra@gmail.com"]
|
12
|
-
s.homepage = "https://github.com/chiku/simple_validation"
|
13
|
-
s.summary = "Validations for a ruby object"
|
14
|
-
s.description = <<-EOS
|
15
|
-
A simple way to validate custom ruby objects using validation defined in the class.
|
16
|
-
EOS
|
17
|
-
s.license = "MIT"
|
18
|
-
s.rubyforge_project = "simple_validation"
|
19
|
-
s.files = `git ls-files`.split("\n")
|
20
|
-
s.test_files = `git ls-files -- {test}/*`.split("\n")
|
21
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
22
|
-
s.require_paths = ["lib"]
|
23
|
-
|
24
|
-
s.add_development_dependency "minitest"
|
25
|
-
end
|