Skip to content

fedora-id/asknot-ng

 
 

Repository files navigation

asknot-ng

Ask not what $ORG can do for you, but what you can do for $ORG.

Written by @ralphbean. Inspired by the original work of Josh Matthews, Henri Koivuneva, and others.

I stumbled upon and loved the original whatcanidoformozilla.org and wanted to deploy it for the Fedora Community but I found that I couldn’t easily change the questions and links that were presented. A year went by and in 2015 I wrote this: “asknot-ng”.

The gist of this “next generation” rewrite is to make it as configurable as possible. There is a primary script, asknot-ng.py that works like a static-site generator. It takes as input three things:

  • A questions file, written in yaml (see the example or Fedora’s file). You’ll have to write your own one of these.
  • A template file, written in mako (the default should work for everybody).
  • A ‘theme’ argument to specify what CSS to use. The default is nice enough, but you’ll probably want to customize it to your own use case.

We have a Fedora instance up and running if you’d like to poke it.

Requirements

The site-generator script is written in Python, so you’ll need that. Furthermore, see requirements.txt or just run::

$ sudo yum install python-mako PyYAML python-virtualenv

The script can optionally generate an svg visualizing your question tree. This requires pygraphviz which you could install like so:

$ sudo yum install python-pygraphviz

Giving it a run

Install the requirements, first.

Clone the repo::

$ git clone https://github.com/fedora-infra/asknot-ng.git
$ cd asknot-ng

Create a virtualenv into which you can install the module.

$ virtualenv --system-site-packages venv
$ source venv/bin/activate
$ python setup.py develop

Run the script with the Fedora configuration::

$ ./asknot-ng.py templates/index.html questions/fedora.yml --theme fedora
Wrote build/en/index.html

.. and open up build/en/index.html in your favorite browser.

Preparing Translations

First, setup a virtualenv, install Babel, and build the egg info.

$ virtualenv venv
$ source venv/bin/activate
$ pip install Babel
$ python setup.py develop

Then, extract the translatable strings:

$ python setup.py extract_messages --output-file locale/asknot-ng.pot

Contributing back

asknot-ng is licensed GPLv3+ and we’d love to get patches back containing even the things you might not think we want. If you have a questions file for your repo, a modified template, or a CSS theme for your use case... please send them to us. It would be nice to build a library of deployments so we can all learn.

Of course, bug reports and patches to the main script are appreciated as always.

Happy Hacking!

Releases

No releases published

Packages

No packages published

Languages

  • Python 42.9%
  • CSS 26.6%
  • HTML 18.3%
  • Shell 5.8%
  • JavaScript 5.6%
  • Ruby 0.8%