Pages

Automating my Work Day

Jul 18, 2012
I’ve always been a big proponent of “work smarter, not harder” and like to find ways to automate certain tasks. This is what drove me to create WorkingMan.

What is WorkingMan

WorkingMan is a Rubygem that makes it easy to start and stop your work day. It really just makes it easy to open specified applications and urls that you may commonly need to. For example, my work day typically starts by opening Google Chrome, Propane, X-Lite, Skype, and a few different urls.
Opening and closing these every day started to get really annoying and I wanted a way to do so without having to think about it. Enter WorkingMan.

The Code

This is really my first Rubygem that is worthy of use by anyone. I also wanted to experiment a bit with testing and so I started with Methadone from David Copeland. If you are curious at all about how to test command line Ruby applications, then definitely check out this gem.
I started by focusing on the user interface and how to make things as easy as possible. As such, there are two commands to really concern yourself with: start and stop. If everything is set up correctly in the YAML configuration file, then you’re golden. Check out my example configuration:



~/.working_man.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# Default applications for startup and shutdown. 
# Add/remove applications to customize 
apps:
  - 'Google Chrome'
  - 'Propane'
  - 'Skype'
  - 'X-Lite'
  - 'OmniFocus'

# URLs open in default browser 
urls:
  - 'http://www.gmail.com'
  - 'http://support.cloud.engineyard.com'
  - 'http://orchestra.tenderapp.com'

As you can see it’s pretty easy to set this up even if you aren’t a programmer. You can just take that file and modify it to your needs and the default location for the configuration is ~/.working_man.yml.

Project-specific Configuration

One feature that I really love is the ability to specify a different configuration file. Let’s say I have a Rails application in ~/Work/my_app and I want to always have the same urls open in my web browser when working on this app. Just add the configuration to that folder and use the --file option to point to that file. An example would be



Specify different configSource
1
$ working_man start -f ~/Work/my_app/working_man.yml

Tmuxinator

Tmuxinator is written by Allen Bargi and makes setting up project-specific Tmux sessions incredibly easy. This is also one of the biggest inspirations for WorkingMan. Pairing WorkingMan with Tmuxinator makes switching projects pretty effortless. This is an example Tmuxinator config that utilizes WorkingMan:



~/.tmuxinator/myapp.yml
1
2
3
4
5
6
7
8
9
10
11
12
# you can make as many tabs as you wish...

project_name: 'MyApp'
project_root: '~/Work/my_app'
rvm: '1.9.3'
tabs:
  - editor:
    layout: 'main-vertical'
    panes:
      - 'vim .'
      - #empty, will just run plain bash 
  - shell: 'working_man start -f ~/Work/my_app/my_app_working_man.yml'

Wrap it up already

I urge you to try out WorkingMan and see if it helps make your day just a little less stressful. Also, make sure to check out the code and Flattr Me if you’d like. Now go and “Work hard today!”
Read more ...