示例#1
0
    def generate(self):
        """
        """
        Printer.log("generating %s documentation..." % self._sdk_name)

        sys.path.append(os.path.abspath(self._sdk_output))
        subprocess_environ = {"PYTHONPATH": ":".join(sys.path), "PATH": os.environ["PATH"]}

        self._install_system_vanilla()
        self._install_user_vanilla()

        writer = SDKDocWriter(monolithe_config=self.monolithe_config)
        writer.write()

        origin_path = os.getcwd()
        os.chdir(self._sdkdoc_tmp_path)
        process = subprocess.Popen(["make", "html"], env=subprocess_environ)
        process.communicate()
        os.chdir(origin_path)

        if os.path.exists(self._sdkdoc_output):
            shutil.rmtree(self._sdkdoc_output)

        shutil.copytree("%s/_build/html/" % self._sdkdoc_tmp_path, self._sdkdoc_output)

        self._cleanup()

        Printer.success("done")
示例#2
0
    def generate(self, specification_info):
        """
        """
        user_vanilla = self.monolithe_config.get_option("user_vanilla", "transformer")
        output = self.monolithe_config.get_option("output", "transformer")
        name = self.monolithe_config.get_option("name", "transformer")
        lang = self.monolithe_config.language

        if not os.path.exists(os.path.join(output, lang)):
            os.makedirs(os.path.join(output, lang))

        vanilla_manager = VanillaManager(monolithe_config=self.monolithe_config)
        vanilla_manager.execute(output_path="%s/%s" % (output, lang))

        self.install_user_vanilla(user_vanilla_path=user_vanilla, output_path="%s/%s" % (output, lang))

        version_generator = SDKAPIVersionGenerator(monolithe_config=self.monolithe_config)
        apiversions = []

        for info in specification_info:
            Printer.log("transforming specifications into %s for version %s..." % (lang, info["api"]["version"]))
            apiversions.append(info["api"]["version"])

        version_generator.generate(specification_info=specification_info)

        Printer.log("assembling...")
        manager = MainManager(monolithe_config=self.monolithe_config)
        manager.execute(apiversions=apiversions)

        cli_manager = CLIManager(monolithe_config=self.monolithe_config)
        cli_manager.execute()

        self.cleanup()
        Printer.success("%s generation complete and available in \"%s/%s\"" % (name, output, self.monolithe_config.language))
示例#3
0
    def addSuccess(self, test):
        """ Add success to the result
        """
        TestResult.addSuccess(self, test)
        self.tests[self.getDescription(test)] = {"status": "SUCCESS"}

        Printer.success("OK")
示例#4
0
    def generate(self):
        """
        """
        Printer.log("generating %s documentation..." % self._sdk_name)

        sys.path.append(os.path.abspath(self._sdk_output))
        subprocess_environ = {
            "PYTHONPATH": ":".join(sys.path),
            "PATH": os.environ["PATH"]
        }

        self._install_system_vanilla()
        self._install_user_vanilla()

        writer = SDKDocWriter(monolithe_config=self.monolithe_config)
        writer.write()

        origin_path = os.getcwd()
        os.chdir(self._sdkdoc_tmp_path)
        process = subprocess.Popen(["make", "html"], env=subprocess_environ)
        process.communicate()
        os.chdir(origin_path)

        if os.path.exists(self._sdkdoc_output):
            shutil.rmtree(self._sdkdoc_output)

        shutil.copytree("%s/_build/html/" % self._sdkdoc_tmp_path,
                        self._sdkdoc_output)

        self._cleanup()

        Printer.success("done")
示例#5
0
    def generate(self, specification_info):
        """
        """
        sdk_user_vanilla = self.monolithe_config.get_option("sdk_user_vanilla", "sdk")
        sdk_output = self.monolithe_config.get_option("sdk_output", "sdk")
        sdk_name = self.monolithe_config.get_option("sdk_name", "sdk")

        self.install_system_vanilla(current_file=__file__, output_path=sdk_output)
        self.install_user_vanilla(user_vanilla_path=sdk_user_vanilla, output_path=sdk_output)

        generator = SDKAPIVersionGenerator(monolithe_config=self.monolithe_config)
        apiversions = []

        for info in specification_info:
            apiversions.append(info["api"]["version"])

        generator.generate(specification_info=specification_info)

        Printer.log("assembling all packages...")
        sdk_writer = SDKWriter(monolithe_config=self.monolithe_config)
        sdk_writer.write(apiversions=apiversions)

        cli_writer = CLIWriter(monolithe_config=self.monolithe_config)
        cli_writer.write()

        self.cleanup()

        Printer.success("%s generation complete and available at \"%s\"" % (sdk_name, sdk_output))
