Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ecosystem.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: ecosystem

on:
- push
# on:
# - push

jobs:
perl6:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build Status](https://github.com/FCO/Red/workflows/test/badge.svg)](https://github.com/FCO/Red/actions) [![Build Status](https://github.com/FCO/Red/workflows/ecosystem/badge.svg)](https://github.com/FCO/Red/actions) [![SparrowCI](https://ci.sparrowhub.io/project/gh-FCO-Red/badge)](https://ci.sparrowhub.io)
[![Build Status](https://github.com/FCO/Red/workflows/test/badge.svg)](https://github.com/FCO/Red/actions) [![SparrowCI](https://ci.sparrowhub.io/project/gh-FCO-Red/badge)](https://ci.sparrowhub.io)

Red
===
Expand Down
2 changes: 1 addition & 1 deletion lib/MetamodelX/Red/Model.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ method compose(Mu \type) {
#}
}
die "{$.rs-class.^name} should do the Red::ResultSeq role" unless $.rs-class ~~ Red::ResultSeq;
self.add_role: type, Red::Model;
self.add_role: type, Red::Model unless type ~~ Red::Model;
self.add_role: type, role :: {
method TWEAK(|c) {
self.^set-dirty: self.^columns;
Expand Down
1 change: 0 additions & 1 deletion lib/Red.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ multi EXPORT(+@experimentals) {
=begin pod

[![Build Status](https://github.com/FCO/Red/workflows/test/badge.svg)](https://github.com/FCO/Red/actions)
[![Build Status](https://github.com/FCO/Red/workflows/ecosystem/badge.svg)](https://github.com/FCO/Red/actions)
[![SparrowCI](https://ci.sparrowhub.io/project/gh-FCO-Red/badge)](https://ci.sparrowhub.io)

=begin head1
Expand Down
2 changes: 1 addition & 1 deletion lib/Red/Attr/Column.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ unit role Red::Attr::Column;
has %.args;
has Red::Column $!column;

method perl { $.column.gist }
method raku { $.column.gist }

method column(--> Red::Column:D) {
$!column.DEFINITE ?? $!column !! Red::Column.new: |%!args, :attr(self)
Expand Down
2 changes: 1 addition & 1 deletion lib/Red/Cli.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ sub gen-stub(:@includes, :@models, :$driver, :%pars) {
for @includes.unique {
@stub.push: "use $_;"
}
@stub.push: "\nred-defaults \"{ $driver }\", { %pars.map(*.perl) };";
@stub.push: "\nred-defaults \"{ $driver }\", { %pars.map(*.raku) };";
@stub.push: "";
for @models {
@stub.push: ".say for { $_ }.^all;"
Expand Down
4 changes: 2 additions & 2 deletions lib/Red/Column.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ multi method WHICH(::?CLASS:D:) {
ValueObjAt.new: self.gist
}

multi method perl(::?CLASS:D:) {
multi method raku(::?CLASS:D:) {
"{ self.^name }.new({
self.Hash.pairs.sort.map(-> (:$key, :$value) {
next if $key eq <inflate deflate>.one;
"$key.Str() => $value.perl()"
"$key.Str() => $value.raku()"
}).join: ", "
})"
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Red/Driver.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ method optimize(Red::AST $in --> Red::AST) { $in }

multi method debug(@bind) {
if $*RED-DEBUG {
note "BIND: @bind.perl()";
note "BIND: @bind.raku()";
}
}

Expand All @@ -135,6 +135,6 @@ multi method debug($sql) {
multi method debug($sql, @binds) {
if $*RED-DEBUG {
note "SQL : $sql";
note "BIND: @binds.perl()";
note "BIND: @binds.raku()";
}
}
2 changes: 1 addition & 1 deletion lib/Red/Driver/Mock.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ method verify { #is test-assertion {

for %!when-re.kv -> Regex $re, % (:$counter = 0, :$times, |) {
ok ($times == Inf or $counter == $times),
"Query that matches '$re.perl()' should be called $times times and was called $counter time(s)";
"Query that matches '$re.raku()' should be called $times times and was called $counter time(s)";
}
}, "Red Mock verify"
}
4 changes: 1 addition & 3 deletions lib/Red/Model.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ unit role Red::Model;
has $!filter;
#method gist { self.^attributes; #`{self.perl} }

multi method perl(::?CLASS:D:) { self.raku }

multi method raku(::?CLASS:D:) {
my @attrs = self.^attributes.grep({ !.^can("relationship-ast") && .has_accessor}).map: {
"{ .name.substr(2) } => { .get_value(self).perl }"
"{ .name.substr(2) } => { .get_value(self).raku }"
}
"{ self.^name }.new({ @attrs.join: ", " })"
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Red/Traits.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ multi trait_mod:<is>(Attribute $attr, :$referencing! (Str :$model!, Str :$column

#| Trait that defines a reference receiving a code block, a model type object and an optional nullable.
multi trait_mod:<is>(Attribute $attr, :$referencing! (&referencing!, Mu:U :$model!, Bool :$nullable = True, *%rest ) --> Empty) is export {
$model.^add_role: Red::Model;
# $model.^add_role: Red::Model;
trait_mod:<is>($attr, :column{ :$nullable, :references(&referencing), model-type => $model, |%rest })
}

Expand Down
2 changes: 1 addition & 1 deletion lib/X/Red/Exceptions.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class X::Red::Driver::Mapped::UnknownError is X::Red::Driver::Mapped {
Unknown Error!!!
Please, copy this backtrace and open an issue on https://github.com/FCO/Red/issues/new
Driver: { $.driver }
Original error: { $.orig-exception.perl }
Original error: { $.orig-exception.raku }
END
}
}
Expand Down
66 changes: 33 additions & 33 deletions t/01-tdd.rakutest
Original file line number Diff line number Diff line change
Expand Up @@ -108,73 +108,73 @@ given model {
use Red::AST;
my $a = 42;
is
(.a == 42).perl,
Red::AST::Eq.new(Red::AST::Cast.new(.a, "num"), ast-value(42)).perl
(.a == 42).raku,
Red::AST::Eq.new(Red::AST::Cast.new(.a, "num"), ast-value(42)).raku
;
is
(42 == .a).perl,
Red::AST::Eq.new(ast-value(42), Red::AST::Cast.new(.a, "num")).perl
(42 == .a).raku,
Red::AST::Eq.new(ast-value(42), Red::AST::Cast.new(.a, "num")).raku
;
is
(.a == $a).perl,
Red::AST::Eq.new(Red::AST::Cast.new(.a, "num"), ast-value(42), :bind-right).perl
(.a == $a).raku,
Red::AST::Eq.new(Red::AST::Cast.new(.a, "num"), ast-value(42), :bind-right).raku
;
is
($a == .a).perl,
Red::AST::Eq.new(ast-value(42), Red::AST::Cast.new(.a, "num"), :bind-left).perl
($a == .a).raku,
Red::AST::Eq.new(ast-value(42), Red::AST::Cast.new(.a, "num"), :bind-left).raku
;

is
(.a != 42).perl,
Red::AST::Ne.new(Red::AST::Cast.new(.a, "num"), ast-value(42)).perl
(.a != 42).raku,
Red::AST::Ne.new(Red::AST::Cast.new(.a, "num"), ast-value(42)).raku
;
is
(42 != .a).perl,
Red::AST::Ne.new(ast-value(42), Red::AST::Cast.new(.a, "num")).perl
(42 != .a).raku,
Red::AST::Ne.new(ast-value(42), Red::AST::Cast.new(.a, "num")).raku
;
is
(.a != $a).perl,
Red::AST::Ne.new(Red::AST::Cast.new(.a, "num"), ast-value(42), :bind-right).perl
(.a != $a).raku,
Red::AST::Ne.new(Red::AST::Cast.new(.a, "num"), ast-value(42), :bind-right).raku
;
is
($a != .a).perl,
Red::AST::Ne.new(ast-value(42), Red::AST::Cast.new(.a, "num"), :bind-left).perl
($a != .a).raku,
Red::AST::Ne.new(ast-value(42), Red::AST::Cast.new(.a, "num"), :bind-left).raku
;


my $b = "lorem ipsum";
is
(.a eq "lorem ipsum").perl,
Red::AST::Eq.new(Red::AST::Cast.new(.a, "str"), ast-value("lorem ipsum")).perl
(.a eq "lorem ipsum").raku,
Red::AST::Eq.new(Red::AST::Cast.new(.a, "str"), ast-value("lorem ipsum")).raku
;
is
("lorem ipsum" eq .a).perl,
Red::AST::Eq.new(ast-value("lorem ipsum"), Red::AST::Cast.new(.a, "str")).perl
("lorem ipsum" eq .a).raku,
Red::AST::Eq.new(ast-value("lorem ipsum"), Red::AST::Cast.new(.a, "str")).raku
;
is
(.a eq $b).perl,
Red::AST::Eq.new(Red::AST::Cast.new(.a, "str"), ast-value("lorem ipsum"), :bind-right).perl
(.a eq $b).raku,
Red::AST::Eq.new(Red::AST::Cast.new(.a, "str"), ast-value("lorem ipsum"), :bind-right).raku
;
is
($b eq .a).perl,
Red::AST::Eq.new(ast-value("lorem ipsum"), Red::AST::Cast.new(.a, "str"), :bind-left).perl
($b eq .a).raku,
Red::AST::Eq.new(ast-value("lorem ipsum"), Red::AST::Cast.new(.a, "str"), :bind-left).raku
;

is
(.a ne "lorem ipsum").perl,
Red::AST::Ne.new(Red::AST::Cast.new(.a, "str"), ast-value("lorem ipsum")).perl
(.a ne "lorem ipsum").raku,
Red::AST::Ne.new(Red::AST::Cast.new(.a, "str"), ast-value("lorem ipsum")).raku
;
is
("lorem ipsum" ne .a).perl,
Red::AST::Ne.new(ast-value("lorem ipsum"), Red::AST::Cast.new(.a, "str")).perl
("lorem ipsum" ne .a).raku,
Red::AST::Ne.new(ast-value("lorem ipsum"), Red::AST::Cast.new(.a, "str")).raku
;
is
(.a ne $b).perl,
Red::AST::Ne.new(Red::AST::Cast.new(.a, "str"), ast-value("lorem ipsum"), :bind-right).perl
(.a ne $b).raku,
Red::AST::Ne.new(Red::AST::Cast.new(.a, "str"), ast-value("lorem ipsum"), :bind-right).raku
;
is
($b ne .a).perl,
Red::AST::Ne.new(ast-value("lorem ipsum"), Red::AST::Cast.new(.a, "str"), :bind-left).perl
($b ne .a).raku,
Red::AST::Ne.new(ast-value("lorem ipsum"), Red::AST::Cast.new(.a, "str"), :bind-left).raku
;
}

Expand Down Expand Up @@ -352,7 +352,7 @@ isa-ok Person2.posts.do-it.head, Post2;
my $seq = Person2.posts.map: *.id;
isa-ok $seq, Post2::ResultSeq;
#isa-ok $seq.head, Int;
is $seq.filter.perl, Person2.posts.filter.perl;
is $seq.filter.raku, Person2.posts.filter.raku;

given my model {
has Int $.int-u is column{ :id };
Expand Down
2 changes: 1 addition & 1 deletion t/17-pp.rakutest
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ my $two = $zub.foos.create( bar => "two" );
$zub.default-foo = $one;
$zub.^save;

lives-ok { [ $one, $two ].perl }
lives-ok { [ $one, $two ].raku }
done-testing;
Loading