Example #1
0
File: main.py Project: raviu/so2py
    def __init__(self, settings, path):

        # Configuring the logging. This logging is used accross all the components
        logging.basicConfig(
            level=logging.DEBUG,
            format='%(asctime)s: %(levelname)s: %(message)s',
            filename='{0}/log/so2py.log'.format(
                os.path.dirname(os.path.realpath(__file__))),
            filemode='w',
        )

        # Setting the output console too
        ch = logging.StreamHandler(sys.stdout)
        ch.setLevel(logging.DEBUG)
        ch.setFormatter(
            color.ColoredFormatter('%(asctime)s: %(levelname)s: %(message)s'))
        logging.getLogger().addHandler(ch)

        print "Running Managment Tools v%s" % __version__

        if settings.repo_location == '' or settings.repo_location == None or settings.repo_location == '#UPDATE_REPO_LOCATION':
            self.repoloc_wizard()
            settings = reload(settings)

        sys.path.append(os.path.realpath(__file__) + '/modules/')
        self.context = {'path': path, 'success': True, 'settings': settings}
        self.path = path
        self.settings = settings
        self.repo_locationrepo_location = settings.repo_location
        self.context['repo_location'] = settings.repo_location

        try:
            self.run(settings.run_order)

            if 'changed_paths' in self.context:
                changed_paths = self.context['changed_paths']
                for path in changed_paths:
                    logging.info('change done @ {0}'.format(path))

            tree_dic = self.context['tree_dic']
            if tree_dic:
                print color.colorstr(
                    "| Associativity tree view of updated artifacts",
                    'DARK_BLUE')
                self.print_tree(self.context['component_artifact_id'],
                                tree_dic, ' ')

            if self.get_user_opinion() == 'n':
                self.revert_changes()
                logging.info(
                    'successfully reverted all the changes because user entered - n'
                )

            logging.info('management tool executed without any errors')
        except:
            self.revert_changes()
            raise
Example #2
0
File: main.py Project: raviu/so2py
    def __init__(self, settings, path):

	# Configuring the logging. This logging is used accross all the components
	logging.basicConfig(level=logging.DEBUG, format='%(asctime)s: %(levelname)s: %(message)s', filename ='{0}/log/so2py.log'.format(os.path.dirname(os.path.realpath(__file__))), filemode = 'w',)

	# Setting the output console too
	ch = logging.StreamHandler(sys.stdout)
	ch.setLevel(logging.DEBUG)
	ch.setFormatter(color.ColoredFormatter('%(asctime)s: %(levelname)s: %(message)s'))
	logging.getLogger().addHandler(ch)

        print "Running Managment Tools v%s" % __version__ 

        if settings.repo_location == '' or settings.repo_location == None or settings.repo_location == '#UPDATE_REPO_LOCATION':
            self.repoloc_wizard()
	    settings = reload(settings)
	
        sys.path.append(os.path.realpath(__file__)+'/modules/')
        self.context = {'path': path, 'success': True, 'settings': settings}
	self.path = path
	self.settings = settings
        self.repo_locationrepo_location = settings.repo_location
	self.context['repo_location'] = settings.repo_location

	try:
      		self.run(settings.run_order)
		
		if 'changed_paths' in self.context: 
			changed_paths = self.context['changed_paths'] 
			for path in changed_paths:
				logging.info('change done @ {0}'.format(path))

		tree_dic = self.context['tree_dic'] 
		if tree_dic: 
			print color.colorstr("| Associativity tree view of updated artifacts", 'DARK_BLUE')
			self.print_tree(self.context['component_artifact_id'], tree_dic, ' ')

		if self.get_user_opinion() == 'n':
			self.revert_changes()
			logging.info('successfully reverted all the changes because user entered - n')			

		logging.info('management tool executed without any errors')
	except:
		self.revert_changes()
		raise			
Example #3
0
File: main.py Project: raviu/so2py
    def print_tree(self, artifact_id, dic, padding):   

	    print color.colorstr(padding[:-1] + '+-' + artifact_id, 'BLUE') 

	    padding = padding + ' '
	    files = []

	    try:
		files = dic[artifact_id]
	    except:
		files = []	

	    count = 0
	    for file in files:
		count += 1
		print color.colorstr(padding + '|', 'BLUE')
		path = file
		if files:
		    if count == len(files):
		        self.print_tree(path, dic, padding + ' ')
		    else:
		        self.print_tree(path, dic, padding + '|')
		else:
		    print color.colorstr(padding + '+-' + file, 'BLUE')
Example #4
0
File: main.py Project: raviu/so2py
    def print_tree(self, artifact_id, dic, padding):

        print color.colorstr(padding[:-1] + '+-' + artifact_id, 'BLUE')

        padding = padding + ' '
        files = []

        try:
            files = dic[artifact_id]
        except:
            files = []

        count = 0
        for file in files:
            count += 1
            print color.colorstr(padding + '|', 'BLUE')
            path = file
            if files:
                if count == len(files):
                    self.print_tree(path, dic, padding + ' ')
                else:
                    self.print_tree(path, dic, padding + '|')
            else:
                print color.colorstr(padding + '+-' + file, 'BLUE')