Installation
Install in a Rails app
Add the gem to your Gemfile:
gem 'thor_tasks'
Run bundle, and install the tasks into your app:
bundle
rails g thor_tasks:install
You can see a list of all the available tasks by running:
thor list
Install system-wide
Clone the repository and install them using ‘thor install’
git clone git://github.com/travishaynes/thor_tasks.git thor_tasks
thor install thor_tasks/lib/tasks/mongo.thor
thor install thor_tasks/lib/tasks/spec.thor
thor install thor_tasks/lib/tasks/spork.thor
Spork tasks
These tasks allow you to start, stop, and restart Spork as a background process from a Bash console.
The tasks are:
thor spork:start
thor spork:restart
thor spork:stop
Since spork is being forked as a background process, once you start it, it will take some time to load. During the time that Spork is loading, it will output some text to the terminal. It’s best just to wait until it’s completely loaded to continue.
Spec tasks
The following tasks are helpers for running your RSpecs:
thor spec:all
thor spec:controller [NAME]
thor spec:helper [NAME]
thor spec:model [NAME]
thor spec:request [NAME]
thor spec:routing [NAME]
thor spec:view [CONTROLLER] [ACTION]
thor spec:list [TYPE]
You can also use these aliases:
thor spec:a # => thor spec:all
thor spec:c # => thor spec:controlleer
thor spec:h # => thor spec:helper
thor spec:m # => thor spec:model
thor spec:t # => thor spec:request
thor spec:r # => thor spec:routing
thor spec:v # => thor spec:view
thor spec:l # => thor spec:list
Running any spec task without any options will run all the specs for that category, with the exception of the list spec, which will list all the available spec files. For the spec:view task, you can specify a controller, and an action. If you specify a controller without an action, all the actions for that view will run.
To run your specs with ‘bundle exec’, use the bundle option. For example:
thor spec:all --bundle
or, you can use the abbreviated option:
thor spec:all -b
Mongo tasks
These tasks allow you to start, stop, and restart MongoDB as a background process, and repair all Mongo databases.
The tasks are:
thor mongo:repair
thor mongo:start
thor mongo:restart
thor mongo:stop
Apt tasks
These tasks are helpers for apt-cache in Linux.
apt:search
Pretty-prints the output from apt-cache search.
thor apt:search "terms" # or thor apt:s
apt:show
Cleans up the output from apt-cache show.
thor apt:show "package" # or thor apt:w
thor apt:show "package --desc # to only show the description