Class: Rumodule
- Inherits:
-
RumoduleCommon
- Object
- RumoduleCommon
- Rumodule
- Includes:
- Utility
- Defined in:
- bin/rumodule
Overview
Prefined Rumodule commands.
Constant Summary
- @@outputlist =
List of output command lines to shell. Must be separeted with semicolon and newline.
[]
- @@varcache =
Cache variables from env to Hash. All updated values are visible to subsequent commands.
{}
Constants included from Utility
Utility::LOADED, Utility::MODULEDIRS, Utility::RUMODULE_PUSH, Utility::SUBLOADED, Utility::SYSLOADED
Constants inherited from RumoduleCommon
Class Method Summary (collapse)
-
+ (Object) flush
Flush all pending shell output.
-
+ (Object) run(cmd, mods)
Map rumodule cmd to internal class method.
Instance Method Summary (collapse)
-
- (Boolean) _is_loaded(mod)
Is module(s) loaded?.
-
- (Object) _output(str)
Place str to output buffer (shell output).
-
- (String) getenvar(var, create = false)
Fetch env varible from env.
Methods included from Utility
#abort, #all_loaded, #commonHelp, #error, #findModule, #help, #loadModule, #loaded, #registerModule, #sys_loaded, #unregisterModule, #usage, #warning
Methods included from RumoduleMod
Class Method Details
+ (Object) flush
Flush all pending shell output.
729 730 731 732 733 734 735 736 737 738 739 740 741 742 |
# File 'bin/rumodule', line 729 def Rumodule.flush # Check for changed env varibles and perform update. @@varcache.values.each do |v| if v.dirty @@outputlist.push v.export end end # Output updates. if @@outputlist.length > 0 puts @@outputlist.join( ";\n" ) end end |
+ (Object) run(cmd, mods)
Map rumodule cmd to internal class method.
641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 |
# File 'bin/rumodule', line 641 def Rumodule.run( cmd, mods ) # Internal class name. cmdClass = "Cmd#{cmd.capitalize}" if Module.const_defined?( cmdClass ) # Create instance of the class. obj = Object::const_get( cmdClass ).new # Execute rumodule method. obj.action( mods ) else error "Unknown command: \"#{cmd}\"!" end end |
Instance Method Details
- (Boolean) _is_loaded(mod)
Is module(s) loaded?
707 708 709 710 711 712 713 714 715 716 717 |
# File 'bin/rumodule', line 707 def _is_loaded( mod ) mod = [ mod ] if mod.class != Array mod.each do |i| if all_loaded.index( i ) return true end end false end |
- (Object) _output(str)
Place str to output buffer (shell output).
723 724 725 |
# File 'bin/rumodule', line 723 def _output( str ) @@outputlist.push str end |
- (String) getenvar(var, create = false)
Fetch env varible from env. Conditionally create the env var.
676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 |
# File 'bin/rumodule', line 676 def getenvar( var, create = false ) if @@varcache[ var ] # In cache. @@varcache[ var ] else # Not in cache. if ENV[ var ] # In env. v = EnvVar.new( var ) @@varcache[ var ] = v elsif create # Create as new. v = EnvVar.new( var, [] ) @@varcache[ var ] = v else nil end end end |