sifttter-redux 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/HISTORY.md +6 -0
- data/README.md +19 -18
- data/bin/srd +1 -1
- data/lib/sifttter_redux/cli_message.rb +24 -14
- data/lib/sifttter_redux/configuration.rb +28 -10
- data/lib/sifttter_redux/date_range_maker.rb +1 -1
- data/lib/sifttter_redux/dbu.rb +4 -0
- data/lib/sifttter_redux/{extensions.rb → string_extensions.rb} +0 -0
- data/lib/sifttter_redux/version.rb +1 -1
- data/lib/sifttter_redux.rb +0 -1
- data/test/cli_message_test.rb +52 -0
- data/test/configuration_test.rb +76 -0
- data/test/{catch_up_test.rb → date_range_maker_test.rb} +16 -17
- metadata +8 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee3777283bf2b3748e1d5a2d835e7f875d96603f
|
4
|
+
data.tar.gz: 9e3caeb4839353e7ac748285e64582483d52081e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1ccdb1974ba23ecf3a143752c65ba1847c259f8636848c3814bad7872e527b269c752836303444762aa2f4c9a3b464c49ef00b4de20163291c4b6eabcdc16dc
|
7
|
+
data.tar.gz: 1f1a2efc918a43e59dc0e5dd620d2653da0273e15bc986a4e46227247ef723465e9e789532f974f3358a358a89ec7f11fbd0aee2358b6feb9ebbf3466a412e71
|
data/HISTORY.md
CHANGED
data/README.md
CHANGED
@@ -7,7 +7,7 @@ Siftter Redux's primary difference is in its execution method: it intended to ru
|
|
7
7
|
|
8
8
|
The aim of this project was to use a Raspberry Pi; as such, the instructions below are specifically catered to that platform. That said, it should be possible to install and configure on any *NIX platform.
|
9
9
|
|
10
|
-
|
10
|
+
# Prerequisites
|
11
11
|
|
12
12
|
In addition to Git (which, given you being on this site, I'll assume you have), there are two prerequisites needed to run Sifttter Redux in a *NIX environment:
|
13
13
|
|
@@ -21,13 +21,13 @@ $ sudo apt-get install ruby
|
|
21
21
|
$ sudo apt-get install uuid
|
22
22
|
```
|
23
23
|
|
24
|
-
|
24
|
+
# Installation
|
25
25
|
|
26
26
|
```
|
27
27
|
gem install sifttter-redux
|
28
28
|
```
|
29
29
|
|
30
|
-
|
30
|
+
# Usage
|
31
31
|
|
32
32
|
Syntax and usage can be accessed by running `srd help`:
|
33
33
|
|
@@ -55,7 +55,7 @@ COMMANDS
|
|
55
55
|
init - Install and initialize dependencies
|
56
56
|
```
|
57
57
|
|
58
|
-
|
58
|
+
## Initialization
|
59
59
|
|
60
60
|
```
|
61
61
|
$ srd init
|
@@ -70,7 +70,7 @@ Initialization will perform the following steps:
|
|
70
70
|
3. The location on your filesystem where Day One files will be temporarily stored
|
71
71
|
4. The location of your Day One files in Dropbox
|
72
72
|
|
73
|
-
|
73
|
+
## Basic Execution
|
74
74
|
|
75
75
|
```
|
76
76
|
$ srd exec
|
@@ -84,13 +84,13 @@ $ srd exec
|
|
84
84
|
#### EXECUTION COMPLETE!
|
85
85
|
```
|
86
86
|
|
87
|
-
|
87
|
+
## "Catch-up" Mode
|
88
88
|
|
89
89
|
Sometimes, events occur that prevent Sifttter Redux from running (power loss to your device, a bad Cron job, etc.). In this case, Sifttter Redux's "catch-up" mode can be used to collect any valid journal on or before today's date.
|
90
90
|
|
91
91
|
There are many ways to use this mode (note that "today" in these examples is **February 15, 2014**):
|
92
92
|
|
93
|
-
|
93
|
+
### Yesterday Catch-up
|
94
94
|
|
95
95
|
To create an entry for yesterday:
|
96
96
|
|
@@ -106,7 +106,7 @@ $ srd exec -y
|
|
106
106
|
#### EXECUTION COMPLETE!
|
107
107
|
```
|
108
108
|
|
109
|
-
|
109
|
+
### Last "N" Days Catch-up
|
110
110
|
|
111
111
|
Sifttter Redux allows you to specify the number of days back it should look for new entries:
|
112
112
|
|
@@ -124,6 +124,7 @@ $ srd exec -n 3
|
|
124
124
|
#### EXECUTION COMPLETE!
|
125
125
|
|
126
126
|
$ srd exec -n 12
|
127
|
+
#### EXECUTING...
|
127
128
|
---> INFO: Creating entries for dates from February 03, 2014 to February 14, 2014...
|
128
129
|
---> INFO: Downloading Sifttter files...DONE.
|
129
130
|
---> SUCCESS: February 03, 2014...
|
@@ -161,7 +162,7 @@ $ srd exec -i -n 3
|
|
161
162
|
#### EXECUTION COMPLETE!
|
162
163
|
```
|
163
164
|
|
164
|
-
|
165
|
+
### Last "N" Weeks Catch-up
|
165
166
|
|
166
167
|
Sifttter Redux also allows you to specify a number of weeks back that should be scanned for new entries:
|
167
168
|
|
@@ -249,7 +250,7 @@ $ srd exec -i -w 1
|
|
249
250
|
#### EXECUTION COMPLETE!
|
250
251
|
```
|
251
252
|
|
252
|
-
|
253
|
+
### Date Range Catch-up
|
253
254
|
|
254
255
|
To create entries for a range of dates:
|
255
256
|
|
@@ -354,13 +355,13 @@ $ srd exec -f "last monday" -t "yesterday"
|
|
354
355
|
|
355
356
|
See [Chronic's Examples section](https://github.com/mojombo/chronic#examples "Chronic Examples") for more examples.
|
356
357
|
|
357
|
-
|
358
|
+
# Cron Job
|
358
359
|
|
359
360
|
By installing an entry to the Raspberry Pi's `crontab`, Sifttter Redux can be run automatically on a schedule.
|
360
361
|
|
361
362
|
One issue that arises is the loading of the bundled gems; because `cron` runs in a limited environment, it does not automatically know where to find installed gems.
|
362
363
|
|
363
|
-
|
364
|
+
## Using RVM
|
364
365
|
|
365
366
|
If your Raspberry Pi uses RVM, this `crontab` entry will do:
|
366
367
|
|
@@ -368,7 +369,7 @@ If your Raspberry Pi uses RVM, this `crontab` entry will do:
|
|
368
369
|
55 23 * * * /bin/bash -l -c 'source "$HOME/.rvm/scripts/rvm" && srd exec'
|
369
370
|
```
|
370
371
|
|
371
|
-
|
372
|
+
## Globally Installing Bundled Gems
|
372
373
|
|
373
374
|
Another option is to install the bundled gems to the global gemset:
|
374
375
|
|
@@ -376,12 +377,12 @@ Another option is to install the bundled gems to the global gemset:
|
|
376
377
|
$ bundle install --global
|
377
378
|
```
|
378
379
|
|
379
|
-
|
380
|
+
# Known Issues
|
380
381
|
|
381
382
|
* Sifttter Redux makes no effort to see if entries already exist in Day One for a particular date. This means that if you're not careful, you might end up with duplicate entries. A future version will address this.
|
382
383
|
* At indeterminiate times (usually when in catch-up mode), Sifttter Redux will upload a file to Day One that Day One fails to read. Uncertain of the cause at this stage, but it's happened a few times.
|
383
384
|
|
384
|
-
|
385
|
+
# Future Releases
|
385
386
|
|
386
387
|
Some functionality I would like to tackle for future releases:
|
387
388
|
|
@@ -389,7 +390,7 @@ Some functionality I would like to tackle for future releases:
|
|
389
390
|
* Interactive cron job installer
|
390
391
|
* Smarter checking of the config file to see if an old version is being used
|
391
392
|
|
392
|
-
|
393
|
+
# Bugs and Feature Requests
|
393
394
|
|
394
395
|
To report bugs with or suggest features/changes for Sifttter Redux, please use the [Issues Page](http://github.com/bachya/sifttter-redux/issues).
|
395
396
|
|
@@ -401,7 +402,7 @@ Contributions are welcome and encouraged. To contribute:
|
|
401
402
|
* Push to the branch (`git push origin new-feature`).
|
402
403
|
* Create a new [Pull Request](http://github.com/bachya/sifttter-redux/compare/).
|
403
404
|
|
404
|
-
|
405
|
+
# License
|
405
406
|
|
406
407
|
(The MIT License)
|
407
408
|
|
@@ -413,7 +414,7 @@ The above copyright notice and this permission notice shall be included in all c
|
|
413
414
|
|
414
415
|
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
415
416
|
|
416
|
-
|
417
|
+
# Credits
|
417
418
|
|
418
419
|
* Craig Eley for [Sifttter](http://craigeley.com/post/72565974459/sifttter-an-ifttt-to-day-one-logger "Sifttter") and for giving me the idea for Sifttter Redux
|
419
420
|
* Dave Copeland for [GLI](https://github.com/davetron5000/gli "GLI")
|
data/bin/srd
CHANGED
@@ -162,7 +162,7 @@ command :exec do |c|
|
|
162
162
|
# Specific Range
|
163
163
|
if !command_complete && (options[:f] || options[:t])
|
164
164
|
begin
|
165
|
-
dates = SifttterRedux::DateRangeMaker.
|
165
|
+
dates = SifttterRedux::DateRangeMaker.range(options[:f], options[:t], options[:i])
|
166
166
|
|
167
167
|
if dates.last > Date.today
|
168
168
|
SifttterRedux::CliMessage.warning("Ignoring overextended end date and using today's date (#{ Date.today })")
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'string_extensions.rb')
|
2
|
+
|
1
3
|
module SifttterRedux
|
2
4
|
# ======================================================
|
3
5
|
# CliManager Module
|
@@ -36,18 +38,22 @@ module SifttterRedux
|
|
36
38
|
# @return Void
|
37
39
|
# ----------------------------------------------------
|
38
40
|
def self.info_block(m1, m2 = 'Done.', multiline = false)
|
39
|
-
if
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
41
|
+
if block_given?
|
42
|
+
if multiline
|
43
|
+
info(m1)
|
44
|
+
else
|
45
|
+
print "---> INFO: #{ m1 }".blue
|
46
|
+
end
|
44
47
|
|
45
|
-
|
48
|
+
yield
|
46
49
|
|
47
|
-
|
48
|
-
|
50
|
+
if multiline
|
51
|
+
info(m2)
|
52
|
+
else
|
53
|
+
puts m2.blue
|
54
|
+
end
|
49
55
|
else
|
50
|
-
|
56
|
+
fail ArgumentError, 'Did not specify a valid block'
|
51
57
|
end
|
52
58
|
end
|
53
59
|
|
@@ -92,13 +98,17 @@ module SifttterRedux
|
|
92
98
|
# @return Void
|
93
99
|
# ----------------------------------------------------
|
94
100
|
def self.section_block(m, multiline = true)
|
95
|
-
if
|
96
|
-
|
101
|
+
if block_given?
|
102
|
+
if multiline
|
103
|
+
section(m)
|
104
|
+
else
|
105
|
+
print "#### #{ m }".purple
|
106
|
+
end
|
107
|
+
|
108
|
+
yield
|
97
109
|
else
|
98
|
-
|
110
|
+
fail ArgumentError, 'Did not specify a valid block'
|
99
111
|
end
|
100
|
-
|
101
|
-
yield
|
102
112
|
end
|
103
113
|
|
104
114
|
# ----------------------------------------------------
|
@@ -18,6 +18,24 @@ module SifttterRedux
|
|
18
18
|
def self.[](section_name)
|
19
19
|
@data[section_name]
|
20
20
|
end
|
21
|
+
|
22
|
+
# ----------------------------------------------------
|
23
|
+
# []= method
|
24
|
+
#
|
25
|
+
# Assigns the passed hash to the section. NOTE THAT THE
|
26
|
+
# PREVIOUS CONTENTS OF THAT SECTION ARE DELETED.
|
27
|
+
# @param section_name The section in which to look
|
28
|
+
# @param hash The Hash that gets merged into the section
|
29
|
+
# @return Void
|
30
|
+
# ----------------------------------------------------
|
31
|
+
def self.[]=(section_name, hash)
|
32
|
+
if hash.is_a?(Hash)
|
33
|
+
@data[section_name] = {}
|
34
|
+
@data[section_name].merge!(hash)
|
35
|
+
else
|
36
|
+
fail ArgumentError, "Parameter is not a Hash: #{hash}"
|
37
|
+
end
|
38
|
+
end
|
21
39
|
|
22
40
|
# ----------------------------------------------------
|
23
41
|
# add_section method
|
@@ -58,6 +76,16 @@ module SifttterRedux
|
|
58
76
|
CliMessage.warning("Can't delete non-existing section: #{section_name}")
|
59
77
|
end
|
60
78
|
end
|
79
|
+
|
80
|
+
# ----------------------------------------------------
|
81
|
+
# dump method
|
82
|
+
#
|
83
|
+
# Returns the data Hash
|
84
|
+
# @return Hash
|
85
|
+
# ----------------------------------------------------
|
86
|
+
def self.dump
|
87
|
+
@data
|
88
|
+
end
|
61
89
|
|
62
90
|
# ----------------------------------------------------
|
63
91
|
# load method
|
@@ -108,15 +136,5 @@ module SifttterRedux
|
|
108
136
|
def self.section_exists?(section_name)
|
109
137
|
@data.key?(section_name)
|
110
138
|
end
|
111
|
-
|
112
|
-
# ----------------------------------------------------
|
113
|
-
# to_s method
|
114
|
-
#
|
115
|
-
# Method to output this Module as a String.
|
116
|
-
# @return Void
|
117
|
-
# ----------------------------------------------------
|
118
|
-
def self.to_s
|
119
|
-
puts @data
|
120
|
-
end
|
121
139
|
end
|
122
140
|
end
|
@@ -65,7 +65,7 @@ module SifttterRedux
|
|
65
65
|
# @param options Miscellaneous options hash
|
66
66
|
# @return Range
|
67
67
|
# ------------------------------------------------------
|
68
|
-
def self.
|
68
|
+
def self.range(start_date, end_date, include_today = false)
|
69
69
|
fail ArgumentError, "You can't specify -t without specifying -f" if start_date.nil? && !end_date.nil?
|
70
70
|
|
71
71
|
begin
|
data/lib/sifttter_redux/dbu.rb
CHANGED
@@ -5,6 +5,7 @@ module SifttterRedux
|
|
5
5
|
# Wrapper module for the Dropbox Uploader project
|
6
6
|
# ======================================================
|
7
7
|
module DBU
|
8
|
+
CONFIG_FILEPATH = File.join(ENV['HOME'], '.dropbox_uploader')
|
8
9
|
DEFAULT_MESSAGE = 'RUNNING DROPBOX UPLOADER'
|
9
10
|
|
10
11
|
# ----------------------------------------------------
|
@@ -57,6 +58,9 @@ module SifttterRedux
|
|
57
58
|
system "git clone https://github.com/andreafabrizi/Dropbox-Uploader.git #{ path }"
|
58
59
|
end
|
59
60
|
end
|
61
|
+
|
62
|
+
# If the user has never configured Dropbox Uploader, have them do it here.
|
63
|
+
system "#{ @dbu }" unless File.exists?(CONFIG_FILEPATH)
|
60
64
|
|
61
65
|
Configuration.add_section('db_uploader')
|
62
66
|
Configuration['db_uploader'].merge!('local_filepath' => path)
|
File without changes
|
data/lib/sifttter_redux.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'sifttter_redux/cli_message.rb'
|
2
2
|
require 'sifttter_redux/configuration.rb'
|
3
3
|
require 'sifttter_redux/date_range_maker.rb'
|
4
|
-
require 'sifttter_redux/extensions.rb'
|
5
4
|
require 'sifttter_redux/dbu.rb'
|
6
5
|
require 'sifttter_redux/os.rb'
|
7
6
|
require 'sifttter_redux/sifttter.rb'
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
require File.join(File.dirname(__FILE__), "..", "lib/sifttter_redux/cli_message.rb")
|
3
|
+
|
4
|
+
class CliMessageTest < Test::Unit::TestCase
|
5
|
+
def test_error_message
|
6
|
+
assert_output('---> ERROR: test'.red + "\n") { SifttterRedux::CliMessage.error('test') }
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_info_message
|
10
|
+
assert_output('---> INFO: test'.blue + "\n") { SifttterRedux::CliMessage.info('test') }
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_info_block_single_line
|
14
|
+
assert_output("---> INFO: start".blue + "body\n" + 'end'.blue + "\n") do
|
15
|
+
SifttterRedux::CliMessage.info_block('start', 'end') { puts 'body' }
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_info_block_multiline
|
20
|
+
assert_output("---> INFO: start".blue + "\nbody\n" + '---> INFO: end'.blue + "\n") do
|
21
|
+
SifttterRedux::CliMessage.info_block('start', 'end', true) { puts 'body' }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_info_block_no_block
|
26
|
+
assert_raise ArgumentError do
|
27
|
+
SifttterRedux::CliMessage.info_block('start', 'end', true)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_prompt
|
32
|
+
assert_equal(SifttterRedux::CliMessage.prompt('Pick the default option', 'default'), 'default')
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_section_message
|
36
|
+
assert_output('#### test'.purple + "\n") { SifttterRedux::CliMessage.section('test') }
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_section_block_single_line
|
40
|
+
assert_output("#### section".purple + "\nbody\n") do
|
41
|
+
SifttterRedux::CliMessage.section_block('section', true) { puts 'body' }
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_success_message
|
46
|
+
assert_output('---> SUCCESS: test'.green + "\n") { SifttterRedux::CliMessage.success('test') }
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_warning_message
|
50
|
+
assert_output('---> WARNING: test'.yellow + "\n") { SifttterRedux::CliMessage.warning('test') }
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
require File.join(File.dirname(__FILE__), "..", "lib/sifttter_redux/configuration.rb")
|
3
|
+
|
4
|
+
class ConfigurationTest < Test::Unit::TestCase
|
5
|
+
|
6
|
+
def setup
|
7
|
+
SifttterRedux::Configuration.load('/tmp/srd_config')
|
8
|
+
end
|
9
|
+
|
10
|
+
def teardown
|
11
|
+
File.delete('/tmp/srd_config') if File.exists?('/tmp/srd_config')
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_add_data
|
15
|
+
SifttterRedux::Configuration.add_section('section1')
|
16
|
+
SifttterRedux::Configuration['section1'] = { 'a' => 'test', 'b' => 'test' }
|
17
|
+
assert_equal(SifttterRedux::Configuration.dump, { 'section1' => { 'a' => 'test', 'b' => 'test' } })
|
18
|
+
|
19
|
+
SifttterRedux::Configuration['section1']['a'] = 'bigger test'
|
20
|
+
SifttterRedux::Configuration['section1']['c'] = 'little test'
|
21
|
+
assert_equal(SifttterRedux::Configuration.dump, { 'section1' => { 'a' => 'bigger test', 'b' => 'test', 'c' => 'little test' } })
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_add_section
|
25
|
+
SifttterRedux::Configuration.add_section('section1')
|
26
|
+
SifttterRedux::Configuration.add_section('section2')
|
27
|
+
assert_equal(SifttterRedux::Configuration.dump, { 'section1' => {}, 'section2' => {} })
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_add_section_duplicate
|
31
|
+
SifttterRedux::Configuration.add_section('section1')
|
32
|
+
SifttterRedux::Configuration.add_section('section2')
|
33
|
+
SifttterRedux::Configuration.add_section('section2')
|
34
|
+
assert_equal(SifttterRedux::Configuration.dump, { 'section1' => {}, 'section2' => {} })
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_config_path
|
38
|
+
assert_equal(SifttterRedux::Configuration.config_path, '/tmp/srd_config')
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_delete_section
|
42
|
+
SifttterRedux::Configuration.add_section('section1')
|
43
|
+
SifttterRedux::Configuration.add_section('section2')
|
44
|
+
SifttterRedux::Configuration.delete_section('section2')
|
45
|
+
assert_equal(SifttterRedux::Configuration.dump, { 'section1' => {} })
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_delete_section_nonexistant
|
49
|
+
SifttterRedux::Configuration.add_section('section1')
|
50
|
+
SifttterRedux::Configuration.delete_section('section12723762323')
|
51
|
+
assert_equal(SifttterRedux::Configuration.dump, { 'section1' => {} })
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_reset
|
55
|
+
SifttterRedux::Configuration.add_section('section1')
|
56
|
+
SifttterRedux::Configuration.add_section('section2')
|
57
|
+
SifttterRedux::Configuration.add_section('section3')
|
58
|
+
SifttterRedux::Configuration.reset
|
59
|
+
assert_equal(SifttterRedux::Configuration.dump, {})
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_save
|
63
|
+
SifttterRedux::Configuration.add_section('section1')
|
64
|
+
SifttterRedux::Configuration['section1'] = { 'a' => 'test', 'b' => 'test' }
|
65
|
+
SifttterRedux::Configuration.save
|
66
|
+
|
67
|
+
File.open('/tmp/srd_config', 'r') do |f|
|
68
|
+
assert_output("---\nsection1:\n a: test\n b: test\n") { puts f.read }
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_section_exists
|
73
|
+
SifttterRedux::Configuration.add_section('section1')
|
74
|
+
assert_equal(SifttterRedux::Configuration.section_exists?('section1'), true)
|
75
|
+
end
|
76
|
+
end
|
@@ -1,9 +1,8 @@
|
|
1
1
|
require "date"
|
2
2
|
require "test_helper"
|
3
|
-
require File.join(File.dirname(__FILE__), "..", "lib/sifttter_redux/
|
4
|
-
|
5
|
-
class DefaultTest < Test::Unit::TestCase
|
3
|
+
require File.join(File.dirname(__FILE__), "..", "lib/sifttter_redux/date_range_maker.rb")
|
6
4
|
|
5
|
+
class DateRangeMakerTest < Test::Unit::TestCase
|
7
6
|
def test_today
|
8
7
|
assert_equal(SifttterRedux::DateRangeMaker.today, (Date.today..Date.today))
|
9
8
|
end
|
@@ -64,37 +63,37 @@ class DefaultTest < Test::Unit::TestCase
|
|
64
63
|
assert_equal(SifttterRedux::DateRangeMaker.last_n_weeks(2, true), (Date.today - Date.today.wday - 13..end_date))
|
65
64
|
end
|
66
65
|
|
67
|
-
def
|
68
|
-
assert_equal(SifttterRedux::DateRangeMaker.
|
66
|
+
def test_range_only_start_date
|
67
|
+
assert_equal(SifttterRedux::DateRangeMaker.range("2014-02-01", nil), (Date.parse("2014-02-01")...Date.today))
|
69
68
|
end
|
70
69
|
|
71
|
-
def
|
72
|
-
assert_equal(SifttterRedux::DateRangeMaker.
|
70
|
+
def test_range_only_start_date_include_today
|
71
|
+
assert_equal(SifttterRedux::DateRangeMaker.range("2014-02-01", nil, true), (Date.parse("2014-02-01")..Date.today))
|
73
72
|
end
|
74
73
|
|
75
|
-
def
|
76
|
-
assert_equal(SifttterRedux::DateRangeMaker.
|
74
|
+
def test_range_start_date_and_end_date
|
75
|
+
assert_equal(SifttterRedux::DateRangeMaker.range("2014-02-01", "2014-02-05"), (Date.parse("2014-02-01")..Date.parse("2014-02-05")))
|
77
76
|
end
|
78
77
|
|
79
|
-
def
|
80
|
-
assert_raise ArgumentError do
|
81
|
-
SifttterRedux::DateRangeMaker.
|
78
|
+
def test_range_bad_dates
|
79
|
+
assert_raise ArgumentError do
|
80
|
+
SifttterRedux::DateRangeMaker.range("Bad Start Date", "Bad End Date")
|
82
81
|
end
|
83
82
|
end
|
84
83
|
|
85
|
-
def
|
84
|
+
def test_range_end_date_with_no_start_date
|
86
85
|
assert_raise ArgumentError do
|
87
|
-
SifttterRedux::DateRangeMaker.
|
86
|
+
SifttterRedux::DateRangeMaker.range(nil, Date.today)
|
88
87
|
end
|
89
88
|
end
|
90
89
|
|
91
|
-
def
|
90
|
+
def test_range_end_date_before_start_date
|
92
91
|
assert_raise ArgumentError do
|
93
|
-
SifttterRedux::DateRangeMaker.
|
92
|
+
SifttterRedux::DateRangeMaker.range(Date.today, Date.today - 1)
|
94
93
|
end
|
95
94
|
end
|
96
95
|
|
97
|
-
def
|
96
|
+
def test_range_negative_look_back
|
98
97
|
assert_raise ArgumentError do
|
99
98
|
SifttterRedux::DateRangeMaker.last_n_days(-5)
|
100
99
|
end
|
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.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Bach
|
@@ -75,12 +75,14 @@ files:
|
|
75
75
|
- lib/sifttter_redux/configuration.rb
|
76
76
|
- lib/sifttter_redux/date_range_maker.rb
|
77
77
|
- lib/sifttter_redux/dbu.rb
|
78
|
-
- lib/sifttter_redux/extensions.rb
|
79
78
|
- lib/sifttter_redux/os.rb
|
80
79
|
- lib/sifttter_redux/sifttter.rb
|
80
|
+
- lib/sifttter_redux/string_extensions.rb
|
81
81
|
- lib/sifttter_redux/version.rb
|
82
82
|
- sifttter_redux.gemspec
|
83
|
-
- test/
|
83
|
+
- test/cli_message_test.rb
|
84
|
+
- test/configuration_test.rb
|
85
|
+
- test/date_range_maker_test.rb
|
84
86
|
- test/test_helper.rb
|
85
87
|
homepage: https://github.com/bachya/sifttter-redux
|
86
88
|
licenses:
|
@@ -109,6 +111,8 @@ signing_key:
|
|
109
111
|
specification_version: 4
|
110
112
|
summary: Automated IFTTT to Day One engine.
|
111
113
|
test_files:
|
112
|
-
- test/
|
114
|
+
- test/cli_message_test.rb
|
115
|
+
- test/configuration_test.rb
|
116
|
+
- test/date_range_maker_test.rb
|
113
117
|
- test/test_helper.rb
|
114
118
|
has_rdoc:
|