Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version # needs parameterized in build process #25

Closed
hossman opened this issue Sep 23, 2016 · 3 comments
Closed

Version # needs parameterized in build process #25

hossman opened this issue Sep 23, 2016 · 3 comments
Assignees

Comments

@hossman
Copy link
Collaborator

hossman commented Sep 23, 2016

We need to ensure that anywhere in the ref guide that refers to the version# gets it's info from a variable defined at build time via an ant property.

In some cases this should be easy using asciidoctor run time attributes, which IIUC can be used in pages as if variables, but other places like layout or theme based yaml/json config files may be trickier.

@hossman
Copy link
Collaborator Author

hossman commented Oct 25, 2016

Based on some experimentation today, it seems like there's basically 3 diff things we need to worry about here, to solve both this issue and issue #26 ...

  1. we need to pass the Solr version / javadocs URLs as "attributes" to the asciidoctor ant task when building the PDF so that we can use attribute substitution in the body of adoc files
    • this is fairly easy using the <attribute/> element for the <asciidoctor> ant task
  2. we need to ensure asciidoctor has access to the same version / javadocs URL attributes when it gets invoked by jekyll so it can do the same substitution
  3. we need to ensure the liquid templates have access to some/all of the same attributes so that things like the header/nav/footer have access to them (notably: the solr version#)
    • the easiest way to do this seems to be to generate a _data/ant_properties.yml file containing the properties we need liquid to have access to, and then the templates can access them just like they access the sidebar data via {{ site.data.ant_properties.whatever }}

I'll dig into this more tomorow...

@hossman hossman self-assigned this Oct 25, 2016
@ctargett
Copy link
Owner

It's not clear if you know this already, but the liquid templates can pull from _config.yml with syntax like {{site.<param>}} in the templates. The param can be whatever name you want it to be. It feels to me that 3 on your list could be satisfied with that, but I may by missing nuances.

To automate this, is it possible to just have something in Ant or in a script that's run that finds out the version from wherever it's stored in the Solr tree for the dist and package builds and updates _config.yml and build.xml for docs?

@hossman
Copy link
Collaborator Author

hossman commented Oct 25, 2016

It's not clear if you know this already, but the liquid templates can pull from _config.yml ...

I did not realize that -- that simplifies things greatly (i knew about _data/foo.yml being mapped to site.data.foo... but didn't realize you could just get stuff straight from _config.yml)

To automate this, is it possible to just have something in Ant or in a script that's run that finds out the version from wherever it's stored in the Solr tree for the dist and package builds and updates _config.yml ...

yup, yup ... that's basically what i've got locally - a _data/adoc-attributes.yml.template file that ant does property value substituion on to create _data/adoc-attributes.yml with things like solr-docs-version and solr-javadocs properties filled in.

I'll simplify that to just work with a _config.yml.template file instead

hossman added a commit that referenced this issue Oct 25, 2016
we can now substitute ant properties for the solr/lucene version & javadoc urls in:
 - adoc files
   - when generating pdf
   - when generating jekyll html
 - liquid templates when generating jekyll html
hossman added a commit that referenced this issue Oct 25, 2016
hossman added a commit that referenced this issue Oct 25, 2016
cassandra pointed out that we don't need a _data/adoc-attributes.yml.template file,
_config.yml variables can be used as site.foo variables in our templates.

So this change removes _data/adoc-attributes.yml.template and puts the asciidoctor config back into a
_config.yml.template instead.  This involves less magic and makes it easier to find all the jekyll config options.

Unfortuntately there seems to be a bug/oddity in how the asciidoctor jekyll plugin is initializatin itself, so we
can't just use variables like site.asciidoctor.attributes.foo in our templates, we have to redundently declare
"foo" again in the _config.yml: asciidoctor/jekyll-asciidoc#137
@hossman hossman closed this as completed Oct 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants