Skip to content

Commit

Permalink
stop installing to ~/.perl6
Browse files Browse the repository at this point in the history
requires a pretty new Rakudo with $*CUSTOM-LIB support
  • Loading branch information
moritz committed Oct 14, 2012
1 parent 2ef186a commit c181c9a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
5 changes: 2 additions & 3 deletions bin/panda
Expand Up @@ -87,11 +87,10 @@ if %*ENV<PANDA_DEFAULT_OPTS> {
# initialize the Panda object
my $panda;
{
my $home = $*OS eq 'MSWin32' ?? %*ENV<HOMEDRIVE> ~ %*ENV<HOMEPATH> !! %*ENV<HOME>;
my $pandadir = "$home/.panda";
my $pandadir = "$*CUSTOM-LIB/panda";
mkpath $pandadir unless $pandadir.IO ~~ :d;

my $destdir = %*ENV<DESTDIR> || "$home/.perl6";
my $destdir = %*ENV<DESTDIR> || $*CUSTOM-LIB;
$destdir = "{cwd}/$destdir" if $*OS ne 'MSWin32' && $destdir !~~ /^ '/' /;

$panda = Panda.new(
Expand Down
13 changes: 6 additions & 7 deletions bootstrap.pl
Expand Up @@ -4,22 +4,21 @@
say '==> Bootstrapping Panda';

my $is_win = $*OS eq 'MSWin32';
my $home = $is_win ?? %*ENV<HOMEDRIVE> ~ %*ENV<HOMEPATH> !! %*ENV<HOME>;

mkdir $home unless $home.IO.d;
mkdir "$home/.panda" unless "$home/.panda".IO.d;
my $panda-base = "$*CUSTOM-LIB/panda";
mkdir $*CUSTOM-LIB unless $*CUSTOM-LIB.path.d;
mkdir $panda-base unless $panda-base.path.d;

my $projects = slurp 'projects.json.bootstrap';
$projects ~~ s:g/_BASEDIR_/{cwd}\/ext/;
$projects .= subst('\\', '/', :g) if $is_win;

given open "$home/.panda/projects.json", :w {
given open "$panda-base/projects.json", :w {
.say: $projects;
.close;
}

my $env_sep = $is_win ?? ';' !! ':';
my $destdir = %*ENV<DESTDIR> || "$home/.perl6";
my $destdir = %*ENV<DESTDIR> || $*CUSTOM-LIB;
$destdir = "{cwd}/$destdir" unless $destdir ~~ /^ '/' /
|| $is_win && $destdir ~~ /^ [ '\\' | <[a..zA..Z]> ':' ] /;

Expand All @@ -31,4 +30,4 @@

shell "perl6 bin/panda install File::Tools JSON::Tiny Test::Mock {cwd}";

unlink "$home/.panda/projects.json";
unlink "$panda-base/projects.json";
9 changes: 4 additions & 5 deletions rebootstrap.pl
Expand Up @@ -4,8 +4,7 @@
use Shell::Command;

# Find old state file
my $home = $*OS eq 'MSWin32' ?? %*ENV<HOMEDRIVE> ~ %*ENV<HOMEPATH> !! %*ENV<HOME>;
my $state-file = "$home/.panda/state";
my $state-file = "$*CUSTOM-LIB/panda/state";

if not $state-file.IO.e {
say "No need to rebootstrap, running normal bootstrap";
Expand All @@ -32,11 +31,11 @@

# Clean old directories, boostrap a fresh panda,
# and reinstall all manually-installed modules
rm_rf "$home/.perl6/lib";
rm_rf "$home/.panda";
rm_rf "$*CUSTOM-LIB/lib";
rm_rf "$*CUSTOM-LIB/panda";
shell 'perl6 bootstrap.pl';
say "==> Reinstalling @modules[]";
shell "panda install @modules[]";

# Save the backup state file back to ~/.panda/
# Save the backup state file back to $*CUSTOM-LIB/panda/
spurt "$state-file.bak", $old-state if $old-state;

0 comments on commit c181c9a

Please sign in to comment.