Skip to content

Commit

Permalink
Add format to mustache filenames
Browse files Browse the repository at this point in the history
Testing Done:
Travis CI: https://travis-ci.org/pantsbuild/pants/jobs/135505515

It looks like half of the mustache file names include the format in the filename and half do not.  This change adds the format for the mustache file used by reporting, ivy_utils and jar_publish.

Bugs closed: 3551

Reviewed at https://rbcommons.com/s/twitter/r/3976/
  • Loading branch information
cheister authored and ericzundel committed Jun 8, 2016
1 parent d01fdb7 commit 34f352e
Show file tree
Hide file tree
Showing 15 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/python/pants/backend/jvm/ivy_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -987,7 +987,7 @@ def _generate_resolve_ivy(cls, jars, excludes, ivyxml, confs, resolve_hash_name,
excludes=excludes,
overrides=overrides)

template_relpath = os.path.join('templates', 'ivy_utils', 'ivy.mustache')
template_relpath = os.path.join('templates', 'ivy_utils', 'ivy.xml.mustache')
cls._write_ivy_xml_file(ivyxml, template_data, template_relpath)

@classmethod
Expand All @@ -1012,7 +1012,7 @@ def generate_fetch_ivy(cls, jars, ivyxml, confs, resolve_hash_name):
extra_configurations=extra_configurations,
dependencies=dependencies)

template_relpath = os.path.join('templates', 'ivy_utils', 'ivy_fetch.mustache')
template_relpath = os.path.join('templates', 'ivy_utils', 'ivy_fetch.xml.mustache')
cls._write_ivy_xml_file(ivyxml, template_data, template_relpath)

@classmethod
Expand Down
6 changes: 3 additions & 3 deletions src/python/pants/backend/jvm/tasks/jar_publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def write(self, target, path):
if target_jar:
target_jar = target_jar.extend(dependencies=dependencies.values())

template_relpath = os.path.join(_TEMPLATES_RELPATH, 'pom.mustache')
template_relpath = os.path.join(_TEMPLATES_RELPATH, 'pom.xml.mustache')
template_text = pkgutil.get_data(__name__, template_relpath)
generator = Generator(template_text, project=target_jar)
with safe_open(path, 'w') as output:
Expand Down Expand Up @@ -906,7 +906,7 @@ def fetch_ivysettings(self, ivy):
return ivy.ivy_settings

def generate_ivysettings(self, ivy, publishedjars, publish_local=None):
template_relpath = os.path.join(_TEMPLATES_RELPATH, 'ivysettings.mustache')
template_relpath = os.path.join(_TEMPLATES_RELPATH, 'ivysettings.xml.mustache')
template_text = pkgutil.get_data(__name__, template_relpath)

published = [TemplateData(org=jar.org, name=jar.name) for jar in publishedjars]
Expand All @@ -923,7 +923,7 @@ def generate_ivysettings(self, ivy, publishedjars, publish_local=None):
return wrapper.name

def generate_ivy(self, jar, version, publications):
template_relpath = os.path.join(_TEMPLATES_RELPATH, 'ivy.mustache')
template_relpath = os.path.join(_TEMPLATES_RELPATH, 'ivy.xml.mustache')
template_text = pkgutil.get_data(__name__, template_relpath)

pubs = [TemplateData(name=None if p.name == jar.name else p.name,
Expand Down
22 changes: 11 additions & 11 deletions src/python/pants/reporting/reporting_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ def do_GET(self):
def _handle_runs(self, relpath, params):
"""Show a listing of all pants runs since the last clean-all."""
runs_by_day = self._partition_runs_by_day()
args = self._default_template_args('run_list')
args = self._default_template_args('run_list.html')
args['runs_by_day'] = runs_by_day
self._send_content(self._renderer.render_name('base', args), 'text/html')
self._send_content(self._renderer.render_name('base.html', args), 'text/html')

_collapsible_fmt_string = dedent("""
<div class="{class_prefix}" id="{id}">
Expand All @@ -106,7 +106,7 @@ def _handle_runs(self, relpath, params):

def _handle_run(self, relpath, params):
"""Show the report for a single pants run."""
args = self._default_template_args('run')
args = self._default_template_args('run.html')
run_id = relpath
run_info = self._get_run_info_dict(run_id)
if run_info is None:
Expand Down Expand Up @@ -141,12 +141,12 @@ def _handle_run(self, relpath, params):
if run_id == 'latest':
args['is_latest'] = run_info['id']

self._send_content(self._renderer.render_name('base', args), 'text/html')
self._send_content(self._renderer.render_name('base.html', args), 'text/html')

def _handle_stats(self, relpath, params):
"""Show stats for pants runs in the statsdb."""
args = self._default_template_args('stats')
self._send_content(self._renderer.render_name('base', args), 'text/html')
args = self._default_template_args('stats.html')
self._send_content(self._renderer.render_name('base.html', args), 'text/html')

def _handle_statsdata(self, relpath, params):
"""Show stats for pants runs in the statsdb."""
Expand Down Expand Up @@ -191,7 +191,7 @@ def _handle_content(self, relpath, params):
linenums = True
args = {'prettify_extra_langs': prettify_extra_langs, 'content': content,
'prettify': prettify, 'linenums': linenums}
self._send_content(self._renderer.render_name('file_content', args), 'text/html')
self._send_content(self._renderer.render_name('file_content.html', args), 'text/html')

def _handle_assets(self, relpath, params):
"""Statically serve assets: js, css etc."""
Expand Down Expand Up @@ -293,12 +293,12 @@ def _serve_dir(self, abspath, params):
relpath = os.path.relpath(abspath, self._root)
breadcrumbs = self._create_breadcrumbs(relpath)
entries = [{'link_path': os.path.join(relpath, e), 'name': e} for e in os.listdir(abspath)]
args = self._default_template_args('dir')
args = self._default_template_args('dir.html')
args.update({'root_parent': os.path.dirname(self._root),
'breadcrumbs': breadcrumbs,
'entries': entries,
'params': params})
self._send_content(self._renderer.render_name('base', args), 'text/html')
self._send_content(self._renderer.render_name('base.html', args), 'text/html')

def _serve_file(self, abspath, params):
"""Show a file.
Expand All @@ -308,11 +308,11 @@ def _serve_file(self, abspath, params):
relpath = os.path.relpath(abspath, self._root)
breadcrumbs = self._create_breadcrumbs(relpath)
link_path = urlparse.urlunparse([None, None, relpath, None, urllib.urlencode(params), None])
args = self._default_template_args('file')
args = self._default_template_args('file.html')
args.update({'root_parent': os.path.dirname(self._root),
'breadcrumbs': breadcrumbs,
'link_path': link_path})
self._send_content(self._renderer.render_name('base', args), 'text/html')
self._send_content(self._renderer.render_name('base.html', args), 'text/html')

def _send_content(self, content, content_type, code=200):
"""Send content to client."""
Expand Down

0 comments on commit 34f352e

Please sign in to comment.