default => sub {
Moose::Website::Resource::Templates->new
},
- handles => {
- 'template_root' => 'dir'
- }
);
+sub template_root {
+ shift->template_resource->fetch('template_dir')->install_from_absolute;
+}
+
has 'web_file_resource' => (
traits => [ 'NoGetopt' ],
is => 'ro',
isa => 'Moose::Website::Resource::WebFiles',
lazy => 1,
default => sub {
- Moose::Website::Resource::WebFiles->new
+ Moose::Website::Resource::WebFiles->new(install_to => shift->outdir)
},
);
}
$self->log( "Copying web resources to " . $self->outdir );
- $self->web_file_resource->copy( to => $self->outdir, include_deps => 1 );
+ $self->web_file_resource->install;
}
sub build_template_params {
package Moose::Website::Resource::Templates;
use Moose;
+use Resource::Pack;
our $VERSION = '0.01';
our $AUTHORITY = 'cpan:STEVAN';
-with 'Resource::Pack' => {
- traits => [
- 'Resource::Pack::Dir'
- ]
-};
+extends 'Resource::Pack::Resource';
+
+has '+name' => (default => 'templates');
+
+sub BUILD {
+ my $self = shift;
+
+ resource $self => as {
+ install_from(Path::Class::File->new(__FILE__)->parent
+ ->subdir('Templates'));
+ dir template_dir => (
+ dir => '.',
+ install_as => '',
+ );
+ };
+}
__PACKAGE__->meta->make_immutable;
-no Moose; 1;
+no Moose; no Resource::Pack; 1;
__END__
package Moose::Website::Resource::WebFiles;
use Moose;
+use Resource::Pack;
+
+use Moose::Website::Resource::jQuery;
our $VERSION = '0.01';
our $AUTHORITY = 'cpan:STEVAN';
-with 'Resource::Pack' => {
- traits => [
- 'Resource::Pack::Dir'
- ],
- depends_on => [
- 'Moose::Website::Resource::jQuery'
- ]
-};
+extends 'Resource::Pack::Resource';
+
+has '+name' => (default => 'webfiles');
+
+sub BUILD {
+ my $self = shift;
+
+ resource $self => as {
+ install_from(Path::Class::File->new(__FILE__)->parent
+ ->subdir('WebFiles'));
+
+ resource(Moose::Website::Resource::jQuery->new);
+
+ dir 'css';
+ dir 'images';
+ dir js => (
+ dir => 'js',
+ dependencies => ['jquery/core'],
+ );
+ };
+}
__PACKAGE__->meta->make_immutable;
-no Moose; 1;
+no Moose; no Resource::Pack; 1;
__END__
package Moose::Website::Resource::jQuery;
use Moose;
+use Resource::Pack;
our $VERSION = '0.01';
our $AUTHORITY = 'cpan:STEVAN';
-with 'Resource::Pack' => {
- traits => [
- 'Resource::Pack::URL' => {
- url => 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js',
- sub_dir => 'js'
- }
- ]
-};
+extends 'Resource::Pack::Resource';
+
+has '+name' => (default => 'jquery');
+
+sub BUILD {
+ my $self = shift;
+
+ resource $self => as {
+ install_to 'js';
+ url core => 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js';
+ };
+}
__PACKAGE__->meta->make_immutable;
-no Moose; 1;
+no Moose; no Resource::Pack; 1;
__END__