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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 34b47cca996f377fe18994fdc93ec4434c9f7126
4
- data.tar.gz: b2ba6dfa2f4fe920170f6febc85fe08fd655b338
3
+ metadata.gz: a297001fe3422429dc834fdf46aac20f178c4a05
4
+ data.tar.gz: cf6d72162013a24f9a096d6bf3c6b8eb2df8061a
5
5
  SHA512:
6
- metadata.gz: 7de9b29c76857ed63808f68198358d2c0a8e819e5008a88747e389dee021434f00f2ebff139deeaadc8ae5d5df77ed52995a90d8998729fb8c1418d87a972f13
7
- data.tar.gz: 90b6c2828c1b535a594bae9275aadcbe7f574c398e66757b618b2f72d1556bcc070d84a498781166158f276aad40858e09d0aa704c08c6ce47c2bd0e1ea9c498
6
+ metadata.gz: 941beafd5f7132064e68b8fd1265485f4ecbd2b26fec8129a1159ffeb80e2bccd00663eafe9f9d96fd9fef304baade9c1ac3c047ba578c655bdcdaf60fa2c86d
7
+ data.tar.gz: 8dc0676210fb91536d1568e021ea7858e8cf3e2e66e9800e504bd257012323755f2f46d1611d92b16940a48759921c2b0f0de13a58b974a19ab0e87a18eef328
@@ -63,7 +63,7 @@ module Granify
63
63
  @@user.getUser(@@developer_token)
64
64
  end
65
65
 
66
- def notebook_by_name(name = $request.command)
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[$request.command]
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[$request.command], body = template_contents, p_notebook_name = nil, file = nil, share_note = false, created_on = nil)
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 $request.command
188
- when :weekly
187
+ case command
188
+ when :Weekly
189
189
  our_note.tagNames << "week-#{::Time.now.strftime('%V').to_i}"
190
- when :monthly
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
- def template_contents
319
- if Date.today.friday? && $request.command == :daily
320
- # Friday uses a slightly different template
321
- IO.readlines("#{Granify::TEMPLATE_DIR}#{$request.command}-friday.enml").join("").gsub!("\n", '')
322
- else
323
- IO.readlines("#{Granify::TEMPLATE_DIR}#{$request.command}.enml").join("").gsub!("\n", '')
324
- end
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
- def date_templates
328
- now = DateTime.now
329
- end_of_week = now + 4 # days
330
-
331
- {
332
- :Daily => "Daily Log [#{now.strftime('%B %-d')} - #{day_of_week}]",
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
- end
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[0..ARGV.size].select { |f| f.start_with?('-') }.map { |f| f.split("=").map &:to_sym } || []
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 > 1
10
- @controller = ARGV[0].to_sym rescue nil
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
@@ -1,3 +1,3 @@
1
1
  module Granify
2
- VERSION = '0.1.15'
2
+ VERSION = '0.1.17'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evertils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.15
4
+ version: 0.1.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Priebe