Skip to content

Commit

Permalink
Rename sake to ake
Browse files Browse the repository at this point in the history
As the files move anyways we also change .pm6 to .rakumod.
Provide a back-compat `Sake` module to keep current users working.
  • Loading branch information
patrickbkr committed Jun 13, 2020
1 parent cf45815 commit 47682d5
Show file tree
Hide file tree
Showing 26 changed files with 188 additions and 143 deletions.
13 changes: 7 additions & 6 deletions META6.json
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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 47682d5

Please sign in to comment.