validates_timeliness 5.0.0 → 6.0.0.alpha1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2a87264d54db8505c8dcbeff59eda9c7e091d07942c97de3f34e7f9fc2f465c8
4
- data.tar.gz: 504d91a6c0af936ffd864180c4e174521598c13f4c7774966b86808138e6fc51
3
+ metadata.gz: e153117c69ae4a75bde2e8a9cb1334118fbc083be371ed10d6658bf6a82aa8fb
4
+ data.tar.gz: cb77f367f614fd8c6fbf754cd5b1d1beed8845a5afe74937e97e38ab7da8ee8b
5
5
  SHA512:
6
- metadata.gz: 335b52bbbd66dd0a2e0a5ca1db25637eb2afb9007418d5a035342de756f391325170ec62fce16f422d30f80ffdf0b2f12e7fdb3fbbcecfb82d3ebbed2e6e2b25
7
- data.tar.gz: cc3000300065dac0b74164ce5491f541fd338fa7649a6a0da722ae4179de48a7c46ec1f6c47aee2a91769058e0e7e2a2565d1d0b1b3c29d8495f5a9814d94041
6
+ metadata.gz: c67105f25b5473d6bd3a4f5b07763382424da6103053f7fa477a50c82a38d5fc3e61638854a1016d51da3c765419fe4a4986cee1105afbaf0255f2bf1bd623df
7
+ data.tar.gz: f5364e75b90e6bd60836e4858cb6fa2debeb557540de870aa6828a5c462329c550cb5af444d4e9337172653f56db04a1b0ef971d81a7fbace564ab08cf81c18e
data/.travis.yml CHANGED
@@ -1,14 +1,31 @@
1
+ dist: focal
2
+ os: linux
1
3
  language: ruby
2
4
  before_install: gem install bundler
3
5
  cache: bundler
4
6
 
5
7
  gemfile:
6
- - gemfiles/rails_5_0.gemfile
7
- - gemfiles/rails_5_1.gemfile
8
- - gemfiles/rails_5_2.gemfile
8
+ - gemfiles/rails_6_0.gemfile
9
+ - gemfiles/rails_6_1.gemfile
10
+ - gemfiles/rails_edge.gemfile
9
11
 
10
12
  rvm:
11
- - "2.5.3"
13
+ - "2.5.8"
14
+ - "2.6.6"
15
+ - "2.7.2"
16
+ - "3.0.0"
17
+ - ruby-head
18
+
19
+ jobs:
20
+ allow_failures:
21
+ - rvm: ruby-head
22
+ - gemfile: gemfiles/rails_edge.gemfile
23
+ exclude:
24
+ - rvm: 2.5.8
25
+ gemfile: gemfiles/rails_edge.gemfile
26
+ - rvm: 2.6.6
27
+ gemfile: gemfiles/rails_edge.gemfile
28
+ fast_finish: true
12
29
 
13
30
  script: 'bundle exec rspec'
14
31
 
data/CHANGELOG.rdoc CHANGED
@@ -5,6 +5,8 @@
5
5
  in a request.
6
6
  * Add initializer to ensure Timeliness v0.4+ ambiguous date config is set
