dm-validations 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -31,6 +31,7 @@ measurements
31
31
  .bundle
32
32
  Gemfile.local
33
33
  Gemfile.lock
34
+ Gemfile.local.lock
34
35
 
35
36
  ## PROJECT::SPECIFIC
36
37
  spec/db/
data/Gemfile CHANGED
@@ -71,14 +71,14 @@
71
71
  source 'http://rubygems.org'
72
72
 
73
73
  DATAMAPPER = 'git://github.com/datamapper'
74
- DM_VERSION = '~> 1.0.0'
74
+ DM_VERSION = '~> 1.0.1'
75
75
 
76
76
  group :runtime do # Runtime dependencies (as in the gemspec)
77
77
 
78
78
  if ENV['EXTLIB']
79
- gem 'extlib', '~> 0.9.15', :git => "#{DATAMAPPER}/extlib.git"
79
+ gem 'extlib', '~> 0.9.15', :git => "#{DATAMAPPER}/extlib.git"
80
80
  else
81
- gem 'activesupport', '~> 3.0.0.beta3', :git => 'git://github.com/rails/rails.git', :require => nil
81
+ gem 'activesupport', '~> 3.0.0', :git => 'git://github.com/rails/rails.git', :branch => '3-0-stable', :require => nil
82
82
  end
83
83
 
84
84
  gem 'dm-core', DM_VERSION, :git => "#{DATAMAPPER}/dm-core.git"
@@ -90,7 +90,7 @@ group(:development) do # Development dependencies (as in the gemspec)
90
90
  gem 'dm-types', DM_VERSION, :git => "#{DATAMAPPER}/dm-types.git"
91
91
 
92
92
  gem 'rake', '~> 0.8.7'
93
- gem 'rspec', '~> 1.3'
93
+ gem 'rspec', '~> 1.3', :git => 'git://github.com/snusnu/rspec', :branch => 'heckle_fix_plus_gemfile'
94
94
  gem 'jeweler', '~> 1.4'
95
95
 
96
96
  end
@@ -109,32 +109,31 @@ end
109
109
  group :datamapper do # We need this because we want to pin these dependencies to their git master sources
110
110
 
111
111
  adapters = ENV['ADAPTER'] || ENV['ADAPTERS']
112
- adapters = adapters.to_s.gsub(',',' ').split(' ') - ['in_memory']
112
+ adapters = adapters.to_s.tr(',', ' ').split.uniq - %w[ in_memory ]
113
113
 
114
- unless adapters.empty?
114
+ DO_VERSION = '~> 0.10.2'
115
+ DM_DO_ADAPTERS = %w[ sqlite postgres mysql oracle sqlserver ]
115
116
 
116
- DO_VERSION = '~> 0.10.3'
117
- DM_DO_ADAPTERS = %w[sqlite postgres mysql oracle sqlserver]
117
+ if (do_adapters = DM_DO_ADAPTERS & adapters).any?
118
+ options = {}
119
+ options[:git] = "#{DATAMAPPER}/do.git" if ENV['DO_GIT'] == 'true'
118
120
 
119
- gem 'data_objects', DO_VERSION, :git => "#{DATAMAPPER}/do.git"
121
+ gem 'data_objects', DO_VERSION, options.dup
120
122
 
