コード例 #1
0
ファイル: targets_help.py プロジェクト: jduan/pants
    def details(self, sym):
        """Show details of one symbol.

    :param sym: string like 'java_library' or 'artifact'."""
        d = assemble_buildsyms(build_file_parser=self.context.build_file_parser)
        if not sym in d:
            return ["\nNo such symbol: {0}\n".format(sym)]
        template = resource_string(__name__, os.path.join(self._templates_dir, "cli_details.mustache"))
        spacey_render = pystache.render(template, d[sym]["defn"])
        compact_render = re.sub("\n\n+", "\n\n", spacey_render)
        return compact_render.splitlines()
コード例 #2
0
ファイル: targets_help.py プロジェクト: jduan/pants
 def list_all(self):
     d = assemble_buildsyms(build_file_parser=self.context.build_file_parser)
     max_sym_len = max(len(sym) for sym in d.keys())
     console = []
     blurb_template = resource_string(__name__, os.path.join(self._templates_dir, "cli_list_blurb.mustache"))
     for sym, data in sorted(d.items(), key=lambda (k, v): k.lower()):
         blurb = pystache.render(blurb_template, data)
         summary = re.sub("\s+", " ", blurb).strip()
         if len(summary) > 50:
             summary = summary[:47].strip() + "..."
         console.append("{0}: {1}".format(sym.rjust(max_sym_len), summary))
     return console
コード例 #3
0
ファイル: targets_help.py プロジェクト: youprofit/pants
    def details(self, sym):
        '''Show details of one symbol.

    :param sym: string like 'java_library' or 'artifact'.'''
        d = assemble_buildsyms(
            build_file_parser=self.context.build_file_parser)
        if not sym in d:
            return ['\nNo such symbol: {0}\n'.format(sym)]
        template = resource_string(
            __name__, os.path.join(self._templates_dir,
                                   'cli_details.mustache'))
        spacey_render = pystache.render(template, d[sym]['defn'])
        compact_render = re.sub('\n\n+', '\n\n', spacey_render)
        return compact_render.splitlines()
コード例 #4
0
ファイル: targets_help.py プロジェクト: youprofit/pants
 def list_all(self):
     d = assemble_buildsyms(
         build_file_parser=self.context.build_file_parser)
     max_sym_len = max(len(sym) for sym in d.keys())
     console = []
     blurb_template = resource_string(
         __name__,
         os.path.join(self._templates_dir, 'cli_list_blurb.mustache'))
     for sym, data in sorted(d.items(), key=lambda (k, v): k.lower()):
         blurb = pystache.render(blurb_template, data)
         summary = re.sub('\s+', ' ', blurb).strip()
         if len(summary) > 50:
             summary = summary[:47].strip() + '...'
         console.append('{0}: {1}'.format(sym.rjust(max_sym_len), summary))
     return console
コード例 #5
0
ファイル: builddictionary.py プロジェクト: Gabriel439/pants
    def _gen_build_dictionary(self):
        """Generate the BUILD dictionary reference rst doc."""
        d = assemble_buildsyms(build_file_parser=self.context.build_file_parser)
        tocs = [tocl(d), jvm_sub_tocl(d), python_sub_tocl(d)]

        defns = [d[t]["defn"] for t in sorted(d.keys(), key=_lower)]
        # generate rst
        template = resource_string(__name__, os.path.join(self._templates_dir, "page.mustache"))
        filename = os.path.join(self._outdir, "build_dictionary.rst")
        self.context.log.info("Generating {}".format(filename))
        with safe_open(filename, "wb") as outfile:
            generator = Generator(template, tocs=tocs, defns=defns)
            generator.write(outfile)
        # generate html
        template = resource_string(__name__, os.path.join(self._templates_dir, "bdict_html.mustache"))
        filename = os.path.join(self._outdir, "build_dictionary.html")
        self.context.log.info("Generating {}".format(filename))
        with safe_open(filename, "wb") as outfile:
            generator = Generator(template, tocs=tocs, defns=defns)
            generator.write(outfile)
コード例 #6
0
ファイル: builddictionary.py プロジェクト: youprofit/pants
    def _gen_build_dictionary(self):
        """Generate the BUILD dictionary reference rst doc."""
        d = assemble_buildsyms(
            build_file_parser=self.context.build_file_parser)
        tocs = [tocl(d), jvm_sub_tocl(d), python_sub_tocl(d)]

        defns = [d[t]['defn'] for t in sorted(d.keys(), key=_lower)]
        # generate rst
        template = resource_string(
            __name__, os.path.join(self._templates_dir, 'page.mustache'))
        filename = os.path.join(self._outdir, 'build_dictionary.rst')
        self.context.log.info('Generating {}'.format(filename))
        with safe_open(filename, 'wb') as outfile:
            generator = Generator(template, tocs=tocs, defns=defns)
            generator.write(outfile)
        # generate html
        template = resource_string(
            __name__, os.path.join(self._templates_dir, 'bdict_html.mustache'))
        filename = os.path.join(self._outdir, 'build_dictionary.html')
        self.context.log.info('Generating {}'.format(filename))
        with safe_open(filename, 'wb') as outfile:
            generator = Generator(template, tocs=tocs, defns=defns)
            generator.write(outfile)
コード例 #7
0
 def setUp(self):
     super(ExtractedContentSanityTests, self).setUp()
     self._syms = reflect.assemble_buildsyms(
         build_file_parser=self.build_file_parser)
コード例 #8
0
ファイル: test_reflect.py プロジェクト: simudream/pants
 def setUp(self):
   super(BuildsymsSanityTests, self).setUp()
   self._syms = reflect.assemble_buildsyms(build_file_parser=self.build_file_parser)
コード例 #9
0
ファイル: test_reflect.py プロジェクト: youprofit/pants
 def setUp(self):
     super(BuildsymsSanityTests, self).setUp()
     self._syms = reflect.assemble_buildsyms(
         build_file_parser=self.build_file_parser)
コード例 #10
0
ファイル: test_builddict.py プロジェクト: arloherrine/pants
 def setUp(self):
   super(ExtractedContentSanityTests, self).setUp()
   self._syms = reflect.assemble_buildsyms(build_file_parser=self.build_file_parser)