Acme-Schlong

 view release on metacpan or  search on metacpan

lib/Acme/Schlong.pm  view on Meta::CPAN

    # has number_of_rc_files  =>  ~/.*rc
    # has length of .vimrc
    # has length of .emacs
    # has number of files in ~/.emacs.d
    # has using .ssh/config
    # has rvm/rbenv installed
    # 

    # has number_of_modules      => ( is => 'ro', isa => Int,  lazy_build => 1, documentation => q{} );

    method _build_useraccounts           { scalar grep { !/Shared/ } grep { -d $_ } glob ( dir( $self->home_directory => '..') . '/*'); } #TODO Make safer for WIN
    method _build_username_length        { length $self->username }
    method _build_shell                  { $_ = $ENV{SHELL}; s/.*\/(.*?)$/$1/; $_ } # /r
    method _build_harddrive_size         { $_=`df -l | grep '\\/\$' | awk '{print \$2}'`; chomp; $_ } # -E 'use IPC::Run qw<run timeout>; my $out; my @cmd = (q<du>, q<-s>, q</>); run \@cmd, "", \undef, \$out, timeout( 100 ) echo `uptime|grep days|sed...
    method _build_harddrive_used         { $_=`df -l | grep '\\/\$' | awk '{print \$3}'`; chomp; $_ } # -E 'use IPC::Run qw<run timeout>; my $out; my @cmd = (q<du>, q<-s>, q</>); run \@cmd, "", \undef, \$out, timeout( 100 ) echo `uptime|grep days|sed...
    method _build_uptime                 { 100 }
    method _build_users                  {  5  }
    method _build_cores                  { App::OS::Detect::MachineCores->new->cores }
    method _build_using_multiplex        { $self->using_byobu or $self->using_tmux or $self->using_screen ? true : false }
    method _build_using_byobu            { exists $ENV{BYOBU_BACKEND} ? 1 : 0 }
    method _build_using_tmux             { $ENV{TERM} ~~ 'tmux'       ? 1 : 0 }

lib/Acme/Schlong.pm  view on Meta::CPAN

    # method _build_perl_version_is_dev    { version->new($self->perl_version)->version->[1] % 2 ? 1 : 0 } # is_alpha
    method _build_directories_in_path    { scalar split q<:> =>      $ENV{PATH}         }
    method _build_using_perlbrew         { (grep { /perlbrew/i  }    keys %ENV) ? 1 : 0 }
    method _build_using_cpanm            { (grep { /cpanm/i     }    keys %ENV) ? 1 : 0 }
    method _build_using_cpanm_customized { !! (grep { /cpanm_opt/i } keys %ENV) || 0    } # TIMTOWDI just for fun
    method _build_using_bash             { $self->shell ~~ 'bash' || 0 }
    method _build_using_zsh              { $self->shell ~~ 'zsh'  || 0 }
    method _build_using_ksh              { $self->shell ~~ 'ksh'  || 0 }
    method _build_using_tcsh             { $self->shell ~~ 'tcsh' || 0 }
    method _build_using_csh              { $self->shell ~~ 'csh'  || 0 }
    method _build_using_dzil             { (grep {/.dzil/} glob (dir($self->home_directory) . '/' . '.*')) ? 1 : 0 }

    method _build_pause_name {
        Config::Any->load_files( {
            files => [ file($self->home_directory, '.dzil', 'config.ini') ],
            flatten_to_hash => 1,
            use_ext => 1 }
        )->{file($self->home_directory, '.dzil', 'config.ini')}
         ->{'%PAUSE'}
         ->{'username'};
    }

lib/Acme/Schlong.pm  view on Meta::CPAN

        # directories_in_path
        # using_perlbrew
        # using_cpanm
        # using_cpanm_customized
        # using_bash
        # using_zsh
        # using_ksh
        # using_tcsh
        # using_csh
        
        # say for glob (dir($self->home_directory) . '/' . '.*');

        $self->add_size(10)  if $self->using_zsh;
        $self->add_size(100) if $self->using_multiplex;

        $self->add_size( 100 * $self->cores );

        $self->sub_size( 10 * $self->username_length );

        $self->abs_size
    }



( run in 0.353 second using v1.01-cache-2.11-cpan-94b05bcf43c )