samg / timetrap

Simple command line timetracker
http://rubygems.org/gems/timetrap
Other
1.48k stars 116 forks source link

Sync with Harvest #39

Closed zspencer closed 10 years ago

zspencer commented 13 years ago

HarvestApp is great, but it's kinda clunky. I love using timetrap on my machine. Would be great to sync with harvest dynamically.

samg commented 13 years ago

In theory it should be possible to write a Custom Formatter which syncs entries to Harvest. I don't use harvest and have never gotten around to writing one but I'd welcome one as a contribution. You can read about custom formatters in the README.

I've also toyed with the idea of writing a timetracking/invoicing web application that integrates with Timetrap, though I'm not sure I'll ever get around to that.

dblandin commented 10 years ago

I think I might take a crack at this. Our team just started using Harvest for timesheets and I'm using timetrap to keep track of what I'm working on during the day.

I like the way you can assign aliases to Harvest project tasks in hcl.

For example, here are the Harvest tasks we have setup now:

1234567 9876543 dscout inc - Development - Coding
1234567 8765432 dscout inc - Development - Designing
1234567 7654321 dscout inc - Development - Misc
1234567 6543219 dscout inc - Development - Planning
1234567 5432198 dscout inc - Development - Testing
2345678 4321987 dscout inc - Out Of Office - Office Holiday
2345678 3219876 dscout inc - Out Of Office - PTO
2345678 2198765 dscout inc - Out Of Office - Professional Development

And here's how you setup on alias with hcl:

hcl alias mytask <project id> <task id>

Think I could rely on the harvest aliases in timetrap's config?

Something like:

---
harvest_aliases:
  code: 1234567 9876543
  design: 1234567 8765432

Then you could reference the alias in an entry's note:

t in working on some awesome feature @code
samg commented 10 years ago

@dblandin - Timetrap's config system is pretty flexible so you could probably rely on it like you describe. You could look at https://github.com/samg/timetrap_formatters/blob/master/formatters/pay.rb#L6 for an example of a 3rd party custom formatter that is using an unofficial config value. If you wrote a custom formatter that knew how to push data to harvest's api, and could replace values like @code in the message with values in the config file you might be golden.

dblandin commented 10 years ago

v1.0.0 of timetrap-harvest is now up on GitHub and RubyGems!

You can see the project's README for installation, configuration, and usage instructions.

https://github.com/dblandin/timetrap-harvest

I decided to build this formatter as a separate gem so that I can test it separately and release updates down the line.

@samg I'd be happy to add timetrap-harvest to the timetrap_formatters project as a runtime dependency and drop in the same harvest.rb file:

# formatters/harvest.rb
require 'harvest-timetrap'

I've been using and loving this timetrap/harvest flow for the past few weeks. As long as I'm using timetrap to track my time entries during the week, it takes me a few seconds to submit them to Harvest the following Monday.

Would love to get some feedback from others interested in this integration. Please let me know what doesn't work!

samg commented 10 years ago

@dblandin - This looks awesome. Thanks for the contribution. I'd happily accept a pull request adding this as a dependency of timetrap_formatters. Also, since Harvest is a fairly popular tool it would be great to mention this in the timetrap README (e.g. https://github.com/samg/timetrap/blob/master/README.md#output-formats) so folks just getting familiar with the gem realize there's a harvest integration. Feel free to PR that one too.

I'm going to mark this issue closed since this seems to satisfy the request for a method to sync to harvest.

Thanks again!

:metal: :heart_eyes_cat: :metal:

dblandin commented 10 years ago

Thanks! Just opened those two PRs:

samg/timetrap#100 https://github.com/samg/timetrap_formatters/pull/13

Glad to close this issue up!