I'm working on a new feature of the buildservice, a wizard that helps
with creating spec files (and in the future maybe with other tasks). See
I now have a working prototype, including a webclient interface. It
- A controller on the api (frontend), that sends a set of xml-encoded
questions to the client, receives answers from the client and either
asks more questions (suggesting defaults where possible) or generates a
- A webclient part that converts the xml questions into a HTML form,
let's the user fill in the form and sends the responses to the api.
It should be possible to also write an osc command that asks the
questions on terminal instead.
Here are some screenshots of the webclient:
An example of the an xml document describing the questions:
$ curl -n 'http://localhost:3001/source/home:mmarek/hello/_wizard'
<?xml version="1.0" encoding="UTF-8"?>
<legend>What do you want to package?</legend>
<entry name="tarball" type="file">
<label>Source tarball to upload</label>
- label and legend are self-explanatory.
- value is the default value to present to the user.
- If the last attribute of the root element is true, it means that the
client shouldn't send any further replies.
- There can be an arbitrary number of <entry> elements, each
representing a question to ask
- The name attribute of an entry has the same meaning as in HTML forms
- type can currently be one of
- file: the client should PUT a file to the package directory in a
*separate* request and send the filename as response (e.g.
- text or longtext: text data, longtext expects a multiline text (e.g.
the package description)
Client sends back either a GET request with the data in the query string
or a POST request encoding the data either as
application/x-www-form-urlencoded or multipart/form-data (i.e. anything
All communication with the API happens via the
/source/<project>/<package>/_wizard url, which means that the client
must first create the package by uploading a dummy _meta (see the
wizard_new action in the webclient).
To maintain it's state, the frontend stores a wizard.xml file in the
package directory. I know it's a hack, but it seemed as the easies way
for the time being :).
$ curl -sn 'http://localhost:3001/source/home:mmarek/hello/wizard.xml' |
xmllint -format -
<guess name="license">GPL v2 or later</guess>
The patch is attached. Note that this my first ruby code ever (I started
reading some tutorials this week), so please bear with me. If some of
the ruby & rails experts have some time to review the patch for
security, bugs, style, etc, that would be great.