[Rt-commit] rt branch, lcore, updated. a394bf0823cbb625e57ea9c9f7fe28d771193276
clkao at bestpractical.com
clkao at bestpractical.com
Tue Oct 20 19:54:31 EDT 2009
The branch, lcore has been updated
via a394bf0823cbb625e57ea9c9f7fe28d771193276 (commit)
via 28a0c21069bdf214361effc8d0fc29e6ed170d2c (commit)
from 300560fc03eecf6fbdc3b9c75c22e7d0a7eb1ecd (commit)
Summary of changes:
lib/RT/Lorzy.pm | 14 ++++----------
t/lorzy/accessor.t | 2 +-
t/lorzy/action.t | 12 ++++++------
3 files changed, 11 insertions(+), 17 deletions(-)
- Log -----------------------------------------------------------------
commit 28a0c21069bdf214361effc8d0fc29e6ed170d2c
Author: Chia-liang Kao <clkao at bestpractical.com>
Date: Tue Oct 20 22:18:45 2009 +0800
fix accessor test.
diff --git a/t/lorzy/accessor.t b/t/lorzy/accessor.t
index 0473e16..9e99680 100644
--- a/t/lorzy/accessor.t
+++ b/t/lorzy/accessor.t
@@ -23,5 +23,5 @@ is( $ticket_subject->apply($ticket), 'lorzy test' );
my $x = $l->env->find_functions_by_type(['RT::Model::Ticket']);
-is_deeply [sort map { s/^RT::Model::Ticket\.// ? $_ : () } keys %$x],
+is_deeply [sort map { s/^RT::Model::Ticket\.([a-z])/$1/ ? $_ : () } keys %$x],
[qw(created creator disabled due effective_id final_priority id initial_priority issue_statement last_updated last_updated_by owner priority queue resolution resolved started starts status subject time_estimated time_left time_worked told type)];
commit a394bf0823cbb625e57ea9c9f7fe28d771193276
Author: Chia-liang Kao <clkao at bestpractical.com>
Date: Tue Oct 20 22:19:01 2009 +0800
deprecate Native.Invoke, now that we can use accessors.
diff --git a/lib/RT/Lorzy.pm b/lib/RT/Lorzy.pm
index 3f17a3e..97b5003 100644
--- a/lib/RT/Lorzy.pm
+++ b/lib/RT/Lorzy.pm
@@ -13,13 +13,6 @@ use Moose::Util::TypeConstraints;
our $LCORE = LCore->new( env => LCore::Level2->new );
require RT::Lorzy::Package::RT;
-$LCORE->env->set_symbol('Native.Invoke' => LCore::Primitive->new
- ( body => sub {
- my ($object, $method, @args) = @_;
- return $object->$method(@args);
- },
- lazy => 0,
- ));
$LCORE->env->set_symbol('Str.Eq' => LCore::Primitive->new
( body => sub {
@@ -157,13 +150,14 @@ my %cond_compat_map = ( 'On Create' => 'OnCreate',
sub create_scripish {
- my ( $class, $scrip_condition, $scrip_action, $template, $description, $queue ) = @_;
+ my ( $class, $scrip_condition, $scrip_action, $template, $description, $queue_id ) = @_;
my $lorzy_cond = $cond_compat_map{$scrip_condition}
or die "unsupported compat condition: $scrip_condition";
my $lcore_cond = "(RT.Condition.$lorzy_cond ticket transaction)";
- if ($queue) {
- $lcore_cond = qq{(and $lcore_cond (Str.Eq "$queue" (Native.Invoke ticket "queue_id")))};
+ if ($queue_id) {
+ # XXX: Num.Eq
+ $lcore_cond = qq{(and $lcore_cond (Str.Eq "$queue_id" (RT::Model::Queue.id (RT::Model::Ticket.queue ticket))))};
}
$lcore_cond = qq{(lambda (ticket transaction) $lcore_cond)};
diff --git a/t/lorzy/action.t b/t/lorzy/action.t
index 634f134..fcad561 100644
--- a/t/lorzy/action.t
+++ b/t/lorzy/action.t
@@ -1,4 +1,4 @@
-use Test::More tests => 7;
+use Test::More tests => 9;
use RT::Test;
use strict;
@@ -21,13 +21,11 @@ my $l = $RT::Lorzy::LCORE;
my $on_created_lcore = q{
(lambda (ticket transaction)
- (Str.Eq (Native.Invoke transaction "type") "create"))
+ (Str.Eq (RT::Model::Transaction.type transaction) "create"))
};
-#my $on_created_lcore2 = $l->analze_it("RT.Condition.OnCreate")
- # my $lcore_code = "(RT.Condition.$lorzy_cond ticket transaction)"
-#my $auto_reply_lcore = $l->analyze_it(q{(quote (RT.RuleAction.SendEmail (to . ## $self->ticket_obj->role_group("requestor")->member_emails )))});
-# (lambda (ticket :RT::Model::Ticket transaction :RT::Model::Transaction context :HASH)
+ok( $l->analyze_it($on_created_lcore) );
+
my $auto_reply_lcore = q{
(lambda (ticket transaction context)
(RT.RuleAction.Run
@@ -38,6 +36,8 @@ my $auto_reply_lcore = q{
("transaction" . transaction))))
};
+ok( $l->analyze_it($auto_reply_lcore) );
+
RT::Lorzy::Dispatcher->reset_rules;
#
my $rule = RT::Model::Rule->new( current_user => RT->system_user );
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list