Class: CmdAdd

Inherits:
Rumodule show all
Defined in:
bin/rumodule

Overview

Add command.

Direct Known Subclasses

CmdSadd

Constant Summary

Constant Summary

Constants included from Utility

Utility::LOADED, Utility::MODULEDIRS, Utility::RUMODULE_PUSH, Utility::SUBLOADED, Utility::SYSLOADED

Constants inherited from RumoduleCommon

RumoduleCommon::SHELL

Instance Method Summary (collapse)

Methods inherited from Rumodule

#_is_loaded, #_output, flush, #getenvar, run

Methods included from Utility

#abort, #all_loaded, #commonHelp, #error, #findModule, #help, #loadModule, #loaded, #registerModule, #sys_loaded, #unregisterModule, #usage, #warning

Methods included from RumoduleMod

#home

Instance Method Details

- (Object) action(mods, list = :normal)

Add modules if not loaded yet.



826
827
828
829
830
831
832
833
834
835
836
837
838
# File 'bin/rumodule', line 826

def action( mods, list = :normal )
    mods.each do |mod|
        mod_path = findModule( mod )
        if mod_path == nil
            error "Unknown module: \"#{mod}\"..."
        elsif !_is_loaded( mod_path )
            loaded_mod = loadModule( mod_path )
            registerModule( loaded_mod, list )
        else
            warning( "Module is already loaded: \"#{mod_path}\"..." )
        end
    end
end

- (Object) add(mod)



901
902
903
# File 'bin/rumodule', line 901

def add( mod )
    action( [ mod ], :sub )
end

- (Object) append_path(var, value)



857
858
859
# File 'bin/rumodule', line 857

def append_path( var, value )
    getenvar( var, true ).append_path( value )
end

- (Object) conflict(mod)



889
890
891
892
893
# File 'bin/rumodule', line 889

def conflict( mod )
    if is_loaded( mod )
        usage "Conflicting module loaded: #{mod}"
    end
end

- (Object) is_loaded(mod)



896
897
898
# File 'bin/rumodule', line 896

def is_loaded( mod )
    _is_loaded( findModule( mod ) )
end

- (Object) prepend_path(var, value)



862
863
864
# File 'bin/rumodule', line 862

def prepend_path( var, value )
    getenvar( var, true ).prepend_path( value )
end

- (Object) prereq(mod)



882
883
884
885
886
# File 'bin/rumodule', line 882

def prereq( mod )
    unless is_loaded( mod )
        usage "Prerequisite module not loaded: #{mod}"
    end
end

- (Object) pushenv(var, value)



872
873
874
875
876
877
878
879
# File 'bin/rumodule', line 872

def pushenv( var, value )
    # Store old value if it exists.
    bup = "#{RUMODULE_PUSH}_#{var}"
    if EnvVar.exist?( var )
        getenvar( bup, true ).prepend_path( ENV[var] )
    end
    getenvar( var, true ).set( value )
end

- (Object) remove_path(var, value)



867
868
869
# File 'bin/rumodule', line 867

def remove_path( var, value )
    getenvar( var, true ).remove_path( value )
end

- (Object) setenv(var, value)



845
846
847
# File 'bin/rumodule', line 845

def setenv( var, value )
    getenvar( var, true ).set( value )
end

- (Object) unsetenv(var, value = nil)



850
851
852
853
854
# File 'bin/rumodule', line 850

def unsetenv( var, value = nil )
    if v = getenvar( var )
        v.unset
    end
end