2017 © Pedro Peláez
 

script work-scripts

My scripts for work.

image

jaggy/work-scripts

My scripts for work.

  • Monday, August 15, 2016
  • by jaggy
  • Repository
  • 1 Watchers
  • 0 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 13 Versions
  • 0 % Grown

The README.md

Work Scripts

This is a small library to make everything a tad bit easier at work., (*1)

The company I work at heavily depends on Basecamp in logging our work hours. So I came up with a small cli script to just use the git commits to log the hours., (*2)

Dependencies

  • sleepwatcher
  • php >= 5.5

Installation

You can install the scripts with composer, (*3)

composer global require jaggy/work-scripts

Usage

Before I get into the nitty gritty parts, let's just show it off to see how it works., (*4)

$ work time:log

Yow! ( ̄^ ̄)ゞ
Which project would you like to add an entry to? [It might take a while to fetch the project list]
1: xxxxxxxxxxxxxxxxxxxxxxx
2: xxxxxxxxxxxxxxxxxxxxxxx
3: xxxxxxxxxxxxxxxxxxxxxxx
4: xxxxxxxxxxxxxxxxxxxxxxx
Enter the id of the project: [Leave blank to cancel]: 2
Log description []: Update the project readme.
How many hours did this task take? [2.25 hours remaining]]: 2
Project ID: xxxxxxxxxxx
Log Description: Update the project readme
Rendered Hours: 0.2
Is the provided data correct? [n] y
Sending the data to basecamp...
Time is now logged! You're good to go! (╯°□°)╯︵ ┻━┻

Also, you can just force the parameters. This is how the git hook makes everything much easier., (*5)

work time:log --project=<PROJECT_ID> --description="Log Entry" --hours=1.0

More or less, that's basically how it works., (*6)

Configuration

Setting up Basecamp

~/.workrc, (*7)

To make the work scripts work, you need to register your environment in your home directory ~/.workrc., (*8)

BASECAMP_URL=null
BASECAMP_USERNAME=null
BASECAMP_PASSWORD=null

Initializing a project

To initialize your project, you just need to run work init. From there, it'll do the following: - Register .work in your .gitignore - Create a .work file in your project root. - Ask which basecamp project you want to assiciate with that project and register it to your work config. - Ask if you want to write a prefix for your logs. - Register a post-commit git hook to your project., (*9)

Commands

Command Description
init Initialize the current directory as a work project.
scrum Start a SCRUM session and log to basecamp.
time:log Log a time entry to basecamp.
time:remaining Fetch the remaining hours to render from basecamp.
time:in Sends a message to the skype channel that you're in.
time:out Say your goodbyes!

Notes

Fetch the current SSID, (*10)

/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | awk '/ SSID/ {print substr($0, index($0, $2))}'

Todo

  • [x] Add caching to avoid repeated requests to basecamp.
  • [ ] Add an offline handler to send the basecamp log once an internet connection is detected.

The Versions