Exemplo n.º 1
0
 def work(self, *parameters):
     ''' ADVANCED Save and process pending changes.'''
     parser = argparse.ArgumentParser(description=self.work.__doc__,
                                      prog="bii work")
     parser.parse_args(*parameters)  # To enable -h
     client_hive_manager = ClientHiveManager(self.bii)
     client_hive_manager.work()
     self.bii.user_io.out.write('Work done!\n')
Exemplo n.º 2
0
 def _configure(self, force, generator, toolchain, parameters):
     paths_to_add = self.prepare_build_path()
     cmds_to_remove = self.prepare_configure_cmds(generator)
     with CustomEnvPath(paths_to_add=paths_to_add, cmds_to_remove=cmds_to_remove):
         client_hive_manager = ClientHiveManager(self.bii)
         client_hive_manager.work()
         base = self.target_processor(client_hive_manager)
         block_targets = base.targets()
         cmake = self.cmake(self.bii)
         cmake.configure(block_targets, force, generator, toolchain, parameters)
Exemplo n.º 3
0
 def update(self, *parameters):
     ''' EXPERIMENTAL update an outdated block
     If one of your block is outdated, because you have published from another project or
     computer, you cannot publish again.
     If you want to discard your current changes, just close-open the block.
     If you have made changes in your block that you dont want to lose, and you want also the
     last changes in the server, you can use this command.
     If you want just to override the last published version, you can always point your
     parents.bii to the last published version.
     '''
     block, time = _BiiArgParser.get_update_params(*parameters)
     manager = ClientHiveManager(self.bii)
     manager.update(block, time)
Exemplo n.º 4
0
    def clean(self, *parameters):
        """ cleans project database, temporal and build files """
        parser = argparse.ArgumentParser(description=BiiCommand.clean.__doc__,
                                         prog="bii clean")
        parser.add_argument("--cache", default=False,
                            action='store_true',
                            help='Delete user cache.')

        args = parser.parse_args(*parameters)
        client_hive_manager = ClientHiveManager(self.bii)
        client_hive_manager.clean()
        if args.cache:
            self.bii.user_cache.localdb.clean()
Exemplo n.º 5
0
    def publish(self, *parameters):
        ''' publish one or all the blocks of the current project'''
        publish_args = _BiiArgParser.get_publish_params(*parameters)
        block_name, tag, versiontag, msg, publish_all, origin = publish_args
        if block_name and publish_all:
            raise BiiException('Do not specify block name with --all option')
        if publish_all and origin:
            raise BiiException('Do not specify --all with --remote option')

        if origin and origin.url is None:  # Entered empty -r option
            origin = self._auto_detect_origin_info(origin, block_name)

        hive_manager = ClientHiveManager(self.bii)
        hive_manager.publish(block_name, tag, msg, versiontag, publish_all, origin)
Exemplo n.º 6
0
 def open(self, *parameters):
     ''' it allows you to edit any existing block'''
     parser = argparse.ArgumentParser(description=BiiCommand.open.__doc__, prog="bii open")
     help_msg = ('Block name. eg: bii open my_user/my_block, '
                 'or block version. E.g: bii open "my_user/my_block(user/branch): 7"')
     parser.add_argument("block", help=help_msg)
     args = parser.parse_args(*parameters)  # To enable -h
     try:
         brl_block, time, version_tag = parse_block_version_expression(args.block)
     except:
         raise BiiException("Bad parameter: %s" % help_msg)
     # user has specified track or not
     track = brl_block.owner_branch if '(' in args.block else None
     manager = ClientHiveManager(self.bii)
     manager.open(brl_block.block_name, track, time, version_tag)
Exemplo n.º 7
0
    def close(self, *parameters):
        """ close a block under edition.
        If it's a dependency, moves it to dependencies folder
        """
        parser = argparse.ArgumentParser(description=self.close.__doc__, prog="bii close")
        parser.add_argument("block", type=block_name,
                            help='Block to close USER_NAME/BLOCK_NAME, '
                                 'e.g.: my_user/my_block')
        parser.add_argument("--force", default=False,
                            action='store_true',
                            help='Closes the block even if it has unpublished changes')

        args = parser.parse_args(*parameters)  # To enable -h
        manager = ClientHiveManager(self.bii)
        manager.close(args.block, args.force)
Exemplo n.º 8
0
    def new(self, *parameters):
        """ wizard to create new block folder and, optionally, a Hello World"""
        parser = argparse.ArgumentParser(description=BiiCommand.init.__doc__, prog="bii new")
        parser.add_argument("block_name", default=False, nargs='?',
                            help='Block Name USER_NAME/BLOCK_NAME, '
                            'e.g.: my_user/my_block',
                            type=block_name)

        parser.add_argument("--hello", default=None, type=str, nargs=1,
                            help='Creates a "Hello World" main. You need to specify the language '
                            'in which the main file will be created, e.g.: --hello cpp')
        args = parser.parse_args(*parameters)  # To enable -h
        if not (args.block_name or args.hello):
            parser.error('No action requested, add block_name or --hello')
        manager = ClientHiveManager(self.bii)
        manager.new(args.block_name, args.hello)
Exemplo n.º 9
0
 def monitor(self, *parameters):
     '''Open serial monitor
     This is a small utility to send and receive text messages over the serial port'''
     parser = argparse.ArgumentParser(description=self.monitor.__doc__,
                                      prog="bii %s:monitor" % self.group)
     parser.parse_args(*parameters)
     try:
         port = self.arduino.refresh_port()
         monitor(self, ClientHiveManager(self.bii), port)
     except Exception as e:
         raise BiiException('Cannot open serial monitor: %s' % str(e))
Exemplo n.º 10
0
 def diff(self, *parameters):
     ''' compare files and show differences.
     You can compare your current project with previous published versions or compare between
     published versions.
     '''
     parser = argparse.ArgumentParser(description=BiiCommand.diff.__doc__, prog="bii diff")
     parser.add_argument("block_name", help='Block Name USER_NAME/BLOCK_NAME, '
                                            'e.g.: my_user/my_block',
                         type=block_name, nargs='?')
     parser.add_argument("v1", help='Child block version',
                         type=int, default=None, nargs='?')
     parser.add_argument("v2", help='Parent block version',
                         type=int, default=None, nargs='?')
     parser.add_argument("--short", default=False,
                         action='store_true',
                         help='View the basic information about your block/s status')
     # TODO: Remote option is not possible while sync manager is out of service
     args = parser.parse_args(*parameters)  # To enable -h
     manager = ClientHiveManager(self.bii)
     manager.diff(args.block_name, args.v1, args.v2, args.short)
Exemplo n.º 11
0
 def find(self, *parameters):
     ''' looks in server for unresolved dependencies'''
     find_args = _BiiArgParser.get_find_params(*parameters)
     find_args = vars(find_args)
     manager = ClientHiveManager(self.bii)
     manager.find(**find_args)
Exemplo n.º 12
0
 def deps(self, *parameters):
     """ show information about current project dependencies.
     """
     args = _BiiArgParser.get_deps_params(*parameters)
     manager = ClientHiveManager(self.bii)
     manager.deps(args.block_name, args.details, args.files)