txt_timesheet 1.1.12 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/txt_timesheet/version.rb +1 -1
- data/lib/txt_timesheet.rb +10 -6
- data/txt_timesheet.gemspec +2 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '08470fe381a48aedf40c08e78d0f2885516bab22f586e3aeb121cd85f3431dae'
|
4
|
+
data.tar.gz: 6af41285c78b9c1deb410a767f894521549613ec0f1f17d4e3ca517f76da34d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3bb8f3afc6c4a446bf42afb09e9ae326b887838e33c47cbc59b0042667ec3d70b6a0982fb5a302081d1743e56276304a13254e1c1a985a8c0341af187adc1b14
|
7
|
+
data.tar.gz: b7b38b26ec472654b6476df591fbde2fee4148e4740f48fc3a8360b47c7e013ccd46e13af5cbf06630f9beb0b5d59a4b3a4fa0da5bfcb11032a7e1dda084798f
|
data/lib/txt_timesheet.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'time'
|
4
|
-
# Treat
|
4
|
+
# Treat passed files as parameters and calculates total hours worked
|
5
|
+
|
5
6
|
class TxtTimesheet
|
6
7
|
def initialize
|
7
8
|
@can_parse = false
|
@@ -32,6 +33,10 @@ class TxtTimesheet
|
|
32
33
|
line = content_file.gets.chomp
|
33
34
|
set_can_parse(line)
|
34
35
|
|
36
|
+
if line.match(/^description:/)
|
37
|
+
phrase = line.split(':')[1]
|
38
|
+
end
|
39
|
+
|
35
40
|
next unless can_parse?
|
36
41
|
|
37
42
|
next unless time_regex.match(line)
|
@@ -48,12 +53,11 @@ class TxtTimesheet
|
|
48
53
|
###
|
49
54
|
total_sec = sum_time
|
50
55
|
|
51
|
-
# phrase = 'xixixococo'
|
52
56
|
|
53
57
|
{
|
54
58
|
file_name: filename,
|
55
|
-
file_time: total_sec
|
56
|
-
|
59
|
+
file_time: total_sec,
|
60
|
+
phrase: phrase
|
57
61
|
}
|
58
62
|
end
|
59
63
|
|
@@ -67,9 +71,9 @@ class TxtTimesheet
|
|
67
71
|
file_name = result[:file_name]
|
68
72
|
time_file = result[:file_time]
|
69
73
|
total_time += time_file
|
70
|
-
|
74
|
+
phrase = result[:phrase]
|
71
75
|
time_file = Time.at(time_file).utc
|
72
|
-
output << "#{file_name}: #{time_file.strftime('%H:%M')} hours \n"
|
76
|
+
output << "#{file_name}: #{time_file.strftime('%H:%M')} hours -#{phrase}\n"
|
73
77
|
|
74
78
|
# total_time = result[:file_time]
|
75
79
|
end
|
data/txt_timesheet.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.authors = ['Elvis Serrão']
|
9
9
|
spec.email = ['elvis.serrao1@gmail.com']
|
10
10
|
|
11
|
-
spec.summary = '
|
12
|
-
spec.description = 'Receive n files as command line parameters, parse these files and
|
11
|
+
spec.summary = 'Calculates Timesheet.'
|
12
|
+
spec.description = 'Receive n files as command line parameters, parse these files and then, calculates how many hours has been worked.'
|
13
13
|
spec.homepage = 'https://elvisserrao.github.io/'
|
14
14
|
spec.license = 'MIT'
|
15
15
|
spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: txt_timesheet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elvis Serrão
|
@@ -10,8 +10,8 @@ bindir: bin
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2019-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description: Receive n files as command line parameters, parse these files and
|
14
|
-
calculates how many hours has been worked
|
13
|
+
description: Receive n files as command line parameters, parse these files and then,
|
14
|
+
calculates how many hours has been worked.
|
15
15
|
email:
|
16
16
|
- elvis.serrao1@gmail.com
|
17
17
|
executables:
|
@@ -59,5 +59,5 @@ requirements: []
|
|
59
59
|
rubygems_version: 3.0.6
|
60
60
|
signing_key:
|
61
61
|
specification_version: 4
|
62
|
-
summary:
|
62
|
+
summary: Calculates Timesheet.
|
63
63
|
test_files: []
|