matthutchinson / project_launcher

A simple time-saving project launching script (written in Ruby with Appscript) using the standard OSX Terminal

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Project Launcher

About

A simple, small Ruby script to launch commands on the standard multi-tabbed OSX Terminal (using Appscript). Project configuration is set in launcher_config.yml, where detection (based on a directory name, what folders it contains) and terminal commands can be setup. The example configuration shows a Rails and Erlang project type. See below for info on using and configuring. For anything else check the latest commit logs.

Caveats

Ongoing issues with this project include;

  • If you run into trouble installing the Appscript gem (rb-appscript) – try building it from source
  • Depending on the performance of your machine, you may have to let all command tabs open before interacting with the Terminal window (otherwise Appscript gets confused on focus)
  • Tests? There are no tests
  • Screencast? maybe if the budget allows it, and Ridley Scott will direct it.

Setup / Using

Requirements

What do you need?

Installing

Download the project, and place the contents of the bin/ folder into a searchable bin path. After configuring launcher_config.yml (see below), you can start launching projects using the following command;

ruby ./project_launcher.rb _project_name_

Where project_name is the project to search for in the projects folder (set in the config). To make use of the launcher to launch in your current working directory, set up an alias in your ~/.bash_login file e.g.

alias launch_me='ruby /full/path/to/project_launcher.rb'

Then (from anywhere) you can simply type;

launch_me (runs launcher with current working dir as the project)
launch_me _project_name_

(don’t forget to re-source your bash_login before trying this. Type; . ~/.bash_login)

Configuration

The main config file (YAML) is located alongside the script, in launcher_config.yml. Here is what it all means;

  • projects_folder – full path to the folder to search in when you pass a project_name
  • search_depth – distance of tree to search in for a matching project_name
  • project types – YAML definition of multiple project types, see below for explanation

Projects types are configured with three things;

  • name – defined as the YAML block name (default is the name given when no detection is matched for a project)
  • detection – list of folders the project must contain (all of them), in order to match the project type
  • tasks – the actual command to run in the terminal, and a label (for the terminal window) – multiple tasks spawn tabs in a single terminal

Example Configuration Explanation (a Rails project)

The example config shows detection of a Rail project (based on presence of app, db, public, vendor folders). And the following tasks in Terminal tabs;

  • rake spec is ran, and then autotest
  • the development log cleared and tailed
  • textmate is launched with Rails folders, and mongrel server started
  • Git info is shown
  • MySQL launches into development database (based on project_name_development)
  • Terminal launches some notification messages, and sits open in project folder

Credits

Who’s who?

Get out clause

Right now this script is provided without warranty, or support from the author.

Creative Commons License

Creative Commons License

Project Launcher by Matthew Hutchinson is licensed under a Creative Commons Attribution 2.0 UK: England & Wales License.

About

A simple time-saving project launching script (written in Ruby with Appscript) using the standard OSX Terminal


Languages

Language:Ruby 100.0%