timeshit 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +51 -0
- data/.rspec +3 -0
- data/.travis.yml +5 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +43 -0
- data/README.md +51 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/demo.gif +0 -0
- data/exe/timeshit +4 -0
- data/lib/timeshit.rb +4 -0
- data/lib/timeshit/cli.rb +50 -0
- data/lib/timeshit/version.rb +3 -0
- data/timeshit.gemspec +39 -0
- metadata +133 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6477c0dbec4787858b3e64c14fa4e7d4f9a70cfa
|
4
|
+
data.tar.gz: b76268ad0e3fd0e632f5283634fefb8d44fb985a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 529071aeab6f7a56755feb85b0119250109a24b9c8bcf849711e74c764c44f65d6c41653fcd1f8b5c6b0243090be13b4b54aac8e33495871081cba8be961f58f
|
7
|
+
data.tar.gz: bbd28cb62ff3ce70500fbd0015675a0f6cc6fe4be9f41b85e8495b9f001894ba2dccc6c3ea39df2ea540299e89e091699244b588cf2a4a957dd354620f4718a1
|
data/.gitignore
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
*.ignore
|
2
|
+
*.gem
|
3
|
+
*.rbc
|
4
|
+
/.config
|
5
|
+
/coverage/
|
6
|
+
/InstalledFiles
|
7
|
+
/pkg/
|
8
|
+
/spec/reports/
|
9
|
+
/spec/examples.txt
|
10
|
+
/test/tmp/
|
11
|
+
/test/version_tmp/
|
12
|
+
/tmp/
|
13
|
+
|
14
|
+
# Used by dotenv library to load environment variables.
|
15
|
+
# .env
|
16
|
+
|
17
|
+
## Specific to RubyMotion:
|
18
|
+
.dat*
|
19
|
+
.repl_history
|
20
|
+
build/
|
21
|
+
*.bridgesupport
|
22
|
+
build-iPhoneOS/
|
23
|
+
build-iPhoneSimulator/
|
24
|
+
|
25
|
+
## Specific to RubyMotion (use of CocoaPods):
|
26
|
+
#
|
27
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
28
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
29
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
30
|
+
#
|
31
|
+
# vendor/Pods/
|
32
|
+
|
33
|
+
## Documentation cache and generated files:
|
34
|
+
/.yardoc/
|
35
|
+
/_yardoc/
|
36
|
+
/doc/
|
37
|
+
/rdoc/
|
38
|
+
|
39
|
+
## Environment normalization:
|
40
|
+
/.bundle/
|
41
|
+
/vendor/bundle
|
42
|
+
/lib/bundler/man/
|
43
|
+
|
44
|
+
# for a library or gem, you might want to ignore these files since the code is
|
45
|
+
# intended to run in multiple environments; otherwise, check them in:
|
46
|
+
# Gemfile.lock
|
47
|
+
# .ruby-version
|
48
|
+
# .ruby-gemset
|
49
|
+
|
50
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
51
|
+
.rvmrc
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
timeshit (0.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
coderay (1.1.2)
|
10
|
+
diff-lcs (1.3)
|
11
|
+
method_source (0.9.0)
|
12
|
+
pry (0.11.3)
|
13
|
+
coderay (~> 1.1.0)
|
14
|
+
method_source (~> 0.9.0)
|
15
|
+
rake (10.5.0)
|
16
|
+
rspec (3.7.0)
|
17
|
+
rspec-core (~> 3.7.0)
|
18
|
+
rspec-expectations (~> 3.7.0)
|
19
|
+
rspec-mocks (~> 3.7.0)
|
20
|
+
rspec-core (3.7.1)
|
21
|
+
rspec-support (~> 3.7.0)
|
22
|
+
rspec-expectations (3.7.0)
|
23
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
24
|
+
rspec-support (~> 3.7.0)
|
25
|
+
rspec-mocks (3.7.0)
|
26
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
27
|
+
rspec-support (~> 3.7.0)
|
28
|
+
rspec-support (3.7.1)
|
29
|
+
thor (0.20.0)
|
30
|
+
|
31
|
+
PLATFORMS
|
32
|
+
ruby
|
33
|
+
|
34
|
+
DEPENDENCIES
|
35
|
+
bundler (~> 1.16)
|
36
|
+
pry
|
37
|
+
rake (~> 10.0)
|
38
|
+
rspec (~> 3.0)
|
39
|
+
thor (~> 0.20)
|
40
|
+
timeshit!
|
41
|
+
|
42
|
+
BUNDLED WITH
|
43
|
+
1.16.1
|
data/README.md
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# Timeshit
|
2
|
+
|
3
|
+
Leser csv filer eksportert fra TidBank detaljert rapport og skriver ut timeføringsposter i tripletex vennlig format
|
4
|
+
|
5
|
+
## Usage
|
6
|
+
|
7
|
+
- Først last ned en csv rapport detaljert pr dag.
|
8
|
+
- Så les in filen med timeshit
|
9
|
+
|
10
|
+
$ timeshit read <PATH_TO_CSV>
|
11
|
+
|
12
|
+
Du kan også filtrere på oppgave, dersom det er ønskelig med --filter option:
|
13
|
+
|
14
|
+
$ timeshit read <PATH_TO_CSV> --filter 4010
|
15
|
+
|
16
|
+
## Demo
|
17
|
+
|
18
|
+
![Demo gif](https://github.com/kenglxn/timeshit/raw/master/demo.gif "Demo gif")
|
19
|
+
|
20
|
+
## Installation
|
21
|
+
|
22
|
+
You can install the prebuilt gem with:
|
23
|
+
|
24
|
+
$ curl -O -J -L https://github.com/kenglxn/timeshit/raw/master/dist/timeshit.gem; gem install timeshit.gem
|
25
|
+
|
26
|
+
Or if you want/need to build it yourself:
|
27
|
+
|
28
|
+
Clone:
|
29
|
+
|
30
|
+
$ git clone git@github.com:kenglxn/timeshit.git
|
31
|
+
|
32
|
+
Then build with:
|
33
|
+
|
34
|
+
$ rake build
|
35
|
+
-> timeshit 0.0.1 built to pkg/timeshit-0.0.1.gem.
|
36
|
+
|
37
|
+
And then install:
|
38
|
+
|
39
|
+
$ gem install pkg/timeshit-0.0.1.gem
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
## Development
|
44
|
+
|
45
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
46
|
+
|
47
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
48
|
+
|
49
|
+
## Contributing
|
50
|
+
|
51
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/kenglxn/timeshit.
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "timeshit"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/demo.gif
ADDED
Binary file
|
data/exe/timeshit
ADDED
data/lib/timeshit.rb
ADDED
data/lib/timeshit/cli.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'csv'
|
5
|
+
require 'thor'
|
6
|
+
|
7
|
+
module Timeshit
|
8
|
+
class CLI < Thor
|
9
|
+
CSV_OPTS = {
|
10
|
+
col_sep: ';',
|
11
|
+
quote_char:'"',
|
12
|
+
headers: true,
|
13
|
+
force_quotes: true,
|
14
|
+
header_converters: :symbol
|
15
|
+
}.freeze
|
16
|
+
|
17
|
+
option :filter
|
18
|
+
option :rate => :number
|
19
|
+
desc "read FILE", "read exported SKD timereport csv file"
|
20
|
+
def read(filename)
|
21
|
+
filter = options[:filter]
|
22
|
+
rate = options[:rate] || 1297.0
|
23
|
+
total = 0.0
|
24
|
+
|
25
|
+
CSV.open(filename, 'r:bom|utf-8', CSV_OPTS) do |csv|
|
26
|
+
csv.each do |row|
|
27
|
+
code = row[:dimensjon_4]
|
28
|
+
filtered_out = filter && !code.include?(filter)
|
29
|
+
|
30
|
+
next if code.empty? || filtered_out
|
31
|
+
|
32
|
+
hrs = row[:sum].split(":")[0].to_i
|
33
|
+
min = row[:sum].split(":")[1].to_i
|
34
|
+
sum = hrs+(min.to_i/60.0).round(2)
|
35
|
+
puts " #{row[:dato]}: #{code[/\d+/]} #{sum}"
|
36
|
+
total+=sum
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
puts "------------------------------------"
|
41
|
+
puts " rate: #{rate}"
|
42
|
+
puts " total hrs: #{total.round(2)}"
|
43
|
+
puts " total earnings: #{(total * rate).round(2)}"
|
44
|
+
puts " your cut: #{(total * rate * 0.6).round(2)}"
|
45
|
+
puts " after tax: #{(total * rate * 0.6 * 0.6).round(2)}"
|
46
|
+
puts " after vacation: #{(total * rate * 0.6 * 0.6 * 0.88).round(2)}"
|
47
|
+
puts "------------------------------------"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
data/timeshit.gemspec
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "timeshit/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'timeshit'
|
8
|
+
spec.version = Timeshit::VERSION
|
9
|
+
spec.date = '2018-03-27'
|
10
|
+
spec.summary = 'timeshit yo'
|
11
|
+
spec.description = 'Kicks ass and chews bubblegum'
|
12
|
+
spec.authors = ["kenglxn"]
|
13
|
+
spec.email = ["ken@glxn.net"]
|
14
|
+
spec.homepage = 'https://github.com/kenglxn/skd_timeshit'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
21
|
+
else
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
23
|
+
"public gem pushes."
|
24
|
+
end
|
25
|
+
|
26
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
27
|
+
f.match(%r{^(test|spec|features)/})
|
28
|
+
end
|
29
|
+
spec.bindir = "exe"
|
30
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
31
|
+
spec.require_paths = ["lib"]
|
32
|
+
|
33
|
+
spec.add_runtime_dependency "thor", "~> 0.20"
|
34
|
+
|
35
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
36
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
37
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
38
|
+
spec.add_development_dependency "pry"
|
39
|
+
end
|
metadata
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: timeshit
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- kenglxn
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-03-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: thor
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.20'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.20'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.16'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.16'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: Kicks ass and chews bubblegum
|
84
|
+
email:
|
85
|
+
- ken@glxn.net
|
86
|
+
executables:
|
87
|
+
- timeshit
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- ".gitignore"
|
92
|
+
- ".rspec"
|
93
|
+
- ".travis.yml"
|
94
|
+
- Gemfile
|
95
|
+
- Gemfile.lock
|
96
|
+
- README.md
|
97
|
+
- Rakefile
|
98
|
+
- bin/console
|
99
|
+
- bin/setup
|
100
|
+
- demo.gif
|
101
|
+
- dist/timeshit-0.0.1.gem
|
102
|
+
- dist/timeshit.gem
|
103
|
+
- exe/timeshit
|
104
|
+
- lib/timeshit.rb
|
105
|
+
- lib/timeshit/cli.rb
|
106
|
+
- lib/timeshit/version.rb
|
107
|
+
- timeshit.gemspec
|
108
|
+
homepage: https://github.com/kenglxn/skd_timeshit
|
109
|
+
licenses:
|
110
|
+
- MIT
|
111
|
+
metadata:
|
112
|
+
allowed_push_host: https://rubygems.org
|
113
|
+
post_install_message:
|
114
|
+
rdoc_options: []
|
115
|
+
require_paths:
|
116
|
+
- lib
|
117
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
118
|
+
requirements:
|
119
|
+
- - ">="
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '0'
|
122
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - ">="
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0'
|
127
|
+
requirements: []
|
128
|
+
rubyforge_project:
|
129
|
+
rubygems_version: 2.5.2
|
130
|
+
signing_key:
|
131
|
+
specification_version: 4
|
132
|
+
summary: timeshit yo
|
133
|
+
test_files: []
|