def create_talker_listener_classes(project_name, template_directory, author):
    path = os.path.join(os.getcwd(), project_name.lower())
    package_name = os.path.basename(os.getcwd())
    java_package_path = os.path.join(path, 'src', 'main', 'java', 'com', 'github', package_name, project_name)
    utils.mkdir_p(java_package_path)
    try:
        for template_name in ['Talker.java', 'Listener.java']:
            filename = os.path.join(java_package_path, template_name)
            template = utils.read_template_file(template_directory, template_name)
            contents = instantiate_code_template(template, package_name, project_name, author)
            try:
                f = open(filename, 'w')
                f.write(contents)
                console.pretty_print('  File      : ', console.cyan)
                console.pretty_println(template_name, console.yellow)
            finally:
                f.close()
    except Exception:
        raise
Esempio n. 2
0
def create_talker_listener_classes(project_name, template_directory, author):
    path = os.path.join(os.getcwd(), project_name.lower())
    package_name = os.path.basename(os.getcwd())
    java_package_path = os.path.join(path, 'src', 'main', 'java', 'com', 'github', package_name, project_name)
    utils.mkdir_p(java_package_path)
    try:
        for template_name in ['Talker.java', 'Listener.java']:
            filename = os.path.join(java_package_path, template_name)
            template = utils.read_template_file(template_directory, template_name)
            contents = instantiate_code_template(template, package_name, project_name, author)
            try:
                f = open(filename, 'w')
                f.write(contents)
                console.pretty_print('  File      : ', console.cyan)
                console.pretty_println(template_name, console.yellow)
            finally:
                f.close()
    except Exception:
        raise
def create_gradle_package_files(args, template_directory):
    '''
      This is almost a direct copy from catkin_create_pkg.
    '''
    try:
        project_name = args.name[0].lower()
        package_path = os.path.abspath(os.path.join(os.getcwd(), project_name))
        for template_name in ['build.gradle']:  # 'CMakeLists.txt']:
            filename = os.path.join(package_path, template_name)
            template = utils.read_template_file(template_directory, template_name)
            contents = instantiate_template(template, project_name, args.author)
            try:
                f = open(filename, 'w')
                f.write(contents)
                console.pretty_print('  File      : ', console.cyan)
                console.pretty_println(template_name, console.yellow)
            finally:
                f.close()
    except Exception:
        raise
Esempio n. 4
0
def create_gradle_package_files(args, template_directory):
    '''
      This is almost a direct copy from catkin_create_pkg.
    '''
    try:
        project_name = args.name[0].lower()
        package_path = os.path.abspath(os.path.join(os.getcwd(), project_name))
        for template_name in ['build.gradle']:  # 'CMakeLists.txt']:
            filename = os.path.join(package_path, template_name)
            template = utils.read_template_file(template_directory, template_name)
            contents = instantiate_template(template, project_name, args.author)
            try:
                f = open(filename, 'w')
                f.write(contents)
                console.pretty_print('  File      : ', console.cyan)
                console.pretty_println(template_name, console.yellow)
            finally:
                f.close()
    except Exception:
        raise