evertils 0.1.4 → 0.1.5
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/controllers/generate.rb +26 -9
- data/lib/controllers/new.rb +2 -2
- data/lib/helpers/evernote.rb +0 -1
- 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: 389c3afea9ed6166b9397c2c61e8ade411638593
|
4
|
+
data.tar.gz: a9c386724d2de8ef2d3cbfd0fc9cc6a22a3dc26d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26f6861b308742a3ec1d79b6d0cbe88735585207b808e7768373b40ae60efad852e31d506cc61cb256099ba8df84901e9fc68c660984da4ede1943d3d14eee90
|
7
|
+
data.tar.gz: 09a9bce66f922421fd301766abda3a7071469cf70e72523c2737f24c9e677a2f22422f14f41ff3c2f82c2d46c365bc9a0b1b6abcb7586a43d55276b0a91f9b67
|
data/lib/controllers/generate.rb
CHANGED
@@ -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
|
26
|
-
|
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
|
35
|
-
|
36
|
-
|
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
|
-
|
39
|
-
|
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
|
48
|
-
|
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
|
data/lib/controllers/new.rb
CHANGED
@@ -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", "
|
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
|
|
data/lib/helpers/evernote.rb
CHANGED
@@ -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