work-md 0.4.4 → 0.4.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 +2 -0
- data/lib/work/md/commands/plast.rb +3 -1
- data/lib/work/md/file.rb +2 -2
- data/lib/work/md/parser/engine.rb +23 -6
- data/lib/work/md/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e11b12242f29e25b4cd175693b475d548e37c422f966cca7c4ecdd7ae7bbf23
|
4
|
+
data.tar.gz: 7707b5b4ddbcf93fcfa22209eafcfd214de35cf56faec7739ed2b3239af33cd1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49da10202bf64a92baff477f92ad3cb510e8445ef4792b64298f0449680862b0b241ed8a710f047dd846ee5cf9d53930b9bc1594ca1a4e9fcaa29b6adef8ad0e
|
7
|
+
data.tar.gz: 932cc585bf763de7d26eade30b48a903885ba23a17a5a6594e3d088f598a7b99fbb99414bb98b0042b2b351f7a32e740c8c0bd74f82851afd2960235ec5aa06d
|
@@ -42,7 +42,9 @@ module Work
|
|
42
42
|
end
|
43
43
|
|
44
44
|
Work::Md::File.create_and_open_parsed(parser)
|
45
|
-
rescue
|
45
|
+
rescue Work::Md::Parser::Error => e
|
46
|
+
Work::Md::Cli.help(e.message)
|
47
|
+
rescue StandardError => e
|
46
48
|
Work::Md::Cli.help(
|
47
49
|
::TTY::Box.frame(
|
48
50
|
"message: Some of verified markdown files may be with an incorrect format",
|
data/lib/work/md/file.rb
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'date'
|
4
|
+
|
3
5
|
module Work
|
4
6
|
module Md
|
5
7
|
module Parser
|
8
|
+
class Error < StandardError; end
|
9
|
+
|
6
10
|
# rubocop:disable Metrics/ClassLength
|
7
11
|
class Engine
|
8
12
|
IS_FROZEN_ERROR_MESSAGE = 'Work::Md::Parser::Engine is frozen'
|
@@ -108,12 +112,12 @@ module Work
|
|
108
112
|
|
109
113
|
@days_bars ||=
|
110
114
|
@parsed_files.map do |f|
|
111
|
-
pom = (1..f.pomodoros).map { '⬛' }.join
|
112
|
-
mee = f.meetings.map { '📅' }.join
|
113
|
-
int = f.interruptions.map { '⚠️' }.join
|
114
|
-
dif = f.difficulties.map { '😓' }.join
|
115
|
-
obs = f.observations.map { '📝' }.join
|
116
|
-
tas = f.tasks.map { '✔️' }.join
|
115
|
+
pom = (1..f.pomodoros).map { '⬛' }.join if f.pomodoros
|
116
|
+
mee = f.meetings.map { '📅' }.join if f.meetings
|
117
|
+
int = f.interruptions.map { '⚠️' }.join if f.interruptions
|
118
|
+
dif = f.difficulties.map { '😓' }.join if f.difficulties
|
119
|
+
obs = f.observations.map { '📝' }.join if f.observations
|
120
|
+
tas = f.tasks.map { '✔️' }.join if f.tasks
|
117
121
|
|
118
122
|
"(#{f.date}) #{pom}#{mee}#{int}#{dif}#{obs}#{tas}"
|
119
123
|
end
|
@@ -170,6 +174,19 @@ module Work
|
|
170
174
|
parsed_file.pomodoros =
|
171
175
|
parse_pomodoro(content, start_with: @t[:pomodoros])
|
172
176
|
end
|
177
|
+
rescue StandardError
|
178
|
+
# TODO: Write tests for this scenario
|
179
|
+
file_name = Date.strptime(parsed_file.date, '%d/%m/%Y').strftime('%Y/%m/%d.md')
|
180
|
+
message = ::TTY::Box.frame(
|
181
|
+
"message: Cannot parse file '#{file_name}' maybe it's in an incorrect format.",
|
182
|
+
'',
|
183
|
+
'Usage example:',
|
184
|
+
'',
|
185
|
+
'work-md pl 7 # parse the last 7 days',
|
186
|
+
**Work::Md::Cli.error_frame_style
|
187
|
+
)
|
188
|
+
|
189
|
+
raise Error, message
|
173
190
|
end
|
174
191
|
# rubocop:enable Metrics/CyclomaticComplexity
|
175
192
|
# rubocop:enable Metrics/PerceivedComplexity
|
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.4.
|
4
|
+
version: 0.4.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-
|
11
|
+
date: 2021-11-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tty-box
|