package VineLinux::VSS::Type::Elisp;

use base qw( VineLinux::VSS::Type );

use VineLinux::VSS::Skeleton::Elisp::InitEl;
use VineLinux::VSS::Skeleton::Elisp::Spec;
use VineLinux::VSS::Skeleton::Elisp::InstallSh;
use VineLinux::VSS::Skeleton::Elisp::RemoveSh;
use VineLinux::VSS::Skeleton::Elisp::VineDefaultEl;

sub generate {
    my $class = shift;
    my $vss = shift;

    my $filename = '';
    my @skeleton_data;
    my $tmpl;

    my $params = $class->_set_params($vss);
   
    # <package>-init.el
    @skeleton_data = <VineLinux::VSS::Skeleton::Elisp::InitEl::DATA>;
    $tmpl = HTML::Template->new(arrayref => \@skeleton_data,
				die_on_bad_params => 0);
    $tmpl->param($params);
    $filename = $vss->package_name . '-init.el';
    $class->_generate_file($filename, $tmpl->output);


    # vine-default-<package>.el
    @skeleton_data = <VineLinux::VSS::Skeleton::Elisp::VineDefaultEl::DATA>;
    $tmpl = HTML::Template->new(arrayref => \@skeleton_data,
				die_on_bad_params => 0);
    $tmpl->param($params);
    $filename = 'vine-default-' . $vss->package_name . '.el';
    $class->_generate_file($filename, $tmpl->output);

    
    # <package>.spec
    @skeleton_data = <VineLinux::VSS::Skeleton::Elisp::Spec::DATA>;
    $tmpl = HTML::Template->new(arrayref => \@skeleton_data,
				die_on_bad_params => 0);
    $tmpl->param($params);
    $filename = $vss->package_name . '.spec';
    $class->_generate_file($filename, $tmpl->output);


    # <package>-install.sh
    @skeleton_data = <VineLinux::VSS::Skeleton::Elisp::InstallSh::DATA>;
    $tmpl = HTML::Template->new(arrayref => \@skeleton_data,
				die_on_bad_params => 0);
    $tmpl->param($params);
    $filename = $vss->package_name . '-install.sh';
    $class->_generate_file($filename, $tmpl->output);


    # <package>-remove.sh
    @skeleton_data = <VineLinux::VSS::Skeleton::Elisp::RemoveSh::DATA>;
    $tmpl = HTML::Template->new(arrayref => \@skeleton_data,
				die_on_bad_params => 0);
    $tmpl->param($params);
    $filename = $vss->package_name . '-remove.sh';
    $class->_generate_file($filename, $tmpl->output);
}

1;
