smart_field_constraints 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +4 -0
- data/LICENSE +1 -1
- data/Rakefile +17 -15
- data/test/app_root/config/environment.rb +1 -0
- data/test/unit/validations_test.rb +3 -3
- metadata +14 -26
data/CHANGELOG.rdoc
CHANGED
data/LICENSE
CHANGED
data/Rakefile
CHANGED
@@ -1,13 +1,15 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
1
3
|
require 'rake/testtask'
|
2
4
|
require 'rake/rdoctask'
|
3
5
|
require 'rake/gempackagetask'
|
4
|
-
require 'rake/contrib/sshpublisher'
|
5
6
|
|
6
7
|
spec = Gem::Specification.new do |s|
|
7
8
|
s.name = 'smart_field_constraints'
|
8
|
-
s.version = '0.1.
|
9
|
+
s.version = '0.1.2'
|
9
10
|
s.platform = Gem::Platform::RUBY
|
10
11
|
s.summary = 'Intelligently applies a maxlength attribute for text fields based on column constraints and validations'
|
12
|
+
s.description = s.summary
|
11
13
|
|
12
14
|
s.files = FileList['{lib,test}/**/*'] + %w(CHANGELOG.rdoc init.rb LICENSE Rakefile README.rdoc) - FileList['test/app_root/{log,log/*,script,script/*}']
|
13
15
|
s.require_path = 'lib'
|
@@ -52,20 +54,27 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
|
|
52
54
|
rdoc.options << '--line-numbers' << '--inline-source'
|
53
55
|
rdoc.rdoc_files.include('README.rdoc', 'CHANGELOG.rdoc', 'LICENSE', 'lib/**/*.rb')
|
54
56
|
end
|
55
|
-
|
57
|
+
|
58
|
+
desc 'Generate a gemspec file.'
|
59
|
+
task :gemspec do
|
60
|
+
File.open("#{spec.name}.gemspec", 'w') do |f|
|
61
|
+
f.write spec.to_ruby
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
56
65
|
Rake::GemPackageTask.new(spec) do |p|
|
57
66
|
p.gem_spec = spec
|
58
|
-
p.need_tar = true
|
59
|
-
p.need_zip = true
|
60
67
|
end
|
61
68
|
|
62
69
|
desc 'Publish the beta gem.'
|
63
70
|
task :pgem => [:package] do
|
71
|
+
require 'rake/contrib/sshpublisher'
|
64
72
|
Rake::SshFilePublisher.new('aaron@pluginaweek.org', '/home/aaron/gems.pluginaweek.org/public/gems', 'pkg', "#{spec.name}-#{spec.version}.gem").upload
|
65
73
|
end
|
66
74
|
|
67
75
|
desc 'Publish the API documentation.'
|
68
76
|
task :pdoc => [:rdoc] do
|
77
|
+
require 'rake/contrib/sshpublisher'
|
69
78
|
Rake::SshDirPublisher.new('aaron@pluginaweek.org', "/home/aaron/api.pluginaweek.org/public/#{spec.name}", 'rdoc').upload
|
70
79
|
end
|
71
80
|
|
@@ -74,15 +83,8 @@ task :publish => [:pgem, :pdoc, :release]
|
|
74
83
|
|
75
84
|
desc 'Publish the release files to RubyForge.'
|
76
85
|
task :release => [:gem, :package] do
|
77
|
-
require '
|
78
|
-
|
79
|
-
ruby_forge = RubyForge.new.configure
|
80
|
-
ruby_forge.login
|
86
|
+
require 'rake/gemcutter'
|
81
87
|
|
82
|
-
|
83
|
-
|
84
|
-
puts "Releasing #{File.basename(file)}..."
|
85
|
-
|
86
|
-
ruby_forge.add_release(spec.rubyforge_project, spec.name, spec.version, file)
|
87
|
-
end
|
88
|
+
Rake::Gemcutter::Tasks.new(spec)
|
89
|
+
Rake::Task['gem:push'].invoke
|
88
90
|
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
2
2
|
|
3
|
-
class ModelWithoutLengthValidationsTest <
|
3
|
+
class ModelWithoutLengthValidationsTest < ActiveSupport::TestCase
|
4
4
|
def test_should_not_have_any_constraints
|
5
5
|
assert User.smart_length_constraints.empty?
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
9
|
-
class ModelWithLengthValidationsTest <
|
9
|
+
class ModelWithLengthValidationsTest < ActiveSupport::TestCase
|
10
10
|
def test_should_not_track_constraint_for_minimum
|
11
11
|
User.validates_length_of :name, :minimum => 1
|
12
12
|
assert_nil User.smart_length_constraints['name']
|
@@ -43,7 +43,7 @@ class ModelWithLengthValidationsTest < Test::Unit::TestCase
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
-
class ModelWithSizeValidationsTest <
|
46
|
+
class ModelWithSizeValidationsTest < ActiveSupport::TestCase
|
47
47
|
def test_should_track_constraints
|
48
48
|
User.validates_size_of :name, :maximum => 10
|
49
49
|
assert_equal 10, User.smart_length_constraints['name']
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smart_field_constraints
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Pfeifer
|
@@ -9,11 +9,11 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2010-03-07 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
16
|
-
description:
|
16
|
+
description: Intelligently applies a maxlength attribute for text fields based on column constraints and validations
|
17
17
|
email: aaron@pluginaweek.org
|
18
18
|
executables: []
|
19
19
|
|
@@ -22,32 +22,18 @@ extensions: []
|
|
22
22
|
extra_rdoc_files: []
|
23
23
|
|
24
24
|
files:
|
25
|
-
- lib/smart_field_constraints
|
26
|
-
- lib/smart_field_constraints/extensions
|
25
|
+
- lib/smart_field_constraints.rb
|
27
26
|
- lib/smart_field_constraints/extensions/form_helper.rb
|
28
27
|
- lib/smart_field_constraints/extensions/validations.rb
|
29
|
-
- lib/smart_field_constraints.rb
|
30
|
-
- test/test_helper.rb
|
31
|
-
- test/unit
|
32
28
|
- test/unit/validations_test.rb
|
33
|
-
- test/helpers
|
34
|
-
- test/helpers/form_helper_test.rb
|
35
|
-
- test/app_root
|
36
|
-
- test/app_root/db
|
37
|
-
- test/app_root/db/migrate
|
38
|
-
- test/app_root/db/migrate/001_create_users.rb
|
39
|
-
- test/app_root/db/migrate/002_create_tags.rb
|
40
|
-
- test/app_root/config
|
41
|
-
- test/app_root/config/environment.rb
|
42
|
-
- test/app_root/vendor
|
43
|
-
- test/app_root/vendor/plugins
|
44
|
-
- test/app_root/vendor/plugins/tags
|
45
|
-
- test/app_root/vendor/plugins/tags/lib
|
46
|
-
- test/app_root/vendor/plugins/tags/lib/tag.rb
|
47
29
|
- test/app_root/vendor/plugins/tags/init.rb
|
48
|
-
- test/app_root/
|
49
|
-
- test/app_root/
|
30
|
+
- test/app_root/vendor/plugins/tags/lib/tag.rb
|
31
|
+
- test/app_root/db/migrate/002_create_tags.rb
|
32
|
+
- test/app_root/db/migrate/001_create_users.rb
|
50
33
|
- test/app_root/app/models/user.rb
|
34
|
+
- test/app_root/config/environment.rb
|
35
|
+
- test/test_helper.rb
|
36
|
+
- test/helpers/form_helper_test.rb
|
51
37
|
- CHANGELOG.rdoc
|
52
38
|
- init.rb
|
53
39
|
- LICENSE
|
@@ -55,6 +41,8 @@ files:
|
|
55
41
|
- README.rdoc
|
56
42
|
has_rdoc: true
|
57
43
|
homepage: http://www.pluginaweek.org
|
44
|
+
licenses: []
|
45
|
+
|
58
46
|
post_install_message:
|
59
47
|
rdoc_options: []
|
60
48
|
|
@@ -75,9 +63,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
63
|
requirements: []
|
76
64
|
|
77
65
|
rubyforge_project: pluginaweek
|
78
|
-
rubygems_version: 1.
|
66
|
+
rubygems_version: 1.3.5
|
79
67
|
signing_key:
|
80
|
-
specification_version:
|
68
|
+
specification_version: 3
|
81
69
|
summary: Intelligently applies a maxlength attribute for text fields based on column constraints and validations
|
82
70
|
test_files:
|
83
71
|
- test/unit/validations_test.rb
|