GBrowse

 view release on metacpan or  search on metacpan

install_util/GBrowseInstall.pm  view on Meta::CPAN

	    my ($volume,$dir) = File::Spec->splitdir($opts{$key});
	    my $top_level     = File::Spec->catfile($volume,$dir);

            if ($opts{$key} =~ m!(/usr/local/apache2*)!) {
                #it looks like there is no apache installed; let the user know
                my $apachedir = $1;
                if (!-d $apachedir and !$dire_warning) {
                    print STDERR <<END

******************************WARNING***********************************
GBrowse is being configured to install in $apachedir, but that 
directory doesn't exist, which means either Apache isn\'t installed
or the installer couldn't find it.  If you continue with this
installation there is a good chance it won't work if Apache isn't
installed.
******************************WARNING***********************************

END
;
                   $dire_warning = 1;
                }
            }

	    unless (-d $top_level) {
		next if Module::Build->y_n("The directory $top_level does not exist. Use anyway?",'n');
		redo;
	    }
	}
    }

    for my $key (keys %opts) {
	$self->config_data($key=>$opts{$key});
    }

    $self->config_done(1);

    print STDERR "\n**Interactive configuration done. Run './Build reconfig' to reconfigure**\n";
}

sub ACTION_register {
    my $self = shift;
    return unless -t STDIN;
    print STDERR "\n**Registration**\nGBrowse2 registration is optional, but will help us maintain funding for this project.\n";
    if (Module::Build->y_n("Do you wish to register your installation?",'y')) {
	print STDERR "All values are optional, but appreciated.\n";
	my $user  = prompt('Your name:');
	my $email = prompt('Your email address:');
	my $org   = prompt('Your organization:');
	my $organism = prompt('Organisms you will be using GBrowse for (one line):');
	my $site  = prompt('If GBrowse will be public, the URL of your web site:');
	my $result = eval {
	    eval "use HTTP::Request::Common";
	    eval "use LWP::UserAgent";
	    my $ua = LWP::UserAgent->new;
	    my $response = $ua->request(POST(REGISTRATION_SERVER,
					     [user=>$user,email=>$email,
					      org=>$org,organism=>$organism,
					      site=>$site]
					));
	    die $response->status_line unless $response->is_success;
	    my $content = $response->decoded_content;
	    $content eq 'ok';
	};
	if ($@) {
	    print STDERR "An error occurred during registration: $@\n";
	    print STDERR "If you are able to fix the error, you can register later ";
	    print STDERR "using \"./Build register\"\n";
	} else {
	    print STDERR $result ? "Thank you. Your registration was sent successfully.\n"
		                 : "An error occurred during registration. Thanks anyway.\n";
	}
    } else {
	print STDERR "If you wish to register at a later time please \"./Build register\"\n";
	print STDERR "Press any key to continue\n";
	my $h = <STDIN>;
    }
    $self->registration_done(1);
}


sub ACTION_config_data {
    my $self = shift;
    $self->depends_on('config');
    $self->SUPER::ACTION_config_data;
}

sub ACTION_apache_conf {
    my $self = shift;
    $self->depends_on('config');

    my $docs   = basename($self->config_data('htdocs'));
    print STDERR <<END;

INSTRUCTIONS: Paste the following into your Apache configuration
file. You may wish to save it separately and include it using the
Apache "Include /path/to/file" directive. Then restart Apache and
point your browser to http://your.site/$docs/ to start browsing the
sample genomes.

>>>>>> cut here <<<<<
END
;
    print $self->apache_conf;
}

sub apache_conf {
    my $self = shift;
    my $dir       = $self->config_data('htdocs');
    my $conf      = $self->config_data('conf');
    my $cgibin    = $self->config_data('cgibin');
    my $tmp       = $self->config_data('tmp');
    my $databases = $self->config_data('databases');
    my $cgiroot = basename($cgibin);
    my $perl5lib= $self->added_to_INC;
    my $inc      = $perl5lib ? "SetEnv PERL5LIB \"$perl5lib\"" : '';
    my $fcgi_inc = $perl5lib ? "-initial-env PERL5LIB=$perl5lib"        : '';
    my $fcgid_inc= $perl5lib ? "FcgidInitialEnv PERL5LIB $perl5lib"        : '';
    my $modperl_switches = $perl5lib
	? "PerlSwitches ".join ' ',map{"-I$_"} split ':',$perl5lib
        : '';



( run in 1.299 second using v1.01-cache-2.11-cpan-5a3173703d6 )