work_md 0.2.1 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/work_md/commands/parse.rb +12 -6
- data/lib/work_md/commands/today.rb +10 -1
- data/lib/work_md/config.rb +5 -4
- data/lib/work_md/parser/engine.rb +10 -0
- data/lib/work_md/version.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d5b841881acd03d54092af4c2e04b6fa29356b784ac52905810a3ba021c01de
|
4
|
+
data.tar.gz: 324ad983b70bd2749e7c888a21949a7c8b66ca6bbe7c3c7ebabeaeaee7f83a3d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ab6691773bf32657133a362cfbb42a45e6fbace7a716dcd20f065fe081297ae720efc3b1bcaa86a297327d61886522b45101c3d65fc0bfa3edbdf2422611b28
|
7
|
+
data.tar.gz: e6de20ebdf9b3a5055bc4f1c0e822de41e37ee9ea4131ddc4268c0c47e0acc5d388f2c8864dbc0171dfd419264ea7aec9bc56fe26431475cd9351b12efa704e7
|
@@ -31,12 +31,12 @@ module WorkMd
|
|
31
31
|
|
32
32
|
File.open(PARSED_FILE_PATH, 'w+') do |f|
|
33
33
|
f.puts("# #{WorkMd::Config.title}\n\n")
|
34
|
-
f.puts("### #{t[:tasks]}:\n\n")
|
34
|
+
f.puts("### #{t[:tasks]} (#{parser.tasks.size}):\n\n")
|
35
35
|
parser.tasks.each do |task|
|
36
36
|
f.puts("- [#{task}\n\n") if task != ' ]'
|
37
37
|
end
|
38
38
|
f.puts("---\n\n")
|
39
|
-
f.puts("### #{t[:meetings]}:\n\n")
|
39
|
+
f.puts("### #{t[:meetings]} (#{parser.meetings.size}):\n\n")
|
40
40
|
parser.meetings.each do |meeting|
|
41
41
|
f.puts("- #{meeting}\n\n")
|
42
42
|
end
|
@@ -50,21 +50,27 @@ module WorkMd
|
|
50
50
|
f.puts("- #{meeting_annotation}\n\n")
|
51
51
|
end
|
52
52
|
f.puts("---\n\n")
|
53
|
-
f.puts("### #{t[:interruptions]}:\n\n")
|
53
|
+
f.puts("### #{t[:interruptions]} (#{parser.interruptions.size}):\n\n")
|
54
54
|
parser.interruptions.each do |interruption|
|
55
55
|
f.puts("- #{interruption}\n\n")
|
56
56
|
end
|
57
57
|
f.puts("---\n\n")
|
58
|
-
f.puts("### #{t[:difficulties]}:\n\n")
|
58
|
+
f.puts("### #{t[:difficulties]} (#{parser.difficulties.size}):\n\n")
|
59
59
|
parser.difficulties.each do |difficulty|
|
60
60
|
f.puts("- #{difficulty}\n\n")
|
61
61
|
end
|
62
62
|
f.puts("---\n\n")
|
63
|
-
f.puts("### #{t[:pomodoros]}:\n\n")
|
63
|
+
f.puts("### #{t[:pomodoros]} (#{parser.average_pomodoros} #{t[:per_day]}):\n\n")
|
64
64
|
f.puts(parser.pomodoros)
|
65
65
|
end
|
66
66
|
|
67
|
-
::
|
67
|
+
editor = WorkMd::Config.editor
|
68
|
+
|
69
|
+
unless editor.nil?
|
70
|
+
::TTY::Editor.open(PARSED_FILE_PATH, command: editor)
|
71
|
+
else
|
72
|
+
::TTY::Editor.open(PARSED_FILE_PATH)
|
73
|
+
end
|
68
74
|
rescue
|
69
75
|
WorkMd::Cli.info(
|
70
76
|
::TTY::Box.frame(
|
@@ -37,8 +37,17 @@ module WorkMd
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
+
editor = WorkMd::Config.editor
|
41
|
+
|
40
42
|
::FileUtils.cd(work_dir) do
|
41
|
-
|
43
|
+
unless editor.nil?
|
44
|
+
::TTY::Editor.open(
|
45
|
+
"#{today.strftime('%Y/%m/%d')}.md",
|
46
|
+
command: editor
|
47
|
+
)
|
48
|
+
else
|
49
|
+
::TTY::Editor.open("#{today.strftime('%Y/%m/%d')}.md")
|
50
|
+
end
|
42
51
|
end
|
43
52
|
end
|
44
53
|
end
|
data/lib/work_md/config.rb
CHANGED
@@ -5,7 +5,6 @@ require 'yaml'
|
|
5
5
|
module WorkMd
|
6
6
|
module Config
|
7
7
|
DEFAULT_WORK_DIR = Dir.home + '/work_md'
|
8
|
-
DEFAULT_EDITOR = 'vi'
|
9
8
|
TRANSLATIONS = {
|
10
9
|
'pt' =>
|
11
10
|
{
|
@@ -15,7 +14,8 @@ module WorkMd
|
|
15
14
|
meeting_annotations: 'Anotações de Reunião',
|
16
15
|
interruptions: 'Interrupções',
|
17
16
|
difficulties: 'Dificuldades',
|
18
|
-
pomodoros: 'Pomodoros'
|
17
|
+
pomodoros: 'Pomodoros / Ciclos',
|
18
|
+
per_day: 'por dia'
|
19
19
|
},
|
20
20
|
'en' =>
|
21
21
|
{
|
@@ -25,7 +25,8 @@ module WorkMd
|
|
25
25
|
meeting_annotations: 'Meeting Annotations',
|
26
26
|
interruptions: 'Interruptions',
|
27
27
|
difficulties: 'Difficulties',
|
28
|
-
pomodoros: 'Pomodoros'
|
28
|
+
pomodoros: 'Pomodoros / Cycles',
|
29
|
+
per_day: 'per day'
|
29
30
|
}
|
30
31
|
}.freeze
|
31
32
|
|
@@ -34,7 +35,7 @@ module WorkMd
|
|
34
35
|
end
|
35
36
|
|
36
37
|
def self.editor
|
37
|
-
ENV['EDITOR'] || ENV['VISUAL'] || yaml_file['editor'] ||
|
38
|
+
ENV['EDITOR'] || ENV['VISUAL'] || yaml_file['editor'] || nil
|
38
39
|
end
|
39
40
|
|
40
41
|
def self.work_dir
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# rubocop:disable Metrics/ClassLength
|
3
4
|
module WorkMd
|
4
5
|
module Parser
|
5
6
|
class Engine
|
@@ -80,6 +81,14 @@ module WorkMd
|
|
80
81
|
@difficulties ||= @parsed_files.map(&:difficulties).flatten
|
81
82
|
end
|
82
83
|
|
84
|
+
def average_pomodoros
|
85
|
+
if @parsed_files.size.positive? && pomodoros.positive?
|
86
|
+
return (pomodoros / @parsed_files.size)
|
87
|
+
end
|
88
|
+
|
89
|
+
0
|
90
|
+
end
|
91
|
+
|
83
92
|
def pomodoros
|
84
93
|
raise IS_NOT_FROZEN_ERROR_MESSAGE unless @frozen
|
85
94
|
|
@@ -152,3 +161,4 @@ module WorkMd
|
|
152
161
|
end
|
153
162
|
end
|
154
163
|
end
|
164
|
+
# rubocop:enable Metrics/ClassLength
|
data/lib/work_md/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: work_md
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henrique Fernandez Teixeira
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-07-
|
11
|
+
date: 2021-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tty-box
|
@@ -38,7 +38,7 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.7.0
|
41
|
-
description:
|
41
|
+
description:
|
42
42
|
email:
|
43
43
|
- hriqueft@gmail.com
|
44
44
|
executables:
|
@@ -56,12 +56,12 @@ files:
|
|
56
56
|
- lib/work_md/config.rb
|
57
57
|
- lib/work_md/parser/engine.rb
|
58
58
|
- lib/work_md/version.rb
|
59
|
-
homepage:
|
59
|
+
homepage:
|
60
60
|
licenses:
|
61
61
|
- MIT
|
62
62
|
metadata:
|
63
63
|
source_code_uri: https://github.com/henriquefernandez/work_md
|
64
|
-
post_install_message:
|
64
|
+
post_install_message:
|
65
65
|
rdoc_options: []
|
66
66
|
require_paths:
|
67
67
|
- lib
|
@@ -76,8 +76,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: '0'
|
78
78
|
requirements: []
|
79
|
-
rubygems_version: 3.
|
80
|
-
signing_key:
|
79
|
+
rubygems_version: 3.2.15
|
80
|
+
signing_key:
|
81
81
|
specification_version: 4
|
82
82
|
summary: Track your work activities, write annotations, recap what you did for a week,
|
83
83
|
month or specific days... and much more!
|