GBrowse

 view release on metacpan or  search on metacpan

install_util/GBrowseInstall.pm  view on Meta::CPAN

    mkdir "$dir/tmp";

    # make copies of htdocs and conf
    open my $saveout,">&STDOUT";
    open STDOUT,">/dev/null";

    my $f    = IO::File->new('MANIFEST');
    while (<$f>) {
	chomp;
	if (m!^(conf|htdocs)!) {
	    $self->copy_if_modified($_ => $dir);
	} elsif (m!cgi-bin!) {
	    $self->copy_if_modified(from => $_,to_dir => "$dir/cgi-bin/gb2",flatten=>1);
	    chmod 0755,$_ foreach (glob "$dir/cgi-bin/gb2/*");
	} elsif (m!^sample_data!) {
	    chdir $self->base_dir();
	    my ($subdir) = m!^sample_data/([^/]+)/!;
	    $self->copy_if_modified(from    => $_,
				    to_dir  => "$dir/htdocs/databases/$subdir",
				    flatten => 1,
		);
	}
    }
    close $f;
    chdir $self->base_dir;
    open STDOUT,"<&",$saveout;

    # fix GBrowse.conf to point to correct directories

install_util/GBrowseInstall.pm  view on Meta::CPAN


    my $prefix = $self->install_base || $self->prefix || '';
    GBrowseGuessDirectories->prefix($prefix);
    my $install_path = $self->config_data('conf') || GBrowseGuessDirectories->conf;

    while (<$f>) {
	next unless m!^conf/!;
	chomp;
	my $base = $_;

	my $copied = $self->copy_if_modified($_=>'blib');
	if ($copied || !$self->up_to_date('_build/config_data',"blib/$_")) {
	    $self->substitute_in_place("blib/$_");
	    $self->check_installed($install_path,$base);
	}
    }

}

sub check_installed {
    my $self = shift;

install_util/GBrowseInstall.pm  view on Meta::CPAN

sub process_htdocs_files {
    my $self = shift;
    my $f    = IO::File->new('MANIFEST');
    my $install_path = $self->install_path->{'htdocs'} || GBrowseGuessDirectories->htdocs;

    my %doneit;
    while (<$f>) {
	next unless m!^htdocs/!;
	chomp;
	my $base = $_;
	my $copied = $self->copy_if_modified($base=>'blib');
	if ($copied or !$self->up_to_date('_build/config_data',"blib/$base")) {
	    $self->substitute_in_place("blib/$base");
	    $self->check_installed($install_path,$base) if $copied;
	}
    }

    # hacky thing for getting the cloud index.html right
    if (eval "require Bio::Graphics::Browser2::Render::Slave::AWS_Balancer;1") {
	if (Bio::Graphics::Browser2::Render::Slave::AWS_Balancer->running_as_instance) {
	    warn "Cloud instance detected; renaming index.html";

install_util/GBrowseInstall.pm  view on Meta::CPAN

	}
    }
}

sub process_cgibin_files {
    my $self = shift;
    my $f    = IO::File->new('MANIFEST');
    while (<$f>) {
	next unless m!^cgi-bin/!;
	chomp;
	my $copied = $self->copy_if_modified($_=>'blib');
	my $path   = File::Spec->catfile('blib',$_);
	if ($copied) {
	    $self->fix_shebang_line($path);
	    chmod 0755,$path;
	}
    }
}

sub process_etc_files {
    my $self = shift;

install_util/GBrowseInstall.pm  view on Meta::CPAN

    my $install_path = $self->install_path->{'etc'} || GBrowseGuessDirectories->etc;

    if ($self->config_data('installetc') =~ /^[yY]/) {
	my $f    = IO::File->new('MANIFEST');
	while (<$f>) {
	    next unless m!^etc/!;
	    chomp;

	    my $base = $_;

	    my $copied = $self->copy_if_modified($_=>'blib');
	    if ($copied or !$self->up_to_date('_build/config_data',"blib/$_")) {
		$self->substitute_in_place("blib/$_");
		$self->check_installed($install_path,$base);
	    }
	}
    }

    # generate the apache config data
    my $includes = GBrowseGuessDirectories->apache_includes || '';

install_util/GBrowseInstall.pm  view on Meta::CPAN

    }
}

sub process_database_files {
    my $self = shift;
    my $f    = IO::File->new('MANIFEST');
    while (<$f>) {
	next unless m!^sample_data/!;
	chomp;
        my $dest = $_;  $dest =~ s|^sample_data/||;
        $self->copy_if_modified(from => $_,
                                to   => "blib/databases/$dest",
                               );
    }
}

sub substitute_in_place {
    my $self = shift;
    my $path = shift;
    return if $path =~ /\.\w+$/ && $path !~ /\.(html|txt|conf)$/;
    my $in   = IO::File->new($path) or return;



( run in 1.672 second using v1.01-cache-2.11-cpan-99c4e6809bf )