tokuhirom/Daiku — pull request #14 by shoichikaji (2014-05-08 19:32:31+00:00)
Title: Feature/task attribute

addresses #12, #9

This pull request contains the following changes.

#### 1. Support multiple prefix rule
```perl
rule '.o' => ['.c', '.h'] => sub { ... };
```

#### 2. Clarify how to access task attributes
All tasks have `name` and `sources` attributes, and can access the first `sources` element by `source` method.
```perl
task hoge => 'hoge.txt' => sub {
my ($task, @argv) = @_;
$task->name; # hoge
$task->sources; # ['hoge.txt']
$task->source; # 'hoge.txt'
};
file 'hoge.txt' => sub {
my $task = shift;
$task->name; # README
$task->sources; # []
$task->source; # undef
};
rule '.o' => ['.c', '.h'] => sub {
my $task = shift;
# say, invoke this rule task by: daiku hello.o
$task->name; # hello.o
$task->sources; # ['hello.c', 'hello.h']
$task->source; # 'hello.c'
sh "gcc", "-o", $task->name, "-c", $task->source;
};
```

Actually I'm not sure the attribute names are appropriate or my implementation is good.
@Songmu How do you think?