Toggl to Codebase Tracker

A command line tool built to help convert your Toggl time entries into entries on Codebase.

Installation Instructions

To install the tracker tool on your mac you need to download both the public key and the latest version of tracker from the download links in the header above.

Open terminal and navigate to the folder you just downloaded the files to.

  1. Put tracker in folder we can access it and make it executable:
    • sudo mv tracker /usr/local/bin
    • sudo chmod 0755 /usr/local/bin/tracker
  2. Add /usr/local/bin to path if it doesn't exist add the following line to ~/.bash_profile.
    • nano ~/.bash_profile
    • export PATH="/usr/local/bin:$PATH"
    • source ~/.bash_profile
  3. Check that the command exists by running the following in the command line.
    • which tracker
  4. If you get a result like below then everything is setup correctly. If not check that the permissions of the tracker file is correct and that all commands above have been ran.
    • /usr/local/bin/tracker

Using Tracker

Described here are details about how you can use tracker to send your information from Toggl into codebase and how you can update/rollback the tracker version.

Initial Setup/Configuration

Run tracker configure

This walks you through the initial setup of the application by requesting your codebase and toggl api keys as well as asking for the toggl workspace you would like to use.

Project Import

Run tracker project-import

This will ask if you want to import any projects into Toggl from Codebase which are archived or not. Type "y" to import or "n" to skip archived projects.

Attach ticket id to time entry

In order to add a ticket entry to toggl you need to reference it like so in the time description:

[touch: {ticket-id}]
e.g.
[touch: 162]

Also for time to be tracked each entry needs to have the correct project attached. You should have these projects populated in toggl if the project import script has ran.

The touch command will be stripped from the time entry before pushing into codebase so it makes sense to also add an extra description to a time entry like the title of the job or just some general information about what was tracker.

[touch: 162] Fixes a bug with the navigation

You can also just log generic time to a project by not adding the above touch command to the time entry.

Importing Time

Run tracker-time-update {[today, yesterday, custom]}

In the brackets above select any of the above items. Today will take all times from today and import them, yesterday will do do yesterday and custom will allow you to define a custom time range so you can batch import any time entries.

An example of a custom date range could be something like:

tracker time-update custom 19/09/2017 23/09/2017

Which will import all times between those dates.

Update and rollback

Tracker also comes with update and rollback commands which can be used like below:

tracker update
tracker rollback

Rather than following the installation steps above each time a new version of tracker is available the update command was added in so whenever a release is added with new features and bug fixes the update so that this is much easier.

The rollback command was added so that if a new release has broken some functionality or has introduced a new bug you can run that command to return back to the earlier version of the tool.

Certificate Download

In the header alongside the downloads we also have a certificate installation script. This can be downloaded and ran if the openssl certificates on the mac are out of date. We need to update these for the auto update functionality to get it to work correctly.

Usually this will occur and you need to install wget via the following brew command:

brew install wget

NOTE: If you don't have brew installed you can download it from here

To install the certficates download the install script, navigate to it in the command line and make sure it is executable:

chmod +x install.sh

Then run it:

./install.sh

You may be prompted to type in your password for the script to run.

Automatically Import Your Times

Download the cron script from here and add it to ~/.tracker/.

Do the following to add a cronjob to call the script.

crontab -e

In this file add the following code:

30 09 * * * cd ~/.tracker && ./cron.sh

Finally create a new file in the .tracker folder

nano ~/.tracker/last-import.txt

Add yesterdays date into the file in the following format.

27/02/2019

Save this and exit nano with ctrl + x

Problems importing your times?

If your times are not importing then the info below may help.

Project Names

In order to import into Codebase the project name in Toggl must match the project name in Codebase.

If the project name is changed in Codebase it will not automatically be updated in Toggl.

Timer still running

It's possible for the desktop app and the toggl site to go out of sync, and the site to still be tracking when you've stopped the desktop app.

If this happens then you need to log into your toggl dashboard and stop the timer in order to import times.