work_md 0.2.0 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f2935dcad2a4d572722fa3c39017ca68b3446fc07bad13fa8c993c7d3a60529f
4
- data.tar.gz: add270c4aa64a634f4a22ff0f37246940d1216f78fc20b378be7c1a1d374af0e
3
+ metadata.gz: 2c18792b91679e26b6bf4e08499a20f147ab158ae7ffa1ad0b43cb159f4d4172
4
+ data.tar.gz: 7a326af95178ba2f3b91bf20a4f67ba7e467da6f5b63465adae75553ecaee6e7
5
5
  SHA512:
6
- metadata.gz: a7c21fa7695913b8161a6b85514b69a77bb15a86a6ddc14692f6b9db1178ac8088028c108e94536e29588d899e8b83d63c1d9b52cbdf3a93cdeab7402c5371b7
7
- data.tar.gz: 3ebadf962e40746eaaf6005005e2608af36d968c6bbfb675cd0dbc37b8dfb409dbeb2aab0902df45f3a5f6bb70684248acaebe28039db166ef20d848af3ccf5f
6
+ metadata.gz: 400b9fa6e7274f8c3cb610c1cd2b99e5b30f41ec5e8f3ad6939b1bf25d9ec491d343707eb0ffb2e9882b01153b5290bfe04089335e2686854fd1837df0d5bdab
7
+ data.tar.gz: 8802acb02ea2f617948603aff2bf0fcffa13197a84620ec05c99f3cedf6fcd0620461a32b6546a67863ddd55e33e2be70746a2cf062e4788aa47eaaf885fdb83
@@ -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,12 +50,12 @@ 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
@@ -64,7 +64,13 @@ module WorkMd
64
64
  f.puts(parser.pomodoros)
65
65
  end
66
66
 
67
- ::TTY::Editor.open(PARSED_FILE_PATH)
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
- ::TTY::Editor.open("#{today.strftime('%Y/%m/%d')}.md")
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
@@ -5,8 +5,6 @@ require 'yaml'
5
5
  module WorkMd
6
6
  module Config
7
7
  DEFAULT_WORK_DIR = Dir.home + '/work_md'
8
- YAML_FILE = YAML.load_file(DEFAULT_WORK_DIR + '/config.yml')
9
- DEFAULT_EDITOR = 'vi'
10
8
  TRANSLATIONS = {
11
9
  'pt' =>
12
10
  {
@@ -31,11 +29,11 @@ module WorkMd
31
29
  }.freeze
32
30
 
33
31
  def self.title
34
- YAML_FILE['title'] || ''
32
+ yaml_file['title'] || ''
35
33
  end
36
34
 
37
35
  def self.editor
38
- ENV['EDITOR'] || ENV['VISUAL'] || YAML_FILE['editor'] || DEFAULT_EDITOR
36
+ ENV['EDITOR'] || ENV['VISUAL'] || yaml_file['editor'] || nil
39
37
  end
40
38
 
41
39
  def self.work_dir
@@ -44,8 +42,14 @@ module WorkMd
44
42
 
45
43
  def self.translations
46
44
  TRANSLATIONS[ENV['WORK_MD_LANG']] ||
47
- TRANSLATIONS[YAML_FILE['lang']] ||
45
+ TRANSLATIONS[yaml_file['lang']] ||
48
46
  TRANSLATIONS['en']
49
47
  end
48
+
49
+ def self.yaml_file
50
+ YAML.load_file(DEFAULT_WORK_DIR + '/config.yml')
51
+ rescue StandardError
52
+ {}
53
+ end
50
54
  end
51
55
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WorkMd
4
- VERSION = '0.2.0'
4
+ VERSION = '0.2.4'
5
5
  end
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.0
4
+ version: 0.2.4
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 00:00:00.000000000 Z
11
+ date: 2021-07-13 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.1.6
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!