evertils 0.3.11 → 0.3.12

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: ad62baedc7a7cc0b591ca277d9524a356f4feb26
4
- data.tar.gz: c7e736bd63c4d2b461170f2d0a80f4acaf3e3bf6
3
+ metadata.gz: 14fb0d4d14987ca35e2271f9bf5d0cd62dcdbc80
4
+ data.tar.gz: b3658a61ff67727365d5c2ef0a7a847f57e07436
5
5
  SHA512:
6
- metadata.gz: 38353d2f0d79183b55faebdcfc0afe4cd69a676baad72c81f0fd2f59573df0cff3b4b83c69f5b1ae789798fb8a12d3555009e6b84711449b6f95c30c0e96a650
7
- data.tar.gz: 8287b24d155416fde7a379e5a3b26992188e34987f9df7a0355c02618012c039cd752bf5ee061a73deccb03193050b9ca2b53053f0a463ca277a973b0658affb
6
+ metadata.gz: 66034f1b1108c9d833ee5ec65e49e1df4881ec8e0e5c01b5b43b6e6613afab8626a528678ebb341bcd6796b1c079b218981dd0aa878e44981ed9a6004617e21c
7
+ data.tar.gz: 57c1521538ef72e102456d3e2f60506033e6610f3b5669b17d94c56868229bf5b82d6334171e566fc5314eb4e994b921d1619c9ff23694efb984961447fdc9d9
@@ -10,19 +10,19 @@ module Evertils
10
10
  # generate daily notes
11
11
  def daily
12
12
  note = Type::Daily.new(@config)
13
- note.create
13
+ note.create if note.should_create?
14
14
  end
15
15
 
16
16
  # generate weekly notes
17
17
  def weekly
18
18
  note = Type::Weekly.new(@config)
19
- note.create
19
+ note.create if note.should_create?
20
20
  end
21
21
 
22
22
  # generate monthly notes
23
23
  def monthly
24
24
  note = Type::Monthly.new(@config)
25
- note.create
25
+ note.create if note.should_create?
26
26
  end
27
27
 
28
28
  # generate monthly task summary templates
@@ -30,13 +30,13 @@ module Evertils
30
30
  Notify.error('Name argument is required', {}) if arg.nil?
31
31
 
32
32
  note = Type::MonthlyTaskSummary.new(@config, arg[1])
33
- note.create
33
+ note.create if note.should_create?
34
34
  end
35
35
 
36
36
  # generate priority queue notes
37
37
  def pq
38
38
  note = Type::PriorityQueue.new(@config)
39
- note.create
39
+ note.create if note.should_create?
40
40
  end
41
41
 
42
42
  # creates the notes required to start the day
@@ -45,17 +45,10 @@ module Evertils
45
45
  # - weekly (if today is Monday and there isn't a weekly log already)
46
46
  # - monthly (if today is the 1st and there isn't a monthly log already)
47
47
  def morning
48
- pq = Type::PriorityQueue.new(@config)
49
- pq.create
50
-
51
- daily = Type::Daily.new(@config)
52
- daily.create
53
-
54
- weekly = Type::Weekly.new(@config)
55
- weekly.create if weekly.should_create?
56
-
57
- monthly = Type::Monthly.new(@config)
58
- monthly.create if monthly.should_create?
48
+ pq
49
+ daily
50
+ weekly
51
+ monthly
59
52
  end
60
53
  end
61
54
  end
data/lib/evertils/type.rb CHANGED
@@ -22,7 +22,7 @@ module Evertils
22
22
  body: @content,
23
23
  parent_notebook: self.class::NOTEBOOK,
24
24
  tags: tags || [],
25
- colour: self.class.COLOUR
25
+ colour: self.class::COLOUR
26
26
  }
27
27
 
28
28
  raise 'Invalid title' if @title.nil?
@@ -35,10 +35,13 @@ module Evertils
35
35
  #
36
36
  # @since 0.3.7
37
37
  def should_create?
38
- note_title = @format.date_templates[NOTEBOOK]
38
+ note_title = @format.date_templates[self.class::NOTEBOOK]
39
39
  found = @model.find_note_contents(note_title)
40
+ result = found.entity.nil?
40
41
 
41
- found.entity.nil?
42
+ Notify.warning "#{self.class.name} skipped, note already exists" unless result
43
+
44
+ result
42
45
  end
43
46
  end
44
47
  end
@@ -26,8 +26,11 @@ module Evertils
26
26
 
27
27
  monthly_note_title = @format.date_templates[NOTEBOOK]
28
28
  found = @model.find_note_contents(monthly_note_title)
29
+ result = found.entity.nil? && today_is_first_of_month
29
30
 
30
- found.entity.nil? && today_is_first_of_month
31
+ Notify.warning "#{self.class.name} skipped, note already exists" unless result
32
+
33
+ result
31
34
  end
32
35
  end
33
36
  end
@@ -26,8 +26,11 @@ module Evertils
26
26
 
27
27
  weekly_note_title = @format.date_templates[NOTEBOOK]
28
28
  found = @model.find_note_contents(weekly_note_title)
29
+ result = found.entity.nil? && is_monday
29
30
 
30
- found.entity.nil? && is_monday
31
+ Notify.warning "#{self.class.name} skipped, note already exists" unless result
32
+
33
+ result
31
34
  end
32
35
  end
33
36
  end
@@ -1,3 +1,3 @@
1
1
  module Evertils
2
- VERSION = '0.3.11'.freeze
2
+ VERSION = '0.3.12'.freeze
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.3.11
4
+ version: 0.3.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Priebe