# TODO Tue Feb 26 09:35:41 2013 GMT
# $Id: TODO 128 2013-05-08 12:35:26Z minus $

# GENERAL

    ** !!! IMPORTANT !!! **

       -  http://perl.apache.org/docs/2.0/user/handlers/http.html   
               .    
             .

       - dir_*   -              , !!
          File::Spec (CTK::Util)        !!

       -   src/skel     targz      
          __DATA__  MPMinus/Helepr/Skel.pm   Skel.pm    
                  SKEL   
         share  .   ,  Skel.pm     
                  ...   
           !

    *         MPMinus
   
# BUGS

    * none

# REFACTORING

    *   croak  die,    !!

# DOCUMENTATION

    !!!   !!!
    *    base   $m     ,
          MPMinus::Manual.       
          MPMinus.pm. 

    *      =item B<>      

# DIAGNOSTICS

    *   

# SUPPORT

    * none

FROM CPAN
=========

sub _gitify # 
	{
	my $args = shift;

	my $loaded = eval "require Archive::Extract; 1;";
	croak "You need Archive::Extract to use features that gitify distributions\n"
		unless $loaded;

	my $starting_dir = cwd();

	foreach my $module ( @$args )
		{
		$logger->info( "Checking $module" );
		my $path = CPAN::Shell->expand( "Module", $module )->cpan_file;

		my $store_paths = _download( [ $module ] );
		$logger->debug( "gitify Store path is $store_paths->{$module}" );
		my $dirname = dirname( $store_paths->{$module} );

		my $ae = Archive::Extract->new( archive => $store_paths->{$module} );
		$ae->extract( to => $dirname );

		chdir $ae->extract_path;

		my $git = $ENV{GIT_COMMAND} || '/usr/local/bin/git';
		croak "Could not find $git"    unless -e $git;
		croak "$git is not executable" unless -x $git;

		# can we do this in Pure Perl?
		system( $git, 'init'    );
		system( $git, qw( add . ) );
		system( $git, qw( commit -a -m ), 'initial import' );
		}

	chdir $starting_dir;

	return HEY_IT_WORKED;
	}
