work_md 0.3.1 → 0.3.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/cli.rb +2 -1
- data/lib/work_md/commands/annotations.rb +22 -0
- data/lib/work_md/commands/config.rb +1 -1
- data/lib/work_md/commands/parse.rb +14 -5
- data/lib/work_md/commands/tyesterday.rb +1 -1
- data/lib/work_md/config.rb +9 -4
- data/lib/work_md/file.rb +5 -5
- data/lib/work_md/parser/engine.rb +26 -4
- data/lib/work_md/version.rb +1 -1
- data/lib/work_md.rb +1 -0
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d6967faa7de63beb6db958b095b1cf6a157a9bc8db5a1effaae490c86add0bc
|
4
|
+
data.tar.gz: 054cdf1f0c0910e8962943e5a0ff5affd3830c300c54d85180049b4de7f4f708
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3473bfd171cd7f1effd40914561dd9bac760e9d3b1fe4b80561f4cfa8e0e794adc6395cdec668fd7b113a9071d750719922669a0c8681bcfdf48651c96e9ff7
|
7
|
+
data.tar.gz: a0fb4d64a689853cfe3ec7c58c1ca0ef7edb22924c222eae0bd2de9e91ca37aa14ec48d44cd60eeeafb2efd17d98f0b1508dd3a4b5bd97970f0cb3f490662b17
|
data/lib/work_md/cli.rb
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module WorkMd
|
4
|
+
module Commands
|
5
|
+
class Annotations
|
6
|
+
class << self
|
7
|
+
def execute(_argv = [])
|
8
|
+
file_name = "annotations.md"
|
9
|
+
work_dir = WorkMd::Config.work_dir
|
10
|
+
|
11
|
+
::FileUtils.mkdir_p("#{work_dir}")
|
12
|
+
|
13
|
+
unless ::File.exist?("#{work_dir}/#{file_name}")
|
14
|
+
::File.open("#{work_dir}/#{file_name}", 'w+') { |f| f.puts("# \n\n") }
|
15
|
+
end
|
16
|
+
|
17
|
+
WorkMd::File.open_in_editor([file_name])
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -51,27 +51,36 @@ module WorkMd
|
|
51
51
|
f.puts("---\n\n")
|
52
52
|
f.puts("### #{t[:interruptions]} (#{parser.interruptions.size}):\n\n")
|
53
53
|
parser.interruptions.each do |interruption|
|
54
|
-
f.puts("- #{interruption}\n
|
54
|
+
f.puts("- #{interruption}\n")
|
55
55
|
end
|
56
56
|
f.puts("---\n\n")
|
57
57
|
f.puts("### #{t[:difficulties]} (#{parser.difficulties.size}):\n\n")
|
58
58
|
parser.difficulties.each do |difficulty|
|
59
|
-
f.puts("- #{difficulty}\n
|
59
|
+
f.puts("- #{difficulty}\n")
|
60
60
|
end
|
61
61
|
f.puts("---\n\n")
|
62
62
|
f.puts("### #{t[:observations]} (#{parser.observations.size}):\n\n")
|
63
63
|
parser.observations.each do |observation|
|
64
|
-
f.puts("- #{observation}\n
|
64
|
+
f.puts("- #{observation}\n")
|
65
65
|
end
|
66
66
|
f.puts("---\n\n")
|
67
67
|
f.puts("### #{t[:pomodoros]} (#{parser.average_pomodoros} #{t[:per_day]}):\n\n")
|
68
|
-
f.puts(parser.pomodoros_sum)
|
68
|
+
f.puts("**#{t[:total]}: #{parser.pomodoros_sum}**")
|
69
69
|
f.puts("\n\n")
|
70
|
-
|
71
70
|
parser.pomodoros_bars.each do |pomodoro_bar|
|
72
71
|
f.puts(pomodoro_bar)
|
73
72
|
f.puts("\n\n")
|
74
73
|
end
|
74
|
+
f.puts("---\n\n")
|
75
|
+
f.puts("### #{t[:days_bars]}:\n\n")
|
76
|
+
f.puts("**#{t[:pomodoros]}: ⬛ | #{t[:meetings]}: 📅 | #{t[:interruptions]}: ⚠️ | #{t[:difficulties]}: 😓 | #{t[:observations]}: 📝 | #{t[:tasks]}: ✔️**")
|
77
|
+
|
78
|
+
f.puts("\n\n")
|
79
|
+
parser.days_bars.each do |day_bar|
|
80
|
+
f.puts(day_bar)
|
81
|
+
f.puts("\n\n")
|
82
|
+
end
|
83
|
+
|
75
84
|
f.puts("\n\n")
|
76
85
|
end
|
77
86
|
|
data/lib/work_md/config.rb
CHANGED
@@ -14,7 +14,9 @@ module WorkMd
|
|
14
14
|
difficulties: 'Dificuldades',
|
15
15
|
observations: 'Observações',
|
16
16
|
pomodoros: 'Pomodoros / Ciclos',
|
17
|
-
per_day: 'por dia'
|
17
|
+
per_day: 'por dia',
|
18
|
+
total: 'total',
|
19
|
+
days_bars: 'Resumo'
|
18
20
|
},
|
19
21
|
'en' =>
|
20
22
|
{
|
@@ -24,7 +26,9 @@ module WorkMd
|
|
24
26
|
difficulties: 'Difficulties',
|
25
27
|
observations: 'Observations',
|
26
28
|
pomodoros: 'Pomodoros / Cycles',
|
27
|
-
per_day: 'per day'
|
29
|
+
per_day: 'per day',
|
30
|
+
total: 'all',
|
31
|
+
days_bars: 'Summary'
|
28
32
|
},
|
29
33
|
'es' =>
|
30
34
|
{
|
@@ -34,9 +38,10 @@ module WorkMd
|
|
34
38
|
difficulties: 'Dificultades',
|
35
39
|
observations: 'Observaciones',
|
36
40
|
pomodoros: 'Pomodoros / Ciclos',
|
37
|
-
per_day: 'por día'
|
41
|
+
per_day: 'por día',
|
42
|
+
total: 'total',
|
43
|
+
days_bars: 'Abstracto'
|
38
44
|
}
|
39
|
-
|
40
45
|
}.freeze
|
41
46
|
|
42
47
|
def self.title
|
data/lib/work_md/file.rb
CHANGED
@@ -2,13 +2,13 @@
|
|
2
2
|
|
3
3
|
module WorkMd
|
4
4
|
class File
|
5
|
-
def self.open_or_create(some_date)
|
6
|
-
open_in_editor(
|
5
|
+
def self.open_or_create(some_date, dir: nil)
|
6
|
+
open_in_editor([create_if_not_exist(some_date, dir: dir)], dir: dir)
|
7
7
|
end
|
8
8
|
|
9
|
-
def self.create_if_not_exist(some_date)
|
9
|
+
def self.create_if_not_exist(some_date, dir: nil)
|
10
10
|
t = WorkMd::Config.translations
|
11
|
-
work_dir = WorkMd::Config.work_dir
|
11
|
+
work_dir = dir || WorkMd::Config.work_dir
|
12
12
|
|
13
13
|
file_name = "#{some_date.strftime('%Y/%m/%d')}.md"
|
14
14
|
|
@@ -43,7 +43,7 @@ module WorkMd
|
|
43
43
|
file_name
|
44
44
|
end
|
45
45
|
|
46
|
-
def self.open_in_editor(file_names
|
46
|
+
def self.open_in_editor(file_names = [], dir: nil)
|
47
47
|
editor = WorkMd::Config.editor
|
48
48
|
work_dir = dir || WorkMd::Config.work_dir
|
49
49
|
|
@@ -41,7 +41,7 @@ module WorkMd
|
|
41
41
|
raise IS_NOT_FROZEN_ERROR_MESSAGE unless @frozen
|
42
42
|
|
43
43
|
@done_tasks ||=
|
44
|
-
tasks.
|
44
|
+
tasks.select { |t| t.start_with?('x]') || t.start_with?('X]') }
|
45
45
|
end
|
46
46
|
|
47
47
|
def tasks
|
@@ -89,15 +89,37 @@ module WorkMd
|
|
89
89
|
@parsed_files.reduce(0) { |sum, f| sum + f.pomodoros || 0 }
|
90
90
|
end
|
91
91
|
|
92
|
-
def pomodoros_bars
|
92
|
+
def pomodoros_bars(_file = nil)
|
93
93
|
raise IS_NOT_FROZEN_ERROR_MESSAGE unless @frozen
|
94
94
|
|
95
95
|
@pomodoros_bars ||=
|
96
96
|
@parsed_files.map do |f|
|
97
|
-
"(#{f.date}) #{(1..f.pomodoros).map { '
|
97
|
+
"(#{f.date}) #{(1..f.pomodoros).map { '⬛' }.join}"
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
101
|
+
# rubocop:disable Metrics/CyclomaticComplexity
|
102
|
+
# rubocop:disable Metrics/PerceivedComplexity
|
103
|
+
def days_bars
|
104
|
+
raise IS_NOT_FROZEN_ERROR_MESSAGE unless @frozen
|
105
|
+
|
106
|
+
return @days_bars if @days_bars
|
107
|
+
|
108
|
+
@days_bars ||=
|
109
|
+
@parsed_files.map do |f|
|
110
|
+
pom = (1..f.pomodoros).map { '⬛' }.join
|
111
|
+
mee = f.meetings.map { '📅' }.join
|
112
|
+
int = f.interruptions.map { '⚠️' }.join
|
113
|
+
dif = f.difficulties.map { '😓' }.join
|
114
|
+
obs = f.observations.map { '📝' }.join
|
115
|
+
tas = f.tasks.map { '✔️' }.join
|
116
|
+
|
117
|
+
"(#{f.date}) #{pom}#{mee}#{int}#{dif}#{obs}#{tas}"
|
118
|
+
end
|
119
|
+
end
|
120
|
+
# rubocop:enable Metrics/CyclomaticComplexity
|
121
|
+
# rubocop:enable Metrics/PerceivedComplexity
|
122
|
+
|
101
123
|
def freeze
|
102
124
|
@frozen = true
|
103
125
|
end
|
@@ -164,7 +186,7 @@ module WorkMd
|
|
164
186
|
|
165
187
|
list
|
166
188
|
.map { |s| s.gsub('---', '') unless s.nil? }
|
167
|
-
.
|
189
|
+
.select { |s| (s != '') && (s != "\n\n") }
|
168
190
|
.map(&:strip)
|
169
191
|
end
|
170
192
|
end
|
data/lib/work_md/version.rb
CHANGED
data/lib/work_md.rb
CHANGED
@@ -7,6 +7,7 @@ require_relative 'work_md/commands/today'
|
|
7
7
|
require_relative 'work_md/commands/config'
|
8
8
|
require_relative 'work_md/commands/yesterday'
|
9
9
|
require_relative 'work_md/commands/tyesterday'
|
10
|
+
require_relative 'work_md/commands/annotations'
|
10
11
|
require_relative 'work_md/parser/engine'
|
11
12
|
require_relative 'work_md/commands/parse'
|
12
13
|
require_relative 'work_md/cli'
|
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.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henrique Fernandez Teixeira
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tty-box
|
@@ -51,6 +51,7 @@ files:
|
|
51
51
|
- bin/work_md
|
52
52
|
- lib/work_md.rb
|
53
53
|
- lib/work_md/cli.rb
|
54
|
+
- lib/work_md/commands/annotations.rb
|
54
55
|
- lib/work_md/commands/config.rb
|
55
56
|
- lib/work_md/commands/parse.rb
|
56
57
|
- lib/work_md/commands/today.rb
|
@@ -64,7 +65,7 @@ homepage:
|
|
64
65
|
licenses:
|
65
66
|
- MIT
|
66
67
|
metadata:
|
67
|
-
source_code_uri: https://github.com/
|
68
|
+
source_code_uri: https://github.com/work-md/work-md
|
68
69
|
post_install_message:
|
69
70
|
rdoc_options: []
|
70
71
|
require_paths:
|
@@ -83,6 +84,5 @@ requirements: []
|
|
83
84
|
rubygems_version: 3.2.15
|
84
85
|
signing_key:
|
85
86
|
specification_version: 4
|
86
|
-
summary:
|
87
|
-
month or specific days... and much more!
|
87
|
+
summary: "*** DEPRECATED 'work_md' was renamed 'work-md'"
|
88
88
|
test_files: []
|