예제 #1
0
    def __init__(self):
        """Initialization method for the Initialize Object."""
        print PPHeader(header="INITIALIZING JENKINS REPORT VIEWER",
                       buffer=True)

        # Create the .jrb directory in the user's home directory
        DirectoryUtilities.safe_create_dir(JRB_ROOT_DIR)
        DirectoryUtilities.safe_create_dir(JRB_LOG_DIR)
        DirectoryUtilities.safe_create_dir(JRB_CONFIG_DIR)

        with open(
                os.path.join('jenkins_report_builder', 'configuration',
                             'default_engine_config.config'), 'r') as dec:
            engine_config_data = dec.read().format(
                default_results_path=os.path.join(JRB_ROOT_DIR, 'results'))

        # Create the JRB Engine configuration file
        FileUtilities.safe_config_create(JRB_ROOT_DIR, JRB_ENGINE_CONFIG_NAME,
                                         engine_config_data)

        with open(
                os.path.join('jenkins_report_builder', 'configuration',
                             'sample_config.config'), 'r') as dec:
            sample_config_data = dec.read().format(
                default_results_path=JRB_ROOT_DIR)

        # Create the JRB Engine configuration file
        FileUtilities.safe_config_create(JRB_CONFIG_DIR, 'sample.config',
                                         sample_config_data)

        print PPFooter(buffer=True)
예제 #2
0
    def __init__(self, msg, *args, **kwargs):
        """
        Initialization method for Configuration Exceptions.

        :param msg: Mesage desired to output to terminal on exception.
        :type msg: String
        """
        print PPHeader(header="WARNING", buffer=True)
        print "The Jenkins-Report-Builder has not been initialized properly."
        print "Please run 'Jenkins-Report-Builder init'"
        print "{0}{1}".format('\t', msg)
        print PPFooter(buffer=True)
        Exception.__init__(self, msg, *args, **kwargs)
예제 #3
0
파일: config.py 프로젝트: ananci/jrb
 def get_configs(cls):
     """Get a list of available configs."""
     if not any(x.endswith('.config') for x in os.listdir(JRB_CONFIG_DIR)):
         raise custom_exceptions.ConfigurationException(
             msg=('Unable to find any config files at {0}\n').format(
                 JRB_CONFIG_DIR))
     print PPHeader(header='AVAILABVLE CONFIGS')
     configs = [os.path.splitext(x)[0] for x in os.listdir(
         JRB_CONFIG_DIR) if x.endswith('.config')]
     sorted(configs)
     for config in configs:
         print '\t{}'.format(config)
     print PPFooter()
예제 #4
0
    def __init__(self, msg, *args, **kwargs):
        """
        Initialization method for Configuration Exceptions.

        :param msg: Mesage desired to output to terminal on exception.
        :type msg: String
        """
        print PPHeader(header="WARNING", buffer=True)
        print 'The Jenkins-Report-Builder has not been configured properly.'
        print(
            'Please review the README to create appropriate configuration '
            'files.')
        print '{0}{1}'.format('\t', msg)
        print PPFooter(buffer=True)
        Exception.__init__(self, msg, *args, **kwargs)
예제 #5
0
    def __init__(self, msg, *args, **kwargs):
        """
        Initialization method for Safe Configuration Exceptions.

        :param msg: Mesage desired to output to terminal on exception.
        :type msg: String
        """
        print PPHeader(header="WARNING", buffer=True)
        print(
            'There was an issue when attempting to manipulate a '
            'configuration file.')
        print(
            'Please check the location and manually adjust the '
            'configuration as desired.')
        print "{0}{1}".format('\t', msg)
        print PPFooter(buffer=True)
        Exception.__init__(self, msg, *args, **kwargs)
예제 #6
0
 def test_PPFooter_footer_list_if_buffer_set(self):
     """Check that the footers list is as expected if buffer is True."""
     h = PPFooter(buffer=True).footer_list
     self.assertTrue(len(h) == 3)