示例#6
0
    def generate_documentation(self):
        """
        """
        name = self.monolithe_config.get_option("name", "transformer")
        output = self.monolithe_config.get_option("output", "transformer")
        doc_output = self.monolithe_config.get_option("doc_output", "transformer")

        input_path = os.path.join(output, self.monolithe_config.language, name)
        output_path = os.path.join(doc_output, self.monolithe_config.language)

        if self.monolithe_config.language == 'python':
            Printer.log("generating documentation...")
            os.system("pdoc --overwrite --html --html-dir '%s' '%s' >/dev/null 2>&1" % (output_path, input_path))
            Printer.success("%s documentation generation complete and available in \"%s\"" % (name, output_path))
        else:
            Printer.warn("no documentation generator for this language. ignoring")
示例#7
0
    def run(self, test):
        """ Run the given test case or test suite.
        """
        result = self._makeResult()
        startTime = time.time()
        test(result)
        stopTime = time.time()
        timeTaken = stopTime - startTime

        run = result.testsRun
        Printer.log("Ran %d test%s in %.3fs" % (run, run != 1 and "s" or "", timeTaken))

        if not result.wasSuccessful():
            Printer.warn("FAILED (failures=%i, errors=%i)" % (len(result.failures), len(result.errors)))
        else:
            Printer.success("OK")
        return result
    def generate(self, specification_info):
        """ Start generation ofthe API Documentation
        """
        apidoc_output = self.monolithe_config.get_option("apidoc_output", "apidoc")
        apidoc_user_vanilla = self.monolithe_config.get_option("apidoc_user_vanilla", "apidoc")
        sdk_name = self.monolithe_config.get_option("product_name")
        product_name = self.monolithe_config.get_option("product_name")

        writer = APIDocWriter(self.monolithe_config)
        apiversions = []

        for info in specification_info:

            vanilla_output_path = "%s/%s/%s" % (apidoc_output, sdk_name, info["api"]["version"])

            self.install_system_vanilla(current_file=__file__, output_path=vanilla_output_path)
            self.install_user_vanilla(user_vanilla_path=apidoc_user_vanilla, output_path=vanilla_output_path)

            Printer.log("generating %s api documentation for api version: %s" % (product_name, info["api"]["version"]))
            writer.write(specifications=info["specifications"], api_info=info["api"])

        Printer.success("%s api documentation generation complete and available at \"%s\"" % (product_name, apidoc_output))
示例#9
0
    def generate(self, specification_info):
        user_vanilla = self.config.get_option("user_vanilla", "transformer")
        output = self.config.get_option("output", "transformer")
        name = self.config.get_option("name", "transformer")
        lang = self.config.language

        if not os.path.exists(os.path.join(output, lang)):
            os.makedirs(os.path.join(output, lang))

        vanilla_manager = VanillaManager(monolithe_config=self.config)
        vanilla_manager.execute(output_path="%s/%s" % (output, lang))

        self.install_user_vanilla(user_vanilla_path=user_vanilla,
                                  output_path="%s/%s" % (output, lang))

        version_generator = SDKAPIVersionGenerator(self.config)
        apiversions = []

        for info in specification_info:
            Printer.log(
                "transforming specifications into %s for version %s..." %
                (lang, info["api"]["version"]))
            apiversions.append(info["api"]["version"])

        version_generator.generate(specification_info=specification_info)

        Printer.log("assembling...")
        manager = MainManager(monolithe_config=self.config)
        manager.execute(apiversions=apiversions)

        cli_manager = CLIManager(monolithe_config=self.config)
        cli_manager.execute()

        self.cleanup()
        Printer.success("%s generation complete and available in \"%s/%s\"" %
                        (name, output, self.config.language))