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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YjZhZTIzMTI3NTM1Mjc1MjFhZThiODc5ZmI2YmFkZjc4YTk2ZDY3Yw==
4
+ ZDU5ZGQ5Y2Q5MjhhMmZkMjczNjk1NGMxNGZkNWM0ZjcwMDRiNGJjYg==
5
5
  data.tar.gz: !binary |-
6
- OTAxYzExZjZjNDc1MmU5NjVkY2RkYjE1MTU3YzYwNDliMmU5Nzk2YQ==
6
+ NmEwNjIwMDQxZGVmZDkwNzA1ZDE2ZWJmMGYzM2NjN2MyOTUyYzVhZQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NDA2Y2VmYTg4YWIzNTFkZTg0YjYyMTAyZGQ1ODM1Y2IzMjE0ZDA5NDkwZjIy
10
- ZmQ2NDBhYzExYjIxMjVjM2U1NTY4NDkxYWY2ZmI4NjhlYWY3OTU3ZTVkMjE5
11
- M2NiMTFjNTY5NTlmYTljYjY2ZWY4ZDVkZGM3NTk5MWRhNmFkMzE=
9
+ NTA2NzBlYTgxNjQyMmMxMWVkNDgzYTlkYzlkM2U1ZDAwNDExYzI0M2RlYTE0
10
+ NGQxYTg4YTUzYmFhOWI5NThiMDRhZjkxZWRhYzZkN2QyYThlMGVhNDJlNDcx
11
+ Y2ExM2E1OWE3MTUxYWJhYzRjZjQxODY2NWIyYjU0Y2I2MzBlNWI=
12
12
  data.tar.gz: !binary |-
13
- NDEzOTY5YWZkZmMyZDBiOWRlNWVkOTNhZGNjYmVhNjAzNjFhMmExYTc0ZTgx
14
- MDg1ODY4YTM0M2U4MzRkMzkzM2M3YzFiNzdlMGIzZDVhNjQ5ZTAwMjc1NTAz
15
- MjI4NmMzN2IzMmRiMjcwMjJlODVlZGRiOWQ5YWZmMGUyMzg4NzY=
13
+ ZGQ5N2QwNDM2MTAyZmFkY2VjYjg5OWQ3NTdhYTdkNDA2OWQ0MTY4M2Q0YjU2
14
+ ZDNmNmE1NTJlMTU0N2MyODdlMzBkNDM2MDU1ZmI1NTE4N2RkNDdkMjMwMjNi
15
+ MDY2YjQ4NzJiMDYyNDZkZTY2YjNlYjMxNzFiYWQ1NGRmMGNhMWE=
data/HISTORY.md CHANGED
@@ -1,3 +1,8 @@
1
+ # 0.3.1
2
+
3
+ * Removed reliance on Rails methods for first-and-last-day-of-week calculations
4
+ * Fixed a bug with the gemspec
5
+
1
6
  # 0.3.0
2
7
 
3
8
  * Added ability to create entries for the past N days (not just 7)
@@ -1,5 +1,5 @@
1
1
  module SifttterRedux
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
 
4
4
  # Sifttter and Sifttter Redux Constants
5
5
  SRD_CONFIG_FILEPATH = File.join(ENV['HOME'], '.sifttter_redux')
@@ -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.at_beginning_of_week
119
- end_date = Date.today.at_end_of_week
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.week..end_date)
127
+ _r = (beginning_date - num_weeks * 7..end_date)
129
128
  else
130
- _r = (beginning_date - num_weeks.week...end_date)
129
+ _r = (beginning_date - num_weeks * 7...end_date)
131
130
  end
132
131
 
133
132
  return _r
@@ -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')
@@ -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.at_end_of_week
38
- if Date.today.at_end_of_week > Date.today
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.at_beginning_of_week...end_date))
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.at_end_of_week
47
- if Date.today.at_end_of_week > Date.today
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.at_beginning_of_week..end_date))
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.at_end_of_week
56
- if Date.today.at_end_of_week > Date.today
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.at_beginning_of_week - 2.week...end_date))
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.at_end_of_week
65
- if Date.today.at_end_of_week > Date.today
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.at_beginning_of_week - 2.week..end_date))
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.0
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