evertils 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/configs/templates/pq.enml +3 -0
- data/lib/controller.rb +4 -5
- data/lib/controllers/generate.rb +19 -8
- data/lib/helpers/formatting.rb +6 -22
- data/lib/version.rb +1 -1
- metadata +2 -3
- data/lib/configs/templates/daily-friday.enml +0 -12
- data/lib/configs/templates/daily-thursday.enml +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1fd3248143eff7e8b781638d5099de4e5c05535a
|
4
|
+
data.tar.gz: 5b2f2eef86e3159a1039a23bac1c1f5825cd1828
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4aca086dff5f7374d585f7311be1c506be32e6df2f1557e84c8728f548d8ed2930555c8991e5483af051361ce3c3b77697422e3514b5e6b62cd2858ca274d164
|
7
|
+
data.tar.gz: 059af51da8b902f6a751ac41b56483d5e349cdf1fb0f848da0a84d729ad8f74a1a6cc29016beae3b33755a852e3904f7cbae58f7617aaf25fc45a4762fc7c33e
|
data/lib/controller.rb
CHANGED
@@ -4,7 +4,7 @@ module Evertils
|
|
4
4
|
attr_accessor :model, :helper, :methods_require_internet, :default_method
|
5
5
|
|
6
6
|
@@options = Hash.new
|
7
|
-
|
7
|
+
|
8
8
|
# Perform pre-run tasks
|
9
9
|
def pre_exec
|
10
10
|
# interface with the Evernote API so we can use it later
|
@@ -34,7 +34,6 @@ module Evertils
|
|
34
34
|
|
35
35
|
# Perform post-run cleanup tasks, such as deleting old logs
|
36
36
|
def post_exec(total_errors = 0, total_warnings = 0, total_files = 0)
|
37
|
-
|
38
37
|
end
|
39
38
|
|
40
39
|
# Determines if the command can execute
|
@@ -54,7 +53,7 @@ module Evertils
|
|
54
53
|
|
55
54
|
@default_method = name || user_defined_methods.first || :sample
|
56
55
|
|
57
|
-
|
56
|
+
unless respond_to? @default_method.to_sym, true
|
58
57
|
Notify.error("Command not found: #{name}")
|
59
58
|
end
|
60
59
|
|
@@ -84,12 +83,12 @@ module Evertils
|
|
84
83
|
# autoload and instantiate required libraries, models and helpers
|
85
84
|
def auto_load_required(modules = [])
|
86
85
|
loaded = {:controller => {}, :helper => {}, :model => {}}
|
87
|
-
|
86
|
+
|
88
87
|
begin
|
89
88
|
modules.each do |mod|
|
90
89
|
if File.exists? "#{Evertils::INSTALLED_DIR}/lib/controllers/#{mod}.rb"
|
91
90
|
require "#{Evertils::INSTALLED_DIR}/lib/controllers/#{mod}.rb"
|
92
|
-
|
91
|
+
|
93
92
|
loaded[:controller][mod] = Evertils::Controller.const_get(mod.capitalize).new
|
94
93
|
else
|
95
94
|
raise StandardError, "Controller not found: #{mod}"
|
data/lib/controllers/generate.rb
CHANGED
@@ -9,6 +9,7 @@ module Evertils
|
|
9
9
|
NOTEBOOK_MONTHLY = :Monthly
|
10
10
|
NOTEBOOK_DEPLOYMENT = :Deployments
|
11
11
|
NOTEBOOK_MTS = :'Monthly Task Summaries'
|
12
|
+
NOTEBOOK_PRIORITY_QUEUE = :'Priority Queue'
|
12
13
|
|
13
14
|
def pre_exec
|
14
15
|
@methods_require_internet.push(:daily, :weekly, :monthly, :mts)
|
@@ -36,7 +37,7 @@ module Evertils
|
|
36
37
|
def daily
|
37
38
|
title = @format.date_templates[NOTEBOOK_DAILY]
|
38
39
|
body = @format.template_contents
|
39
|
-
body += to_enml($config.custom_sections[NOTEBOOK_DAILY])
|
40
|
+
body += to_enml($config.custom_sections[NOTEBOOK_DAILY]) unless $config.custom_sections.nil?
|
40
41
|
parent_notebook = NOTEBOOK_DAILY
|
41
42
|
|
42
43
|
@model.create_note(title: title, body: body, parent_notebook: parent_notebook)
|
@@ -46,7 +47,7 @@ module Evertils
|
|
46
47
|
def weekly
|
47
48
|
title = @format.date_templates[NOTEBOOK_WEEKLY]
|
48
49
|
body = @format.template_contents
|
49
|
-
body += to_enml($config.custom_sections[NOTEBOOK_WEEKLY])
|
50
|
+
body += to_enml($config.custom_sections[NOTEBOOK_WEEKLY]) unless $config.custom_sections.nil?
|
50
51
|
parent_notebook = NOTEBOOK_WEEKLY
|
51
52
|
|
52
53
|
if !@force
|
@@ -57,7 +58,7 @@ module Evertils
|
|
57
58
|
|
58
59
|
note = @model.create_note(title: title, body: body, parent_notebook: parent_notebook)
|
59
60
|
|
60
|
-
tag_manager = Evertils::Common::Manager::Tag.
|
61
|
+
tag_manager = Evertils::Common::Manager::Tag.instance
|
61
62
|
week_tag = tag_manager.find("week-#{DateTime.now.cweek + 1}")
|
62
63
|
note.tag(week_tag.prop(:name))
|
63
64
|
end
|
@@ -66,12 +67,12 @@ module Evertils
|
|
66
67
|
def monthly
|
67
68
|
title = @format.date_templates[NOTEBOOK_MONTHLY]
|
68
69
|
body = @format.template_contents
|
69
|
-
body += to_enml($config.custom_sections[NOTEBOOK_MONTHLY])
|
70
|
+
body += to_enml($config.custom_sections[NOTEBOOK_MONTHLY]) unless $config.custom_sections.nil?
|
70
71
|
parent_notebook = NOTEBOOK_MONTHLY
|
71
72
|
|
72
73
|
note = @model.create_note(title: title, body: body, parent_notebook: parent_notebook)
|
73
74
|
|
74
|
-
tag_manager = Evertils::Common::Manager::Tag.
|
75
|
+
tag_manager = Evertils::Common::Manager::Tag.instance
|
75
76
|
month_tag = tag_manager.find("month-#{DateTime.now.strftime('%-m')}")
|
76
77
|
note.tag(month_tag.prop(:name))
|
77
78
|
end
|
@@ -82,7 +83,7 @@ module Evertils
|
|
82
83
|
|
83
84
|
title = "#{@name} #{DateTime.now.strftime('%m-%Y')}"
|
84
85
|
body = @format.template_contents
|
85
|
-
body += to_enml($config.custom_sections[NOTEBOOK_MTS])
|
86
|
+
body += to_enml($config.custom_sections[NOTEBOOK_MTS]) unless $config.custom_sections.nil?
|
86
87
|
parent_notebook = NOTEBOOK_MTS
|
87
88
|
|
88
89
|
# create the note from template
|
@@ -90,7 +91,7 @@ module Evertils
|
|
90
91
|
|
91
92
|
# tag it
|
92
93
|
# TODO: maybe move this out of controller?
|
93
|
-
tag_manager = Evertils::Common::Manager::Tag.
|
94
|
+
tag_manager = Evertils::Common::Manager::Tag.instance
|
94
95
|
month_tag = tag_manager.find("month-#{DateTime.now.strftime('%-m')}")
|
95
96
|
mts_note.tag(month_tag.prop(:name))
|
96
97
|
|
@@ -99,12 +100,22 @@ module Evertils
|
|
99
100
|
# mts_note.tag(client_tag.prop(:name))
|
100
101
|
end
|
101
102
|
|
103
|
+
# generate priority queue notes
|
104
|
+
def pq
|
105
|
+
title = @format.date_templates[NOTEBOOK_PRIORITY_QUEUE]
|
106
|
+
body = @format.template_contents
|
107
|
+
body += to_enml($config.custom_sections[NOTEBOOK_PRIORITY_QUEUE]) unless $config.custom_sections.nil?
|
108
|
+
parent_notebook = NOTEBOOK_PRIORITY_QUEUE
|
109
|
+
|
110
|
+
note = @model.create_note(title: title, body: body, parent_notebook: parent_notebook)
|
111
|
+
end
|
112
|
+
|
102
113
|
private
|
103
114
|
|
104
115
|
#
|
105
116
|
# @since 0.3.1
|
106
117
|
def to_enml(hash)
|
107
|
-
|
118
|
+
Evertils::Helper::EvernoteENML.with_list(hash)
|
108
119
|
end
|
109
120
|
|
110
121
|
end
|
data/lib/helpers/formatting.rb
CHANGED
@@ -24,26 +24,7 @@ module Evertils
|
|
24
24
|
|
25
25
|
# Template file for note body
|
26
26
|
def template_contents
|
27
|
-
|
28
|
-
:monday => "#{Evertils::TEMPLATE_DIR}#{command.downcase}-monday.enml",
|
29
|
-
:tuesday => "#{Evertils::TEMPLATE_DIR}#{command.downcase}-tuesday.enml",
|
30
|
-
:wednesday => "#{Evertils::TEMPLATE_DIR}#{command.downcase}-wednesday.enml",
|
31
|
-
:thursday => "#{Evertils::TEMPLATE_DIR}#{command.downcase}-thursday.enml",
|
32
|
-
:friday => "#{Evertils::TEMPLATE_DIR}#{command.downcase}-friday.enml",
|
33
|
-
:default => "#{Evertils::TEMPLATE_DIR}#{command.downcase}.enml"
|
34
|
-
}
|
35
|
-
|
36
|
-
template = local_template_override?(tmpls[:default])
|
37
|
-
|
38
|
-
if command == :Daily
|
39
|
-
if Date.today.friday? && File.exist?(tmpls[:friday])
|
40
|
-
template = tmpls[:friday]
|
41
|
-
elsif Date.today.thursday? && File.exist?(tmpls[:thursday])
|
42
|
-
template = tmpls[:thursday]
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
IO.readlines(template, :encoding => 'UTF-8').join("").gsub!("\n", '')
|
27
|
+
IO.readlines(load_template, :encoding => 'UTF-8').join("").delete!("\n")
|
47
28
|
end
|
48
29
|
|
49
30
|
# Template string for note title
|
@@ -55,7 +36,8 @@ module Evertils
|
|
55
36
|
:Daily => "Daily Log [#{arg_date.strftime('%B %-d')} - #{dow}]",
|
56
37
|
:Weekly => "Weekly Log [#{arg_date.strftime('%B %-d')} - #{end_of_week.strftime('%B %-d')}]",
|
57
38
|
:Monthly => "Monthly Log [#{arg_date.strftime('%B %Y')}]",
|
58
|
-
:Deployments => "#{arg_date.strftime('%B %-d')} - #{dow}"
|
39
|
+
:Deployments => "#{arg_date.strftime('%B %-d')} - #{dow}",
|
40
|
+
:'Priority Queue' => "Queue For [#{arg_date.strftime('%B %-d')} - #{dow}]"
|
59
41
|
}
|
60
42
|
end
|
61
43
|
|
@@ -68,7 +50,9 @@ module Evertils
|
|
68
50
|
|
69
51
|
#
|
70
52
|
# @since 0.3.1
|
71
|
-
def
|
53
|
+
def load_template
|
54
|
+
default = "#{Evertils::TEMPLATE_DIR}#{command.downcase}.enml"
|
55
|
+
|
72
56
|
return default if $config.custom_templates.nil?
|
73
57
|
|
74
58
|
rval = default
|
data/lib/version.rb
CHANGED
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.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Priebe
|
@@ -96,11 +96,10 @@ files:
|
|
96
96
|
- evertils.gemspec
|
97
97
|
- lib/command.rb
|
98
98
|
- lib/config.rb
|
99
|
-
- lib/configs/templates/daily-friday.enml
|
100
|
-
- lib/configs/templates/daily-thursday.enml
|
101
99
|
- lib/configs/templates/daily.enml
|
102
100
|
- lib/configs/templates/monthly.enml
|
103
101
|
- lib/configs/templates/mts.enml
|
102
|
+
- lib/configs/templates/pq.enml
|
104
103
|
- lib/configs/templates/weekly.enml
|
105
104
|
- lib/controller.rb
|
106
105
|
- lib/controllers/convert.rb
|
@@ -1,12 +0,0 @@
|
|
1
|
-
<div><span style="font-size: 18px;">Logs</span></div>
|
2
|
-
<ul>
|
3
|
-
<li>...</li>
|
4
|
-
</ul>
|
5
|
-
<br />
|
6
|
-
<div><span style="font-size: 18px;">Tasks completed</span></div>
|
7
|
-
<ul>
|
8
|
-
<li>...</li>
|
9
|
-
</ul>
|
10
|
-
<br />
|
11
|
-
<div><span style="font-size: 18px;">EOD</span></div>
|
12
|
-
<div><en-todo checked="false"/>Ensure timecard is up to date</div>
|
@@ -1,15 +0,0 @@
|
|
1
|
-
<div><span style="font-size: 18px;">Logs</span></div>
|
2
|
-
<ul>
|
3
|
-
<li>...</li>
|
4
|
-
</ul>
|
5
|
-
<br />
|
6
|
-
<div><span style="font-size: 18px;">Tasks completed</span></div>
|
7
|
-
<ul>
|
8
|
-
<li>...</li>
|
9
|
-
</ul>
|
10
|
-
<br />
|
11
|
-
<div><span style="font-size: 18px;">EOD</span></div>
|
12
|
-
<ul>
|
13
|
-
<li><en-todo checked="false"/>Weekly timecard is up to date</li>
|
14
|
-
<li><en-todo checked="false"/>Tasks are filled out</li>
|
15
|
-
</ul>
|