summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTatsuhiko Miyagawa <miyagawa@bulknews.net>2013-06-01 14:54:24 +0900
committerTatsuhiko Miyagawa <miyagawa@bulknews.net>2013-06-01 14:54:24 +0900
commit5c8f94569d907247926648bb1480ff92fee966ff (patch)
tree59ffc6bac197114cdcef992980bcbb3303d51528
parent5739372621f57e19b01cd0b0dbb47aeb89dabdac (diff)
downloadcarton-5c8f94569d907247926648bb1480ff92fee966ff.tar.gz
Add convenience clean_local in xt
-rw-r--r--xt/CLI.pm8
-rw-r--r--xt/cli/freeze.t4
-rw-r--r--xt/cli/json_pp.t4
3 files changed, 9 insertions, 7 deletions
diff --git a/xt/CLI.pm b/xt/CLI.pm
index c72191a..62ab801 100644
--- a/xt/CLI.pm
+++ b/xt/CLI.pm
@@ -16,7 +16,8 @@ use parent qw(Carton::CLI);
$Carton::CLI::UseSystem = 1;
use Capture::Tiny qw(capture);
-use File::pushd;
+use File::pushd ();
+use File::Path ();
sub new {
my($class, %args) = @_;
@@ -61,5 +62,10 @@ sub system_error {
$self->{system_error};
}
+sub clean_local {
+ my $self = shift;
+ File::Path::rmtree("$self->{dir}/local", 1);
+}
+
1;
diff --git a/xt/cli/freeze.t b/xt/cli/freeze.t
index 3f99163..d9d701b 100644
--- a/xt/cli/freeze.t
+++ b/xt/cli/freeze.t
@@ -2,8 +2,6 @@ use strict;
use Test::More;
use xt::CLI;
-use File::Path qw(rmtree);
-
{
my $app = cli();
@@ -15,7 +13,7 @@ EOF
$app->run("list");
like $app->output, qr/Try-Tiny-0\.11/;
- rmtree($app->dir . "/local", 1);
+ $app->clean_local;
$app->run("install");
$app->run("list");
diff --git a/xt/cli/json_pp.t b/xt/cli/json_pp.t
index 246f07b..b704986 100644
--- a/xt/cli/json_pp.t
+++ b/xt/cli/json_pp.t
@@ -2,8 +2,6 @@ use strict;
use Test::More;
use xt::CLI;
-use File::Path qw(rmtree);
-
plan skip_all => "perl <= 5.14" if $] >= 5.015;
{
@@ -15,7 +13,7 @@ requires 'CPAN::Meta', '2.12';
EOF
$app->run("install");
- rmtree($app->dir . "/local", 1);
+ $app->clean_local;
TODO: {
local $TODO = "collect installs";