Project

mina-hooks

0.02
No commit activity in last 3 years
No release in over 3 years
Mina plugin to provide local task hooks that run before and after the mina commands.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.2
~> 5.0
~> 10.0
~> 0.8

Runtime

~> 0.3
 Project Readme

mina-hooks

Description

Mina plugin to provide local task hooks that run before and after the mina commands.

Mina uses a queueing system to create a deploy script that executes on the remote system but that leaves no way to know when the deploy has started or ended.

mina-hooks gets around this limitation by defining a new mina_cleanup! method that does the following:

  • detect if mina is being run with the deploy argument
  • invoke each of the before_mina_tasks
  • delegate to the pre-existing mina_cleanup!
  • invoke each of the after_mina_tasks

Warning

This is extremenly dependant on Mina internals so buyer beware. However, it's not a lot of code so we should be fine. It will all be just fine.

Features

Easily add tasks

Helper methods to add tasks to the lists: (see Usage)

  • before_mina
  • after_mina

Access the task lists

Lists of tasks to be run before and after the mina commands:

  • before_mina_tasks
  • after_mina_tasks

Output

Prints confirmation that the hook is running

  • <----- Invoke before mina tasks
  • <----- Invoke after mina tasks

Prints task list using Mina-style output if set to verbose

  • >> tasks: some:task, some:other:task

Still Just Rake

Task invocation is still handled by Rake and operates under the same rules you've come to expect.

Usage

require "mina/hooks"

before_mina

# Inside your deploy tasks ...

before_mina :"some:task", :"some:other:task"
before_mina :"task:added:later"

puts before_mina_tasks.inspect
# => [:"some:task", :"some:other:task", :"task:added:later"]

# ...

after_mina

# Still inside your deploy tasks ...

after_mina :"some:task", :"some:other:task"
after_mina :"task:added:later", :"some:task"

puts after_mina_tasks.inspect
# => [:"some:task", :"some:other:task", :"task:added:later", :"some:task"]

# ...

Because this is Rake, the above task some:task will only be invoked once.

Requirements

Install

$ gem install mina-hooks

Copyright

Copyright (c) 2013 Don Morrison

See {file:LICENSE.txt} for details.