time_cop 0.1.0 → 0.2.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 +4 -4
- data/README.md +7 -12
- data/lib/time_cop/accountability.rb +8 -3
- data/lib/time_cop/option_parser.rb +4 -0
- data/lib/time_cop/runner.rb +1 -1
- data/lib/time_cop/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dbd30d879f6956f878131b5e070f6973f85f5451
|
4
|
+
data.tar.gz: 5fd2f4729fa582dadfd679b3df1a1351112a837c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2110f326ec451c4d0068e84cbfe6079eed7b7423f593fee38a47097e61e029904c15fabb19a9061c675ba79bc006f79ce034a09a04bc71e80d014628784a1ee0
|
7
|
+
data.tar.gz: 08a5d4bf2b089baee33e764b9a1b94055ac9c9d2f3b7aeb19f5cc10304038913c96fab97924a3c6e8efaed090f3fc88154de16675fe82416ee6c29d8d52144e9
|
data/README.md
CHANGED
@@ -5,32 +5,27 @@ Welcome to your new gem! In this directory, you'll find the files you need to be
|
|
5
5
|
TODO: Delete this and the text above, and describe your gem
|
6
6
|
|
7
7
|
## Installation
|
8
|
-
|
9
|
-
Add this line to your application's Gemfile:
|
10
|
-
|
11
|
-
```ruby
|
12
|
-
gem 'time_cop'
|
13
|
-
```
|
8
|
+
$ gem install time_cop
|
14
9
|
|
15
10
|
And then execute:
|
16
11
|
|
17
|
-
$
|
12
|
+
$ time_cop
|
18
13
|
|
19
14
|
Or install it yourself as:
|
20
15
|
|
21
|
-
$ gem install time_cop
|
22
|
-
|
23
16
|
## Usage
|
24
17
|
|
25
|
-
|
18
|
+
$ time_cop --username=user@wild.land --password=super_secret_password
|
26
19
|
|
27
20
|
## Development
|
28
21
|
|
29
22
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
23
|
|
31
|
-
To
|
24
|
+
To run the local development copy on your machine, run `$ ruby -Ilib ./exe/time_cop`
|
25
|
+
|
26
|
+
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).
|
32
27
|
|
33
28
|
## Contributing
|
34
29
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
30
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/wildland/time_cop. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
31
|
|
@@ -16,13 +16,13 @@ module TimeCop
|
|
16
16
|
q4: [{month: 10, day: 1}, {month: 12, day: 31}]
|
17
17
|
}
|
18
18
|
|
19
|
-
def initialize(username:, password:, subdomain: 'wildland', date: Date.today, report_builder: nil)
|
19
|
+
def initialize(username:, password:, subdomain: 'wildland', date: Date.today, report_builder: nil, email: nil)
|
20
20
|
@client = Harvest.client(username: username, password: password, subdomain: subdomain)
|
21
21
|
@date = date
|
22
22
|
@report_builder = report_builder ||
|
23
23
|
ReportBuilder.new(
|
24
24
|
client: client,
|
25
|
-
user:
|
25
|
+
user: email ? fetch_user(email) : default_user,
|
26
26
|
start_date: start_of_quarter_date,
|
27
27
|
end_date: end_of_quarter_date
|
28
28
|
)
|
@@ -32,7 +32,11 @@ module TimeCop
|
|
32
32
|
client.account
|
33
33
|
end
|
34
34
|
|
35
|
-
def
|
35
|
+
def fetch_user(email)
|
36
|
+
client.users.find(email)
|
37
|
+
end
|
38
|
+
|
39
|
+
def default_user
|
36
40
|
account.who_am_i
|
37
41
|
end
|
38
42
|
|
@@ -146,6 +150,7 @@ module TimeCop
|
|
146
150
|
end
|
147
151
|
|
148
152
|
def print_report
|
153
|
+
puts "Quarter Period: #{start_of_quarter_date} #{end_of_quarter_date}"
|
149
154
|
puts "Current Surplus(+)/Deficit(-): #{current_hours_delta.round(2)}"
|
150
155
|
puts "Quarterly Hour Target: #{expected_quarter_hours.round(2)}"
|
151
156
|
puts "Current Quarterly Charged Hours: #{total_quarter_time_tracked.round(2)}"
|
data/lib/time_cop/runner.rb
CHANGED
@@ -6,7 +6,7 @@ module TimeCop
|
|
6
6
|
options_parser = OptionParser.new(ARGV)
|
7
7
|
options = options_parser.parse
|
8
8
|
|
9
|
-
accountability = Accountability.new(username: options[:username], password: options[:password])
|
9
|
+
accountability = Accountability.new(username: options[:username], password: options[:password], email: options[:email])
|
10
10
|
accountability.print_report
|
11
11
|
end
|
12
12
|
end
|
data/lib/time_cop/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: time_cop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Clopton
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: harvested
|