Skip to content

Commit

Permalink
Merge pull request #29 from patrickbkr/rename-to-ake
Browse files Browse the repository at this point in the history
Rename sake to ake
  • Loading branch information
AlexDaniel committed Jun 13, 2020
2 parents cf45815 + 47682d5 commit a598347
Show file tree
Hide file tree
Showing 26 changed files with 188 additions and 143 deletions.
13 changes: 7 additions & 6 deletions META6.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
{
"perl" : "6.c",
"name" : "sake",
"name" : "ake",
"version" : "0.0.3",
"license" : "Artistic-2.0",
"description" : "A make-a-like implemented in Raku",
"provides" : {
"Sake" : "lib/Sake.pm6",
"Sake::Task" : "lib/Sake/Task.pm6",
"Sake::Task::IO" : "lib/Sake/Task/IO.pm6",
"Sake::TaskStore" : "lib/Sake/TaskStore.pm6"
"Ake" : "lib/Ake.rakumod",
"Sake" : "lib/Sake.rakumod",
"Ake::Task" : "lib/Ake/Task.rakumod",
"Ake::Task::IO" : "lib/Ake/Task/IO.rakumod",
"Ake::TaskStore" : "lib/Ake/TaskStore.rakumod"
},
"author" : "Jonathan Scott Duff <duff@pobox.com>",
"depends" : [],
"test-depends": [ "File::Temp" ],
"source-url" : "git://github.com/perl6/p6-sake.git"
"source-url" : "git://github.com/Raku/raku-ake.git"
}
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
## sake
## ake

