Permalink
Browse files

add File::Basename, File::Path and File::Slurp tools to Poet::Tools, …

…get from there
  • Loading branch information...
jonswar committed Jun 8, 2012
1 parent 560bcb0 commit 8a00614111ab7c60f0f8e955033d47cc4f049ec4
View
@@ -2,11 +2,10 @@ package Poet::Conf;
use Carp;
use Cwd qw(realpath);
use Data::Rmap qw(rmap_scalar);
-use File::Basename;
-use File::Slurp qw(read_file);
use File::Spec::Functions qw(catfile);
use Guard;
use Poet::Moose;
+use Poet::Tools qw(read_file);
use Storable qw(dclone);
use Try::Tiny;
use YAML::XS;
@@ -1,13 +1,10 @@
package Poet::Environment::Generator;
use Cwd qw(realpath);
-use File::Basename;
use File::Find;
-use File::Path;
use File::ShareDir;
-use File::Slurp qw(read_dir);
use Mason;
use Method::Signatures::Simple;
-use Poet::Tools qw(trim write_file);
+use Poet::Tools qw(basename dirname mkpath read_dir trim write_file);
use strict;
use warnings;
View
@@ -1,11 +1,9 @@
package Poet::Log;
use Poet qw($conf $poet);
use File::Spec::Functions qw(rel2abs);
-use File::Basename qw(dirname);
-use File::Path qw(mkpath);
use Log::Any::Adapter;
use Method::Signatures::Simple;
-use Poet::Tools qw(can_load read_file write_file);
+use Poet::Tools qw(can_load dirname mkpath read_file write_file);
use strict;
use warnings;
View
@@ -1,10 +1,9 @@
package Poet::Script;
use Cwd qw(realpath);
-use File::Basename;
use File::Spec::Functions qw(rel2abs);
use Method::Signatures::Simple;
use Poet::Environment;
-use Poet::Tools qw(can_load read_file);
+use Poet::Tools qw(can_load dirname read_file);
use strict;
use warnings;
View
@@ -2,13 +2,11 @@ package Poet::Test::Class;
use Method::Signatures::Simple;
use Carp;
use Cwd qw(realpath);
-use File::Basename;
-use File::Path;
use Plack::Util;
use Poet::Environment::Generator;
use Poet::Environment;
use Poet::Mechanize;
-use Poet::Tools qw(tempdir_simple write_file);
+use Poet::Tools qw(basename dirname mkpath rmtree tempdir_simple write_file);
use Test::Class::Most;
use YAML::XS;
use strict;
View
@@ -5,7 +5,10 @@ use Carp;
use Class::MOP;
use Config;
use Fcntl qw( :DEFAULT :seek );
+use File::Basename;
use File::Find;
+use File::Path;
+use File::Slurp qw(read_dir);
use File::Spec::Functions ();
use File::Temp qw(tempdir);
use Try::Tiny;
@@ -14,7 +17,7 @@ use warnings;
use base qw(Exporter);
our @EXPORT_OK =
- qw(can_load catdir catfile checksum find_wanted perl_executable read_file taint_is_on tempdir_simple trim uniq write_file );
+ qw(basename can_load catdir catfile checksum dirname find_wanted mkpath perl_executable read_dir read_file rmtree taint_is_on tempdir_simple trim uniq write_file );
my $Fetch_Flags = O_RDONLY | O_BINARY;
my $Store_Flags = O_WRONLY | O_CREAT | O_BINARY;
@@ -1,7 +1,6 @@
package Poet::t::Environment;
use Test::Class::Most parent => 'Poet::Test::Class';
-use File::Path qw(mkpath);
-use Poet::Tools qw(tempdir_simple write_file);
+use Poet::Tools qw(mkpath tempdir_simple write_file);
use Poet::Environment::Generator;
sub test_environment : Tests {
View
@@ -1,6 +1,5 @@
package Poet::t::Log;
-use Poet::Tools qw(tempdir_simple);
-use File::Path qw(rmtree);
+use Poet::Tools qw(rmtree tempdir_simple);
use JSON::XS;
use Test::Class::Most parent => 'Poet::Test::Class';
@@ -1,10 +1,8 @@
package Poet::t::PSGIHandler;
use Test::Class::Most parent => 'Poet::Test::Class';
use Capture::Tiny qw();
-use File::Basename;
-use File::Path;
use Guard;
-use Poet::Tools qw(trim write_file);
+use Poet::Tools qw(dirname mkpath trim write_file);
my $poet = __PACKAGE__->initialize_temp_env(
conf => {
View
@@ -2,10 +2,8 @@ package Poet::t::Script;
use Test::Class::Most parent => 'Poet::Test::Class';
use Capture::Tiny qw(capture);
use Cwd qw(realpath);
-use File::Basename;
-use File::Path;
use YAML::XS;
-use Poet::Tools qw(perl_executable tempdir_simple write_file);
+use Poet::Tools qw(dirname mkpath perl_executable tempdir_simple write_file);
my $script_template;
@@ -18,7 +18,11 @@ sub test_subclassing : Tests {
join( "\n",
"package TestApp::Import;",
"use Poet::Moose;",
- "extends 'Poet::Import';" )
+ "extends 'Poet::Import';",
+ "no strict 'refs';",
+ "before 'export_to_class' => sub { *{\$_[1] . '::bar'} = sub { 5 } };",
+ "1",
+ )
);
write_file(
"$root_dir/lib/TestApp/Log.pm",
@@ -46,6 +50,7 @@ sub test_subclassing : Tests {
isa_ok( $Foo::conf, 'TestApp::Conf', '$conf' );
isa_ok( $Foo::log, 'TestApp::Logger', '$log' );
isa_ok( $Foo::poet, 'Poet::Environment', '$poet' );
+ is( Foo::bar(), 5, 'imported bar' );
}
}

0 comments on commit 8a00614

Please sign in to comment.