package Dist::Zilla::Plugin::Author::Plicease::DevShare;

use Moose;
use Path::Class qw( dir );
use namespace::autoclean;

# ABSTRACT: Plugin to deal with dev/project share directory
our $VERSION = '1.90'; # VERSION

with 'Dist::Zilla::Role::FileGatherer';

sub gather_files
{
  my($self) = @_;

  my $filename = $self->zilla->main_module->name;
  $filename =~ s{^(.*)/(.*?)\.pm$}{$1/.$2.devshare};
  
  my $count = $filename;
  $count =~ s/[^\/]//g;
  $count = length $count;
  my $content = ('../' x $count) . 'share';
  
  my $file = Dist::Zilla::File::InMemory->new({
    name    => $filename,
    content => $content,
  });
  
  $self->add_file($file);
  
  dir->file($filename)->spew($content);
}

__PACKAGE__->meta->make_immutable;

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

Dist::Zilla::Plugin::Author::Plicease::DevShare - Plugin to deal with dev/project share directory

=head1 VERSION

version 1.90

=head1 AUTHOR

Graham Ollis <plicease@cpan.org>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2012 by Graham Ollis.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=cut
