evertils 0.1.15 → 0.1.17
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/lib/helpers/evernote.rb +50 -44
- data/lib/request.rb +7 -6
- data/lib/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a297001fe3422429dc834fdf46aac20f178c4a05
|
4
|
+
data.tar.gz: cf6d72162013a24f9a096d6bf3c6b8eb2df8061a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 941beafd5f7132064e68b8fd1265485f4ecbd2b26fec8129a1159ffeb80e2bccd00663eafe9f9d96fd9fef304baade9c1ac3c047ba578c655bdcdaf60fa2c86d
|
7
|
+
data.tar.gz: 8dc0676210fb91536d1568e021ea7858e8cf3e2e66e9800e504bd257012323755f2f46d1611d92b16940a48759921c2b0f0de13a58b974a19ab0e87a18eef328
|
data/lib/helpers/evernote.rb
CHANGED
@@ -63,7 +63,7 @@ module Granify
|
|
63
63
|
@@user.getUser(@@developer_token)
|
64
64
|
end
|
65
65
|
|
66
|
-
def notebook_by_name(name =
|
66
|
+
def notebook_by_name(name = command)
|
67
67
|
output = {}
|
68
68
|
notebooks.each do |notebook|
|
69
69
|
if notebook.name == name.to_s.capitalize
|
@@ -136,7 +136,7 @@ module Granify
|
|
136
136
|
|
137
137
|
def note_exists
|
138
138
|
results = Helper::Results.new
|
139
|
-
template = date_templates[
|
139
|
+
template = date_templates[command]
|
140
140
|
note = find_note(template)
|
141
141
|
|
142
142
|
# Evernote's search matches things like the following, so we have to get
|
@@ -153,7 +153,7 @@ module Granify
|
|
153
153
|
results.should_eval_to(false)
|
154
154
|
end
|
155
155
|
|
156
|
-
def create_note(title = date_templates[
|
156
|
+
def create_note(title = date_templates[command.capitalize], body = template_contents, p_notebook_name = nil, file = nil, share_note = false, created_on = nil)
|
157
157
|
# final output
|
158
158
|
output = {}
|
159
159
|
|
@@ -184,10 +184,10 @@ module Granify
|
|
184
184
|
our_note.created = created_on if !created_on.nil?
|
185
185
|
|
186
186
|
# properly tag logs
|
187
|
-
case
|
188
|
-
when :
|
187
|
+
case command
|
188
|
+
when :Weekly
|
189
189
|
our_note.tagNames << "week-#{::Time.now.strftime('%V').to_i}"
|
190
|
-
when :
|
190
|
+
when :Monthly
|
191
191
|
our_note.tagNames << "month-#{::Time.now.strftime('%-m').to_i}"
|
192
192
|
end
|
193
193
|
|
@@ -294,47 +294,53 @@ module Granify
|
|
294
294
|
end
|
295
295
|
|
296
296
|
private
|
297
|
-
# Legacy notes will have single/double character denotations for day of
|
298
|
-
# week, this maps them.
|
299
|
-
def day_of_week
|
300
|
-
case Date.today.strftime('%a')
|
301
|
-
when 'Mon'
|
302
|
-
:M
|
303
|
-
when 'Tue'
|
304
|
-
:Tu
|
305
|
-
when 'Wed'
|
306
|
-
:W
|
307
|
-
when 'Thu'
|
308
|
-
:Th
|
309
|
-
when 'Fri'
|
310
|
-
:F
|
311
|
-
when 'Sat'
|
312
|
-
:Sa
|
313
|
-
when 'Sun'
|
314
|
-
:Su
|
315
|
-
end
|
316
|
-
end
|
317
297
|
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
298
|
+
# Legacy notes will have single/double character denotations for day of
|
299
|
+
# week, this maps them.
|
300
|
+
def day_of_week
|
301
|
+
case Date.today.strftime('%a')
|
302
|
+
when 'Mon'
|
303
|
+
:M
|
304
|
+
when 'Tue'
|
305
|
+
:Tu
|
306
|
+
when 'Wed'
|
307
|
+
:W
|
308
|
+
when 'Thu'
|
309
|
+
:Th
|
310
|
+
when 'Fri'
|
311
|
+
:F
|
312
|
+
when 'Sat'
|
313
|
+
:Sa
|
314
|
+
when 'Sun'
|
315
|
+
:Su
|
325
316
|
end
|
317
|
+
end
|
326
318
|
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
:Weekly => "Weekly Log [#{now.strftime('%B %-d')} - #{end_of_week.strftime('%B %-d')}]",
|
334
|
-
:Monthly => "Monthly Log [#{now.strftime('%B %Y')}]",
|
335
|
-
:Deployments => "#{now.strftime('%B %-d')} - #{day_of_week}"
|
336
|
-
}
|
319
|
+
def template_contents
|
320
|
+
if Date.today.friday? && command == :Daily
|
321
|
+
# Friday uses a slightly different template
|
322
|
+
IO.readlines("#{Granify::TEMPLATE_DIR}#{command}-friday.enml").join("").gsub!("\n", '')
|
323
|
+
else
|
324
|
+
IO.readlines("#{Granify::TEMPLATE_DIR}#{command}.enml").join("").gsub!("\n", '')
|
337
325
|
end
|
326
|
+
end
|
327
|
+
|
328
|
+
def date_templates
|
329
|
+
now = DateTime.now
|
330
|
+
end_of_week = now + 4 # days
|
331
|
+
|
332
|
+
{
|
333
|
+
:Daily => "Daily Log [#{now.strftime('%B %-d')} - #{day_of_week}]",
|
334
|
+
:Weekly => "Weekly Log [#{now.strftime('%B %-d')} - #{end_of_week.strftime('%B %-d')}]",
|
335
|
+
:Monthly => "Monthly Log [#{now.strftime('%B %Y')}]",
|
336
|
+
:Deployments => "#{now.strftime('%B %-d')} - #{day_of_week}"
|
337
|
+
}
|
338
|
+
end
|
339
|
+
|
340
|
+
# format command as required by this model
|
341
|
+
def command
|
342
|
+
$request.command.capitalize
|
343
|
+
end
|
338
344
|
end
|
339
345
|
end
|
340
|
-
|
346
|
+
end
|
data/lib/request.rb
CHANGED
@@ -4,17 +4,18 @@ module Granify
|
|
4
4
|
|
5
5
|
def initialize
|
6
6
|
@controller = nil
|
7
|
-
@flags = ARGV
|
7
|
+
@flags = ARGV.select { |f| f.start_with?('-') }.map { |f| f.split("=").map &:to_sym } || []
|
8
|
+
@raw_flags = ARGV.select { |f| f.start_with?('-') } || []
|
8
9
|
|
9
|
-
if ARGV.size >
|
10
|
-
|
10
|
+
if ARGV.size > 0
|
11
|
+
if !ARGV[0].start_with?('-')
|
12
|
+
@controller = ARGV[0].to_sym rescue nil
|
13
|
+
end
|
14
|
+
|
11
15
|
@command = ARGV[1].to_sym rescue nil
|
12
16
|
|
13
17
|
if ARGV.size > 2
|
14
18
|
@custom = ARGV[2..ARGV.size].select { |p| !p.start_with?('-') }.map &:to_sym || []
|
15
|
-
# TODO: parameterize flag key/values
|
16
|
-
@flags = ARGV[2..ARGV.size].select { |f| f.start_with?('-') }.map { |f| f.split("=").map &:to_sym } || []
|
17
|
-
@raw_flags = ARGV[2..ARGV.size].select { |f| f.start_with?('-') } || []
|
18
19
|
end
|
19
20
|
end
|
20
21
|
end
|
data/lib/version.rb
CHANGED