has_safe_dates 0.0.0 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +3 -12
- data/{LICENSE.txt → MIT-LICENSE.txt} +0 -0
- data/README.md +68 -0
- data/Rakefile +2 -85
- data/has_safe_dates.gemspec +38 -38
- data/lib/has_safe_dates/core_ext.rb +2 -2
- data/lib/has_safe_dates/version.rb +3 -0
- data/spec/db/schema.rb +7 -0
- data/spec/has_safe_dates_spec.rb +12 -2
- metadata +82 -41
- data/README.rdoc +0 -23
- data/VERSION +0 -1
- data/has_safe_dates.gemspec.txt +0 -41
data/Gemfile
CHANGED
@@ -1,14 +1,5 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
|
-
# Add dependencies required to use your gem here.
|
3
|
-
# Example:
|
4
|
-
# gem "activesupport", ">= 2.3.5"
|
5
2
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
gem "shoulda", ">= 0"
|
10
|
-
gem "rdoc", "~> 3.12"
|
11
|
-
gem "bundler", "~> 1.0.0"
|
12
|
-
gem "jeweler", "~> 1.8.3"
|
13
|
-
gem "rcov", ">= 0"
|
14
|
-
end
|
3
|
+
gemspec
|
4
|
+
|
5
|
+
gem 'ruby-debug19'
|
File without changes
|
data/README.md
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
HasSafeDates
|
2
|
+
===========================
|
3
|
+
|
4
|
+
Installation
|
5
|
+
------------------------
|
6
|
+
|
7
|
+
In your Gemfile:
|
8
|
+
|
9
|
+
gem "has_safe_dates"
|
10
|
+
|
11
|
+
Do a bundle install, then for each model add the has_safe_dates class method to your model:
|
12
|
+
|
13
|
+
class Post < ActiveRecord::Base
|
14
|
+
has_safe_dates :published_date
|
15
|
+
end
|
16
|
+
|
17
|
+
You can now do things like this:
|
18
|
+
|
19
|
+
post.update_attributes(:published_date => '1st of November 2012')
|
20
|
+
|
21
|
+
And it will work.
|
22
|
+
|
23
|
+
Uses [Chronic](https://github.com/mojombo/chronic) for parsing of the dates to help
|
24
|
+
|
25
|
+
Development
|
26
|
+
-------------------------
|
27
|
+
|
28
|
+
HasSafeDates is developed under Ruby-1.9.2-p290
|
29
|
+
|
30
|
+
To get the tests to run, make sure you have sqlite3 installed on your system, then
|
31
|
+
run:
|
32
|
+
|
33
|
+
$ bundle install
|
34
|
+
$ rake
|
35
|
+
|
36
|
+
Publishing and Releasing a Gem
|
37
|
+
--------------------------
|
38
|
+
|
39
|
+
Do the following to publish and push a new gem:
|
40
|
+
|
41
|
+
1) Make sure the local working copy is clean with no pending commits:
|
42
|
+
|
43
|
+
$ git status
|
44
|
+
# On branch master
|
45
|
+
nothing to commit (working directory clean)
|
46
|
+
|
47
|
+
2) Edit the version number and increment per SEMVER versioning:
|
48
|
+
|
49
|
+
$ vi lib/has_safe_dates/version.rb
|
50
|
+
|
51
|
+
3) Run gem build to create the gem:
|
52
|
+
|
53
|
+
$ gem build has_safe_dates.gemspec
|
54
|
+
|
55
|
+
4) Test install the gem locally:
|
56
|
+
|
57
|
+
$ gem install has_safe_dates-0.0.1.gem
|
58
|
+
|
59
|
+
5) Commit any changes and tag the commit at the current version:
|
60
|
+
|
61
|
+
$ git commit lib/has_safe_dates/version.rb -m "Releasing v0.0.1"
|
62
|
+
$ git tag v0.0.1
|
63
|
+
$ git push
|
64
|
+
|
65
|
+
6) Push the gem to rubygems:
|
66
|
+
|
67
|
+
$ gem push has_safe_dates-0.0.1.gem
|
68
|
+
|
data/Rakefile
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
require 'rubygems'
|
4
|
+
require 'rake'
|
4
5
|
require 'bundler'
|
6
|
+
|
5
7
|
begin
|
6
8
|
Bundler.setup(:default, :development)
|
7
9
|
rescue Bundler::BundlerError => e
|
@@ -9,94 +11,9 @@ rescue Bundler::BundlerError => e
|
|
9
11
|
$stderr.puts "Run `bundle install` to install missing gems"
|
10
12
|
exit e.status_code
|
11
13
|
end
|
12
|
-
require 'rake'
|
13
|
-
|
14
|
-
require 'jeweler'
|
15
|
-
Jeweler::Tasks.new do |gem|
|
16
|
-
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
-
gem.name = "has_safe_dates"
|
18
|
-
gem.homepage = "http://github.com/kylejginavan/has_safe_dates"
|
19
|
-
gem.license = "MIT"
|
20
|
-
gem.summary = %Q{The easy way to add safe dates to any Rails model.}
|
21
|
-
gem.description = %Q{Uses Chronic to parse incoming dates and does not raise errors on invalid multi parameter settings.}
|
22
|
-
gem.email = "kylejginavan@gmail.com"
|
23
|
-
gem.homepage = "http://github.com/kylejginavan/has_safe_dates"
|
24
|
-
gem.authors = ["kylejginavan"]
|
25
|
-
end
|
26
|
-
Jeweler::RubygemsDotOrgTasks.new
|
27
|
-
|
28
|
-
require 'rake/testtask'
|
29
|
-
Rake::TestTask.new(:test) do |test|
|
30
|
-
test.libs << 'lib' << 'test'
|
31
|
-
test.pattern = 'test/**/test_*.rb'
|
32
|
-
test.verbose = true
|
33
|
-
end
|
34
|
-
|
35
|
-
require 'rcov/rcovtask'
|
36
|
-
Rcov::RcovTask.new do |test|
|
37
|
-
test.libs << 'test'
|
38
|
-
test.pattern = 'test/**/test_*.rb'
|
39
|
-
test.verbose = true
|
40
|
-
test.rcov_opts << '--exclude "gems/*"'
|
41
|
-
end
|
42
|
-
|
43
|
-
task :default => :test
|
44
|
-
|
45
|
-
require 'rdoc/task'
|
46
|
-
Rake::RDocTask.new do |rdoc|
|
47
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
48
|
-
|
49
|
-
rdoc.rdoc_dir = 'rdoc'
|
50
|
-
rdoc.title = "has_safe_dates #{version}"
|
51
|
-
rdoc.rdoc_files.include('README*')
|
52
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
53
|
-
end
|
54
|
-
|
55
|
-
=begin
|
56
|
-
|
57
|
-
begin
|
58
|
-
require 'jeweler'
|
59
|
-
Jeweler::Tasks.new do |gem|
|
60
|
-
gem.name = "has_safe_dates"
|
61
|
-
gem.summary = %Q{The easy way to add safe dates to any Rails model.}
|
62
|
-
gem.description = %Q{Uses Chronic to parse incoming dates and does not raise errors on invalid multi parameter settings.}
|
63
|
-
gem.email = "kylejginavan@gmail.com"
|
64
|
-
gem.homepage = "http://github.com/kylejginavan/has_safe_dates"
|
65
|
-
gem.add_dependency('builder')
|
66
|
-
gem.authors = ["kylejginavan"]
|
67
|
-
end
|
68
|
-
Jeweler::GemcutterTasks.new
|
69
|
-
rescue LoadError
|
70
|
-
puts "has_safe_dates (or a dependency) not available. Install it with: gem install has_safe_dates"
|
71
|
-
end
|
72
|
-
|
73
|
-
begin
|
74
|
-
require 'bundler/setup'
|
75
|
-
rescue LoadError
|
76
|
-
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
77
|
-
end
|
78
|
-
|
79
|
-
# begin
|
80
|
-
# require 'rdoc/task'
|
81
|
-
# rescue LoadError
|
82
|
-
# require 'rdoc/rdoc'
|
83
|
-
# require 'rake/task'
|
84
|
-
# RDoc::Task = Rake::RDocTask
|
85
|
-
# end
|
86
|
-
#
|
87
|
-
# RDoc::Task.new(:rdoc) do |rdoc|
|
88
|
-
# rdoc.rdoc_dir = 'rdoc'
|
89
|
-
# rdoc.title = 'SafeDates'
|
90
|
-
# rdoc.options << '--line-numbers'
|
91
|
-
# rdoc.rdoc_files.include('README.rdoc')
|
92
|
-
# rdoc.rdoc_files.include('lib/**/*.rb')
|
93
|
-
# end
|
94
|
-
|
95
|
-
Bundler::GemHelper.install_tasks
|
96
14
|
|
97
15
|
task :spec do
|
98
16
|
sh("bundle exec rspec spec") { |ok, res| }
|
99
17
|
end
|
100
18
|
|
101
19
|
task :default => :spec
|
102
|
-
=end
|
data/has_safe_dates.gemspec
CHANGED
@@ -1,64 +1,64 @@
|
|
1
|
-
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
-
# -*- encoding: utf-8 -*-
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
5
2
|
|
3
|
+
# Maintain your gem's version:
|
4
|
+
require "has_safe_dates/version"
|
5
|
+
|
6
|
+
# Describe your gem and declare its dependencies:
|
6
7
|
Gem::Specification.new do |s|
|
7
|
-
s.name
|
8
|
-
s.version
|
8
|
+
s.name = "has_safe_dates"
|
9
|
+
s.version = HasSafeDates::VERSION
|
10
|
+
s.authors = ["kylejginavan"]
|
11
|
+
s.date = %q{2012-02-24}
|
12
|
+
s.description = %q{Uses Chronic to parse incoming dates and does not raise errors on invalid multi parameter settings}
|
13
|
+
s.email = %q{kylejginavan@gmail.com}
|
9
14
|
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["kylejginavan"]
|
12
|
-
s.date = %q{2012-02-24}
|
13
|
-
s.description = %q{Uses Chronic to parse incoming dates and does not raise errors on invalid multi parameter settings.}
|
14
|
-
s.email = %q{kylejginavan@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
|
-
"LICENSE.txt",
|
17
|
-
"README.
|
16
|
+
"MIT-LICENSE.txt",
|
17
|
+
"README.md"
|
18
18
|
]
|
19
19
|
s.files = [
|
20
20
|
"Gemfile",
|
21
|
-
"LICENSE.txt",
|
22
|
-
"README.rdoc",
|
23
21
|
"Rakefile",
|
24
|
-
"
|
22
|
+
"MIT-LICENSE.txt",
|
23
|
+
"README.md",
|
24
|
+
"Rakefile",
|
25
25
|
"has_safe_dates.gemspec",
|
26
|
-
"has_safe_dates.gemspec.txt",
|
27
|
-
"lib/has_safe_dates.rb",
|
28
26
|
"lib/has_safe_dates/core_ext.rb",
|
27
|
+
"lib/has_safe_dates/version.rb",
|
28
|
+
"lib/has_safe_dates.rb",
|
29
29
|
"spec/db/database.yml",
|
30
30
|
"spec/db/schema.rb",
|
31
31
|
"spec/has_safe_dates_spec.rb",
|
32
32
|
"spec/spec_helper.rb"
|
33
33
|
]
|
34
34
|
s.homepage = %q{http://github.com/kylejginavan/has_safe_dates}
|
35
|
-
s.licenses = ["MIT"]
|
36
35
|
s.require_paths = ["lib"]
|
37
|
-
s.
|
38
|
-
s.summary = %q{The easy way to add safe dates to any Rails model.}
|
36
|
+
s.summary = %q{Chronic based date setting for ActiveRecord models}
|
39
37
|
|
40
38
|
if s.respond_to? :specification_version then
|
41
39
|
s.specification_version = 3
|
42
40
|
|
43
41
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
44
|
-
s.add_development_dependency(
|
45
|
-
s.add_development_dependency(
|
46
|
-
s.add_development_dependency(
|
47
|
-
s.add_development_dependency(
|
48
|
-
s.add_development_dependency(
|
49
|
-
|
50
|
-
s.
|
51
|
-
s.
|
52
|
-
|
53
|
-
s.add_dependency(
|
54
|
-
s.add_dependency(
|
42
|
+
s.add_development_dependency("activerecord", ['>= 3.1.0'])
|
43
|
+
s.add_development_dependency("chronic")
|
44
|
+
s.add_development_dependency("rspec", [">= 0"])
|
45
|
+
s.add_development_dependency("rdoc", ["~> 3.12"])
|
46
|
+
s.add_development_dependency("bundler", ["~> 1.0.0"])
|
47
|
+
s.add_development_dependency("sqlite3")
|
48
|
+
s.add_development_dependency("rspec")
|
49
|
+
s.add_development_dependency('database_cleaner')
|
50
|
+
else
|
51
|
+
s.add_dependency("activerecord", ['>= 3.1.0'])
|
52
|
+
s.add_dependency("chronic")
|
53
|
+
s.add_dependency("rspec", [">= 0"])
|
54
|
+
s.add_dependency("rdoc", ["~> 3.12"])
|
55
|
+
s.add_dependency("bundler", ["~> 1.0.0"])
|
55
56
|
end
|
56
57
|
else
|
57
|
-
s.add_dependency(
|
58
|
-
s.add_dependency(
|
59
|
-
s.add_dependency(
|
60
|
-
s.add_dependency(
|
61
|
-
s.add_dependency(
|
58
|
+
s.add_dependency('activerecord', ['>= 3.1.0'])
|
59
|
+
s.add_dependency('chronic')
|
60
|
+
s.add_dependency("rspec", [">= 0"])
|
61
|
+
s.add_dependency("rdoc", ["~> 3.12"])
|
62
|
+
s.add_dependency("bundler", ["~> 1.0.0"])
|
62
63
|
end
|
63
64
|
end
|
64
|
-
|
@@ -8,7 +8,7 @@ module HasSafeDates
|
|
8
8
|
module ClassMethods
|
9
9
|
|
10
10
|
def has_safe_fields_config
|
11
|
-
|
11
|
+
@has_safe_fields_config ||= {}
|
12
12
|
end
|
13
13
|
|
14
14
|
def has_safe_dates(*args)
|
@@ -27,7 +27,7 @@ module HasSafeDates
|
|
27
27
|
has_safe_fields_config[:fields].each do |field|
|
28
28
|
define_method "#{field.to_s}=" do |value|
|
29
29
|
if value.present?
|
30
|
-
value = Chronic.parse(value)
|
30
|
+
value = Chronic.parse(value.to_s)
|
31
31
|
self.errors.add(field, self.class.has_safe_fields_config[:error_message]) unless value.present?
|
32
32
|
end
|
33
33
|
super value
|
data/spec/db/schema.rb
CHANGED
@@ -2,6 +2,13 @@
|
|
2
2
|
|
3
3
|
ActiveRecord::Schema.define(:version => 0) do
|
4
4
|
|
5
|
+
create_table "comments", :force => true do |t|
|
6
|
+
t.text "body"
|
7
|
+
t.date "approved_at"
|
8
|
+
t.date "created_at"
|
9
|
+
t.date "updated_at"
|
10
|
+
end
|
11
|
+
|
5
12
|
create_table "posts", :force => true do |t|
|
6
13
|
t.string "title"
|
7
14
|
t.date "published_date"
|
data/spec/has_safe_dates_spec.rb
CHANGED
@@ -6,10 +6,15 @@ class Post < ActiveRecord::Base
|
|
6
6
|
has_safe_dates :published_date, :safe_date, :error_message => 'is not a real date'
|
7
7
|
end
|
8
8
|
|
9
|
+
class Comment < ActiveRecord::Base
|
10
|
+
has_safe_dates :approved_at, :error_message => 'is not a real date'
|
11
|
+
end
|
12
|
+
|
9
13
|
describe "HasSafeDates" do
|
10
14
|
|
11
15
|
before(:each) do
|
12
16
|
@post = Post.new
|
17
|
+
@comment = Comment.new
|
13
18
|
end
|
14
19
|
|
15
20
|
describe "class method" do
|
@@ -38,8 +43,11 @@ describe "HasSafeDates" do
|
|
38
43
|
['2012-12-1', '1st of December 2012', 'first of dec 2012', '1 Dec 2012'].each do |date|
|
39
44
|
it "allows you to set the date as '#{date}'" do
|
40
45
|
@post.update_attribute(:safe_date, date)
|
46
|
+
@comment.update_attribute(:approved_at, date)
|
41
47
|
@post.reload
|
48
|
+
@comment.reload
|
42
49
|
@post.safe_date.should == Date.new(2012, 12, 1)
|
50
|
+
@comment.approved_at.should == Date.new(2012, 12, 1)
|
43
51
|
end
|
44
52
|
end
|
45
53
|
|
@@ -64,9 +72,11 @@ describe "HasSafeDates" do
|
|
64
72
|
|
65
73
|
describe "multiparameter parsing" do
|
66
74
|
it "doesn't blow up when given an incorrect values" do
|
67
|
-
|
75
|
+
invalid_post_attributes = {'published_date(1)' => "abc", 'published_date(2)' => "12", 'published_date(3)' => "1"}
|
76
|
+
invalid_comment_attributes = {'approved_at(1)' => "abc", 'approved_at(2)' => "12", 'approved_at(3)' => "1"}
|
68
77
|
expect {
|
69
|
-
@post.update_attributes(
|
78
|
+
@post.update_attributes(invalid_post_attributes)
|
79
|
+
@comment.update_attributes(invalid_comment_attributes)
|
70
80
|
}.to_not raise_error
|
71
81
|
end
|
72
82
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: has_safe_dates
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- kylejginavan
|
@@ -19,7 +19,8 @@ date: 2012-02-24 00:00:00 -06:00
|
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
|
-
|
22
|
+
name: activerecord
|
23
|
+
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
25
|
none: false
|
25
26
|
requirements:
|
@@ -27,14 +28,44 @@ dependencies:
|
|
27
28
|
- !ruby/object:Gem::Version
|
28
29
|
hash: 3
|
29
30
|
segments:
|
31
|
+
- 3
|
32
|
+
- 1
|
30
33
|
- 0
|
31
|
-
version:
|
32
|
-
|
34
|
+
version: 3.1.0
|
35
|
+
type: :development
|
33
36
|
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: chronic
|
34
39
|
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 3
|
46
|
+
segments:
|
47
|
+
- 0
|
48
|
+
version: "0"
|
49
|
+
type: :development
|
50
|
+
version_requirements: *id002
|
35
51
|
- !ruby/object:Gem::Dependency
|
52
|
+
name: rspec
|
53
|
+
prerelease: false
|
54
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
hash: 3
|
60
|
+
segments:
|
61
|
+
- 0
|
62
|
+
version: "0"
|
36
63
|
type: :development
|
37
|
-
|
64
|
+
version_requirements: *id003
|
65
|
+
- !ruby/object:Gem::Dependency
|
66
|
+
name: rdoc
|
67
|
+
prerelease: false
|
68
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
38
69
|
none: false
|
39
70
|
requirements:
|
40
71
|
- - ~>
|
@@ -44,12 +75,12 @@ dependencies:
|
|
44
75
|
- 3
|
45
76
|
- 12
|
46
77
|
version: "3.12"
|
47
|
-
name: rdoc
|
48
|
-
version_requirements: *id002
|
49
|
-
prerelease: false
|
50
|
-
- !ruby/object:Gem::Dependency
|
51
78
|
type: :development
|
52
|
-
|
79
|
+
version_requirements: *id004
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: bundler
|
82
|
+
prerelease: false
|
83
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
53
84
|
none: false
|
54
85
|
requirements:
|
55
86
|
- - ~>
|
@@ -60,28 +91,26 @@ dependencies:
|
|
60
91
|
- 0
|
61
92
|
- 0
|
62
93
|
version: 1.0.0
|
63
|
-
name: bundler
|
64
|
-
version_requirements: *id003
|
65
|
-
prerelease: false
|
66
|
-
- !ruby/object:Gem::Dependency
|
67
94
|
type: :development
|
68
|
-
|
95
|
+
version_requirements: *id005
|
96
|
+
- !ruby/object:Gem::Dependency
|
97
|
+
name: sqlite3
|
98
|
+
prerelease: false
|
99
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
69
100
|
none: false
|
70
101
|
requirements:
|
71
|
-
- -
|
102
|
+
- - ">="
|
72
103
|
- !ruby/object:Gem::Version
|
73
|
-
hash:
|
104
|
+
hash: 3
|
74
105
|
segments:
|
75
|
-
-
|
76
|
-
|
77
|
-
- 3
|
78
|
-
version: 1.8.3
|
79
|
-
name: jeweler
|
80
|
-
version_requirements: *id004
|
81
|
-
prerelease: false
|
82
|
-
- !ruby/object:Gem::Dependency
|
106
|
+
- 0
|
107
|
+
version: "0"
|
83
108
|
type: :development
|
84
|
-
|
109
|
+
version_requirements: *id006
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: rspec
|
112
|
+
prerelease: false
|
113
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
85
114
|
none: false
|
86
115
|
requirements:
|
87
116
|
- - ">="
|
@@ -90,36 +119,48 @@ dependencies:
|
|
90
119
|
segments:
|
91
120
|
- 0
|
92
121
|
version: "0"
|
93
|
-
|
94
|
-
version_requirements: *
|
122
|
+
type: :development
|
123
|
+
version_requirements: *id007
|
124
|
+
- !ruby/object:Gem::Dependency
|
125
|
+
name: database_cleaner
|
95
126
|
prerelease: false
|
96
|
-
|
127
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
128
|
+
none: false
|
129
|
+
requirements:
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
hash: 3
|
133
|
+
segments:
|
134
|
+
- 0
|
135
|
+
version: "0"
|
136
|
+
type: :development
|
137
|
+
version_requirements: *id008
|
138
|
+
description: Uses Chronic to parse incoming dates and does not raise errors on invalid multi parameter settings
|
97
139
|
email: kylejginavan@gmail.com
|
98
140
|
executables: []
|
99
141
|
|
100
142
|
extensions: []
|
101
143
|
|
102
144
|
extra_rdoc_files:
|
103
|
-
- LICENSE.txt
|
104
|
-
- README.
|
145
|
+
- MIT-LICENSE.txt
|
146
|
+
- README.md
|
105
147
|
files:
|
106
148
|
- Gemfile
|
107
|
-
- LICENSE.txt
|
108
|
-
- README.rdoc
|
109
149
|
- Rakefile
|
110
|
-
-
|
150
|
+
- MIT-LICENSE.txt
|
151
|
+
- README.md
|
111
152
|
- has_safe_dates.gemspec
|
112
|
-
- has_safe_dates.gemspec.txt
|
113
|
-
- lib/has_safe_dates.rb
|
114
153
|
- lib/has_safe_dates/core_ext.rb
|
154
|
+
- lib/has_safe_dates/version.rb
|
155
|
+
- lib/has_safe_dates.rb
|
115
156
|
- spec/db/database.yml
|
116
157
|
- spec/db/schema.rb
|
117
158
|
- spec/has_safe_dates_spec.rb
|
118
159
|
- spec/spec_helper.rb
|
119
160
|
has_rdoc: true
|
120
161
|
homepage: http://github.com/kylejginavan/has_safe_dates
|
121
|
-
licenses:
|
122
|
-
|
162
|
+
licenses: []
|
163
|
+
|
123
164
|
post_install_message:
|
124
165
|
rdoc_options: []
|
125
166
|
|
@@ -149,6 +190,6 @@ rubyforge_project:
|
|
149
190
|
rubygems_version: 1.5.2
|
150
191
|
signing_key:
|
151
192
|
specification_version: 3
|
152
|
-
summary:
|
193
|
+
summary: Chronic based date setting for ActiveRecord models
|
153
194
|
test_files: []
|
154
195
|
|
data/README.rdoc
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
HasSafeDates
|
2
|
-
===========================
|
3
|
-
|
4
|
-
Installation
|
5
|
-
------------------------
|
6
|
-
|
7
|
-
In your Gemfile:
|
8
|
-
|
9
|
-
gem "has_safe_dates"
|
10
|
-
|
11
|
-
Do a bundle install, then for each model add the has_safe_dates class method to your model:
|
12
|
-
|
13
|
-
class Post < ActiveRecord::Base
|
14
|
-
has_safe_dates :published_date
|
15
|
-
end
|
16
|
-
|
17
|
-
You can now do things like this:
|
18
|
-
|
19
|
-
post.update_attributes(:published_date => '1st of November 2012')
|
20
|
-
|
21
|
-
And it will work.
|
22
|
-
|
23
|
-
Uses [Chronic](https://github.com/mojombo/chronic) for parsing of the dates to help
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.0.0
|
data/has_safe_dates.gemspec.txt
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
$:.push File.expand_path("../lib", __FILE__)
|
2
|
-
|
3
|
-
# Describe your gem and declare its dependencies:
|
4
|
-
Gem::Specification.new do |s|
|
5
|
-
s.name = "has_safe_dates"
|
6
|
-
s.version = HasSafeDates::VERSION
|
7
|
-
s.authors = ["kylejginavan"]
|
8
|
-
s.date = %q{2012-02-24}
|
9
|
-
s.description = %q{Uses Chronic to parse incoming dates and does not raise errors on invalid multi parameter settings}
|
10
|
-
s.email = %q{kylejginavan@gmail.com}
|
11
|
-
|
12
|
-
s.extra_rdoc_files = [
|
13
|
-
"LICENSE",
|
14
|
-
"README.md"
|
15
|
-
]
|
16
|
-
s.files = [
|
17
|
-
"Gemfile",
|
18
|
-
"Rakefile",
|
19
|
-
"MIT-LICENSE",
|
20
|
-
"README.md",
|
21
|
-
"Rakefile",
|
22
|
-
"has_safe_dates.gemspec",
|
23
|
-
"lib/has_safe_dates/core_ext.rb",
|
24
|
-
"lib/has_safe_dates/version.rb",
|
25
|
-
"lib/has_safe_dates.rb",
|
26
|
-
"spec/db/database.yml",
|
27
|
-
"spec/db/schema.rb",
|
28
|
-
"spec/has_safe_dates_spec.rb",
|
29
|
-
"spec/spec_helper.rb"
|
30
|
-
]
|
31
|
-
s.homepage = %q{http://github.com/kylejginavan/has_safe_dates}
|
32
|
-
s.require_paths = ["lib"]
|
33
|
-
s.summary = %q{Chronic based date setting for ActiveRecord models}
|
34
|
-
|
35
|
-
s.add_dependency('activerecord', ['>= 3.1.0'])
|
36
|
-
s.add_dependency('chronic')
|
37
|
-
|
38
|
-
s.add_development_dependency("sqlite3")
|
39
|
-
s.add_development_dependency("rspec")
|
40
|
-
s.add_development_dependency('database_cleaner')
|
41
|
-
end
|