7
7
  correctly when using `use_euro_formats` or `remove_use_formats'.
8
+ * Add Ruby 3 compatibility
9
+ * Add Rails 6.1 compatibility
8
10
 
9
11
  Breaking Changes
10
12
  * Update Multiparameter extension to use ActiveRecord type classes with multiparameter handling
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2008-2010 Adam Meehan
1
+ Copyright (c) 2008-2021 Adam Meehan
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.rdoc CHANGED
@@ -1,13 +1,17 @@
1
1
  = ValidatesTimeliness {<img src="https://travis-ci.org/adzap/validates_timeliness.svg?branch=master" alt="Build Status" />}[https://travis-ci.org/adzap/validates_timeliness]
2
2
 
3
- * Source: http://github.com/adzap/validates_timeliness
4
- * Issues: http://github.com/adzap/validates_timeliness/issues
3
+ * Source: https://github.com/adzap/validates_timeliness
4
+ * Issues: https://github.com/adzap/validates_timeliness/issues
5
5
 
6
6
  == Description
7
7
 
8
- Complete validation of dates, times and datetimes for Rails 5.x and ActiveModel.
8
+ Complete validation of dates, times and datetimes for Rails 6.x and ActiveModel.
9
9
 
10
- If you a looking for the old version for Rails 4.x go here [https://github.com/adzap/validates_timeliness/tree/4-0-stable].
10
+ Old Rails versions:
11
+
12
+ * Rails 4.x: [https://github.com/adzap/validates_timeliness/tree/4-0-stable]
13
+
14
+ * Rails 5.x: [https://github.com/adzap/validates_timeliness/tree/5-0-stable]
11
15
 
12
16
 
13
17
  == Features
@@ -18,7 +22,7 @@ If you a looking for the old version for Rails 4.x go here [https://github.com/a
18
22
 
19
23
  * Only Rails date/time validation plugin offering complete validation (See ORM/ODM support)
20
24
 
21
- * Uses extensible date/time parser (Using {timeliness gem}[http://github.com/adzap/timeliness]. See Plugin Parser)
25
+ * Uses extensible date/time parser (Using {timeliness gem}[https://github.com/adzap/timeliness]. See Plugin Parser)
22
26
 
23
27
  * Adds extensions to fix Rails date/time select issues (See Extensions)
24
28
 
@@ -30,13 +34,13 @@ If you a looking for the old version for Rails 4.x go here [https://github.com/a
30
34
  == Installation
31
35
 
32
36
  # in Gemfile
33
- gem 'validates_timeliness', '~> 5.0.0.beta1'
37
+ gem 'validates_timeliness', '~> 6.0.0.alpha1'
34
38
 
35
39
  # Run bundler
36
40
  $ bundle install
37
41
 
38
42
  Then run
39
-
43
+
40
44
  $ rails generate validates_timeliness:install
41
45
 
42
46
  This creates configuration initializer and locale files. In the initializer, there are a number of config
@@ -97,7 +101,7 @@ Temporal options (or restrictions):
97
101
  :on_or_before - Attribute must be equal to or before this value to be valid
98
102
  :after - Attribute must be after this value to be valid
99
103
  :on_or_after - Attribute must be equal to or after this value to be valid
100
- :between - Attribute must be between the values to be valid. Range or Array of 2 values.
104
+ :between - Attribute must be between the values to be valid. Range or Array of 2 values.
101
105
 
102
106
  Regular validation options:
103
107
  :allow_nil - Allow a nil value to be valid
@@ -142,7 +146,7 @@ like so
142
146
 
143
147
  end
144
148
 
145
- By default the plugin extends ActiveRecord if loaded. If you wish to extend another ORM then look at the {wiki page}[http://github.com/adzap/validates_timeliness/wiki/ORM-Support] for more information.
149
+ By default the plugin extends ActiveRecord if loaded. If you wish to extend another ORM then look at the {wiki page}[https://github.com/adzap/validates_timeliness/wiki/ORM-Support] for more information.
146
150
 
147
151
  It is not required that you use a shim, but you will not catch errors when the attribute value is invalid and evaluated to nil.
148
152
 
@@ -184,7 +188,7 @@ It is highly recommended you use the I18n system for error messages.
184
188
 
185
189
  === Plugin Parser
186
190
 
187
- The plugin uses the {timeliness gem}[http://github.com/adzap/timeliness] as a fast, configurable and extensible date and time parser.
191
+ The plugin uses the {timeliness gem}[https://github.com/adzap/timeliness] as a fast, configurable and extensible date and time parser.
188
192
  You can add or remove valid formats for dates, times, and datetimes. It is also more strict than the
189
193
  Ruby parser, which means it won't accept day of the month if it's not a valid number for the month.
190
194
 
@@ -194,12 +198,12 @@ By default the parser is disabled. To enable it:
194
198
  config.use_plugin_parser = true
195
199
 
196
200
  Enabling the parser will mean that strings assigned to attributes validated with the plugin will be parsed
197
- using the gem. See the wiki[http://github.com/adzap/validates_timeliness/wiki/Plugin-Parser] for more details about the parser configuration.
201
+ using the gem. See the wiki[https://github.com/adzap/validates_timeliness/wiki/Plugin-Parser] for more details about the parser configuration.
198
202
 
199
203
 
200
204
  === Restriction Shorthand
201
205
 
202
- It is common to restrict an attribute to being on or before the current time or current day.
206
+ It is common to restrict an attribute to being on or before the current time or current day.
203
207
  To specify this you need to use a lambda as an option value e.g. <tt>lambda { Time.current }</tt>.
204
208
  This can be tedious noise amongst your validations for something so common. To combat this the
205
209
  plugin allows you to use shorthand symbols for often used relative times or dates.
@@ -208,7 +212,7 @@ Just provide the symbol as the option value like so:
208
212
 
209
213
  validates_date :birth_date, on_or_before: :today
210
214
 
211
- The :today symbol is evaluated as <tt>lambda { Date.today }</tt>. The :now and :today
215
+ The :today symbol is evaluated as <tt>lambda { Date.current }</tt>. The :now and :today
212
216
  symbols are pre-configured. Configure your own like so:
213
217
 
214
218
  # in the setup block
@@ -220,7 +224,7 @@ symbols are pre-configured. Configure your own like so:
220
224
  === Default Timezone
221
225
 
222
226
  The plugin needs to know the default timezone you are using when parsing or type casting values. If you are using
223
- ActiveRecord then the default is automatically set to the same default zone as ActiveRecord. If you are using
227
+ ActiveRecord then the default is automatically set to the same default zone as ActiveRecord. If you are using
224
228
  another ORM you may need to change this setting.
225
229
 
226
230
  # in the setup block
@@ -286,12 +290,12 @@ To activate it, uncomment this line in the initializer:
286
290
 
287
291
  == Contributors
288
292
 
289
- To see the generous people who have contributed code, take a look at the {contributors list}[http://github.com/adzap/validates_timeliness/contributors].
293
+ To see the generous people who have contributed code, take a look at the {contributors list}[https://github.com/adzap/validates_timeliness/contributors].
290
294
 
291
295
 
292
296
  == Maintainers
293
297
 
294
- * {Adam Meehan}[http://github.com/adzap]
298
+ * {Adam Meehan}[https://github.com/adzap]
295
299
 
296
300
 
297
301
  == License
data/Rakefile CHANGED
@@ -19,10 +19,11 @@ end
19
19
 
20
20
  desc 'Generate documentation for plugin.'
21
21
  Rake::RDocTask.new(:rdoc) do |rdoc|
22
+ rdoc.main = 'README.rdoc'
22
23
  rdoc.rdoc_dir = 'rdoc'
23
24
  rdoc.title = 'ValidatesTimeliness'
24
- rdoc.options << '--line-numbers' << '--inline-source'
25
- rdoc.rdoc_files.include('README')
25
+ rdoc.options << '--line-numbers'
26
+ rdoc.rdoc_files.include('README.rdoc')
26
27
  rdoc.rdoc_files.include('lib/**/*.rb')
27
28
  end
28
29
 
@@ -2,13 +2,13 @@
2
2
 
3
3
  source "http://rubygems.org"
4
4
 
5
- gem "rails", "~> 5.0.0"
5
+ gem "rails", "~> 6.0.0"
6
6
  gem "rspec"
7
7
  gem "rspec-rails", "~> 3.7"
8
+ gem "sqlite3"
8
9
  gem "timecop"
9
10
  gem "byebug"
10
11
  gem "appraisal"
11
- gem "sqlite3", "~> 1.3.6"
12
12
  gem "nokogiri", "~> 1.8"
13
13
 
14
14
  gemspec path: "../"
@@ -2,13 +2,13 @@
2
2
 
3
3
  source "http://rubygems.org"
4
4
 
5
- gem "rails", "~> 5.1.0"
5
+ gem "rails", "~> 6.1.0"
6
6
  gem "rspec"
7
7
  gem "rspec-rails", "~> 3.7"
8
+ gem "sqlite3"
8
9
  gem "timecop"
9
10
  gem "byebug"
10
11
  gem "appraisal"
11
- gem "sqlite3", "~> 1.3.6"
12
12
  gem "nokogiri", "~> 1.8"
13
13
 
14
14
  gemspec path: "../"
@@ -2,13 +2,13 @@
2
2
 
3
3
  source "http://rubygems.org"
4
4
 
5
- gem "rails", "~> 5.2.0"
5
+ gem "rails", git: "https://github.com/rails/rails.git", branch: "main"
6
6
  gem "rspec"
7
7
  gem "rspec-rails", "~> 3.7"
8
+ gem "sqlite3"
8
9
  gem "timecop"
9
10
  gem "byebug"
10
11
  gem "appraisal"
11
- gem "sqlite3", "~> 1.3.6"
12
12
  gem "nokogiri", "~> 1.8"
13
13
 
14
14
  gemspec path: "../"
@@ -43,7 +43,7 @@ module ValidatesTimeliness
43
43
  values[POSITION.key(position.to_i)] = value.to_i
44
44
  end
45
45
 
46
- DateTimeValue.new(values)
46
+ DateTimeValue.new(**values)
47
47
  end
48
48
  end
49
49
  end
@@ -86,7 +86,7 @@ module ValidatesTimeliness
86
86
  def add_error(record, attr_name, message, value=nil)
87
87
  value = format_error_value(value) if value
88
88
  message_options = { :message => options.fetch(:"#{message}_message", options[:message]), :restriction => value }
89
- record.errors.add(attr_name, message, message_options)
89
+ record.errors.add(attr_name, message, **message_options)
90
90
  end
91
91
 
92
92
  def format_error_value(value)
@@ -1,3 +1,3 @@
1
1
  module ValidatesTimeliness
2
- VERSION = '5.0.0'
2
+ VERSION = '6.0.0.alpha1'
3
3
  end
@@ -15,11 +15,11 @@ module TestModel
15
15
  self.model_attributes[name] = type
16
16
  end
17
17
 
18
- def define_method_attribute=(attr_name)
18
+ def define_method_attribute=(attr_name, owner: nil)
19
19
  generated_attribute_methods.module_eval("def #{attr_name}=(new_value); @attributes['#{attr_name}']=self.class.type_cast('#{attr_name}', new_value); end", __FILE__, __LINE__)
20
20
  end
21
21
 
22
- def define_method_attribute(attr_name)
22
+ def define_method_attribute(attr_name, owner: nil)
23
23
  generated_attribute_methods.module_eval("def #{attr_name}; @attributes['#{attr_name}']; end", __FILE__, __LINE__)
24
24
  end
25
25
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: validates_timeliness
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0
4
+ version: 6.0.0.alpha1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Meehan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-02 00:00:00.000000000 Z
11
+ date: 2021-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: timeliness
@@ -45,9 +45,9 @@ files:
45
45
  - LICENSE
46
46
  - README.rdoc
47
47
  - Rakefile
48
- - gemfiles/rails_5_0.gemfile
49
- - gemfiles/rails_5_1.gemfile
50
- - gemfiles/rails_5_2.gemfile
48
+ - gemfiles/rails_6_0.gemfile
49
+ - gemfiles/rails_6_1.gemfile
50
+ - gemfiles/rails_edge.gemfile
51
51
  - init.rb
52
52
  - lib/generators/validates_timeliness/install_generator.rb
53
53
  - lib/generators/validates_timeliness/templates/en.yml
@@ -99,9 +99,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
99
99
  version: '0'
100
100
  required_rubygems_version: !ruby/object:Gem::Requirement
101
101
  requirements:
102
- - - ">="
102
+ - - ">"
103
103
  - !ruby/object:Gem::Version
104
- version: '0'
104
+ version: 1.3.1
105
105
  requirements: []
106
106
  rubygems_version: 3.0.3
107
107
  signing_key: