GithubHelp home page GithubHelp logo

glass's Introduction

Timeglass

Timeglass Screenshot

Fully automated time tracking for Git repositories. It uses hooks and file monitoring to make sure you'll never forget to start or stop your timer ever again. It is written in Go and runs 100% on your own workstation: no internet or account registration required.

Features:

  • The timer automatically starts when make any file changes in the repository
  • The timer automatically pauses when it doesn't detect any file activity for a while
  • The time you spent is automatically added to the next git commit
  • The timer increments in discreet steps: the minimal billable unit (MBU), by default this is 1 minute.
  • Spent time is stored as metadata using git-notes and can be pushed and stored automatically to any remote repository (e.g Github)

Currently Supported:

  • Platforms: OSX, Linux and Windows
  • Version Control: Git

Getting Started

  1. Download and install the latest release using any one of your preferred methods:

    1. Automatic installers for 64bit OSX and Windows
    2. Manual installion with 64bit precompiled Binaries for OSX, Linux and Windows
    3. Manual installion by building from source for all other architectures

Note: For Windows, the documentation assumes you're using Git through a bash-like CLI but nothing about the implementation prevents you from using another approach.

  1. Use your terminal to navigate to the repository that contains the project you would like to track and then initiate Timeglass:
cd ~/my-git-project
glass init

NOTE: you'll have to run this once per clone

  1. The timer starts right away but will pause soon unless it detects file activity or the checkout of a branch:
# see if the timer is running or paused:
glass status

# the timer keeps running while there is file activity
echo "pretending to work..." > ./my_file.go
  1. Edit some files, get a coffee, and commit in order to register the time you spent:
git add -A
git commit -m "time flies when you're having fun"
  1. Verify that the time was indeed registered correctly by looking at your commit log:
git log -n 1 --show-notes=time-spent

What's Next?

Now you know how to measure the time you are spending on each commit, you might want to learn more about...

And ofcourse, you'll always have the options to uninstall:

Roadmap, input welcome!

  • Supporting Other VCS: Timeglass currently only works for git repositories, mainly due to the number of hooks it requires. What other version control systems would you like to see implemented? Input welcome here

Known Issues

  • Handling git stash: Git has the ability to stash work for a later commit prior to switching branches. Currently the timer unable to detect this; adding extra time to next commit. Input welcome here
  • Network Volumes: Projects that are kept on network volumes (e.g using NFS) are known to have flaky support for file monitoring. This means timers might error on reboot as network drives weren't available, or the automatic unpausing of the timer might be broken in such projects. I'm looking for cases that experience such problem, or other information that might be of help over here

Contributors

in alphabetical order:

glass's People

Contributors

advanderveer avatar kvannotten avatar michaelmior avatar rosetree avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

glass's Issues

Supress/Beautify messages from commit hook if no daemon is running?

Now looks like:

2015/05/16 14:08:09 [Error]: No timer appears to be running for '/Users/advanderveer/Documents/Projects/go/src/github.com/advanderveer/timer': Daemon doesn't appears to be running.
2015/05/16 14:08:09 [Error]: No timer appears to be running for '/Users/advanderveer/Documents/Projects/go/src/github.com/advanderveer/timer': Daemon doesn't appears to be running.

Add option to respect .gitignore file

I develop in Xamarin, which likes to store build files along side the project files, during a long build my timer won't pause. At this point, I don't think a separate ignore file is needed, I imagine most people want to track time for only the files that will ultimately be committed.

Handling git stash

Git stash stores uncommited work, in similar fashion, uncommited time should also be stashed when this happens. Currently the timer just continues ticking and time is instead written to the next commit

No longer compiles from source

  • glass-daemon is a main package but imported as a package in glass/command.
  • snow is a dependency but the source build instructions don't specify that

Glass punch for current timer

Is it possible to manually set the time of the currently active timer like glass punch does it on the last commit? I love to see the commit time in the commit message, but punch does not updates it.

Install on OSX troublesome if you don't sudo to start with

Steps to replicate

  • Install glass package
  • Go to repository
  • glass install

Expected result: Error message saying you need to do this with sudo
Actual result: Partial install. The original install fails, but then trying to sudo install fails because some files already exist.

sudo glass uninstall followed by sudo glass install corrects the problem

Piers-MacBook-Air:dezeen-aa piersb$ glass install
glass: 11:36:55 Installing the Timeglass background service...
2016/05/09 11:36:55 Failed to create logger: open /Library/Timeglass/daemon.log: permission denied
glass: 11:36:55 Failed to install Daemon: exit status 1
Piers-MacBook-Air:dezeen-aa piersb$ sudo glass install
Password:
glass: 11:37:03 Installing the Timeglass background service...
2016/05/09 11:37:03 Failed to handle service control: Failed to install Timeglass: Init already exists: /Library/LaunchDaemons/com.timeglass.glass-daemon.plist
glass: 11:37:03 Failed to install Daemon: exit status 1

Proposal: global configuration

the docs says I can customize the configuration by adding a file timaglass.json in the root of my git repo. This not only increase the pollution of boilerplate files but it's also very common that we want the same config in every repo we work on.

For example, mine's is like this:

{
    "mbu": "1m",
    "commit_message": "",
    "auto_push": false
}

so, should I copy&paste this file each time I start a new project?

I propose a global editable file in ~/.config/timeglass/timeglass.json.
the priority should be

  1. local custom configuration
  2. global custom configuration
  3. defaults.

Option to put duration in message body instead of title

After using this for a few days, I feel like git messages become too cluttered with these time measurements.

I would like to keep the durations, but instead have them in the git message body.

This would also allow me to write longer commit messages.

timeglass.json in ~/

Option to read timeglass.json from user's home folder as a .timeglass.json file.

Automated tests and contribution guides

Lets turn this into an open-source project that motivates contribution:

  • automated tests (cross platform in one suite will be hard though)
  • contribution guide
  • build from source guide

Provide Ubuntu PPA (auto updates)

In Ubuntu, PPAs are the way to install and update software. Once it's set up the user can do something like this.

This installs the PPA and updates the package list:

$ sudo apt-add-repository https://some.service/timeglass/glass
$ sudo apt-get update

Then this installs the package:

$ sudo apt-get install glass

Then when new changes are detected in the PPA, they will be installed on the user's system.

If you've never done this, it's actually quite challenging. It requires reading a lot of unclear documentation and uses https://launchpad.net/ as the service. This requires you to upload your source code directly to the Launchpad servers, then the binaries and package files are built on the server. The configuration must be very precise.

An easier way is to use https://packagecloud.io/ which is closed source, but accepts pre-binary files as part of the package. This is what Slack uses to distribute on Linux. They offer a free public account as long as you don't host too much data, which I think you'll be fine with.

Prevent Init Error when no remote is present

Some repositories run without a remote being present, this should not show:

Timeglass: hooks written
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
2015/06/14 22:10:01 [Timeglass Error]: Failed to pull time data: Failed to fetch from remote 'origin' using git command [fetch origin refs/notes/time-spent:refs/notes/time-spent]: exit status 128

Brainstorm: Querying

Having intimate knowledge of both code commits and the time it took to create them opens up enormous potential for interesting data to be extracted. What would you like to query?

Working with multiple repositories simultaneously

It seems that you can double/triple time report when you work with multiple repositories simultaneously.

Timestamp 1
Repo A: status running
Repo B: status running
Timestamp 2
Repo A: status running
Repo B: status running

So in total you will get duration between Timestamp 1 and 2 for both Repo A and B. In other words 5 minutes of work will result in 10 minutes reported.

This depends on MBU, the lower it is the less overtracking you'll get.

Timeglass version 0.6.0 (20150705144337)

Feature: Supporting other OSs

File monitoring is implemented differently across platforms. The current implementation uses FSEvents (OSX), let me know what other platforms you would like to see implemented

Even more transparency when you're about to commit spent time

glass status could give a summary of the activity that was observed in determining the measured time:

$> glass status
glass: first activity: juli 15th 09:20
glass: breaks: 
glass:    10:30 (15min)
glass:    11:30 (1min)
glass:    12:30 (30min)
glass: last activity: juli 15th 16:30
glass: measured time: 5h10m
....

Roll a Homegrew package

Homebrew - is the most popular community package manager for Mac OS X. It provides a CLI way to install things on this platform. It's handy for dotfiles.

It would be nice to have Timeglass home brewed.

Nil Dereference under gentoo se-linux

First of all, awesome project. I love the easy concept that you work with. I have one bug to report:

glass: 22:39:53 Writing version control hooks...
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x553b81]

goroutine 1 [running]:
github.com/timeglass/glass/vcs.(*Git).Hook(0xc20803c4b0, 0x0, 0x0)
        /home/advanderveer/go/src/github.com/timeglass/glass/vcs/git.go:224 +0x1d1
github.com/timeglass/glass/command.(*Init).Run(0xc208044060, 0xc208056460, 0x0, 0x0)
        /home/advanderveer/go/src/github.com/timeglass/glass/command/init.go:53 +0x235
github.com/timeglass/glass/command.*Init.Run·fm(0xc208056460, 0x0, 0x0)
        /home/advanderveer/go/src/github.com/timeglass/glass/command/init.go:38 +0x43
github.com/timeglass/glass/command.func·001(0xc208056460)
        /home/advanderveer/go/src/github.com/timeglass/glass/command/types.go:27 +0x16e
github.com/timeglass/glass/_vendor/github.com/codegangsta/cli.Command.Run(0x7ad250, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x814170, 0x2d, 0xc20807a360, ...)
        /home/advanderveer/go/src/github.com/timeglass/glass/_vendor/github.com/codegangsta/cli/command.go:118 +0x104b
github.com/timeglass/glass/_vendor/github.com/codegangsta/cli.(*App).Run(0xc20807e000, 0xc20800a000, 0x2, 0x2, 0x0, 0x0)
        /home/advanderveer/go/src/github.com/timeglass/glass/_vendor/github.com/codegangsta/cli/app.go:154 +0xd04
main.main()
        /home/advanderveer/go/src/github.com/timeglass/glass/main.go:64 +0xb5d

goroutine 8 [syscall]:
os/signal.loop()
        /usr/local/go/src/os/signal/signal_unix.go:21 +0x1f
created by os/signal.init·1
        /usr/local/go/src/os/signal/signal_unix.go:27 +0x35

This happens after installing the rc-service under se-linux on permissive mode.
It worked the first time, but it crashes on this nil dereference.

Maybe I've started two of them accidentally?

Cheers
rivanov

Can't get timer to track longer than 2 min

I just encountered this issue where the timer stops at 2min no matter how much starting or stopping I do. Any recommendations or data I can provide you to better understand the bug?

Feature: Restart when OS Reboots

Whenever the OS shutsdown the repository might still contain uncommited changes with associated time, currently the timer is not restarted in this case, in supporting this a time should persist data to a tmp location while running:

  • [ ]glass stop should write its time to this place before quitting
  • [ ]glass start should continue from this state after being interrupted (unclean shutdown)

Per file time tracking

Currently time is tracked with a single timer for work across the entire repository, this has the fundamental flaw of making it impossible to correctly handle commits were the author only git add partial work (lets say 2 of the 4 edited files).

A more elegant solution would be to track time per file and only extract spent-time from the files that are actually committed.

Roadmap

0.1

  • Git checkout should start timer on entered branch
  • Git checkout should stop on branch left
  • File edits should prevent the timer from timing out
  • Commits should register spend time in the commit

0.5

  • restart timer when osx reboots
  • allow for certain file patterns to be ignored (doesn't prevent timer from pauzing)

Add a remove option

You should document how to uninstall glass and/or add a option which does it for you.

Allow donations

First off, thank you for creating this. I suffer from adult ADD, and filling out timesheets is an emotional struggle for me. It normally takes me 20+ minutes to fill out a simple timesheet for the day, and today it took me 3 minutes. This is a piece of software that will improve my life literally every single workday. I greatly appreciate the fact that this is free and open source, because I restrict myself to only using free software since I believe it is a way to improve the world.

I feel very strongly about this project and would like to see it continue to be developed and expanded. It makes sense to me that there would be some sort of way for users to send you money. A simple PayPal email address would be fine, or whatever you see fit. Bitcoin also works if you're into that, but using that exclusively may prevent some people from donating.

Thank you!!

Unable to get a timer to start

For what its worth, here is a bug I ran into and my steps to resolve

I noticed that glass was no longer inserting time into my commits. When running glass status I received No timer appears to be running for '/Users/...': Daemon doesn't appears to be running.

I ran glass start and got the timer started message. However glass status yielded the same error. glass stop had no effect either

When I tried to start the daemon manually I received It appears another Daemon is already running or a previous instance didn't shutdown properly, use -force to force start.

running glass-daemon -force and then terminating seems to have corrected the issue.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.