sifttter-redux 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/HISTORY.md +5 -0
- data/lib/sifttter-redux/constants.rb +1 -1
- data/lib/sifttter-redux/date-range-maker.rb +4 -5
- data/sifttter-redux.gemspec +0 -1
- data/test/catch_up_test.rb +12 -13
- metadata +1 -15
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZDU5ZGQ5Y2Q5MjhhMmZkMjczNjk1NGMxNGZkNWM0ZjcwMDRiNGJjYg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NmEwNjIwMDQxZGVmZDkwNzA1ZDE2ZWJmMGYzM2NjN2MyOTUyYzVhZQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NTA2NzBlYTgxNjQyMmMxMWVkNDgzYTlkYzlkM2U1ZDAwNDExYzI0M2RlYTE0
|
10
|
+
NGQxYTg4YTUzYmFhOWI5NThiMDRhZjkxZWRhYzZkN2QyYThlMGVhNDJlNDcx
|
11
|
+
Y2ExM2E1OWE3MTUxYWJhYzRjZjQxODY2NWIyYjU0Y2I2MzBlNWI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZGQ5N2QwNDM2MTAyZmFkY2VjYjg5OWQ3NTdhYTdkNDA2OWQ0MTY4M2Q0YjU2
|
14
|
+
ZDNmNmE1NTJlMTU0N2MyODdlMzBkNDM2MDU1ZmI1NTE4N2RkNDdkMjMwMjNi
|
15
|
+
MDY2YjQ4NzJiMDYyNDZkZTY2YjNlYjMxNzFiYWQ1NGRmMGNhMWE=
|
data/HISTORY.md
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'active_support/core_ext'
|
2
1
|
require 'chronic'
|
3
2
|
|
4
3
|
#| ======================================================
|
@@ -115,8 +114,8 @@ class DateRangeMaker
|
|
115
114
|
opts[k] = v
|
116
115
|
end
|
117
116
|
|
118
|
-
beginning_date = Date.today.
|
119
|
-
end_date = Date.today.
|
117
|
+
beginning_date = Date.today - Date.today.wday + 1
|
118
|
+
end_date = Date.today - Date.today.wday + 7
|
120
119
|
|
121
120
|
# We're currently before the end of the week, so
|
122
121
|
# reset the new ending date to today.
|
@@ -125,9 +124,9 @@ class DateRangeMaker
|
|
125
124
|
end
|
126
125
|
|
127
126
|
if (opts[:include_today])
|
128
|
-
_r = (beginning_date - num_weeks
|
127
|
+
_r = (beginning_date - num_weeks * 7..end_date)
|
129
128
|
else
|
130
|
-
_r = (beginning_date - num_weeks
|
129
|
+
_r = (beginning_date - num_weeks * 7...end_date)
|
131
130
|
end
|
132
131
|
|
133
132
|
return _r
|
data/sifttter-redux.gemspec
CHANGED
@@ -22,7 +22,6 @@ spec = Gem::Specification.new do |s|
|
|
22
22
|
s.extra_rdoc_files = %w[README.md HISTORY.md LICENSE]
|
23
23
|
|
24
24
|
s.add_development_dependency('rake', '~> 0')
|
25
|
-
s.add_runtime_dependency('activesupport', '~> 0')
|
26
25
|
s.add_runtime_dependency('chronic', '0.10.2')
|
27
26
|
s.add_runtime_dependency('colored','1.2')
|
28
27
|
s.add_runtime_dependency('gli','2.9.0')
|
data/test/catch_up_test.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'active_support/core_ext'
|
2
1
|
require 'date'
|
3
2
|
require 'test_helper'
|
4
3
|
require File.join(File.dirname(__FILE__), '..', 'lib/sifttter-redux/date-range-maker.rb')
|
@@ -34,39 +33,39 @@ class DefaultTest < Test::Unit::TestCase
|
|
34
33
|
end
|
35
34
|
|
36
35
|
def test_current_week
|
37
|
-
end_date = Date.today.
|
38
|
-
if
|
36
|
+
end_date = Date.today - Date.today.wday + 7
|
37
|
+
if end_date > Date.today
|
39
38
|
end_date = Date.today
|
40
39
|
end
|
41
40
|
|
42
|
-
assert_equal($drm.last_n_weeks, (Date.today.
|
41
|
+
assert_equal($drm.last_n_weeks, (Date.today - Date.today.wday + 1...end_date))
|
43
42
|
end
|
44
43
|
|
45
44
|
def test_current_week_include_today
|
46
|
-
end_date = Date.today.
|
47
|
-
if
|
45
|
+
end_date = Date.today - Date.today.wday + 7
|
46
|
+
if end_date > Date.today
|
48
47
|
end_date = Date.today
|
49
48
|
end
|
50
49
|
|
51
|
-
assert_equal($drm.last_n_weeks(0, {:include_today => true}), (Date.today.
|
50
|
+
assert_equal($drm.last_n_weeks(0, {:include_today => true}), (Date.today - Date.today.wday + 1..end_date))
|
52
51
|
end
|
53
52
|
|
54
53
|
def test_last_2_weeks
|
55
|
-
end_date = Date.today.
|
56
|
-
if
|
54
|
+
end_date = Date.today - Date.today.wday + 7
|
55
|
+
if end_date > Date.today
|
57
56
|
end_date = Date.today
|
58
57
|
end
|
59
58
|
|
60
|
-
assert_equal($drm.last_n_weeks(2), (Date.today.
|
59
|
+
assert_equal($drm.last_n_weeks(2), (Date.today - Date.today.wday - 13...end_date))
|
61
60
|
end
|
62
61
|
|
63
62
|
def test_last_2_weeks_include_today
|
64
|
-
end_date = Date.today.
|
65
|
-
if
|
63
|
+
end_date = Date.today - Date.today.wday + 7
|
64
|
+
if end_date > Date.today
|
66
65
|
end_date = Date.today
|
67
66
|
end
|
68
67
|
|
69
|
-
assert_equal($drm.last_n_weeks(2, {:include_today => true}), (Date.today.
|
68
|
+
assert_equal($drm.last_n_weeks(2, {:include_today => true}), (Date.today - Date.today.wday - 13..end_date))
|
70
69
|
end
|
71
70
|
|
72
71
|
def test_range_only_start_date
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sifttter-redux
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Bach
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: activesupport
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ~>
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ~>
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: chronic
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|