work_md 0.1.0
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 +7 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/bin/work_md +6 -0
- data/lib/work_md.rb +11 -0
- data/lib/work_md/cli.rb +39 -0
- data/lib/work_md/commands/today.rb +50 -0
- data/lib/work_md/config.rb +16 -0
- data/lib/work_md/version.rb +5 -0
- metadata +54 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5b513f11cea5e174a366551222bcd7c3a9ae12494ecdbb7d5f6b326bfe259cd0
|
4
|
+
data.tar.gz: 96951bcfd495236d08d41a912171caac121afd74413aaf2a920b2985dec7a392
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1dc33cce0525aa56a359619cfae40acd1809317844789ebf50adce5d038f410026a3232cf1bbbf15c63d9c9747c010fee84a339ba436d6cc431e7af6f40b8f84
|
7
|
+
data.tar.gz: 732380d8fa80db98fff04ef5cbd662b789afecc0e68939700a77576fd75731b6339390e303d51b1e0f27a86a0dabf9f0dd6b04a3cb9afcae1376054874aee63c
|
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'work_md'
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require 'irb'
|
15
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/bin/work_md
ADDED
data/lib/work_md.rb
ADDED
data/lib/work_md/cli.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module WorkMd
|
4
|
+
module Cli
|
5
|
+
class CommandMissing < RuntimeError; end
|
6
|
+
|
7
|
+
ALIAS_COMMANDS =
|
8
|
+
{
|
9
|
+
't' => 'today'
|
10
|
+
}.freeze
|
11
|
+
|
12
|
+
DEFAULT_COMMAND = WorkMd::Commands::Today
|
13
|
+
|
14
|
+
def self.execute(argv)
|
15
|
+
first_argv_argument = argv.shift
|
16
|
+
|
17
|
+
raise CommandMissing if first_argv_argument.nil?
|
18
|
+
|
19
|
+
command =
|
20
|
+
(ALIAS_COMMANDS[first_argv_argument] || first_argv_argument).capitalize
|
21
|
+
|
22
|
+
Object
|
23
|
+
.const_get("WorkMd::Commands::#{command}")
|
24
|
+
.send(:execute, argv)
|
25
|
+
rescue NameError
|
26
|
+
error("Command '#{first_argv_argument}' not found!")
|
27
|
+
rescue CommandMissing
|
28
|
+
DEFAULT_COMMAND.execute(argv)
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.error(message)
|
32
|
+
puts 'x - work_md error ------ x'
|
33
|
+
puts ''
|
34
|
+
puts message
|
35
|
+
puts ''
|
36
|
+
puts 'x ---------------------- x'
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module WorkMd
|
4
|
+
module Commands
|
5
|
+
class Today
|
6
|
+
class << self
|
7
|
+
def description; end
|
8
|
+
|
9
|
+
def execute(_argv = [])
|
10
|
+
today = DateTime.now
|
11
|
+
|
12
|
+
::FileUtils
|
13
|
+
.mkdir_p("#{WorkMd::Config.work_dir}/#{today.strftime('%Y/%m')}")
|
14
|
+
unless ::File
|
15
|
+
.exist?(
|
16
|
+
"#{WorkMd::Config.work_dir}/#{today.strftime('%Y/%m/%d')}.md"
|
17
|
+
)
|
18
|
+
::File.open(
|
19
|
+
"#{WorkMd::Config.work_dir}/#{today.strftime('%Y/%m/%d')}.md",
|
20
|
+
'w+'
|
21
|
+
) do |f|
|
22
|
+
f.puts("# #{today.strftime('%d/%m/%Y')} \n\n")
|
23
|
+
f.puts("### Atividades:\n\n")
|
24
|
+
f.puts("- [ ]\n\n")
|
25
|
+
f.puts("---\n\n")
|
26
|
+
f.puts("### Reuniões:\n\n")
|
27
|
+
f.puts("---\n\n")
|
28
|
+
f.puts("### Anotações:\n\n")
|
29
|
+
f.puts("###### Anotações de Reunião:\n\n")
|
30
|
+
f.puts("---\n\n")
|
31
|
+
f.puts("### Interrupções:\n\n")
|
32
|
+
f.puts("---\n\n")
|
33
|
+
f.puts("### Dificuldades:\n\n")
|
34
|
+
f.puts("---\n\n")
|
35
|
+
f.puts("### Pomodoros:\n\n")
|
36
|
+
f.puts("0\n\n")
|
37
|
+
f.puts("---\n\n")
|
38
|
+
f.puts("### Ponto:\n\n")
|
39
|
+
f.puts("- \n\n")
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
::FileUtils.cd(WorkMd::Config.work_dir) do
|
44
|
+
system("#{WorkMd::Config.editor} #{today.strftime('%Y/%m/%d')}.md")
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# TODO: Make this a class with receive an yaml file directory,
|
4
|
+
# this is easier to mock in test
|
5
|
+
# TODO: Set language (i18n) as a config
|
6
|
+
module WorkMd
|
7
|
+
module Config
|
8
|
+
def self.editor
|
9
|
+
ENV['EDITOR']
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.work_dir
|
13
|
+
"#{Dir.home}/work_md/"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: work_md
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Henrique Fernandez Teixeira
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-07-06 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description:
|
14
|
+
email:
|
15
|
+
- hriqueft@gmail.com
|
16
|
+
executables:
|
17
|
+
- work_md
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- bin/console
|
22
|
+
- bin/setup
|
23
|
+
- bin/work_md
|
24
|
+
- lib/work_md.rb
|
25
|
+
- lib/work_md/cli.rb
|
26
|
+
- lib/work_md/commands/today.rb
|
27
|
+
- lib/work_md/config.rb
|
28
|
+
- lib/work_md/version.rb
|
29
|
+
homepage:
|
30
|
+
licenses:
|
31
|
+
- MIT
|
32
|
+
metadata:
|
33
|
+
source_code_uri: https://github.com/henriquefernandez/work_md
|
34
|
+
post_install_message:
|
35
|
+
rdoc_options: []
|
36
|
+
require_paths:
|
37
|
+
- lib
|
38
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 2.3.0
|
43
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
requirements: []
|
49
|
+
rubygems_version: 3.2.15
|
50
|
+
signing_key:
|
51
|
+
specification_version: 4
|
52
|
+
summary: Track your work activities, write annotations, recap what you did for a week,
|
53
|
+
month or specific days... and much more!
|
54
|
+
test_files: []
|