App-Netdisco

 view release on metacpan or  search on metacpan

bin/netdisco-backend  view on Meta::CPAN


our $home;

BEGIN {
  use FindBin;
  FindBin::again();

  my $me = File::Spec->catfile($FindBin::RealBin, $FindBin::RealScript);
  my $uid = (stat($me))[4] || 0;

  $home = ($ENV{NETDISCO_HOME} || (getpwuid($uid))[7] || $ENV{HOME});

  # try to find a localenv if one isn't already in place.
  if (!exists $ENV{PERL_LOCAL_LIB_ROOT}) {
      use File::Spec;
      my $localenv = File::Spec->catfile($FindBin::Bin, 'localenv');
      exec($localenv, $0, @ARGV) if -f $localenv;
      $localenv = File::Spec->catfile($home, 'perl5', 'bin', 'localenv');
      exec($localenv, $0, @ARGV) if -f $localenv;

      die "Sorry, can't find libs required for App::Netdisco.\n"

bin/netdisco-daemon  view on Meta::CPAN


use FindBin;
FindBin::again();

use File::Spec;
use Cwd 'realpath';
use File::Copy 'move';

my $me = realpath(File::Spec->catfile($FindBin::RealBin, $FindBin::RealScript));
my $uid = (stat($me))[4] || 0;
my $home = ($ENV{NETDISCO_HOME} || (getpwuid($uid))[7] || $ENV{HOME});

my $old_pid = File::Spec->catfile($home, 'netdisco-daemon.pid');
my $new_pid = File::Spec->catfile($home, 'netdisco-backend.pid');
if (-f $old_pid) { move( $old_pid, $new_pid ) }

my $backend =
  File::Spec->catfile((File::Spec->splitpath( $me ))[1], 'netdisco-backend');
exec {$backend} 'netdisco-backend', @ARGV;

bin/netdisco-daemon-fg  view on Meta::CPAN

use warnings;

use FindBin;
FindBin::again();

use File::Spec;
use Cwd 'realpath';

my $me = realpath(File::Spec->catfile($FindBin::RealBin, $FindBin::RealScript));
my $uid = (stat($me))[4] || 0;
my $home = ($ENV{NETDISCO_HOME} || (getpwuid($uid))[7] || $ENV{HOME});

my $backend =
  File::Spec->catfile((File::Spec->splitpath( $me ))[1], 'netdisco-backend-fg');
exec {$backend} 'netdisco-backend-fg', @ARGV;

bin/netdisco-web  view on Meta::CPAN


our $home;

BEGIN {
  use FindBin;
  FindBin::again();

  my $me = File::Spec->catfile($FindBin::RealBin, $FindBin::RealScript);
  my $uid = (stat($me))[4] || 0;

  $home = ($ENV{NETDISCO_HOME} || (getpwuid($uid))[7] || $ENV{HOME});

  # try to find a localenv if one isn't already in place.
  if (!exists $ENV{PERL_LOCAL_LIB_ROOT}) {
      use File::Spec;
      my $localenv = File::Spec->catfile($FindBin::Bin, 'localenv');
      exec($localenv, $0, @ARGV) if -f $localenv;
      $localenv = File::Spec->catfile($home, 'perl5', 'bin', 'localenv');
      exec($localenv, $0, @ARGV) if -f $localenv;

      die "Sorry, can't find libs required for App::Netdisco.\n"

lib/App/Netdisco/Environment.pm  view on Meta::CPAN

use Path::Class;
use FindBin;

BEGIN {
  if (not ($ENV{DANCER_APPDIR} || '')
      or not -f file($ENV{DANCER_APPDIR}, 'config.yml')) {

      FindBin::again();
      my $me = File::Spec->catfile($FindBin::RealBin, $FindBin::RealScript);
      my $uid = (stat($me))[4] || 0;
      my $home = ($ENV{NETDISCO_HOME} || (getpwuid($uid))[7] || $ENV{HOME});
      $ENV{NETDISCO_HOME} ||= $home;

      my $auto = dir(dist_dir('App-Netdisco'))->absolute;

      $ENV{DANCER_APPDIR}  ||= $auto->stringify;
      $ENV{DANCER_CONFDIR} ||= $auto->stringify;

      my $test_envdir = dir($home, 'environments')->stringify;
      $ENV{DANCER_ENVDIR} ||= (-d $test_envdir
        ? $test_envdir : $auto->subdir('environments')->stringify);



( run in 0.519 second using v1.01-cache-2.11-cpan-8d75d55dd25 )