validates_im 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/.gitignore ADDED
@@ -0,0 +1,25 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+ .rvmrc
21
+ .bundle
22
+
23
+ ## PROJECT::DOCUMENTATION
24
+ .yardoc
25
+ doc
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ -cfs
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source :rubygems
2
+
3
+ # DEPENDENCIES
4
+ gem 'activerecord', require: 'active_record'
5
+
6
+ # DEVELOPMENT
7
+ gem 'jeweler'
8
+ gem 'yard'
9
+ gem 'RedCloth', require: 'redcloth'
10
+
11
+ # TEST
12
+ gem 'rspec'
data/Gemfile.lock ADDED
@@ -0,0 +1,50 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ RedCloth (4.2.3)
5
+ activemodel (3.0.1)
6
+ activesupport (= 3.0.1)
7
+ builder (~> 2.1.2)
8
+ i18n (~> 0.4.1)
9
+ activerecord (3.0.1)
10
+ activemodel (= 3.0.1)
11
+ activesupport (= 3.0.1)
12
+ arel (~> 1.0.0)
13
+ tzinfo (~> 0.3.23)
14
+ activesupport (3.0.1)
15
+ arel (1.0.1)
16
+ activesupport (~> 3.0.0)
17
+ builder (2.1.2)
18
+ diff-lcs (1.1.2)
19
+ gemcutter (0.6.1)
20
+ git (1.2.5)
21
+ i18n (0.4.2)
22
+ jeweler (1.4.0)
23
+ gemcutter (>= 0.1.0)
24
+ git (>= 1.2.5)
25
+ rubyforge (>= 2.0.0)
26
+ json_pure (1.4.6)
27
+ rspec (2.0.1)
28
+ rspec-core (~> 2.0.1)
29
+ rspec-expectations (~> 2.0.1)
30
+ rspec-mocks (~> 2.0.1)
31
+ rspec-core (2.0.1)
32
+ rspec-expectations (2.0.1)
33
+ diff-lcs (>= 1.1.2)
34
+ rspec-mocks (2.0.1)
35
+ rspec-core (~> 2.0.1)
36
+ rspec-expectations (~> 2.0.1)
37
+ rubyforge (2.0.4)
38
+ json_pure (>= 1.1.7)
39
+ tzinfo (0.3.23)
40
+ yard (0.6.1)
41
+
42
+ PLATFORMS
43
+ ruby
44
+
45
+ DEPENDENCIES
46
+ RedCloth
47
+ activerecord
48
+ jeweler
49
+ rspec
50
+ yard
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Tim Morgan
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.textile ADDED
@@ -0,0 +1,40 @@
1
+ h1. validates_im -- Instant messenger account validations for ActiveRecord
2
+
3
+ | *Author* | Tim Morgan |
4
+ | *Version* | 1.0 (Oct 30, 2010) |
5
+ | *License* | Released under the MIT license. |
6
+
7
+ h2. About
8
+
9
+ @validates_im@ is a simple gem that gives you some @EachValidators@ that you can
10
+ use to validate instant messenger account names in your Rails 3.0 application.
11
+ Validators are provided for the most common IM services, like AIM, Yahoo! IM,
12
+ and Skype.
13
+
14
+ h2. Installation
15
+
16
+ *Important Note:* This gem is for Rails 3 only.
17
+
18
+ To install, simply add this gem to your Rails project's @Gemfile@:
19
+
20
+ <pre><code>
21
+ gem 'validates_im'
22
+ </code></pre>
23
+
24
+ h2. Usage
25
+
26
+ The IM validators are @EachValidators@, meant to be used with the @validates@
27
+ method. An example:
28
+
29
+ <pre><code>
30
+ validates :screen_name,
31
+ aim: true,
32
+ presence: true
33
+ </code></pre>
34
+
35
+ The name of the symbol key is taken from the name of the validator; as such, The
36
+ @XboxLiveValidator@ would be invoked using @:xbox_live@. See the
37
+ {AccountNameValidator} class docs for more information.
38
+
39
+ The localization keys for validation errors are listed in the documentation for
40
+ each validator class.
data/Rakefile ADDED
@@ -0,0 +1,35 @@
1
+ require 'rake'
2
+ begin
3
+ require 'bundler'
4
+ rescue LoadError
5
+ puts "Bundler is not installed; install with `gem install bundler`."
6
+ exit 1
7
+ end
8
+
9
+ Bundler.require :default
10
+
11
+ Jeweler::Tasks.new do |gem|
12
+ gem.name = "validates_im"
13
+ gem.summary = %Q{A set of Rails validators for common instant messenging services}
14
+ gem.description = %Q{Adds ActiveModel validators for common instant messenging services like Skype and AIM.}
15
+ gem.email = "git@timothymorgan.info"
16
+ gem.homepage = "http://github.com/riscfuture/validates_im"
17
+ gem.authors = [ "Tim Morgan" ]
18
+ gem.add_dependency 'activerecord', '>= 3.0'
19
+ end
20
+ Jeweler::GemcutterTasks.new
21
+
22
+ require 'rspec/core/rake_task'
23
+ RSpec::Core::RakeTask.new
24
+
25
+ YARD::Rake::YardocTask.new('doc') do |doc|
26
+ doc.options << "-m" << "textile"
27
+ doc.options << "--protected"
28
+ doc.options << "-r" << "README.textile"
29
+ doc.options << "-o" << "doc"
30
+ doc.options << "--title" << "validates_im Documentation".inspect
31
+
32
+ doc.files = [ 'lib/*_validator.rb', 'README.textile' ]
33
+ end
34
+
35
+ task(default: :spec)
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.0
@@ -0,0 +1,137 @@
1
+ # Generic @EachValidator@ that validates account names on various communication
2
+ # services such as Skype, Yahoo!, etc. This class provides a simple DSL for
3
+ # describing valid account names on these sites, performing all validation for
4
+ # you.
5
+ #
6
+ # Subclass this class and use the provided DSL to describe account names on a
7
+ # given site. An example for a fictional service called Talkalot:
8
+ #
9
+ # <pre><code>
10
+ # class TalkalotValidator < AccountNameValidator
11
+ # min_length 5
12
+ # max_length 64
13
+ # valid_chars "A-Z0-9_"
14
+ # end
15
+ # </code></pre>
16
+ #
17
+ # With your validator defined you can now use it in your Active Record models
18
+ # like any other @EachValidator@:
19
+ #
20
+ # <pre><code>
21
+ # validates :talkalot_id,
22
+ # talkalot: true
23
+ # </code></pre>
24
+ #
25
+ # This class automatically handles the following options passed to the
26
+ # @validates@ method:
27
+ #
28
+ # | @:allow_nil@ | Allows @nil@ values. |
29
+ # | @:message@ | Provide a custom error message. |
30
+ #
31
+ # Error messages generated by this class are stored in the translation table.
32
+ # The localization keys used are generated by the
33
+ # @ActiveModel::Errors#generate_message@ method (see its documentation for more
34
+ # information). The lastmost element of the localization key is the error
35
+ # message key. The error message key is a combination of a validator subclass's
36
+ # {.error_key_prefix} and the error key suffix for a given constraint.
37
+ #
38
+ # By default the error key prefix is the underscored
39
+ #
40
+ # As an example, for the @TalkalotValidator@ example above, the error message
41
+ # key used in the event that a two-letter account name is given would be
42
+ # @:talkalot_too_short@. If you wanted to override the prefix, you could do:
43
+ #
44
+ # <pre><code>
45
+ # class TalkalotValidator < AccountNameValidator
46
+ # error_key_prefix :talky
47
+ # end
48
+ # </code></pre>
49
+ #
50
+ # In this case the error message key for a two-letter account name would be
51
+ # @:talky_too_short@. (You'd do this if Talkalot accounts were called "talkies,"
52
+ # for example.)
53
+ #
54
+ # @abstract Subclass this validator to perform your specific account name
55
+ # validations.
56
+
57
+ class AccountNameValidator < ActiveModel::EachValidator
58
+ class_inheritable_array :validations
59
+ self.validations = Array.new
60
+
61
+ # @private
62
+ def validate_each(record, attribute, value)
63
+ return if options[:allow_nil] and value.nil?
64
+ return if options[:allow_blank] and value.blank?
65
+ return unless self.class.validations
66
+ self.class.validations.each { |block, key| record.errors.add(attribute, options[:message] || record.errors.generate_message(attribute, :"#{self.class.error_key_prefix}_#{key}")) if !block[value.to_s] }
67
+ end
68
+
69
+ protected
70
+
71
+ # @overload error_key_prefix
72
+ # Returns the prefix for error message keys used by this class.
73
+ # @return [Symbol] The error message key prefix.
74
+ #
75
+ # @overload error_key_prefix(value)
76
+ # Sets the error message key prefix this class uses.
77
+ # @param [Symbol] value The new error message key prefix.
78
+
79
+ def self.error_key_prefix(value=nil)
80
+ if value then
81
+ @error_key_prefix = value
82
+ else
83
+ return @error_key_prefix || to_s.demodulize.sub(/Validator$/, '').underscore.to_sym
84
+ end
85
+ end
86
+
87
+ # Describes a custom restraint on account names.
88
+ #
89
+ # @param [Symbol] key The error message key suffix to use.
90
+ # @yield [value] The custom validation.
91
+ # @yieldparam [String] value The value to validate. This will have been
92
+ # coerced into a @String@.
93
+ # @yieldreturn [true, false] Whether or not the validation succeeded.
94
+
95
+ def self.add_validation(key, &block)
96
+ return unless block_given?
97
+ self.validations << [ block, key ]
98
+ end
99
+
100
+ # Enforces a minimum length on account names. Uses the "too_short" error
101
+ # message key suffix.
102
+ #
103
+ # @param [Fixnum] num The minimum number of characters.
104
+
105
+ def self.min_length(num)
106
+ add_validation(:too_short) { |value| value.length >= num }
107
+ end
108
+
109
+ # Enforces a maximum length on account names. Uses the "too_long" error
110
+ # message key suffix.
111
+ #
112
+ # @param [Fixnum] num The maximum number of characters.
113
+
114
+ def self.max_length(num)
115
+ add_validation(:too_long) { |value| value.length <= num }
116
+ end
117
+
118
+ # Enforces a valid set of characters. Uses the "invalid_chars" error message
119
+ # key suffix.
120
+ #
121
+ # @param [String] charlist A set of valid characters, in regex character class
122
+ # format (e.g., "[A-Z0-9_]").
123
+
124
+ def self.valid_chars(charlist)
125
+ add_validation(:invalid_chars) { |value| value =~ /^[#{charlist}]+$/ }
126
+ end
127
+
128
+ # Enforces a valid set of characters for the first character of the account
129
+ # name. Uses the "invalid_first_char" error message key suffix.
130
+ #
131
+ # @param [String] charlist A set of valid characters, in regex character class
132
+ # format (e.g., "[A-Z0-9_]").
133
+
134
+ def self.first_char(charlist)
135
+ add_validation(:invalid_first_char) { |value| value[0] =~ /^[#{charlist}]$/ }
136
+ end
137
+ end
@@ -0,0 +1,25 @@
1
+ # Validates AOL Instant Messenger screen names. According to the AOL website:
2
+ #
3
+ # bq. 3-16 letters or numbers. It must start with a letter.
4
+ #
5
+ # The following error message keys are used to localize invalid screen names:
6
+ #
7
+ # | @aim_too_short@ | Screen name is less than 3 characters. |
8
+ # | @aim_too_long@ | Screen name is over 16 characters. |
9
+ # | @aim_invalid_chars@ | Screen name contains invalid characters. |
10
+ # | @aim_invalid_first_char@ | Screen name doesn't start with a letter. |
11
+ #
12
+ # @example
13
+ # validates :aim_screen_name, aim: true
14
+ #
15
+ # h2. Options
16
+ #
17
+ # | @:message@ | A custom message to use if the email is invalid. |
18
+ # | @:allow_nil@ | If true, @nil@ values are allowed. |
19
+
20
+ class AimValidator < AccountNameValidator
21
+ min_length 3
22
+ max_length 16
23
+ valid_chars 'A-Za-z0-9'
24
+ first_char 'A-Za-z'
25
+ end
@@ -0,0 +1,26 @@
1
+ # Validates Skype screen names. From the Skype website:
2
+ #
3
+ # bq. It must be between 6-32 characters, start with a letter and contain only
4
+ # letters and numbers (no spaces or special characters).
5
+ #
6
+ # The following error message keys are used to localize invalid screen names.
7
+ #
8
+ # | @skype_too_short@ | Skype name is less than 6 characters. |
9
+ # | @skype_too_long@ | Skype name is over 32 characters. |
10
+ # | @skype_invalid_chars@ | Skype name contains invalid characters. |
11
+ # | @skype_invalid_first_char@ | Skype name doesn't start with a letter. |
12
+ #
13
+ # @example
14
+ # validates :skype_name, skype: true
15
+ #
16
+ # h2. Options
17
+ #
18
+ # | @:message@ | A custom message to use if the email is invalid. |
19
+ # | @:allow_nil@ | If true, @nil@ values are allowed. |
20
+
21
+ class SkypeValidator < AccountNameValidator
22
+ min_length 6
23
+ max_length 32
24
+ valid_chars 'A-Za-z0-9'
25
+ first_char 'A-Za-z'
26
+ end
@@ -0,0 +1,18 @@
1
+ # Validates steam account IDs. Steam IDs are between 3 and 63 characters long
2
+ # and consist of letters, numbers, or underscores.
3
+ #
4
+ # The following error message keys are used to localize invalid screen names.
5
+ #
6
+ # | @steam_too_short@ | Steam ID is less than 6 characters. |
7
+ # | @steam_too_long@ | Steam ID is over 32 characters. |
8
+ # | @steam_invalid_chars@ | Steam ID contains invalid characters. |
9
+ # | @steam_invalid_first_char@ | Steam ID doesn't start with a letter. |
10
+ #
11
+ # @example
12
+ # validates :steam_id, steam: true
13
+
14
+ class SteamValidator < AccountNameValidator
15
+ min_length 3
16
+ max_length 63
17
+ valid_chars 'A-Za-z0-9_'
18
+ end
@@ -0,0 +1,7 @@
1
+ require 'account_name_validator'
2
+ require 'aim_validator'
3
+ require 'skype_validator'
4
+ require 'steam_validator'
5
+ require 'validates_im'
6
+ require 'xbox_live_validator'
7
+ require 'yahoo_im_validator'
@@ -0,0 +1,23 @@
1
+ # Validates Xbox Live gamertags. From the Xbox Live website:
2
+ #
3
+ # bq. Gamertags can only contain letters, numbers, and spaces, and can't begin
4
+ # with a number.
5
+ #
6
+ # In addition we discovered that they have no minimum length but are no more
7
+ # than 15 characters, and also cannot start with a space.
8
+ #
9
+ # The following error message keys are used to localize invalid screen names.
10
+ #
11
+ # | @xbox_too_long@ | Gamertag is over 15 characters. |
12
+ # | @xbox_invalid_chars@ | Gamertag contains invalid characters. |
13
+ # | @xbox_invalid_first_char@ | Gamertag doesn't start with a letter. |
14
+ #
15
+ # @example
16
+ # validates :steam_account, steam: true
17
+
18
+ class XboxLiveValidator < AccountNameValidator
19
+ error_key_prefix 'xbox'
20
+ max_length 15
21
+ valid_chars 'A-Za-z0-9 '
22
+ first_char 'A-Za-z'
23
+ end
@@ -0,0 +1,30 @@
1
+ # Validates Yahoo! Instant Messenger screen names. According to the Yahoo!
2
+ # website:
3
+ #
4
+ # bq. Use 4 to 32 characters and start with a letter. You may use letters,
5
+ # numbers, underscores, and one dot (.).
6
+ #
7
+ # The following error message keys are used to localize invalid screen names:
8
+ #
9
+ # | @yim_too_short@ | Screen name is less than 3 characters. |
10
+ # | @yim_too_long@ | Screen name is over 16 characters. |
11
+ # | @yim_invalid_chars@ | Screen name contains invalid characters. |
12
+ # | @yim_invalid_first_char@ | Screen name doesn't start with a letter. |
13
+ # | @yim_multiple_periods@ | Screen name has more than one period in it. |
14
+ #
15
+ # @example
16
+ # validates :yim_sn, yahoo_im: true
17
+ #
18
+ # h2. Options
19
+ #
20
+ # | @:message@ | A custom message to use if the email is invalid. |
21
+ # | @:allow_nil@ | If true, @nil@ values are allowed. |
22
+
23
+ class YahooImValidator < AccountNameValidator
24
+ error_key_prefix 'yim'
25
+ min_length 4
26
+ max_length 32
27
+ valid_chars 'A-Za-z0-9_\\.'
28
+ first_char 'A-Za-z'
29
+ add_validation(:multiple_periods) { |value| value.count('.') < 2 }
30
+ end
@@ -0,0 +1,115 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ module SpecSupport
4
+ class TestAccountNameValidator < AccountNameValidator; end
5
+ class FakeModel
6
+ extend ActiveModel::Translation
7
+ def errors() @errors ||= ActiveModel::Errors.new(self) end
8
+ def self.lookup_ancestors() [ self ] end
9
+ def read_attribute_for_validation(_) "mock" end
10
+ end
11
+ end
12
+
13
+ describe AccountNameValidator do
14
+ before :each do
15
+ SpecSupport::TestAccountNameValidator.validations.clear
16
+ @model = SpecSupport::FakeModel.new
17
+ end
18
+
19
+ describe ".error_key_prefix" do
20
+ it "should be the downcased name of the validator by default" do
21
+ SpecSupport::TestAccountNameValidator.error_key_prefix.should eql(:test_account_name)
22
+ end
23
+
24
+ it "should be able to be set" do
25
+ SpecSupport::TestAccountNameValidator.error_key_prefix(:foo)
26
+ SpecSupport::TestAccountNameValidator.error_key_prefix.should eql(:foo)
27
+ SpecSupport::TestAccountNameValidator.instance_variable_set :@error_key_prefix, nil
28
+ end
29
+ end
30
+
31
+ describe "#validate_each" do
32
+ it "should do nothing if given nil and :allow_nil is set" do
33
+ SpecSupport::TestAccountNameValidator.new(attributes: :field, allow_nil: true).validate_each(@model, :field, nil)
34
+ @model.errors.should be_empty
35
+ end
36
+
37
+ it "should do nothing if given a blank value and :allow_blank is set" do
38
+ SpecSupport::TestAccountNameValidator.new(attributes: :field, allow_blank: true).validate_each(@model, :field, "")
39
+ @model.errors.should be_empty
40
+ end
41
+
42
+ it "should add an error to the record if any validation fails" do
43
+ SpecSupport::TestAccountNameValidator.add_validation(:not_foo) { |value| value == 'foo' }
44
+ SpecSupport::TestAccountNameValidator.new(attributes: :field).validate_each(@model, :field, 'bar')
45
+ @model.errors[:field].should_not be_empty
46
+ @model.errors[:field].first.should include('test_account_name_not_foo')
47
+ end
48
+
49
+ it "should use a :message option for the message" do
50
+ SpecSupport::TestAccountNameValidator.add_validation(:not_foo) { |value| value == 'foo' }
51
+ SpecSupport::TestAccountNameValidator.new(attributes: :field, message: 'bar').validate_each(@model, :field, 'bar')
52
+ @model.errors[:field].should eql([ 'bar' ])
53
+ end
54
+
55
+ it "should typecast the value to a string" do
56
+ SpecSupport::TestAccountNameValidator.add_validation(:not_foo) { |value| value == 'foo' }
57
+ SpecSupport::TestAccountNameValidator.new(attributes: :field).validate_each(@model, :field, :foo)
58
+ @model.errors.should be_empty
59
+ end
60
+ end
61
+
62
+ describe ".add_validation" do
63
+ before :each do
64
+ @validator = SpecSupport::TestAccountNameValidator.new(attributes: :field)
65
+ end
66
+
67
+ it "should add a validation block" do
68
+ SpecSupport::TestAccountNameValidator.add_validation(:not_foo) { |value| value == 'foo' }
69
+ @validator.validate_each(@model, :field, 'bar')
70
+ @model.errors[:field].should_not be_empty
71
+ end
72
+
73
+ it "should do nothing if no block is given" do
74
+ SpecSupport::TestAccountNameValidator.add_validation(:not_foo)
75
+ @validator.validate_each(@model, :field, 'bar')
76
+ @model.errors[:field].should be_empty
77
+ end
78
+ end
79
+
80
+ describe ".min_length" do
81
+ it "should ensure a minimum length" do
82
+ SpecSupport::TestAccountNameValidator.min_length 5
83
+ SpecSupport::TestAccountNameValidator.new(attributes: :field).validate_each(@model, :field, '1234')
84
+ @model.errors[:field].should_not be_empty
85
+ @model.errors[:field].first.should include('too_short')
86
+ end
87
+ end
88
+
89
+ describe ".max_length" do
90
+ it "should ensure a maximum length" do
91
+ SpecSupport::TestAccountNameValidator.max_length 5
92
+ SpecSupport::TestAccountNameValidator.new(attributes: :field).validate_each(@model, :field, '123456')
93
+ @model.errors[:field].should_not be_empty
94
+ @model.errors[:field].first.should include('too_long')
95
+ end
96
+ end
97
+
98
+ describe ".valid_chars" do
99
+ it "should check for invalid chars" do
100
+ SpecSupport::TestAccountNameValidator.valid_chars '[A-Z]'
101
+ SpecSupport::TestAccountNameValidator.new(attributes: :field).validate_each(@model, :field, 'A!Z')
102
+ @model.errors[:field].should_not be_empty
103
+ @model.errors[:field].first.should include('invalid_chars')
104
+ end
105
+ end
106
+
107
+ describe ".first_char" do
108
+ it "should check for an invalid first character" do
109
+ SpecSupport::TestAccountNameValidator.first_char '[A-Z]'
110
+ SpecSupport::TestAccountNameValidator.new(attributes: :field).validate_each(@model, :field, 'abc')
111
+ @model.errors[:field].should_not be_empty
112
+ @model.errors[:field].first.should include('invalid_first_char')
113
+ end
114
+ end
115
+ end
@@ -0,0 +1,10 @@
1
+ Bundler.require :default, :test
2
+
3
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
4
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
5
+
6
+ require 'validates_im'
7
+
8
+ RSpec.configure do |config|
9
+
10
+ end
@@ -0,0 +1,63 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{validates_im}
8
+ s.version = "1.0.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Tim Morgan"]
12
+ s.date = %q{2010-10-30}
13
+ s.description = %q{Adds ActiveModel validators for common instant messenging services like Skype and AIM.}
14
+ s.email = %q{git@timothymorgan.info}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.textile"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".gitignore",
22
+ ".rspec",
23
+ "Gemfile",
24
+ "Gemfile.lock",
25
+ "LICENSE",
26
+ "README.textile",
27
+ "Rakefile",
28
+ "VERSION",
29
+ "lib/account_name_validator.rb",
30
+ "lib/aim_validator.rb",
31
+ "lib/skype_validator.rb",
32
+ "lib/steam_validator.rb",
33
+ "lib/validates_im.rb",
34
+ "lib/xbox_live_validator.rb",
35
+ "lib/yahoo_im_validator.rb",
36
+ "spec/account_name_validator_spec.rb",
37
+ "spec/spec_helper.rb",
38
+ "validates_im.gemspec"
39
+ ]
40
+ s.homepage = %q{http://github.com/riscfuture/validates_im}
41
+ s.rdoc_options = ["--charset=UTF-8"]
42
+ s.require_paths = ["lib"]
43
+ s.rubygems_version = %q{1.3.7}
44
+ s.summary = %q{A set of Rails validators for common instant messenging services}
45
+ s.test_files = [
46
+ "spec/account_name_validator_spec.rb",
47
+ "spec/spec_helper.rb"
48
+ ]
49
+
50
+ if s.respond_to? :specification_version then
51
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
52
+ s.specification_version = 3
53
+
54
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
55
+ s.add_runtime_dependency(%q<activerecord>, [">= 3.0"])
56
+ else
57
+ s.add_dependency(%q<activerecord>, [">= 3.0"])
58
+ end
59
+ else
60
+ s.add_dependency(%q<activerecord>, [">= 3.0"])
61
+ end
62
+ end
63
+
metadata ADDED
@@ -0,0 +1,98 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: validates_im
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 1
7
+ - 0
8
+ - 0
9
+ version: 1.0.0
10
+ platform: ruby
11
+ authors:
12
+ - Tim Morgan
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-10-30 00:00:00 -07:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: activerecord
22
+ requirement: &id001 !ruby/object:Gem::Requirement
23
+ none: false
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 3
29
+ - 0
30
+ version: "3.0"
31
+ type: :runtime
32
+ prerelease: false
33
+ version_requirements: *id001
34
+ description: Adds ActiveModel validators for common instant messenging services like Skype and AIM.
35
+ email: git@timothymorgan.info
36
+ executables: []
37
+
38
+ extensions: []
39
+
40
+ extra_rdoc_files:
41
+ - LICENSE
42
+ - README.textile
43
+ files:
44
+ - .document
45
+ - .gitignore
46
+ - .rspec
47
+ - Gemfile
48
+ - Gemfile.lock
49
+ - LICENSE
50
+ - README.textile
51
+ - Rakefile
52
+ - VERSION
53
+ - lib/account_name_validator.rb
54
+ - lib/aim_validator.rb
55
+ - lib/skype_validator.rb
56
+ - lib/steam_validator.rb
57
+ - lib/validates_im.rb
58
+ - lib/xbox_live_validator.rb
59
+ - lib/yahoo_im_validator.rb
60
+ - spec/account_name_validator_spec.rb
61
+ - spec/spec_helper.rb
62
+ - validates_im.gemspec
63
+ has_rdoc: true
64
+ homepage: http://github.com/riscfuture/validates_im
65
+ licenses: []
66
+
67
+ post_install_message:
68
+ rdoc_options:
69
+ - --charset=UTF-8
70
+ require_paths:
71
+ - lib
72
+ required_ruby_version: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ hash: -3410244154363929374
78
+ segments:
79
+ - 0
80
+ version: "0"
81
+ required_rubygems_version: !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ segments:
87
+ - 0
88
+ version: "0"
89
+ requirements: []
90
+
91
+ rubyforge_project:
92
+ rubygems_version: 1.3.7
93
+ signing_key:
94
+ specification_version: 3
95
+ summary: A set of Rails validators for common instant messenging services
96
+ test_files:
97
+ - spec/account_name_validator_spec.rb
98
+ - spec/spec_helper.rb