Export from the command line

Before you begin

Before you attempt the command line export, you'll need two pieces of information:

  1. The ID of the project you want to export.

  2. The location of the report template you want to use.

You can get your project ID from the browser location bar once you open the project in the main Dradis interface (8 in this example):

Debug template 01

The location of the template can be anywhere in the appliance. However, if you used the web interface to upload your template there is a good chance it would have ended under this location:

/opt/dradispro/dradispro/current/templates/reports/word/

However, to make the examples more readable we'll use /tmp/test-01.docx as the sample location of our template in the following steps.

Running the export

Remember that when you're working in the console of your Dradis Pro appliance, 9 times out of 10 you'll need to run commands as the dradispro user and not the root user.

  1. SSH into the console as dradispro, then navigate to the current folder:

    $ cd /opt/dradispro/dradispro/current/
  2. Now lets get some help/usage information by running the following command:

    $ RAILS_ENV=production bundle exec thor help dradis:pro:plugins:word:export

    The expected output is:

    Usage:
    thor dradis:pro:plugins:word:export --template=TEMPLATE
    Options:
    [--output=OUTPUT] # the report file to create (if ends in .docx or .docm), or the directory to create it in
    --template=TEMPLATE # the template file to use. If not provided the value of the 'advanced_word_export:docx' setting will be used.
    Export the current repository structure as a Word document using the .docx format (uses Issues and Evidence)

    The two parameters are optional, but we'll use both in this guide.

  3. Run the dradis:pro:plugins:word:export command.

    For our example, with a project ID of 8, the command we need to run is this:

    $ PROJECT_ID=8 RAILS_ENV=production bundle exec thor \
            dradis:pro:plugins:word:export \
            --output=/tmp/ \
            --template=/tmp/test-01.docx

When the exporting process starts, the output should look like this:

Project found. Scoping all models to Project 8.
Loading .docx template...
Done
Found 3 issues affecting 2 nodes
Found 3 notes affecting 0 new nodes
[...]

The process will end either with a horrible stack trace:

.../processors/ooxml/processor.rb:252:in `binread': No such file or directory - .../attachments/397/Help%20Desk%20Pricing%20%E2%80%BA%20(20131019).png (Errno::ENOENT)
from /../processors/ooxml/processor.rb:252:in `block (2 levels) in process_docx_archive'
from /../processors/ooxml/processor.rb:250:in `each'
from /../processors/ooxml/processor.rb:250:in `block in process_docx_archive'
[...]
from /../ruby/2.0.0/bin/thor:23:in `<main>'
zlib(finalizer): the stream was freed prematurely.

… or a friendly “all done” message:

[...]
Report file created at:
/tmp/dradis-report_2014-03-31_1.docx

If you get the nasty stack trace, skip to When the export fails

If you get the “all done” message, move on to the next page, Missing content.

Next help article: Missing content →