121
- adapters.each do |adapter|
122
- if DM_DO_ADAPTERS.any? { |dm_do_adapter| dm_do_adapter =~ /#{adapter}/ }
123
- adapter = 'sqlite3' if adapter == 'sqlite'
124
- gem "do_#{adapter}", DO_VERSION, :git => "#{DATAMAPPER}/do.git"
125
- end
123
+ do_adapters.each do |adapter|
124
+ adapter = 'sqlite3' if adapter == 'sqlite'
125
+ gem "do_#{adapter}", DO_VERSION, options.dup
126
126
  end
127
127
 
128
128
  gem 'dm-do-adapter', DM_VERSION, :git => "#{DATAMAPPER}/dm-do-adapter.git"
129
+ end
129
130
 
130
- adapters.each do |adapter|
131
- gem "dm-#{adapter}-adapter", DM_VERSION, :git => "#{DATAMAPPER}/dm-#{adapter}-adapter.git"
132
- end
133
-
131
+ adapters.each do |adapter|
132
+ gem "dm-#{adapter}-adapter", DM_VERSION, :git => "#{DATAMAPPER}/dm-#{adapter}-adapter.git"
134
133
  end
135
134
 
136
135
  plugins = ENV['PLUGINS'] || ENV['PLUGIN']
137
- plugins = (plugins.to_s.gsub(',',' ').split(' ') + ['dm-migrations']).uniq
136
+ plugins = plugins.to_s.tr(',', ' ').split.push('dm-migrations').uniq
138
137
 
139
138
  plugins.each do |plugin|
140
139
  gem plugin, DM_VERSION, :git => "#{DATAMAPPER}/#{plugin}.git"
data/Rakefile CHANGED
@@ -15,10 +15,10 @@ begin
15
15
 
16
16
  gem.rubyforge_project = 'datamapper'
17
17
 
18
- gem.add_dependency 'dm-core', '~> 1.0.0'
18
+ gem.add_dependency 'dm-core', '~> 1.0.1'
19
19
 
20
20
  gem.add_development_dependency 'rspec', '~> 1.3'
21
- gem.add_development_dependency 'dm-types', '~> 1.0.0'
21
+ gem.add_development_dependency 'dm-types', '~> 1.0.1'
22
22
  end
23
23
 
24
24
  Jeweler::GemcutterTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.0.1
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{dm-validations}
8
- s.version = "1.0.0"
8
+ s.version = "1.0.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Guy van den Berg"]
12
- s.date = %q{2010-06-08}
12
+ s.date = %q{2010-09-07}
13
13
  s.description = %q{Library for performing validations on DM models and pure Ruby object}
14
14
  s.email = %q{vandenberg.guy [a] gmail [d] com}
