Voting starts in March for the Drupal Association Board election.
This module allows to upload timetracking data from hamster to Drupal.
For now this is a code dump.
It does work, but I may decide to do big changes any time.
This is D6 only atm, we are preparing a D7 version.
Use case / prerequesites
We suppose that you have
- One or more websites based on Drupal that you use for project management and issue tracking. Esp, such a website should have one node type that acts as "project."
- One or more Linux machines where you do time tracking with Hamster.
- The desire to make some of your timetracking data available on one project management website, and some other of your timetracking data available on another project management website.
- The desire to associate hamster timetrack categories with Drupal project nodes.
On your project management website, a "source" is one of those machines where the timetrack data comes from. Each source belongs to exactly one user, but one user can have more than one source set up. Sources could be named like "andreas-desktop", "andreas-notebook", "andreas-netbook-ubuntu", etc.
On your local machine, a "destination" is one of those websites where the timetrack data is sent to.
For each destination, you can control which of your tracked "categories" you want to export.
How to use
It is important to notice the different branches of this module.
- The 6.x-*, 7.x-*, etc branches do or will contain the Drupal module.
- The "export" branch contains the code to run on your local machine.
- Install the module on your site (git clone, switch to the branch corresponding to your Drupal version, enable).
- Set some permissions.
- Visit admin/settings/hamster, and configure the node types.
You need one node type to act as "project", ideally with organic groups.
On our site, we also use og_mailinglist - your choice.
drush | grep hamsterwill show you a list of hamster-related drush commands.
drush hamster-add-source (name) (user)will create a new source with that name. E.g.
drush hamster-add-source andreas-notebook andreas.
This will automatically create an api key specific to that source.
drush hamster-sourcesto show a list of existing sources with their api keys. Do not publish the api keys anywhere!
We assume you have project hamster already installed, and are actively using it. Otherwise,
sudo apt-get install hamster-applet.
(yep, this is a Linux / Ubuntu / Mint / Debian thing)
- Backup your hamster.db! There is no reason why it would get hurt, but I don't want to be responsible if it does.
- E.g. somewhere in your home folder:
git clone http://git.drupal.org/sandbox/donquixote/1922402.git hamster-export cd hamster-export git checkout export cp example.settings.ini settings.ini
- Change the settings.ini:
- Every section of the ini (what is in the "" brackets) represents a "destination". For the start, you want to create just one section, and remove the junk from the example ini.
- Settings above the first section are the "defaults" that apply to every destination. E.g. you may want to name your machine as "andreas-notebook" for all destinations.
- "file" is the location of your hamster file, typically you can use what is pre-filled. The exporter will always copy the file to /tmp before doing anything harmful, so you can indeed use the default location.
- "url" is the url to Drupal root. This should be different per destination.
- "source_name" is the name of this machine as a hamster source on the project management website.
- "api_key" is the secret token from the source on the project management website. It is needed to provide secure communication.
- To give it a try:
php export.phpto export to all destinations.
php export.php (destination)to export to a specific destination.
- Add one of those commands to cron with
crontab -e, if you want to.
(site url)/hamster in your browser, to see a list of imported timetrack data. You can browse around as you wish.
The next step is to associate hamster categories with Drupal "project" nodes.
The bad news: There are some tools for this in place, but they are quite specific to our own use case, and you won't have much fun with that. We'll see!