예제 #1
0
파일: pyaml.py 프로젝트: bluemoon/shovel
 def __init__(self):
     self.commands = []
     self._os = os.uname()
     self.deps = dependencies()
     self.config = configurator()
     self.features = features()
     self.gen = yamlGenerators()
예제 #2
0
파일: utils.py 프로젝트: bluemoon/shovel
def pprint(string, label, color=None, labelColor=None):
    """ a pretty print that prints with padding and right aligned text """
    config = configurator()
    ##
    ## If the user doesnt pass --np
    if config.GetGlobal('nonpretty') != True:
        padChar     = ' '
        endPadLen   = 2
        labelMsgLen = 0
        
        ## Nast way of getting the terminal column length
        sPack = struct.pack("HHHH", 0, 0, 0, 0)
        fdOut = sys.stdout.fileno()
        fcN = fcntl.ioctl(fdOut, termios.TIOCGWINSZ, sPack)
        uPack = struct.unpack("HHHH", fcN)
        
        ## this is the row length
        rowLen = uPack[1]
        
        ## re-assign the totalLen
        totalLen = rowLen
        
        if label:
            ## gets the label length and appends 2 for the brackets
            labelMsgLen = len(label.splitlines()[0]) + 2
        
        ## gets the string length
        stringLen = len(string.splitlines()[0])
        ## builds a pad string
        padding = padChar * (totalLen - (stringLen + labelMsgLen + endPadLen))
        endPad  = padChar * endPadLen

        ## only label coloring			 
        if labelColor and not color:
            sys.stdout.write("%s%s[%s%s%s]%s\n" %
            (string, padding, colorList[labelColor.upper()], label, 
            colorList['NORMAL'], endPad))	
        
        ## if we have color
        if color:
            sys.stdout.write("%s%s%s%s[%s%s%s]%s\n" %
            (colorList[color.upper()], string, colorList['NORMAL'], padding,
            colorList[labelColor.upper()], label, colorList['NORMAL'], endPad))

        
        ## no coloring
        #else:
        #    sys.stdout.write("%s%s[%s]%s\n" % (string, padding, label, endPad)) 

    ## if nonpretty is True
    else:
        str = "%s [%s]" % (string, label)
        print str
        return str
예제 #3
0
파일: debug.py 프로젝트: bluemoon/shovel
def debug(string, level=DEBUG):
    ''' the debug method, a printer for debugging with verbosity control'''
    config = configurator()
    ## Get the frames so we know who's calling us from what line
    current = inspect.currentframe(0)
    # print inspect.getframeinfo(current)
    # print inspect.stack(current)
    outer   = inspect.getouterframes(current)
    
    ## get the debug level from our global class
    dLevel = int(config.getGlobal('debug'))
    ## Keep a marker so we dont print the same thing more than once
    hasPrinted = False
    
    if dLevel > NONE:
        if dLevel >= level and not hasPrinted:
            hasPrinted = True
            _dPrint(level, string, outer)

    ## we must explicitly delete the frame inspector or it will cause 
    ## unnecessary garbage
    del current    
예제 #4
0
파일: recipe.py 프로젝트: bluemoon/shovel
 def __init__(self):
     self.runFunction = 'run'
     self.config = configurator()
예제 #5
0
 def setUp(self):
     sys.path.append('../')
     from core.configurator import configurator
     self.Config = configurator()
예제 #6
0
 def test_8_ConfiguratorGlobalConfig(self):
     sys.path.append('../core/')
     from core.configurator import configurator
     Config = configurator()
     Config.putConfig('p1', True)
     assert self.Config.getConfig('p1') == True
예제 #7
0
 def test_6_ConfiguratorGlobalFeature(self):
     sys.path.append('../core/')
     from core.configurator import configurator
     Config = configurator()
     Config.putFeature('c1')
     assert self.Config.getFeature('c1') == True
예제 #8
0
 def test_5_ConfiguratorGlobalInstances(self):
     sys.path.append('../Core/')
     from core.configurator import configurator
     Config = configurator()
     Config.putGlobal('c1', True)
     assert self.Config.getGlobal('c1') == True
예제 #9
0
파일: plugin.py 프로젝트: bluemoon/shovel
 def __init__(self):
     """dostring for __init__"""
     self.splitString = '.'
     self.config = configurator()
예제 #10
0
파일: patcher.py 프로젝트: bluemoon/shovel
	def __init__(self):
		self.Config = configurator()
예제 #11
0
파일: shovel.py 프로젝트: bluemoon/shovel
 def __init__(self):
     self.config   = configurator()
     self.plugins  = plugin()
     self.yml      = nyaml()