1
0
Fork 0
mirror of https://github.com/Oreolek/kohana-migrations.git synced 2024-05-18 17:08:18 +03:00
Go to file
2011-01-09 00:51:53 +00:00
classes Allow users to use --help and --task instead of uri 2011-01-09 00:38:47 +00:00
config/minion Filling out the environment config option in db:migrate 2010-12-29 01:17:51 +00:00
tests Changing timestamps to be {year}{month}{day}{hour}{minute}{second} 2010-12-30 15:06:52 +00:00
views/minion Fix typos 2011-01-07 22:43:56 +08:00
init.php Initial import 2010-12-24 15:52:03 +00:00
minion Forgot to add --uri option in binary\! 2011-01-09 00:49:48 +00:00
README.md Fixing typo in README 2011-01-09 00:51:53 +00:00
schema.sql Changing timestamps to be {year}{month}{day}{hour}{minute}{second} 2010-12-30 15:06:52 +00:00

Minion

NOTE: Minion is currently in a beta state, please report any issues in the issue tracker

Minion is a module for running database migrations located in the Kohana cascading filesystem, but it also provides a useful framework for creating cli based tasks.

The original "need" behind Minion was the lack of a good db migrations system, capable of selecting migrations from multiple locations (i.e. different modules).

The system is inspired by ruckusing, which had a nice system for defining tasks but lacked the desired flexibility.

Requirements

Compatibility

Minion should be compatible with both Kohana 3.0.x and 3.1.x

Getting Started

First off, download and enable the module in your bootstrap

Then copy the binary minion into your webroot (i.e. the folder where index.php is, edit the binary if you want to store it in a different location)

You can then run minion like so:

./minion {task}

To view a list of minion tasks, run minion without any parameters, or with the --help option

./minion
./minion --help

To view help for a specific minion task run

./minion {task} --help

For security reasons Minion will only run from the cli. Attempting to access it over http will cause a Kohana_Exception to be thrown.

If you're unable to use the binary file for whatever reason then simply replace ./minion {task} in the above examples with

php index.php --uri=minion --task={task}

Writing your own tasks

All minion tasks must be located in classes/minion/task/. They can be in any module, thus allowing you to ship custom minion tasks with your own module / product.

Each task must extend the abstract class Minion_Task and implement Minion_Task::execute().

See Minion_Task for more details.

Documentation

Code should be commented well enough not to need documentation, and minion can extract a class' doccomment to use as documentation on the cli.

Testing

This module is unittested using the unittest module. You can use the minion group to only run minion tests.

i.e.

phpunit --group minion

Feel free to contribute tests(!), they can be found in the tests/minion directory. :)

License

This is licensed under the same license as Kohana.

This project is not endorsed by the Kohana Framework project.

FAQ

Can't I just create my own controllers instead of creating "tasks"

Yes, controllers offer just as much control as tasks, however there are a number of advantages to tasks:

  • They can only be run via command line or through code (see note about http)
  • All the groundwork for interacting with the user on the command line is already in place, you just need to take advantage of it
  • It provides a uniform way to access and perform tasks on the command line, rather than creating an elaborate collection of controllers while trying to restrict access to them. If you create a module that requires command line interaction then you just ship a minion task with it and users will be able to start using it with minimal setup & configuration

Eeew why aren't you using ORM xyz?

In order to prevent conflicts across installations Minion aims to have as few dependencies as possible.

This is awesome! How can I contribute?

Thanks for wanting to help out, just fork, commit, push, and send a pull request :)

UR DOIN IT WRONG

Sorry you feel that way, it'd be useful if you could create an issue outlining what you think should be changed.

Please don't PM me with support / feature requests.