txt_timesheet 1.1.11 → 1.1.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -0
- data/Gemfile +8 -3
- data/Gemfile.lock +22 -3
- data/Rakefile +5 -3
- data/bin/console +4 -3
- data/bin/setup +0 -0
- data/bin/timesheet +2 -1
- data/lib/txt_timesheet.rb +6 -14
- data/lib/txt_timesheet/version.rb +3 -1
- data/txt_timesheet.gemspec +15 -14
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 40fadf717728a9dd4160dc341e98ff5dd1e9b0891cd1b0ba410e9c9398ea40e3
|
4
|
+
data.tar.gz: 845f042440ef0e81b7f9395bde0f63fe7af5e3797d223307cef234ea89c6d3f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d43a914967e0eaf5d02dc14d5d8fdc2fe6b771d661e3ad7d9e7fbb3c94fd3916dea488cad918fb0dc2b18adfa5f853d64afa3be92601717d7197681b751b2de2
|
7
|
+
data.tar.gz: 4b5c43290c4e3e428690282fa9e4fa9e216c7431ca8494b987635b2a08d0513004a8f40c9a25ba7daf01c03ec81121787c657b66aea3dedfd266a3309f82f00c
|
data/.rubocop.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require: rubocop-rspec
|
data/Gemfile
CHANGED
@@ -1,7 +1,12 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source 'https://rubygems.org'
|
2
4
|
|
3
5
|
# Specify your gem's dependencies in txt_timesheet.gemspec
|
4
6
|
gemspec
|
5
7
|
|
6
|
-
|
7
|
-
gem
|
8
|
+
group :development do
|
9
|
+
gem 'rake'
|
10
|
+
gem 'rspec'
|
11
|
+
gem 'rubocop-rspec'
|
12
|
+
end
|
data/Gemfile.lock
CHANGED
@@ -1,12 +1,18 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
txt_timesheet (1.1.
|
4
|
+
txt_timesheet (1.1.11)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
+
ast (2.4.0)
|
9
10
|
diff-lcs (1.3)
|
11
|
+
jaro_winkler (1.5.4)
|
12
|
+
parallel (1.19.1)
|
13
|
+
parser (2.6.5.0)
|
14
|
+
ast (~> 2.4.0)
|
15
|
+
rainbow (3.0.0)
|
10
16
|
rake (12.3.2)
|
11
17
|
rspec (3.9.0)
|
12
18
|
rspec-core (~> 3.9.0)
|
@@ -21,13 +27,26 @@ GEM
|
|
21
27
|
diff-lcs (>= 1.2.0, < 2.0)
|
22
28
|
rspec-support (~> 3.9.0)
|
23
29
|
rspec-support (3.9.0)
|
30
|
+
rubocop (0.78.0)
|
31
|
+
jaro_winkler (~> 1.5.1)
|
32
|
+
parallel (~> 1.10)
|
33
|
+
parser (>= 2.6)
|
34
|
+
rainbow (>= 2.2.2, < 4.0)
|
35
|
+
ruby-progressbar (~> 1.7)
|
36
|
+
unicode-display_width (>= 1.4.0, < 1.7)
|
37
|
+
rubocop-rspec (1.37.1)
|
38
|
+
rubocop (>= 0.68.1)
|
39
|
+
ruby-progressbar (1.10.1)
|
40
|
+
unicode-display_width (1.6.0)
|
24
41
|
|
25
42
|
PLATFORMS
|
43
|
+
ruby
|
26
44
|
x64-mingw32
|
27
45
|
|
28
46
|
DEPENDENCIES
|
29
|
-
rake
|
30
|
-
rspec
|
47
|
+
rake
|
48
|
+
rspec
|
49
|
+
rubocop-rspec
|
31
50
|
txt_timesheet!
|
32
51
|
|
33
52
|
BUNDLED WITH
|
data/Rakefile
CHANGED
data/bin/console
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
|
-
require
|
4
|
-
require
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'txt_timesheet'
|
5
6
|
|
6
7
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
8
|
# with your gem easier. You can also use a different console, if you like.
|
@@ -10,5 +11,5 @@ require "txt_timesheet"
|
|
10
11
|
# require "pry"
|
11
12
|
# Pry.start
|
12
13
|
|
13
|
-
require
|
14
|
+
require 'irb'
|
14
15
|
IRB.start(__FILE__)
|
data/bin/setup
CHANGED
File without changes
|
data/bin/timesheet
CHANGED
data/lib/txt_timesheet.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'time'
|
3
4
|
# Treat past files as a parameter and calculate total hours worked
|
4
5
|
class TxtTimesheet
|
5
|
-
|
6
6
|
def initialize
|
7
7
|
@can_parse = false
|
8
8
|
end
|
@@ -11,14 +11,6 @@ class TxtTimesheet
|
|
11
11
|
@can_parse
|
12
12
|
end
|
13
13
|
|
14
|
-
def convert(time_in_minutes)
|
15
|
-
### Convert working time to hh:mm format
|
16
|
-
hours = time_in_minutes / 60
|
17
|
-
minutes = time_in_minutes - hours * 60
|
18
|
-
## Add 0 to keep hh: mm format
|
19
|
-
"%02d:%02d" % [hours, minutes]
|
20
|
-
end
|
21
|
-
|
22
14
|
def set_can_parse(line)
|
23
15
|
if @can_parse
|
24
16
|
@can_parse = false if line.start_with? '## '
|
@@ -51,7 +43,7 @@ class TxtTimesheet
|
|
51
43
|
while index < time.count
|
52
44
|
|
53
45
|
sum_time = time_in_sec[index + 1] - time_in_sec[index] + sum_time
|
54
|
-
index +=2
|
46
|
+
index += 2
|
55
47
|
end
|
56
48
|
###
|
57
49
|
total_sec = sum_time
|
@@ -60,12 +52,12 @@ class TxtTimesheet
|
|
60
52
|
|
61
53
|
{
|
62
54
|
file_name: filename,
|
63
|
-
file_time: total_sec
|
55
|
+
file_time: total_sec
|
64
56
|
# phrase: phrase
|
65
57
|
}
|
66
58
|
end
|
67
59
|
|
68
|
-
def process_results(results=[])
|
60
|
+
def process_results(results = [])
|
69
61
|
output = []
|
70
62
|
total = []
|
71
63
|
total_time = 0
|
@@ -77,14 +69,14 @@ class TxtTimesheet
|
|
77
69
|
total_time += time_file
|
78
70
|
# phrase = result[:phrase]
|
79
71
|
time_file = Time.at(time_file).utc
|
80
|
-
output << "#{file_name}: #{time_file.strftime(
|
72
|
+
output << "#{file_name}: #{time_file.strftime('%H:%M')} hours \n"
|
81
73
|
|
82
74
|
# total_time = result[:file_time]
|
83
75
|
end
|
84
76
|
total = total_time.divmod(3600)
|
85
77
|
total[1] /= 60
|
86
78
|
total[1] = total.last.to_i
|
87
|
-
output << "Total Hours:
|
79
|
+
output << format("Total Hours: %02d:%02d hours\n", total[0],total[1])
|
88
80
|
|
89
81
|
output
|
90
82
|
end
|
data/txt_timesheet.gemspec
CHANGED
@@ -1,29 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 'lib/txt_timesheet/version'
|
2
4
|
|
3
5
|
Gem::Specification.new do |spec|
|
4
|
-
spec.name =
|
6
|
+
spec.name = 'txt_timesheet'
|
5
7
|
spec.version = TxtTimesheet::VERSION
|
6
|
-
spec.authors = [
|
7
|
-
spec.email = [
|
8
|
+
spec.authors = ['Elvis Serrão']
|
9
|
+
spec.email = ['elvis.serrao1@gmail.com']
|
8
10
|
|
9
|
-
spec.summary =
|
10
|
-
spec.description =
|
11
|
-
spec.homepage =
|
12
|
-
spec.license =
|
13
|
-
spec.required_ruby_version = Gem::Requirement.new(
|
11
|
+
spec.summary = 'Calculate Timesheet.'
|
12
|
+
spec.description = 'Receive n files as command line parameters, parse these files and than, calculates how many hours has been worked .'
|
13
|
+
spec.homepage = 'https://elvisserrao.github.io/'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
|
14
16
|
|
15
17
|
spec.metadata = {
|
16
|
-
|
17
|
-
|
18
|
+
'homepage_uri' => 'https://elvisserrao.github.io/',
|
19
|
+
'source_code_uri' => 'https://github.com/elvisserrao/txt-timesheet'
|
18
20
|
}
|
19
21
|
|
20
|
-
|
21
22
|
# Specify which files should be added to the gem when it is released.
|
22
23
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
23
|
-
spec.files
|
24
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
24
25
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
25
26
|
end
|
26
|
-
spec.bindir =
|
27
|
+
spec.bindir = 'bin'
|
27
28
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
28
|
-
spec.require_paths = [
|
29
|
+
spec.require_paths = ['lib']
|
29
30
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: txt_timesheet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elvis Serrão
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-12-
|
11
|
+
date: 2019-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Receive n files as command line parameters, parse these files and than,
|
14
14
|
calculates how many hours has been worked .
|
@@ -22,6 +22,7 @@ extensions: []
|
|
22
22
|
extra_rdoc_files: []
|
23
23
|
files:
|
24
24
|
- ".gitignore"
|
25
|
+
- ".rubocop.yml"
|
25
26
|
- ".travis.yml"
|
26
27
|
- Gemfile
|
27
28
|
- Gemfile.lock
|