calendar_sniper 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- NzgxMjAxMzBhYTllYzBkMTU1NDVjMGM4YTFiMWQxYzkzM2NhOTQ5NQ==
5
- data.tar.gz: !binary |-
6
- ODcyMzVkMTlmYjVlNDEwZjVhYzc2ZDE4ZDRkZGQxMDg5ZmU3NjViZA==
2
+ SHA1:
3
+ metadata.gz: 7c31d7ad2c0cd59a2ea753b0b7e68d92161adb2a
4
+ data.tar.gz: f10f266b27d03f539445d466a35a6ede16e8f677
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- MjBmN2VmOGRkZDJhZjYzNTFjOTcwNTkxMjkwZWIxNjI5YjA1ZDJmZjE0MDg0
10
- YmRmZDAzZDBjYThiOWNkZDRlNDk3OGFhZjUwMTEyNzNhNWY2NzljN2JjY2Qy
11
- NjUzZGZmMDM1MTk4MWYzZmRlYmFiYzhkZGFmOWZkYWY0ZjUwOTk=
12
- data.tar.gz: !binary |-
13
- YTQ5NjZmYjMyNWFlM2MyNzNhOTVmNzc1M2EyNjFmMDc0OTY5MDg2MmQ4YWYx
14
- NGMyZGU5MTUzZDM1NDhjNGJkNWIxNWVmZDUzMTQ4MjU3NmJiNTYzY2QyNmUw
15
- N2MzNTNiNTI4YWE4YzU4ZWE4ODAyYWQwYWEyOWNmZTliMjRjMDY=
6
+ metadata.gz: 2084a8b32b9ac82173f2ba176f0b13bb9877d264f673b6278f65e87da5a75b1c38853c612abd84cfbf9af31b941e713120278f74dbed2ca36e88b36664398104
7
+ data.tar.gz: 00304cc06324e6a61b28ec67fe6b39243992e7c7c8d22c0e3d21f19c67f5e1e7567b989ccc4870c896ae154e76eeac4c76f863d954d91c87687c09ce49b72e60
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format documentation
data/README.md CHANGED
@@ -1,12 +1,12 @@
1
- # CalendarSniper
1
+ # calendar_sniper
2
2
 
3
- CalendarSniper adds date related scopes to ActiveRecord models
3
+ calendar_sniper adds date related scopes to ActiveRecord models
4
4
 
5
5
  ## Installation
6
6
 
7
7
  Add this line to your application's Gemfile:
8
8
 
9
- gem 'CaendarSniper'
9
+ gem 'calendar_sniper'
10
10
 
11
11
  And then execute:
12
12
 
@@ -14,11 +14,11 @@ And then execute:
14
14
 
15
15
  Or install it yourself as:
16
16
 
17
- $ gem install CalendarSniper
17
+ $ gem install calendar_sniper
18
18
 
19
19
  ## Usage
20
20
 
21
- CalendarSniper adds ```with_date_range```, ```with_to_date```, ```with_from_date```, and ```in_date_range``` scopes to ActiveRecord models that it is included into.
21
+ calendar_sniper adds ```with_date_range```, ```with_to_date```, ```with_from_date```, and ```in_date_range``` scopes to ActiveRecord models that it is included into.
22
22
 
23
23
  ```with_date_range``` takes a number that is the number of days
24
24
  ```in_date_range``` takes a start and end date
data/Rakefile CHANGED
@@ -1 +1,7 @@
1
1
  require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new('spec')
5
+
6
+ # If you want to make this the default task
7
+ task :default => :spec
@@ -19,6 +19,8 @@ Gem::Specification.new do |spec|
19
19
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
20
  spec.require_paths = ["lib"]
21
21
 
22
+ spec.add_dependency "activesupport", '>= 3.0.0'
22
23
  spec.add_development_dependency "bundler", "~> 1.3"
23
24
  spec.add_development_dependency "rake"
25
+ spec.add_development_dependency "rspec"
24
26
  end
@@ -1,3 +1,3 @@
1
1
  module CalendarSniper
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
@@ -1,4 +1,5 @@
1
1
  require "calendar_sniper/version"
2
+ require 'active_support'
2
3
 
3
4
  module CalendarSniper
4
5
  extend ActiveSupport::Concern
@@ -57,7 +58,9 @@ module CalendarSniper
57
58
  if /^\d{1,2}\/\d{1,2}\/\d{4}/ =~ str
58
59
  '%m/%d/%Y'
59
60
  elsif /^\d{4}-\d{1,2}-\d{1,2}/ =~ str
60
- if /^\d{4}-\d{1,2}-\d{1,2} \d{1,2}:\d{2}:\d{2}+/ =~ str
61
+ if /^\d{4}-\d{1,2}-\d{1,2}\s+\d{1,2}:\d{2}:\d{2}+[\+-]\d+/ =~ str
62
+ '%Y-%m-%d %k:%M:%S%z'
63
+ elsif /^\d{4}-\d{1,2}-\d{1,2}\s+\d{1,2}:\d{2}:\d{2}+/ =~ str
61
64
  '%Y-%m-%d %k:%M:%S'
