sifttter-redux 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/HISTORY.md +9 -0
- data/README.md +1 -1
- data/bin/srd +18 -17
- data/lib/sifttter-redux.rb +15 -13
- data/lib/sifttter-redux/constants.rb +1 -1
- data/lib/sifttter-redux/sifttter.rb +6 -2
- data/sifttter-redux.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f182a76d7be76e3ccdf01cba083d85245e2835ad
|
4
|
+
data.tar.gz: 21578bbf849033bdf56c68ac18b4e4b35fa912fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 882c5eb0824859668aa8f2f6c296071a76050c08f68820bac49873a290b334afa506d64190d41a516dbf21744989bdaeb16543f3bdf0e63bce5e8c073b5874de
|
7
|
+
data.tar.gz: 233d3e9bde6036ca58d339a6f49ffab8818b48ab0c9c5477c692a9123d0658a00e559f13b0ec8b1f055ed025b9867bd897d348d5112c90e28ed85884e2a95300
|
data/HISTORY.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
# 1.0.4 (2014-05-06)
|
2
|
+
|
3
|
+
* Fixed a bug where date range without and end date would incorrectly include today's date
|
4
|
+
|
5
|
+
# 1.0.3 (2014-05-05)
|
6
|
+
|
7
|
+
* Fixed a bug in which HTML entities from IFTTT could cause srd to fail
|
8
|
+
* Bumped CLIUtils version to 2.2.3
|
9
|
+
|
1
10
|
# 1.0.2 (2014-04-22)
|
2
11
|
|
3
12
|
* Added `-d` flag to catch up a specific date
|
data/README.md
CHANGED
data/bin/srd
CHANGED
@@ -70,12 +70,13 @@ pre do |global, command, options, args|
|
|
70
70
|
|
71
71
|
# Compare the two versions and, if needed, update.
|
72
72
|
configuration.compare_version do |c, l|
|
73
|
-
messenger.debug
|
73
|
+
messenger.debug("Upgrading from #{ c } to #{ l }")
|
74
74
|
SifttterRedux.update_config_file
|
75
75
|
exit!(0)
|
76
76
|
end
|
77
77
|
else
|
78
78
|
# Force the user to init if they try to run any command other than `init` first.
|
79
|
+
messenger.info('You need to initialize Sifttter Redux first!')
|
79
80
|
SifttterRedux.init(true)
|
80
81
|
exit!(0)
|
81
82
|
end
|
@@ -89,9 +90,9 @@ post do |global,command,options,args|
|
|
89
90
|
end
|
90
91
|
|
91
92
|
on_error do |exception|
|
92
|
-
messenger.error(exception.to_s)
|
93
|
-
exit!(1)
|
94
|
-
true
|
93
|
+
# messenger.error(exception.to_s)
|
94
|
+
# exit!(1)
|
95
|
+
# true
|
95
96
|
end
|
96
97
|
|
97
98
|
# ======================================================
|
@@ -134,9 +135,9 @@ command :exec do |c|
|
|
134
135
|
dbu.remote_target = configuration.sifttter_redux[:sifttter_remote_filepath]
|
135
136
|
dbu.message = 'Downloading Sifttter files...'
|
136
137
|
|
137
|
-
messenger.
|
138
|
-
|
139
|
-
|
138
|
+
messenger.info(dbu.message || dbu::DEFAULT_MESSAGE)
|
139
|
+
dbu.download
|
140
|
+
messenger.info('Done.')
|
140
141
|
|
141
142
|
# Process a new Sifttter entry for each date.
|
142
143
|
dates.each do |date|
|
@@ -149,9 +150,9 @@ command :exec do |c|
|
|
149
150
|
dbu.remote_target = configuration.sifttter_redux[:dayone_remote_filepath]
|
150
151
|
dbu.message = 'Uploading Day One entries to Dropbox...'
|
151
152
|
|
152
|
-
messenger.
|
153
|
-
|
154
|
-
|
153
|
+
messenger.info(dbu.message || dbu::DEFAULT_MESSAGE)
|
154
|
+
dbu.upload
|
155
|
+
messenger.info('Done.')
|
155
156
|
end
|
156
157
|
|
157
158
|
# Remove any downloaded local files that we no longer need.
|
@@ -202,9 +203,9 @@ command :upgrade do |c|
|
|
202
203
|
dbu.remote_target = configuration.sifttter_redux[:sifttter_remote_filepath]
|
203
204
|
dbu.message = "Backing up Sifttter files to #{ filename }..."
|
204
205
|
|
205
|
-
messenger.
|
206
|
-
|
207
|
-
|
206
|
+
messenger.info(dbu.message || dbu::DEFAULT_MESSAGE)
|
207
|
+
dbu.download
|
208
|
+
messenger.info('Done.')
|
208
209
|
|
209
210
|
# Archive the Sifttter files.
|
210
211
|
Archive::Zip.archive(filename, configuration.sifttter_redux[:sifttter_local_filepath])
|
@@ -215,7 +216,7 @@ command :upgrade do |c|
|
|
215
216
|
t.gsub!(/^- /, "@begin\n@date ")
|
216
217
|
t.gsub!(/ - /, "\n- ")
|
217
218
|
t.gsub!(/\s?@done/, '@end')
|
218
|
-
messenger.debug
|
219
|
+
messenger.debug("Replacing contents of file: #{ file }")
|
219
220
|
File.open(file, 'w') { |f| f.write(t) }
|
220
221
|
end
|
221
222
|
|
@@ -224,9 +225,9 @@ command :upgrade do |c|
|
|
224
225
|
dbu.remote_target = Pathname.new(configuration.sifttter_redux[:sifttter_remote_filepath]).dirname.to_s
|
225
226
|
dbu.message = "Uploading revised Sifttter files to Dropbox..."
|
226
227
|
|
227
|
-
messenger.
|
228
|
-
|
229
|
-
|
228
|
+
messenger.info(dbu.message || dbu::DEFAULT_MESSAGE)
|
229
|
+
dbu.upload
|
230
|
+
messenger.info('Done.')
|
230
231
|
|
231
232
|
# Remove any downloaded local files that we no longer need.
|
232
233
|
SifttterRedux.cleanup_temp_files
|
data/lib/sifttter-redux.rb
CHANGED
@@ -24,11 +24,10 @@ module SifttterRedux
|
|
24
24
|
configuration.sifttter_redux[:sifttter_local_filepath]
|
25
25
|
]
|
26
26
|
|
27
|
-
messenger.
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
end
|
27
|
+
messenger.info('Removing temporary local files...')
|
28
|
+
dirs.each do |d|
|
29
|
+
FileUtils.rm_rf(d)
|
30
|
+
messenger.debug("Removed directory: #{ d }")
|
32
31
|
end
|
33
32
|
end
|
34
33
|
|
@@ -60,14 +59,15 @@ module SifttterRedux
|
|
60
59
|
if File.directory?(dbu_path)
|
61
60
|
messenger.warn("Using pre-existing Dropbox Uploader at #{ dbu_path }...")
|
62
61
|
else
|
63
|
-
messenger.
|
64
|
-
|
65
|
-
|
62
|
+
messenger.info("Downloading Dropbox Uploader to #{ dbu_path }...")
|
63
|
+
system "git clone https://github.com/andreafabrizi/Dropbox-Uploader.git #{ dbu_path }"
|
64
|
+
messenger.info('Done.')
|
66
65
|
end
|
67
66
|
|
68
67
|
# If the user has never configured Dropbox Uploader, have them do it here.
|
69
68
|
unless File.exists?(DEFAULT_DBU_CONFIG_FILEPATH)
|
70
|
-
messenger.
|
69
|
+
messenger.info('Initializing Dropbox Uploader...')
|
70
|
+
system "#{ executable_path }"
|
71
71
|
end
|
72
72
|
|
73
73
|
configuration.add_section(:db_uploader) unless configuration.data.key?(:db_uploader)
|
@@ -87,7 +87,7 @@ module SifttterRedux
|
|
87
87
|
# @param [Hash] options GLI command line options
|
88
88
|
# @return [Range]
|
89
89
|
def self.get_dates_from_options(options)
|
90
|
-
if options[:c] || options[:n] || options[:w] ||
|
90
|
+
if options[:c] || options[:n] || options[:w] ||
|
91
91
|
options[:y] || options[:f] || options[:t] ||
|
92
92
|
options[:d]
|
93
93
|
# Yesterday
|
@@ -113,14 +113,14 @@ module SifttterRedux
|
|
113
113
|
messenger.warn("Ignoring overextended end date and using today's date (#{ Date.today })...")
|
114
114
|
r = (_dates.first..Date.today)
|
115
115
|
else
|
116
|
-
r =
|
116
|
+
r = _dates
|
117
117
|
end
|
118
118
|
end
|
119
119
|
else
|
120
120
|
r = DateRangeMaker.today
|
121
121
|
end
|
122
122
|
|
123
|
-
messenger.debug
|
123
|
+
messenger.debug("Date range: #{ r }")
|
124
124
|
r
|
125
125
|
end
|
126
126
|
|
@@ -129,6 +129,8 @@ module SifttterRedux
|
|
129
129
|
# @param [Boolean] from_scratch
|
130
130
|
# @return [void]
|
131
131
|
def self.init(from_scratch = false)
|
132
|
+
messenger.section('INITIALIZING...')
|
133
|
+
|
132
134
|
if from_scratch
|
133
135
|
configuration.reset
|
134
136
|
configuration.add_section(:sifttter_redux)
|
@@ -147,7 +149,7 @@ module SifttterRedux
|
|
147
149
|
pm.ask
|
148
150
|
configuration.ingest_prefs(pm)
|
149
151
|
|
150
|
-
messenger.debug
|
152
|
+
messenger.debug("Collected configuration values: #{ configuration.data }")
|
151
153
|
configuration.save
|
152
154
|
@initialized = true
|
153
155
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'htmlentities'
|
2
|
+
|
1
3
|
module SifttterRedux
|
2
4
|
# Sifttter Module
|
3
5
|
# Used to examine Sifttter data and create
|
@@ -49,7 +51,7 @@ module SifttterRedux
|
|
49
51
|
|
50
52
|
date_regex = "(?:#{ date.strftime("%B") } 0?#{ date.strftime("%-d") }, #{ date.strftime("%Y") })"
|
51
53
|
time_regex = "(?:\d{1,2}:\d{1,2}\s?[AaPpMm]{2})"
|
52
|
-
entry_regex = /@begin\n@date\s#{ date_regex }(?: at (
|
54
|
+
entry_regex = /@begin\n@date\s#{ date_regex }(?: at (#{ time_regex }?)\n)?(.*?)@end/m
|
53
55
|
|
54
56
|
contents = File.read(filepath)
|
55
57
|
cur_entries = contents.scan(entry_regex)
|
@@ -89,10 +91,12 @@ module SifttterRedux
|
|
89
91
|
end
|
90
92
|
|
91
93
|
if @entries.length > 0
|
94
|
+
|
92
95
|
entrytext = "# Things done on #{ date_for_title }\n"
|
93
96
|
@entries.each do |key, value|
|
97
|
+
coder = HTMLEntities.new
|
94
98
|
entrytext += '### ' + key.gsub(/.txt/, '').gsub(/_/, ' ').upcase + "\n\n"
|
95
|
-
value.each { |v| entrytext += "#{ v[1] }\n" }
|
99
|
+
value.each { |v| entrytext += "#{ coder.encode(v[1]) }\n" }
|
96
100
|
entrytext += "\n"
|
97
101
|
end
|
98
102
|
|
data/sifttter-redux.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sifttter-redux
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Bach
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - '='
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: 2.9.0
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: htmlentities
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 4.3.1
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 4.3.1
|
111
125
|
description: A customized IFTTT-to-Day One service that allows for smart installation
|
112
126
|
and automated running on a standalone *NIX device (such as a Raspberry Pi).
|
113
127
|
email:
|