evertils 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/evertils/action.rb +1 -1
- data/lib/evertils/actions/duplicate_previous.rb +13 -41
- data/lib/evertils/controllers/render.rb +4 -2
- data/lib/evertils/grammar.rb +1 -0
- data/lib/evertils/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a73b52e4baf5b8c14bb0927c7f34ad5d6379c32403a5aa73dd3e4aa6720695fc
|
4
|
+
data.tar.gz: eabd9cd23471a321759a41586f1551561b8508058fddc60069acb452c0e04580
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90f8309a45345fa461078aeda4bc4a0b2c58698a958c84101291a3e14950d221ec7ee1425ff07809875f5bff724ea8097b03763e68adcc9e8690c83e03fe0495
|
7
|
+
data.tar.gz: 2f983ff37691cd9969de44a240e1b594216dc52c8397c3266e1c7684569fbe053f451d1d96ae2a22dc4a5105cf9abb05c65a616e46dbc0549719b1b92be61a4c
|
data/lib/evertils/action.rb
CHANGED
@@ -6,7 +6,7 @@ module Evertils
|
|
6
6
|
def initialize(args)
|
7
7
|
super(args)
|
8
8
|
|
9
|
-
@args[:content] = find_previous
|
9
|
+
@args[:content] = find_previous
|
10
10
|
|
11
11
|
query = Evertils::Common::Query::Simple.new
|
12
12
|
query.create_note_from_hash(@args)
|
@@ -14,50 +14,22 @@ module Evertils
|
|
14
14
|
|
15
15
|
private
|
16
16
|
|
17
|
-
def find_previous
|
18
|
-
|
19
|
-
note =
|
17
|
+
def find_previous
|
18
|
+
helper = Evertils::Helper::Note.instance
|
19
|
+
note = helper.wait_for_with_grammar(grammar)
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
(1..Evertils::Base::MAX_SEARCH_SIZE).each do |iter|
|
24
|
-
day -= 1
|
25
|
-
dow = day.strftime('%a')
|
26
|
-
|
27
|
-
# always skip weekends, even if there is a note for those days
|
28
|
-
next if %i[Sat Sun].include?(dow)
|
29
|
-
|
30
|
-
note_title = previous_note_title(@args[:title_format], day)
|
31
|
-
note = @note_helper.model.find_note_contents(note_title).entity
|
32
|
-
|
33
|
-
Notify.info(" (#{iter}) #{note_title}")
|
34
|
-
|
35
|
-
break unless note.nil?
|
36
|
-
end
|
37
|
-
|
38
|
-
@api.convert_to_xml(note.content).prepare
|
21
|
+
@api.convert_to_xml(note.entity.content).prepare
|
39
22
|
end
|
40
23
|
|
41
|
-
def
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
'%MONTH%': date.month,
|
48
|
-
'%DAY%': date.day,
|
49
|
-
'%DOW%': date.wday,
|
50
|
-
'%DOW_NAME%': date.strftime('%a'),
|
51
|
-
'%YEAR%': date.year,
|
52
|
-
'%WEEK%': date.cweek,
|
53
|
-
'%WEEK_START%': Date.commercial(date.year, date.cweek, 1),
|
54
|
-
'%WEEK_END%': Date.commercial(date.year, date.cweek, 5)
|
24
|
+
def grammar
|
25
|
+
terms = Grammar.new
|
26
|
+
terms.notebook = @args[:notebook]
|
27
|
+
terms.tags = {
|
28
|
+
day: Date.today.yday,
|
29
|
+
week: Date.today.cweek
|
55
30
|
}
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
replacements.each_pair { |k, v| title_format.gsub!(k.to_s, v.to_s) }
|
60
|
-
title_format
|
31
|
+
terms.created = Date.new(Date.today.year, 1, 1).strftime('%Y%m%d')
|
32
|
+
terms
|
61
33
|
end
|
62
34
|
end
|
63
35
|
end
|
@@ -6,9 +6,11 @@ module Evertils
|
|
6
6
|
def from_file
|
7
7
|
set_allowed_fields
|
8
8
|
|
9
|
-
|
9
|
+
if @allowed_fields[:action] == 'create'
|
10
|
+
return Notify.warning("Note already exists\n- #{@link}") if note_exists?
|
10
11
|
|
11
|
-
|
12
|
+
Notify.info 'Note not found, creating a new one'
|
13
|
+
end
|
12
14
|
|
13
15
|
execute_action(@allowed_fields[:action])
|
14
16
|
end
|
data/lib/evertils/grammar.rb
CHANGED
data/lib/evertils/version.rb
CHANGED