62
65
  elsif /^\d{4}-\d{1,2}-\d{1,2} \S+/ =~ str
63
66
  '%Y-%m-%d %Z'
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+ describe CalendarSniper::ClassMethods do
3
+ class TestSniper
4
+ extend CalendarSniper::ClassMethods
5
+ end
6
+
7
+ [
8
+ [ '%m/%d/%Y', '1/1/2013' ],
9
+ [ '%m/%d/%Y', '01/1/2013' ],
10
+ [ '%m/%d/%Y', '1/01/2013' ],
11
+ [ '%m/%d/%Y', '01/01/2013'],
12
+ [ '%Y-%m-%d', '2013-01-01'],
13
+ [ '%Y-%m-%d %Z', '2013-01-01 +01:00' ],
14
+ [ '%Y-%m-%d %k:%M:%S', '2013-01-01 3:00:00' ],
15
+ [ '%Y-%m-%d %l:%M:%S%z', '2013-01-01 2:50:00-0400']
16
+ ].each do |format, example|
17
+ it "can parse #{example} as #{format}" do
18
+ expect(TestSniper.send(:coalesce_date, example, '=')).to eq(DateTime.strptime(example, format))
19
+ end
20
+ end
21
+
22
+ it 'fails when there is an invalid string' do
23
+ expect { TestSniper.send(:date_format_for_string, 'bogus') }.to raise_error
24
+ end
25
+ end
@@ -0,0 +1,8 @@
1
+ require 'bundler/setup'
2
+ Bundler.setup
3
+
4
+ require 'calendar_sniper' # and any other gems you need
5
+
6
+ RSpec.configure do |config|
7
+ # some (optional) config here
8
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calendar_sniper
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris MacNaughton
@@ -9,8 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-02 00:00:00.000000000 Z
12
+ date: 2014-04-11 00:00:00.000000000 Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: activesupport
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - '>='
19
+ - !ruby/object:Gem::Version
20
+ version: 3.0.0
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - '>='
26
+ - !ruby/object:Gem::Version
27
+ version: 3.0.0
14
28
  - !ruby/object:Gem::Dependency
15
29
  name: bundler
16
30
  requirement: !ruby/object:Gem::Requirement
@@ -29,14 +43,28 @@ dependencies:
29
43
  name: rake
30
44
  requirement: !ruby/object:Gem::Requirement
31
45
  requirements:
32
- - - ! '>='
46
+ - - '>='
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: rspec
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - '>='
33
61
  - !ruby/object:Gem::Version
34
62
  version: '0'
35
63
  type: :development
36
64
  prerelease: false
37
65
  version_requirements: !ruby/object:Gem::Requirement
38
66
  requirements:
39
- - - ! '>='
67
+ - - '>='
40
68
  - !ruby/object:Gem::Version
41
69
  version: '0'
42
70
  description: Gem that adds date related scopes to ActiveRecord models
@@ -48,6 +76,7 @@ extensions: []
48
76
  extra_rdoc_files: []
49
77
  files:
50
78
  - .gitignore
79
+ - .rspec
51
80
  - Gemfile
52
81
  - LICENSE.txt
53
82
  - README.md
@@ -55,6 +84,8 @@ files:
55
84
  - calendar_sniper.gemspec
56
85
  - lib/calendar_sniper.rb
57
86
  - lib/calendar_sniper/version.rb
87
+ - spec/parsing_spec.rb
88
+ - spec/spec_helper.rb
58
89
  homepage: https://github.com/eLocal/calendar_sniper
59
90
  licenses:
60
91
  - MIT
@@ -65,20 +96,21 @@ require_paths:
65
96
  - lib
66
97
  required_ruby_version: !ruby/object:Gem::Requirement
67
98
  requirements:
68
- - - ! '>='
99
+ - - '>='
69
100
  - !ruby/object:Gem::Version
70
101
  version: '0'
71
102
  required_rubygems_version: !ruby/object:Gem::Requirement
72
103
  requirements:
73
- - - ! '>='
104
+ - - '>='
74
105
  - !ruby/object:Gem::Version
75
106
  version: '0'
76
107
  requirements: []
77
108
  rubyforge_project:
78
- rubygems_version: 2.1.5
109
+ rubygems_version: 2.2.2
79
110
  signing_key:
80
111
  specification_version: 4
81
112
  summary: CalendarSniper adds with_date_range, with_to_date, with_from_date, and in_date_range
82
113
  scopes to ActiveRecord models that it is included into.
83
- test_files: []
84
- has_rdoc:
114
+ test_files:
115
+ - spec/parsing_spec.rb
116
+ - spec/spec_helper.rb