summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTatsuhiko Miyagawa <miyagawa@bulknews.net>2013-06-06 09:55:07 +0900
committerTatsuhiko Miyagawa <miyagawa@bulknews.net>2013-06-06 09:56:36 +0900
commit8137ec0304d02a02d702f063aad812ce00e82fb4 (patch)
treea933c41b4cf74cdeac77321a4b267c7c03b3367a
parentb658c1316ea1dfd16d342e35b88ab0a15190c276 (diff)
downloadcarton-8137ec0304d02a02d702f063aad812ce00e82fb4.tar.gz
add write_cpanfile() convenient method
-rw-r--r--xt/CLI.pm5
-rw-r--r--xt/cli/bundle.t2
-rw-r--r--xt/cli/check.t6
-rw-r--r--xt/cli/deployment.t2
-rw-r--r--xt/cli/deps_phase.t2
-rw-r--r--xt/cli/exec.t6
-rw-r--r--xt/cli/freeze.t2
-rw-r--r--xt/cli/json_pp.t2
-rw-r--r--xt/cli/mirror.t4
-rw-r--r--xt/cli/mismatch.t2
-rw-r--r--xt/cli/perl.t2
-rw-r--r--xt/cli/tree.t2
-rw-r--r--xt/cli/update.t12
13 files changed, 27 insertions, 22 deletions
diff --git a/xt/CLI.pm b/xt/CLI.pm
index 8186cf0..0b58068 100644
--- a/xt/CLI.pm
+++ b/xt/CLI.pm
@@ -26,6 +26,11 @@ has stdout => (is => 'rw');
has stderr => (is => 'rw');
has exit_code => (is => 'rw');
+sub write_cpanfile {
+ my($self, @args) = @_;
+ $self->dir->child('cpanfile')->spew(@args);
+}
+
sub run {
my($self, @args) = @_;
diff --git a/xt/cli/bundle.t b/xt/cli/bundle.t
index 4b84e60..aa84f24 100644
--- a/xt/cli/bundle.t
+++ b/xt/cli/bundle.t
@@ -5,7 +5,7 @@ use xt::CLI;
{
my $app = cli();
- $app->dir->child("cpanfile")->spew(<<EOF);
+ $app->write_cpanfile(<<EOF);
requires 'Try::Tiny', '== 0.12';
EOF
diff --git a/xt/cli/check.t b/xt/cli/check.t
index 21bd3c2..59805e0 100644
--- a/xt/cli/check.t
+++ b/xt/cli/check.t
@@ -5,7 +5,7 @@ use xt::CLI;
{
my $app = cli();
- $app->dir->child("cpanfile")->spew(<<EOF);
+ $app->write_cpanfile(<<EOF);
requires 'Try::Tiny', '== 0.11';
EOF
@@ -20,7 +20,7 @@ EOF
$app->run("list");
like $app->stdout, qr/Try-Tiny-0\.11/;
- $app->dir->child("cpanfile")->spew(<<EOF);
+ $app->write_cpanfile(<<EOF);
requires 'Try::Tiny', '0.12';
EOF
@@ -37,7 +37,7 @@ EOF
$app->run("list");
like $app->stdout, qr/Try-Tiny-0\.12/;
- $app->dir->child("cpanfile")->spew(<<EOF);
+ $app->write_cpanfile(<<EOF);
requires 'Try::Tiny', '10.00';
EOF
diff --git a/xt/cli/deployment.t b/xt/cli/deployment.t
index 596c6d4..36a2511 100644
--- a/xt/cli/deployment.t
+++ b/xt/cli/deployment.t
@@ -4,7 +4,7 @@ use xt::CLI;
{
my $app = cli();
- $app->dir->child("cpanfile")->spew(<<EOF);
+ $app->write_cpanfile(<<EOF);
requires 'Try::Tiny', '== 0.11';
EOF
diff --git a/xt/cli/deps_phase.t b/xt/cli/deps_phase.t
index 781d767..862dc76 100644
--- a/xt/cli/deps_phase.t
+++ b/xt/cli/deps_phase.t
@@ -5,7 +5,7 @@ use xt::CLI;
{
my $app = cli();
- $app->dir->child("cpanfile")->spew(<<EOF);
+ $app->write_cpanfile(<<EOF);
on test => sub {
requires 'Test::NoWarnings';
recommends 'Test::Pretty';
diff --git a/xt/cli/exec.t b/xt/cli/exec.t
index bd3ab28..b56b241 100644
--- a/xt/cli/exec.t
+++ b/xt/cli/exec.t
@@ -11,7 +11,7 @@ use xt::CLI;
{
my $app = cli();
- $app->dir->child("cpanfile")->spew('');
+ $app->write_cpanfile('');
$app->run("install");
TODO: {
@@ -20,7 +20,7 @@ use xt::CLI;
like $app->stderr, qr/Can't locate Try\/Tiny.pm/;
}
- $app->dir->child("cpanfile")->spew(<<EOF);
+ $app->write_cpanfile(<<EOF);
requires 'Try::Tiny', '== 0.11';
EOF
@@ -35,7 +35,7 @@ EOF
$app->run("exec", "perl", "-MTry::Tiny", "-e", 'print $Try::Tiny::VERSION, "\n"');
like $app->stdout, qr/0\.11/;
- $app->dir->child("cpanfile")->spew(<<EOF);
+ $app->write_cpanfile(<<EOF);
requires 'Try::Tiny';
requires 'Mojolicious', '== 4.01';
EOF
diff --git a/xt/cli/freeze.t b/xt/cli/freeze.t
index f363626..f02a2c3 100644
--- a/xt/cli/freeze.t
+++ b/xt/cli/freeze.t
@@ -5,7 +5,7 @@ use xt::CLI;
{
my $app = cli();
- $app->dir->child("cpanfile")->spew(<<EOF);
+ $app->write_cpanfile(<<EOF);
requires 'Try::Tiny', '== 0.11';
EOF
diff --git a/xt/cli/json_pp.t b/xt/cli/json_pp.t
index c1f7707..0c64395 100644
--- a/xt/cli/json_pp.t
+++ b/xt/cli/json_pp.t
@@ -7,7 +7,7 @@ plan skip_all => "perl <= 5.14" if $] >= 5.015;
{
my $app = cli();
- $app->dir->child("cpanfile")->spew(<<EOF);
+ $app->write_cpanfile(<<EOF);
requires 'JSON';
requires 'CPAN::Meta', '2.12';
EOF
diff --git a/xt/cli/mirror.t b/xt/cli/mirror.t
index 089f702..a97fdcd 100644
--- a/xt/cli/mirror.t
+++ b/xt/cli/mirror.t
@@ -7,7 +7,7 @@ my $cwd = Path::Tiny->cwd;
{
my $app = cli();
- $app->dir->child("cpanfile")->spew(<<EOF);
+ $app->write_cpanfile(<<EOF);
requires 'Hash::MultiValue';
EOF
@@ -21,7 +21,7 @@ EOF
{
# fallback to CPAN
my $app = cli();
- $app->dir->child("cpanfile")->spew(<<EOF);
+ $app->write_cpanfile(<<EOF);
requires 'PSGI';
EOF
diff --git a/xt/cli/mismatch.t b/xt/cli/mismatch.t
index e233dc9..dca4751 100644
--- a/xt/cli/mismatch.t
+++ b/xt/cli/mismatch.t
@@ -5,7 +5,7 @@ use xt::CLI;
{
my $app = cli();
- $app->dir->child('cpanfile')->spew(<<EOF);
+ $app->write_cpanfile(<<EOF);
requires 'Data::Dumper' => '== 2.139';
requires 'Test::Differences' => '== 0.61';
EOF
diff --git a/xt/cli/perl.t b/xt/cli/perl.t
index 27e9a66..a7e0143 100644
--- a/xt/cli/perl.t
+++ b/xt/cli/perl.t
@@ -5,7 +5,7 @@ use xt::CLI;
{
my $app = cli();
- $app->dir->child("cpanfile")->spew(<<EOF);
+ $app->write_cpanfile(<<EOF);
requires 'perl', '5.8.5';
requires 'Hash::MultiValue';
EOF
diff --git a/xt/cli/tree.t b/xt/cli/tree.t
index 15c56bf..bc7ce8c 100644
--- a/xt/cli/tree.t
+++ b/xt/cli/tree.t
@@ -5,7 +5,7 @@ use xt::CLI;
{
my $app = cli();
- $app->dir->child("cpanfile")->spew(<<EOF);
+ $app->write_cpanfile(<<EOF);
requires 'HTML::Parser';
EOF
diff --git a/xt/cli/update.t b/xt/cli/update.t
index 8babb1d..a6c94c1 100644
--- a/xt/cli/update.t
+++ b/xt/cli/update.t
@@ -5,7 +5,7 @@ use xt::CLI;
subtest 'carton update NonExistentModule' => sub {
my $app = cli();
- $app->dir->child("cpanfile")->spew(<<EOF);
+ $app->write_cpanfile(<<EOF);
requires 'Try::Tiny', '== 0.09';
EOF
@@ -17,7 +17,7 @@ EOF
subtest 'carton update upgrades a dist' => sub {
my $app = cli();
- $app->dir->child("cpanfile")->spew(<<EOF);
+ $app->write_cpanfile(<<EOF);
requires 'Try::Tiny', '== 0.09';
EOF
@@ -25,7 +25,7 @@ EOF
$app->run("list");
like $app->stdout, qr/Try-Tiny-0\.09/;
- $app->dir->child("cpanfile")->spew(<<EOF);
+ $app->write_cpanfile(<<EOF);
requires 'Try::Tiny', '>= 0.09, <= 0.12';
EOF
@@ -49,14 +49,14 @@ EOF
subtest 'downgrade a distribution' => sub {
my $app = cli();
- $app->dir->child("cpanfile")->spew(<<EOF);
+ $app->write_cpanfile(<<EOF);
requires 'Try::Tiny', '0.12';
EOF
$app->run("install");
$app->run("list");
like $app->stdout, qr/Try-Tiny-0\.12/;
- $app->dir->child("cpanfile")->spew(<<EOF);
+ $app->write_cpanfile(<<EOF);
requires 'Try::Tiny', '== 0.09';
EOF
$app->run("update");
@@ -65,7 +65,7 @@ EOF
TODO: {
local $TODO = 'collecting wrong install info';
- $app->dir->child("cpanfile")->spew(<<EOF);
+ $app->write_cpanfile(<<EOF);
requires 'Try::Tiny', '0.09';
EOF
$app->run("install");