Esempio n. 1
0
 def setUp(self):
     LOG.set_none()
     self.stale_plugins = Mock()
     self.stale_plugins.expect_get_bundled_plugins_module(toReturn=['bundled_plugins'])
     self.stale_plugins.default_find_plugins_to_recompile([])
     self.module = Run(self.stale_plugins)
     self.module._Run__build_tomcat_layout = lambda args: None
Esempio n. 2
0
 def call(self):
     super().__call__(LOG)
     for line in self.output:
         if self.returncode:
             if line: LOG.error(line)
         else:
             if line: LOG.trace(line)
     return self.output
Esempio n. 3
0
 def setUp(self):
     LOG.set_none()
     self.layout = MockLayout(True)
     self.horde_layout = HordeLayout(self.layout.jira_home())
     self.args = Mock()
     self.args.layout = self.layout
     self.args.horde_layout = self.horde_layout
     self.args.with_workspace = False
     self.args.mvn_clean = False
     self.horde_status_checker = MockStatusChecker()
Esempio n. 4
0
    def dispatch_from_params(self, argv):
        main_help = 'jmake is a primary tool for JIRA devs.'

        parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter)
        self.__register_submodules(parser, MainModule(parser).get_submodules())
        self.__discover_help(main_help, parser)

        if argv[1:]:
            args = parser.parse_args(
                [arg for arg in argv[1:] if arg != 'clean' or argv[1] == arg or argv[1] == 'auto-complete'])

            args.mvn_clean = 'clean' in argv[2:]
            if args.func.check_branch and not 'JMAKE_DRY' in os.environ:
                git_branch = GitBranchDiscovery()
                self.executor.append(git_branch)
                if not args.mvn_clean:
                    self.executor.append(BranchInconsistencyCheck(git_branch))
                self.executor.append_post(BranchInconsistencyMarker(git_branch))

            try:
                args.func(args, self.executor)
            except Exception as e:
                self.executor.commands = [ lambda logger : logger.error('Exception occurred during preparing executor: %s' % str(e)) or Callable.success]
                self.executor.post_commands = []
                traceback.print_exc()
                return self.executor.execute()

            if args.log_level:
                try:
                    getattr(LOG, 'set_' + args.log_level)()
                except AttributeError:
                    LOG.error('Cannot set log level to %s' % args.log_level)
                    return Callable.failure

            if args.silent: args.func.prevent_post_commands = True
            if not args.func.prevent_post_commands:
                timer = ExecutionTimeCallable()
                self.executor.append_post(timer)
                if os.getenv('JMAKE_STFU') is None:
                    self.executor.append_post(Notifier(timer))
            if args.func.prevent_console_reset:
                self.executor.perform_console_reset = False
            if not args.func.prevent_post_diagnostics:
                self.__append_post_diagnostics()
        else:
            parser.print_help()
            self.__append_post_diagnostics()

        return self.executor.execute()
Esempio n. 5
0
    def add_plugins_maven_goals(self, args, maven):
        profiles_for_plugins = self.add_devmode_plugins(args, maven)

        if not args.bundled_plugins:
            maven.property('jira.exclude.bundled.plugins')

        if args.mvn_clean:
            LOG.info('Clean parameter present recompiling bundled plugins')
            modules_to_build = self.stale_plugins.get_bundled_plugins_module()
        else:
            modules_to_build = self.stale_plugins.find_plugins_to_recompile(profiles_for_plugins)

        for module in modules_to_build:
            maven.project(module)

        if len(modules_to_build) == 0:
            LOG.info('Bundled plugins up to date skipping compilation')
 def setUpClass(cls):
     LOG.set_none()
 def log(self, msg):
     LOG.info(msg)
Esempio n. 8
0
#!/usr/bin/env python3
import sys
from CommandDispatcher import CommandDispatcher
from CommandExecutor import CommandExecutor
from Logger import LOG


dispatcher = CommandDispatcher(CommandExecutor().set_logger(LOG.set_debug()))
sys.exit(dispatcher.dispatch_from_params(sys.argv))






 def setUp(self):
     self.layout = MockLayout(False)
     LOG.set_none()