timestream 0.0.2
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.
- data/.gitignore +4 -0
- data/Gemfile +2 -0
- data/Rakefile +2 -0
- data/bin/timestream +42 -0
- data/lib/timestream/version.rb +3 -0
- data/lib/timestream.rb +3 -0
- data/timestream.gemspec +23 -0
- metadata +87 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
data/bin/timestream
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'spreadsheet'
|
5
|
+
|
6
|
+
# TODO Add selector for spreadsheets
|
7
|
+
spreadsheet = Spreadsheet.open ARGV[0]
|
8
|
+
worksheet = spreadsheet.worksheet "EAR - Current Week"
|
9
|
+
|
10
|
+
DATE_ROW = 2
|
11
|
+
DATE_COLUMN = 1
|
12
|
+
|
13
|
+
saturday_date = worksheet.row(DATE_ROW)[DATE_COLUMN]
|
14
|
+
project_totals_by_day = Hash.new { |hash, day|
|
15
|
+
hash[day] = Hash.new(0)
|
16
|
+
}
|
17
|
+
|
18
|
+
DAY_COLUMN_SPAN = 3
|
19
|
+
PROJECT_NUMBER_COLUMN = 0
|
20
|
+
|
21
|
+
# 0-indexed - rows are for this week's time
|
22
|
+
(12 .. 36).each do |row_index|
|
23
|
+
row = worksheet.row(row_index)
|
24
|
+
project_number = row[PROJECT_NUMBER_COLUMN]
|
25
|
+
|
26
|
+
# TODO handle Vacation / Holiday / Sick time
|
27
|
+
# no project number assigned
|
28
|
+
next if project_number.nil?
|
29
|
+
|
30
|
+
# 0 - Weekend
|
31
|
+
# 1 - Monday
|
32
|
+
# 2 - Tuesday...
|
33
|
+
(0 .. 5).each do |day_index|
|
34
|
+
day_column = 9 + DAY_COLUMN_SPAN * day_index
|
35
|
+
hours = row[day_column] || 0
|
36
|
+
|
37
|
+
total_by_project = project_totals_by_day[day_index]
|
38
|
+
total_by_project[project_number] += hours
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
puts project_totals_by_day.inspect
|
data/lib/timestream.rb
ADDED
data/timestream.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "timestream/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "timestream"
|
7
|
+
s.version = Timestream::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Luke Imhoff"]
|
10
|
+
s.email = ["luke@cray.com"]
|
11
|
+
s.homepage = ""
|
12
|
+
s.summary = "Timestream"
|
13
|
+
s.description = "Converts Hamster report to EAR to JDE Timecard"
|
14
|
+
|
15
|
+
s.rubyforge_project = "timestream"
|
16
|
+
|
17
|
+
s.add_dependency("spreadsheet")
|
18
|
+
|
19
|
+
s.files = `git ls-files`.split("\n")
|
20
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
21
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
22
|
+
s.require_paths = ["lib"]
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: timestream
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Luke Imhoff
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-05-11 00:00:00 -05:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: spreadsheet
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
description: Converts Hamster report to EAR to JDE Timecard
|
36
|
+
email:
|
37
|
+
- luke@cray.com
|
38
|
+
executables:
|
39
|
+
- timestream
|
40
|
+
extensions: []
|
41
|
+
|
42
|
+
extra_rdoc_files: []
|
43
|
+
|
44
|
+
files:
|
45
|
+
- .gitignore
|
46
|
+
- Gemfile
|
47
|
+
- Rakefile
|
48
|
+
- bin/timestream
|
49
|
+
- lib/timestream.rb
|
50
|
+
- lib/timestream/version.rb
|
51
|
+
- timestream.gemspec
|
52
|
+
has_rdoc: true
|
53
|
+
homepage: ""
|
54
|
+
licenses: []
|
55
|
+
|
56
|
+
post_install_message:
|
57
|
+
rdoc_options: []
|
58
|
+
|
59
|
+
require_paths:
|
60
|
+
- lib
|
61
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
+
none: false
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
hash: 3
|
67
|
+
segments:
|
68
|
+
- 0
|
69
|
+
version: "0"
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
hash: 3
|
76
|
+
segments:
|
77
|
+
- 0
|
78
|
+
version: "0"
|
79
|
+
requirements: []
|
80
|
+
|
81
|
+
rubyforge_project: timestream
|
82
|
+
rubygems_version: 1.5.2
|
83
|
+
signing_key:
|
84
|
+
specification_version: 3
|
85
|
+
summary: Timestream
|
86
|
+
test_files: []
|
87
|
+
|