package VineLinux::VSS;

use strict;
use warnings;

use VineLinux::VSS::ConfigLoader;
use VineLinux::VSS::Type::Elisp;
use VineLinux::VSS::Type::SelfBuild;
use VineLinux::VSS::Type::PerlModule;

use base qw( Class::Accessor::Fast );
__PACKAGE__->mk_accessors( qw(type package_name packager_name packager_fullname packager_email) );

our $VERSION = '0.3';

sub new{
    my ($class, %opt) = @_;

    my $self = bless {
	type => '',
    }, $class;
    
    my $loader = VineLinux::VSS::ConfigLoader->new;
    my $config = $loader->load($opt{config}, $self);
    
    $self->type($opt{type});
    $self->package_name($opt{package_name});

    return $self;
}

sub run{
    my $class = shift;

    my $type = $class->type;
    print "generating sleleton files: "  . $type  . "\n";
    
    if ($type eq 'elisp') {
	VineLinux::VSS::Type::Elisp->generate($class);
    } elsif ($type eq 'self-build') {
	VineLinux::VSS::Type::SelfBuild->generate($class);
    } elsif ($type eq 'perlmodule') {
	VineLinux::VSS::Type::PerlModule->generate($class);
    }

    print "done.\n";
    return $class;
}

sub bootstrap{
    my $class = shift;
    my $self = $class->new(@_);
    $self->run();
    return $self;
}

1;

