示例#1
0
                                                                                       field=field)
            controller_fields += controller_field.format(field=field)

        # Generate files with the new fields
        module_dir = os.path.join('app', resources)
        angular_dir = os.path.join('angularjs-frontend', resources)

        try:
            os.mkdir(module_dir)
            try:
                os.makedirs(angular_dir)
                generate_files(module_dir, angular_dir)
                print('{} created successfully'.format(module_dir))
                register_blueprints()
                # Update routes in app.js
                replace_string(
                    resource, resources, app_js_file, "// States", new_route_string)

                # Add js files to index.html
                replace_string(
                    resource, resources, main_index_file, "<!-- Controllers -->", js_src_string)

                # Add menus to the main index.html
                replace_string(
                    resource, resources, main_index_file, "<!-- menu -->", menu_string)

                # Add tests to test.bash
                replace_string(
                    resource, resources, test_script, "#TESTS", test_script_string)

                run_autopep8()
            except:
示例#2
0
            # controller.js

        # Generate files with the new fields
        module_dir = os.path.join('app', resources)
        angular_dir = os.path.join('app/templates/', resources)

        try:
            os.mkdir(module_dir)
            try:
                os.makedirs(angular_dir)
                generate_files(module_dir, angular_dir)
                print('{} created successfully'.format(module_dir))
                register_blueprints()
                # Update routes in app.js
                replace_string(resource, resources, app_js_file, "// States",
                               new_route_string)

                # Add js files to index.html
                replace_string(resource, resources, main_index_file,
                               "<!-- Controllers -->", js_src_string)

                # Add menus to the main index.html
                replace_string(resource, resources, main_index_file,
                               "<!-- menu -->", menu_string)

                # Add tests to test.bash
                replace_string(resource, resources, test_script, "#TESTS",
                               test_script_string)

                # Add tests to conf.js
                replace_string(resource, resources, conf_js_file, "//Specs",