15
15
  s.extra_rdoc_files = [
@@ -285,18 +285,18 @@ Gem::Specification.new do |s|
285
285
  s.specification_version = 3
286
286
 
287
287
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
288
- s.add_runtime_dependency(%q<dm-core>, ["~> 1.0.0"])
288
+ s.add_runtime_dependency(%q<dm-core>, ["~> 1.0.1"])
289
289
  s.add_development_dependency(%q<rspec>, ["~> 1.3"])
290
- s.add_development_dependency(%q<dm-types>, ["~> 1.0.0"])
290
+ s.add_development_dependency(%q<dm-types>, ["~> 1.0.1"])
291
291
  else
292
- s.add_dependency(%q<dm-core>, ["~> 1.0.0"])
292
+ s.add_dependency(%q<dm-core>, ["~> 1.0.1"])
293
293
  s.add_dependency(%q<rspec>, ["~> 1.3"])
294
- s.add_dependency(%q<dm-types>, ["~> 1.0.0"])
294
+ s.add_dependency(%q<dm-types>, ["~> 1.0.1"])
295
295
  end
296
296
  else
297
- s.add_dependency(%q<dm-core>, ["~> 1.0.0"])
297
+ s.add_dependency(%q<dm-core>, ["~> 1.0.1"])
298
298
  s.add_dependency(%q<rspec>, ["~> 1.3"])
299
- s.add_dependency(%q<dm-types>, ["~> 1.0.0"])
299
+ s.add_dependency(%q<dm-types>, ["~> 1.0.1"])
300
300
  end
301
301
  end
302
302
 
@@ -40,7 +40,7 @@ module DataMapper
40
40
  end
41
41
 
42
42
  def self.default_error_message(key, field, *values)
43
- field = ActiveSupport::Inflector.humanize(field)
43
+ field = DataMapper::Inflector.humanize(field)
44
44
  @@default_error_messages[key] % [field, *values].flatten
45
45
  end
46
46
 
@@ -33,7 +33,7 @@ module DataMapper
33
33
  @options = options.except(:if, :unless)
34
34
  @if_clause = options[:if]
35
35
  @unless_clause = options[:unless]
36
- @humanized_field_name = ActiveSupport::Inflector.humanize(@field_name)
36
+ @humanized_field_name = DataMapper::Inflector.humanize(@field_name)
37
37
  end
38
38
 
39
39
  # Add an error message to a target resource. If the error corresponds to a
@@ -30,7 +30,7 @@ module DataMapper
30
30
 
31
31
  validates_confirmation_of :person_name, :allow_nil => false, :allow_blank => false
32
32
  validates_confirmation_of :number_of_seats, :confirm => :seats_confirmation, :message => Proc.new { |resource, property|
33
- '%s requires confirmation for %s' % [ActiveSupport::Inflector.demodulize(resource.model.name), property.name]
33
+ '%s requires confirmation for %s' % [DataMapper::Inflector.demodulize(resource.model.name), property.name]
34
34
  }
35
35
  end # Reservation
36
36
  end # Fixtures
@@ -5,8 +5,8 @@ describe 'Inferred validations' do
5
5
  it "allow overriding a single error message" do
6
6
  custom_boat = Class.new do
7
7
  include DataMapper::Resource
8
- property :id, DataMapper::Types::Serial
9
- property :name, String, :required => true, :message => "This boat must have name"
8
+ property :id, DataMapper::Property::Serial
9
+ property :name, String, :required => true, :message => "This boat must have name"
10
10
  end
11
11
  boat = custom_boat.new
12
12
  boat.should_not be_valid
@@ -16,8 +16,8 @@ describe 'Inferred validations' do
16
16
  it "should have correct error messages" do
17
17
  custom_boat = Class.new do
18
18
  include DataMapper::Resource
19
- property :id, DataMapper::Types::Serial
20
- property :name, String, :required => true, :length => 5..20, :format => /^[a-z]+$/,
19
+ property :id, DataMapper::Property::Serial
20
+ property :name, String, :required => true, :length => 5..20, :format => /^[a-z]+$/,
21
21
  :messages => {
22
22
  :presence => "This boat must have name",
23
23
  :length => "Name must have at least 4 and at most 20 chars",
@@ -6,9 +6,9 @@ describe "A class with inferred validations disabled for all properties with an
6
6
  @klass = Class.new do
7
7
  include DataMapper::Resource
8
8
 
9
- property :id, DataMapper::Types::Serial, :auto_validation => false
10
- property :name, String, :required => true, :auto_validation => false
11
- property :bool, DataMapper::Types::Boolean, :required => true, :auto_validation => false
9
+ property :id, DataMapper::Property::Serial, :auto_validation => false
10
+ property :name, String, :required => true, :auto_validation => false
11
+ property :bool, DataMapper::Property::Boolean, :required => true, :auto_validation => false
12
12
  end
13
13
 
14
14
  @model = @klass.new
@@ -26,9 +26,9 @@ describe "A class with inferred validations disabled for all properties with a b
26
26
  include DataMapper::Resource
27
27
 
28
28
  without_auto_validations do
29
- property :id, DataMapper::Types::Serial
30
- property :name, String, :required => true
31
- property :bool, DataMapper::Types::Boolean, :required => true
29
+ property :id, DataMapper::Property::Serial
30
+ property :name, String, :required => true
31
+ property :bool, DataMapper::Property::Boolean, :required => true
32
32
  end
33
33
  end
34
34
 
@@ -5,8 +5,8 @@ describe 'A model with a :set & :default options on a property' do
5
5
  before :all do
6
6
  class ::LimitedBoat
7
7
  include DataMapper::Resource
8
- property :id, DataMapper::Types::Serial
9
- property :limited, String, :set => %w[ foo bar bang ], :default => 'foo'
8
+ property :id, DataMapper::Property::Serial
9
+ property :limited, String, :set => %w[ foo bar bang ], :default => 'foo'
10
10
  end
11
11
  end
12
12
 
@@ -1,16 +1,14 @@
1
1
  desc "Support bundling from local source code (allows BUNDLE_GEMFILE=Gemfile.local bundle foo)"
2
2
  task :local_gemfile do |t|
3
3
 
4
- root = Pathname(__FILE__).dirname.parent
5
- datamapper = root.parent
6
-
7
- source_regex = /DATAMAPPER = 'git:\/\/github.com\/datamapper'/
8
- gem_source_regex = /:git => \"#\{DATAMAPPER\}\/(.+?)(?:\.git)?\"/
4
+ root = Pathname(__FILE__).dirname.parent
5
+ datamapper = root.parent
9
6
 
10
7
  root.join('Gemfile.local').open('w') do |f|
11
8
  root.join('Gemfile').open.each do |line|
12
- line.sub!(source_regex, "DATAMAPPER = '#{datamapper}'")
13
- line.sub!(gem_source_regex, ':path => "#{DATAMAPPER}/\1"')
9
+ line.sub!(/DATAMAPPER = 'git:\/\/github.com\/datamapper'/, "DATAMAPPER = '#{datamapper}'")
10
+ line.sub!(/:git => \"#\{DATAMAPPER\}\/(.+?)(?:\.git)?\"/, ':path => "#{DATAMAPPER}/\1"')
11
+ line.sub!(/do_options\[:git\] = \"#\{DATAMAPPER\}\/(.+?)(?:\.git)?\"/, 'do_options[:path] = "#{DATAMAPPER}/\1"')
14
12
  f.puts line
15
13
  end
16
14
  end
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dm-validations
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
5
4
  prerelease: false
6
5
  segments:
7
6
  - 1
8
7
  - 0
9
- - 0
10
- version: 1.0.0
8
+ - 1
9
+ version: 1.0.1
11
10
  platform: ruby
12
11
  authors:
13
12
  - Guy van den Berg
@@ -15,7 +14,7 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2010-06-08 00:00:00 -07:00
17
+ date: 2010-09-07 00:00:00 -07:00
19
18
  default_executable:
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
@@ -26,12 +25,11 @@ dependencies:
26
25
  requirements:
27
26
  - - ~>
28
27
  - !ruby/object:Gem::Version
29
- hash: 23
30
28
  segments:
31
29
  - 1
32
30
  - 0
33
- - 0
34
- version: 1.0.0
31
+ - 1
32
+ version: 1.0.1
35
33
  type: :runtime
36
34
  version_requirements: *id001
37
35
  - !ruby/object:Gem::Dependency
@@ -42,7 +40,6 @@ dependencies:
42
40
  requirements:
43
41
  - - ~>
44
42
  - !ruby/object:Gem::Version
45
- hash: 9
46
43
  segments:
47
44
  - 1
48
45
  - 3
@@ -57,12 +54,11 @@ dependencies:
57
54
  requirements:
58
55
  - - ~>
59
56
  - !ruby/object:Gem::Version
60
- hash: 23
61
57
  segments:
62
58
  - 1
63
59
  - 0
64
- - 0
65
- version: 1.0.0
60
+ - 1
61
+ version: 1.0.1
66
62
  type: :development
67
63
  version_requirements: *id003
68
64
  description: Library for performing validations on DM models and pure Ruby object
@@ -234,7 +230,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
234
230
  requirements:
235
231
  - - ">="
236
232
  - !ruby/object:Gem::Version
237
- hash: 3
238
233
  segments:
239
234
  - 0
240
235
  version: "0"
@@ -243,7 +238,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
243
238
  requirements:
244
239
  - - ">="
245
240
  - !ruby/object:Gem::Version
246
- hash: 3
247
241
  segments:
248
242
  - 0
249
243
  version: "0"