evertils 0.3.1.1 → 0.3.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/config.rb +4 -2
- data/lib/controllers/generate.rb +2 -2
- data/lib/helpers/formatting.rb +11 -4
- 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: 9bfbec7f3599e451794675eba97e020e1a2c478a
|
4
|
+
data.tar.gz: 79c2d40edeeb68ff45eb1053aed8a518f39be78b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62553e2671eb2a96110ee10e706392a7a48ea825853e07daa33a93d926025b898bbb87948a137e73d86bf802e4b727e55fcf2bcbf67414cdf557447776039485
|
7
|
+
data.tar.gz: 46d7dcc874f6ad43aa4141f7ea34116aa313638774a11e0da2743351b6b156435304bebc643a467ffc6d3124e09f7c15553e2e470b4294651b3e02afece7caa8
|
data/lib/config.rb
CHANGED
@@ -11,7 +11,7 @@ module Evertils
|
|
11
11
|
DEBUG = false
|
12
12
|
|
13
13
|
class Cfg
|
14
|
-
attr_accessor :custom_sections, :custom_templates
|
14
|
+
attr_accessor :custom_sections, :custom_templates, :custom_path
|
15
15
|
|
16
16
|
def bootstrap!
|
17
17
|
begin
|
@@ -45,8 +45,10 @@ module Evertils
|
|
45
45
|
#
|
46
46
|
# @since 0.3.1
|
47
47
|
def load_user_customizations
|
48
|
-
|
48
|
+
conf_path = Dir.home + '/.evertils/'
|
49
|
+
conf = recursive_symbolize_keys(YAML::load_file(conf_path + 'config.yml'))
|
49
50
|
|
51
|
+
@custom_path = conf_path
|
50
52
|
@custom_sections = conf[:sections] if conf[:sections]
|
51
53
|
@custom_templates = conf[:templates] if conf[:templates]
|
52
54
|
end
|
data/lib/controllers/generate.rb
CHANGED
@@ -51,7 +51,7 @@ module Evertils
|
|
51
51
|
|
52
52
|
if !@force
|
53
53
|
if !Date.today.monday?
|
54
|
-
Notify.error("Sorry, you can only create new weekly logs on Mondays")
|
54
|
+
Notify.error("Sorry, you can only create new weekly logs on Mondays", {})
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
@@ -78,7 +78,7 @@ module Evertils
|
|
78
78
|
|
79
79
|
# generate monthly task summary templates
|
80
80
|
def mts
|
81
|
-
Notify.error("Name argument is required") if @name.nil?
|
81
|
+
Notify.error("Name argument is required", {}) if @name.nil?
|
82
82
|
|
83
83
|
title = "#{@name} #{DateTime.now.strftime('%m-%Y')}"
|
84
84
|
body = @format.template_contents
|
data/lib/helpers/formatting.rb
CHANGED
@@ -71,13 +71,20 @@ module Evertils
|
|
71
71
|
def local_template_override?(default)
|
72
72
|
return default if $config.custom_templates.nil?
|
73
73
|
|
74
|
+
rval = default
|
74
75
|
tmpl = $config.custom_templates[command]
|
75
76
|
|
76
|
-
if tmpl.nil?
|
77
|
-
|
78
|
-
|
79
|
-
|
77
|
+
if !tmpl.nil?
|
78
|
+
rval = $config.custom_path
|
79
|
+
|
80
|
+
if tmpl.include?('~')
|
81
|
+
rval += tmpl.gsub!(/~/, Dir.home)
|
82
|
+
else
|
83
|
+
rval += tmpl
|
84
|
+
end
|
80
85
|
end
|
86
|
+
|
87
|
+
rval
|
81
88
|
end
|
82
89
|
|
83
90
|
end
|
data/lib/version.rb
CHANGED