Skip to content

Commit

Permalink
Merge pull request #13 from dblandin/add-harvest-formatter
Browse files Browse the repository at this point in the history
Add Harvest formatter
  • Loading branch information
samg committed Jul 25, 2014
2 parents 3bc35ed + 3874203 commit 9857be7
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
source 'http://rubygems.org'

gem 'timetrap'
gem 'timetrap-harvest'
gem 'rake'

group :test do
gem "rspec", "~>2.13"
gem 'rspec', '~>2.13'
gem 'fakefs'
end

44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,48 @@ Also supports prefixes and suffixes, so to have your pay printed in dollars, set
which will be printed after each pay amount as such: `$3.14M` if you make, say,
3.14 million USD per hour.

### Harvest formatter

The Harvest formatter, developed separately as the [timetrap-harvest][timetrap-harvest] gem, will
submit your timetrap entries to timesheets on Harvest.

After adding Harvest credentials and project/task alias definitions to your
timetrap config file, you can tag entries for harvesting:

```bash
$ timetrap in working on timetrap-harvest @code
$ timetrap out
```

When you're ready to submit, you can use `timetrap` to limit the range of your
entries.

For example, you can submit your entries at the end of the day:

```bash
$ timetrap today --format harvest
```

Or for the past week:

```bash
$ timetrap display --start 'last monday' --end 'last friday' --format harvest
```

The output will list entries that `timetrap-harvest` successfully submitted as
well as entries that `timetrap-harvest` failed to submit.

```bash
Submitted: 1
Failed: 0

Submitted entries
--------------------------------------------------------------------------------
Submitted: working on timetrap-harvest @code
```

See timetrap-harvests's [README](timetrap-harvest) for more details.

## Contributing

To contribute a formatter:
Expand All @@ -165,3 +207,5 @@ To contribute a formatter:
Bugs and Feature Requests
--------
Submit to http://github.com/samg/timetrap/issues

[timetrap-harvest]: https://github.com/dblandin/timetrap-harvest
1 change: 1 addition & 0 deletions formatters/harvest.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require 'timetrap-harvest'
5 changes: 3 additions & 2 deletions spec/timetrap_formatters_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def invoke command
Timetrap::Config.stub(:[]).with('formatter_search_paths').and_return(
[File.expand_path(File.join(File.dirname(__FILE__), '..', 'formatters'))]
)
Timetrap::Config.stub(:[]).with('auto_sheet').and_return(nil)
Timetrap::Entry.create_table!
Timetrap::Meta.create_table!
$stdout = StringIO.new
Expand All @@ -44,7 +45,7 @@ def invoke command
Timetrap::Entry.create( :sheet => 'SpecSheet',
:note => 'entry', :start => '2008-10-04 19:00:00'
)
Time.stub!(:now).and_return local_time('2008-10-04 20:00:00')
Time.stub(:now).and_return local_time('2008-10-04 20:00:00')
@desired_output = <<-OUTPUT
Timesheet: SpecSheet
Day Start End Duration Notes
Expand Down Expand Up @@ -76,7 +77,7 @@ def invoke command
Timetrap::Entry.create( :sheet => 'SpecSheet',
:note => 'entry theww', :start => '2008-10-04 19:00:00'
)
Time.stub!(:now).and_return local_time('2008-10-04 20:00:00')
Time.stub(:now).and_return local_time('2008-10-04 20:00:00')
end

it "should correctly output by day format" do
Expand Down

0 comments on commit 9857be7

Please sign in to comment.