`sake` is a make-a-like implemented in Raku. It was inspired by
`ake` is a make-a-like implemented in Raku. It was inspired by
[rake](https://github.com/ruby/rake).


### Installation

Sake is easily installable with [`zef`](https://github.com/ugexe/zef):
Ake is easily installable with [`zef`](https://github.com/ugexe/zef):

```sh
zef install sake
zef install ake
```

If you are using `rakubrew` in `shim` mode you will need to run
`rakubrew rehash` to make the `sake` executable available.
`rakubrew rehash` to make the `ake` executable available.


### Current status

Sake is fully-functional but may lack some advanced features. Feature
Ake is fully-functional but may lack some advanced features. Feature
requests and PRs are welcome!


### Example

Create a file named `Sakefile` with these contents:
Create a file named `Akefile` with these contents:

```raku
task 'buy-food', {
Expand All @@ -42,10 +42,10 @@ task 'dinner' => <buy-food>, {
}
```

Then you will be able to run `sake` from the same directory
(e.g. `sake morning`).
Then you will be able to run `ake` from the same directory
(e.g. `ake morning`).


### License

Sake is available under Artistic License 2.0.
Ake is available under Artistic License 2.0.
18 changes: 18 additions & 0 deletions bin/ake
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env perl6

use v6;
use Ake;

sub MAIN(*@tasks,
:$file = Akefile,
:$force = False,
) {

if !$file.IO.e {
note Could not find file $file!;
exit 2
}
EVALFILE $file;
ake-precheck :$force;
execute @tasks || default
}
11 changes: 9 additions & 2 deletions bin/sake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env perl6

use v6;
use Sake;
use Ake;

sub MAIN(*@tasks,
:$file = Sakefile,
Expand All @@ -13,6 +13,13 @@ sub MAIN(*@tasks,
exit 2
}
EVALFILE $file;
sake-precheck :$force;
ake-precheck :$force;
execute @tasks || default

say '';
say '==================== DEPRECATION NOTE ====================';
say '| `sake` has been renamed to `ake`. |';
say '| Please consider using `ake` in the future. |';
say '==========================================================';
say '';
}
File renamed without changes.
16 changes: 8 additions & 8 deletions lib/Sake.pm6 → lib/Ake.rakumod
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
use Sake::Task;
use Sake::TaskStore;
use Sake::Task::IO;
use Ake::Task;
use Ake::TaskStore;
use Ake::Task::IO;

sub EXPORT {
%(
Sake::Task::EXPORT::DEFAULT::,
Sake::Task::IO::EXPORT::DEFAULT::,
Ake::Task::EXPORT::DEFAULT::,
Ake::Task::IO::EXPORT::DEFAULT::,
)
}

unit module Sake;
unit module Ake;

INIT {
task 'help', {
Expand All @@ -29,7 +29,7 @@ multi execute(Str $task) {
execute %TASKS{$task}
}

multi execute(Sake::Task $task) {
multi execute(Ake::Task $task) {
my $result = $task.execute;
$result ~~ Promise
?? await $result
Expand All @@ -46,7 +46,7 @@ multi execute(*@tasks) is export {
(execute $_ for @tasks)
}

sub sake-precheck(:$force = False) is export {
sub ake-precheck(:$force = False) is export {
my @errors = gather resolve-deps;
if @errors {
.note for @errors;
Expand Down
10 changes: 5 additions & 5 deletions lib/Sake/Task.pm6 → lib/Ake/Task.rakumod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use Sake::TaskStore;
use Ake::TaskStore;

unit class Sake::Task;
unit class Ake::Task;

has $.name = !!! name required;
has @.deps; #= Task dependencies
Expand Down Expand Up @@ -39,7 +39,7 @@ method readify {

multi resolve-deps($task, :$live = False) is export {
$task.deps .= map: {
do if $_ ~~ Sake::Task {
do if $_ ~~ Ake::Task {
$_ # already resolved
} elsif %TASKS{$_}:exists {
%TASKS{$_}
Expand All @@ -64,9 +64,9 @@ multi resolve-deps is export {
proto sub task(|) is export {*}

multi sub task(Str $name, &body?) {
make-task $name, &body, type => Sake::Task
make-task $name, &body, type => Ake::Task
}

multi sub task(Pair (Str :key($name), :value($deps)), &body?) {
make-task $name, &body, type => Sake::Task, deps => $deps.list
make-task $name, &body, type => Ake::Task, deps => $deps.list
}
10 changes: 5 additions & 5 deletions lib/Sake/Task/IO.pm6 → lib/Ake/Task/IO.rakumod
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use Sake::Task;
use Sake::TaskStore;
use Ake::Task;
use Ake::TaskStore;

unit class Sake::Task::IO is Sake::Task;
unit class Ake::Task::IO is Ake::Task;

method modification-time {
$.name.IO.e
Expand Down Expand Up @@ -29,11 +29,11 @@ method execute {


multi sub task(IO $path, &body?) is export {
make-task $path, &body, type => Sake::Task::IO
make-task $path, &body, type => Ake::Task::IO
}

multi sub task(Pair (IO :key($path), :value($deps)), &body?) is export {
make-task $path, &body, deps => $deps.list, type => Sake::Task::IO
make-task $path, &body, deps => $deps.list, type => Ake::Task::IO
}


Expand Down
2 changes: 1 addition & 1 deletion lib/Sake/TaskStore.pm6 → lib/Ake/TaskStore.rakumod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
unit module Sake::TaskStore;
unit module Ake::TaskStore;

our %TASKS is export;

Expand Down
19 changes: 19 additions & 0 deletions lib/Sake.rakumod
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
use Ake;

sub EXPORT {
%(
Ake::Task::EXPORT::DEFAULT::,
Ake::Task::IO::EXPORT::DEFAULT::,
)
}

unit module Sake;

sub execute(*@tasks) is export {
execute |@tasks;
}

sub sake-precheck(:$force = False) is export {
ake-precheck :$force;
}

2 changes: 1 addition & 1 deletion t/00-original-task.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use v6;
use lib <lib/ t/lib>;
use Sake;
use Ake;
use Test;

plan 5;
Expand Down
4 changes: 2 additions & 2 deletions t/01-original-file.t
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use v6;
use lib <lib/ t/lib>;
use Sake;
use Ake;
use Test;

plan 11;

my $path = $*TMPDIR.add: sake- ~ (^999999).pick;
my $path = $*TMPDIR.add: ake- ~ (^999999).pick;
mkdir $path;
chdir $path; # ugly but OK

Expand Down

0 comments on commit a598347

Please sign in to comment.