Bump version to 0.004002 and update Changes.
[catagits/Gitalist.git] / script / bootstrap.pl
CommitLineData
42b626cd 1#!/usr/bin/env perl
2
3# This script installs an initial local::lib into your application directory
4# named local-lib5, which automatically turns on local::lib support by default.
5
6# Needs to be run as script/bootstrap.pl
7
8# Will then install Module::Install, and all of your dependencies into
9# the local lib directory created.
10
11use strict;
12use warnings;
13
14use lib;
15use FindBin;
16use CPAN;
17
18# Do not take no for an answer.
19
20$ENV{CATALYST_LOCAL_LIB}=1;
21
22# Get the base paths and setup your %ENV
23
24my $basedir;
25if (-r "$FindBin::Bin/Makefile.PL") {
26 $basedir = $FindBin::Bin;
27}
28elsif (-r "$FindBin::Bin/../Makefile.PL") {
29 $basedir = "$FindBin::Bin/..";
30}
31
32$basedir ||= '';
33my $target = "$basedir/local-lib5";
34my $lib = "$target/lib/perl5";
35
36# Start installing stuff in the target dir
37$ENV{PERL_MM_OPT} = "INSTALL_BASE=$target";
38$ENV{PERL_MM_USE_DEFAULT} = "1";
39# And allow dependency checks to find it
40lib->import("$target/lib/perl5");
41
42# Deal with the weird case that cpan has never been run before and
43# cpan wants to create a .cpan directory in /root or somewhere you
44# can't access
45
46local %CPAN::Config;
bb20c968 47require CPAN::HandleConfig;
42b626cd 48CPAN::HandleConfig->load();
99daca22 49$CPAN::Config->{prefs_dir} = "$ENV{HOME}/.cpan/prefs";
42b626cd 50
42b626cd 51force(qw/install local::lib/);
52
99daca22 53require lib::core::only; # Turn lib::core:only on
42b626cd 54require local::lib; # Turn local::lib on
99daca22 55lib::core::only->import();
42b626cd 56local::lib->import( $target );
57
58# Become fully self contained
59$ENV{PERL5LIB} = ""; # If we used a local::lib to bootstrap, this kills it.
60
61# Sorry kane ;)
62$ENV{PERL_AUTOINSTALL_PREFER_CPAN}=1;
63$ENV{PERL_MM_OPT} .= " INSTALLMAN1DIR=none INSTALLMAN3DIR=none";
64
99daca22 65lib::core::only->import();
66local::lib->import( $target );
42b626cd 67
68# Force a re-install of local::lib here to get the dependencies for local::lib
69# It requires things which ensure we have an unfucked toolchain :)
70force(qw/install local::lib/);
71
72# Install the base modules
73install('Module::Install');
74install('YAML');
75install('CPAN');
99daca22 76# For some reason this isn't installed along with M::I::Catalyst.
77install('File::Copy::Recursive');
42b626cd 78install('Module::Install::Catalyst');
79
0556ab26 80print "local::lib setup, type perl Makefile.PL && make installdeps to install dependencies\n";
42b626cd 81