evertils 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 87f6ee585b3a642700972cbe2612d0537759543f
4
- data.tar.gz: 950dff94e5200e001719ffc071f090a2067c108a
3
+ metadata.gz: 389c3afea9ed6166b9397c2c61e8ade411638593
4
+ data.tar.gz: a9c386724d2de8ef2d3cbfd0fc9cc6a22a3dc26d
5
5
  SHA512:
6
- metadata.gz: 63e1f76cd892fb0b97bbbbe7edbfd636e1bb9b91b118e4d4a6fd04c637a1f55ec9d01702eb8e0b90c0df21290b91685f25df13c8bed96b0e08b3fade907d953c
7
- data.tar.gz: 1d8aa7e4c7c3201e6ff77dac9c5fb160244ffe0ebd708a40ae6985296039d038c0f739f0971cbd76a3e59db255c7b2a03eab6f90db51e06ef0954e2fc7685d17
6
+ metadata.gz: 26f6861b308742a3ec1d79b6d0cbe88735585207b808e7768373b40ae60efad852e31d506cc61cb256099ba8df84901e9fc68c660984da4ede1943d3d14eee90
7
+ data.tar.gz: 09a9bce66f922421fd301766abda3a7071469cf70e72523c2737f24c9e677a2f22422f14f41ff3c2f82c2d46c365bc9a0b1b6abcb7586a43d55276b0a91f9b67
@@ -1,6 +1,8 @@
1
1
  module Granify
2
2
  module Controller
3
3
  class Generate < Controller::Base
4
+ attr_accessor :force
5
+
4
6
  def pre_exec
5
7
  begin
6
8
  # interface with the Evernote API so we can use it later
@@ -17,13 +19,23 @@ module Granify
17
19
  Notify.error("Evernote.authenticate error\n#{e.parameter} (#{e.errorCode})")
18
20
  end
19
21
 
22
+ OptionParser.new do |opt|
23
+ opt.banner = "#{Granify::PACKAGE_NAME} generate timeframe [...-flags]"
24
+
25
+ opt.on("-f", "--force", "Force execution") do
26
+ @force = true
27
+ end
28
+ end.parse!
29
+
20
30
  super
21
31
  end
22
32
 
23
33
  # generate daily notes
24
34
  def daily
25
- if @model.note_exists
26
- Notify.error("There's already a log for today!")
35
+ if !@force
36
+ if @model.note_exists
37
+ Notify.error("There's already a log for today!")
38
+ end
27
39
  end
28
40
 
29
41
  @model.create_note
@@ -31,12 +43,15 @@ module Granify
31
43
 
32
44
  # generate weekly notes
33
45
  def weekly
34
- if @model.note_exists
35
- Notify.error("There's already a log for this week!")
36
- end
46
+ if !@force
47
+ if @model.note_exists
48
+ Notify.error("There's already a log for this week!")
49
+ end
50
+
37
51
 
38
- if !Date.today.monday?
39
- Notify.error("Sorry, you can only create new weekly logs on Mondays")
52
+ if !Date.today.monday?
53
+ Notify.error("Sorry, you can only create new weekly logs on Mondays")
54
+ end
40
55
  end
41
56
 
42
57
  @model.create_note
@@ -44,8 +59,10 @@ module Granify
44
59
 
45
60
  # generate monthly notes
46
61
  def monthly
47
- if @model.note_exists
48
- Notify.error("There's already a log for this month!")
62
+ if !@force
63
+ if @model.note_exists
64
+ Notify.error("There's already a log for this month!")
65
+ end
49
66
  end
50
67
 
51
68
  @model.create_note
@@ -1,7 +1,7 @@
1
1
  module Granify
2
2
  module Controller
3
3
  class New < Controller::Base
4
- attr_accessor :title, :file, :notebook
4
+ attr_accessor :title, :file, :notebook, :force
5
5
 
6
6
  def pre_exec
7
7
  begin
@@ -25,7 +25,7 @@ module Granify
25
25
  @file = file
26
26
  end
27
27
 
28
- opt.on("-n", "--notebook=PBOOK", "Attach a file to your custom note") do |notebook|
28
+ opt.on("-n", "--notebook=PBOOK", "Choose the notebook to add your note to") do |notebook|
29
29
  @notebook = notebook
30
30
  end
31
31
 
@@ -148,7 +148,6 @@ module Granify
148
148
  end
149
149
 
150
150
  def create_note(title = date_templates[$request.command], body = template_contents, p_notebook_name = nil, file = nil, share_note = false)
151
-
152
151
  # Create note object
153
152
  our_note = ::Evernote::EDAM::Type::Note.new
154
153
  our_note.resources = []
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Granify
2
- VERSION = '0.1.4'
2
+ VERSION = '0.1.5'
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.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Priebe