2017 © Pedro Peláez
 

library fred

A very simple iteration based task runner

image

wouterj/fred

A very simple iteration based task runner

  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 3 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Fred

Welcome to Fred. Fred will execute tasks that you have described in a fred file., (*1)

Fred is not a grown up man at the moment. The steps used in this docs are not yet implemented. Do you help me teach him how to do developer tasks?, (*2)

Build Status, (*3)

Why should I use Fred?

  • You don't have to spent time installing NodeJS, NPM on your server just to run tasks;
  • You can work with a syntax you're familiar with;
  • Fred's codebase is very small (just 9 classes) and as flexible as task runners can be.

Installation

The best way to install Fred is using Composer:, (*4)

$ composer global require wouterj/fred:0.*

If you set-up composer's global binary directory correctly, this will give you a new command: fred, (*5)

Usage

You start by creating a fred.php file (the fred file). In this file, you specify the tasks. You do this by calling the task() method of the $fred variable that's available in the file:, (*6)

$fred->task('build', function () use ($fred) {
    // ... specify the tasks
});

All tasks begin by opening a file or multiple files and passing a Traversable of these files to load(). The best way to do this is by using the Symfony Finder Component:, (*7)

use Symfony\Component\Finder\Finder;

$fred->task('build', function () use ($fred) {
    $fred->load(Finder::create()->files()->name('*.js')->in('/web/assets/raw'));
});

You've now opened a Fred step sequence for all files with a .js extension in /web/assets/raw., (*8)

Now you can assign as many steps to this sequence as you want:, (*9)

use Symfony\Component\Finder\Finder;
use WouterJ\Fred\Extension as Ext;

$fred->task('build', function () use ($fred) {
    $fred->load(Finder::create()->files()->name('*.js')->in('/web/assets/raw'))
        ->then(new Ext\JsHint())   // Lint the JS code using JsHint...
        ->then(new Ext\Uglify())   // ...minify the JS files using UglifyJS...
        ->then(new Ext\Compact())  // ...and combine all JS files into one file
    ;
});

At last, you have to output the generated code somewhere. This is done with the dist() function:, (*10)

$fred->load(Finder::create()->files()->name('*.js')->in('/web/assets/raw'))
    ->then(new Ext\JsHint())
    ->then(new Ext\Uglify())
    ->then(new Ext\Compact())
    ->dist('/web/assets/script.min.js')
;

Now, the generated code is dumped in the /web/assets/script.min.js file., (*11)

You can run this task by using fred build (where build is the name of the task)., (*12)

License

The project is released under the BSD license. See the LICENSE file included in this package for more information., (*13)

Roadmap

Of course, all kind of changes are welcome (as long as it doesn't make the Fred more complex), but Fred should have learn the following things before reaching a stable version:, (*14)

  • Have more tests (that actually test the console app)
  • Have a complete documentation
  • Have more extensions and steps

The Versions

01/04 2015

dev-master

9999999-dev

A very simple iteration based task runner

  Sources   Download

BSD

The Requires

 

The Development Requires

30/01 2015

0.3.0

0.3.0.0

A very simple iteration based task runner

  Sources   Download

BSD

The Requires

 

The Development Requires

01/01 2015

0.2.0

0.2.0.0

A very simple iteration based task runner

  Sources   Download

BSD

The Requires

 

The Development Requires

30/12 2014

0.1.1

0.1.1.0

A very simple iteration based task runner

  Sources   Download

BSD

The Requires

 

The Development Requires

30/12 2014

0.1.0

0.1.0.0

A very simple iteration based task runner

  Sources   Download

BSD

The Requires

 

The Development Requires