redmine_re icon indicating copy to clipboard operation
redmine_re copied to clipboard

Added BDD feature management / Basic PDF export

Open gimmebytes opened this issue 11 years ago • 8 comments

Hi There,

First thanks for your great work. It helped me to increase the productivity of my customer and to tighten the requirements definition process and management as well. Basically what the KOREM plugin was intended for.

As I suggested my customer to select a Behavior Driven Development (BDD) approach for their projects to collect requirements I added the possibility to KOREM to add so called features from the BDD philosophy to the Redmine database. For further information on this please read on here.

One missing feature also was that it is not simply possible to export the requirements and other added data from the plugin. We could have done this via an external interface (e.g. database admin interface), but a direct export was mandatory.

So I spend the effort and also added the possibility to export the tree structure as flat PDF file by right clicking on the tree root node and select the "Export" option. This feature uses pdfkit which requires wkhtmltopdf - I updated the gem file accordingly and added some information to the README.rdoc file.

I would be happy if you merge the changes in your main stream and if we could get together to talk about further adjustments which I have in mind, not only related to the export function, but also to other missing features.

Cheers, Marvin Kruse Philotech GmbH

gimmebytes avatar Sep 18 '14 10:09 gimmebytes

I forgot to add a preview export file, you can view one here.

gimmebytes avatar Sep 18 '14 10:09 gimmebytes

Hi Martin. Thanks for all your effort. We will need some time to check out the code on our machines and give it a try. So far we do like the BDD-Feature artifact. We have to be careful though not to give Redmine RE a spin towards a certain method or workflow since its intention was to be able to combine artiacts from all areas (Use-Cases, Requirements, Features, whatever).

As for the export part. We tried a lot of export mechanisms during time and I am not sure if it is wise to have a large(r) external dependency when installing Redmine RE. Our last try was based on pandoc which did not work out to good since it behaved differently on different OSes. However, I'll check your solution out and I guess we'll move along with most of your changes. Dominic or I will contact you again in about a week and we can also discuss about your future ideas then.

tmerten avatar Sep 18 '14 11:09 tmerten

thanks for your efforts guys. lack of export function is the only thing that stop me from deploying this great plugin on our redmine instance.

alterdaemon avatar Sep 18 '14 11:09 alterdaemon

I totally agree with you about not pushing Redmine RE into a certain direction. But I think especially because Redmine RE is not pushing the user into any certain direction and giving total freedom when starting off using it, it is good to give the opportunity to use something like features coming from BDD. In my project we will use features along with common (technical) requirements, which is mandatory because features on its own wouldn't satisfy the requirements definition process.

Regarding the export function I also agree that having large or complex dependencies could raise the bars for projects to make use of Redmine RE, but on the other hand the dependencies are relatively small. Installing the ruby bindings for wkhtmltopdf is a breeze with gem / bundler which already is needed when setting up Redmine and wkhtmltopdf itself is available as static binary from the project which has zero other dependencies. In fact it is another dependency, but not to big to keep users away of using Redmine RE in my opinion.

If you have any questions on the implementation, do not hesitate to send me a message!

Cheers, Marvin :-)

gimmebytes avatar Sep 18 '14 15:09 gimmebytes

Hi Marvin,

i've installed you version of the re plugin and I got an error when i try to export something:

RuntimeError (command failed (exitstatus=1): /home/dmarko2s/.rvm/gems/ruby-1.9.2-p320/bin/wkhtmltopdf --quiet --page-size Letter --margin-top 0.75in --margin-right 0.75in --margin-bottom 0.75in --margin-left 0.75in --encoding UTF-8 - -): pdfkit (0.6.2) lib/pdfkit/pdfkit.rb:73:in to_pdf' plugins/redmine_re/lib/exporter.rb:98:inget_pdf' plugins/redmine_re/app/controllers/requirements_controller.rb:144:in export' actionpack (3.2.19) lib/action_controller/metal/implicit_render.rb:4:insend_action' actionpack (3.2.19) lib/abstract_controller/base.rb:167:in process_action' actionpack (3.2.19) lib/action_controller/metal/rendering.rb:10:inprocess_action' actionpack (3.2.19) lib/abstract_controller/callbacks.rb:18:in block in process_action' activesupport (3.2.19) lib/active_support/callbacks.rb:513:in_run__585112424__process_action__529772642__callbacks' activesupport (3.2.19) lib/active_support/callbacks.rb:405:in __run_callback' activesupport (3.2.19) lib/active_support/callbacks.rb:385:in_run_process_action_callbacks' activesupport (3.2.19) lib/active_support/callbacks.rb:81:in run_callbacks' actionpack (3.2.19) lib/abstract_controller/callbacks.rb:17:inprocess_action' actionpack (3.2.19) lib/action_controller/metal/rescue.rb:29:in `process_action'

(I had to install a gem manually, maybe ist the wrong version:

dmarko2s@korem-dev:~/development/git_repos/redmine-2.5$ gem install wkhtmltopdf Fetching: wkhtmltopdf-0.1.2.gem (100%) Successfully installed wkhtmltopdf-0.1.2 1 gem installed Installing ri documentation for wkhtmltopdf-0.1.2... unable to convert "\xCE" from ASCII-8BIT to UTF-8 for bin/wkhtmltopdf_darwin_386, skipping unable to convert "\x90" from ASCII-8BIT to UTF-8 for bin/wkhtmltopdf_linux_386, skipping Building YARD (yri) index for wkhtmltopdf-0.1.2... Installing RDoc documentation for wkhtmltopdf-0.1.2... unable to convert "\xCE" from ASCII-8BIT to UTF-8 for bin/wkhtmltopdf_darwin_386, skipping unable to convert "\x90" from ASCII-8BIT to UTF-8 for bin/wkhtmltopdf_linux_386, skipping )

(It's hopfully just a small bug, because i realy like the way you integrated the feature!)

joki1987 avatar Oct 06 '14 09:10 joki1987

Hi Dominic,

I would suggest that you try the following:

  1. Remove the wkhtmltopdf gem (It seems the gem version is kind of experimental)
  2. Try to install a static binary version of wkhtmltopdf (= all required libs are linked into the binary so no need of external dependencies). Depending on your linux flavor select the appropriate version from here:

http://wkhtmltopdf.org/downloads.html

To see if the installation works run the following on your shell

bsh$ wkhtmltopdf www.google.com test.pdf

A PDF with the google front page should have been created then.

  1. Retry to export something from Korem.

Hopefully this should do the trick.

By the way: I found some minor issues with my changes which I will tackle within the next week. Along with the fixes I can send you some further Ideas of mine to enhance the plugin even further.

Cheers

gimmebytes avatar Oct 08 '14 14:10 gimmebytes

Hi Marvin,

I think the plugin is really wounderful, but I need to export the requirements to document. I would like to export the requirements to html or xml, so I can work on them later. Based on your export enhancement, where should I look to change this (unfortunately I don't have and ruby experience, so this would help me a lot). Would it be possible to call a python script from within the export ruby code segment?

best regrads Bernhard

hokreb avatar Nov 10 '16 17:11 hokreb

Hi Bernhard,

sorry for the late reply - I'm currently kinda busy at my company projects.

You've luck - the export routine is fairly simple and creates HTML in the first place and then generates a PDF document from that. Have a look at the exporter

https://github.com/gimmebytes/redmine_re/blob/bda7b55783d6d1e98de605e0f95a1a3b4aad90aa/lib/exporter.rb

Seek for the function get_pdf; as you can see the whole BDD tree is build as HTML and then passed to PDFKit - it would be sufficient to write the HTML to any given file before the PDF generation, e.g.

File.write('/path/to/file', html)

taken from here http://stackoverflow.com/questions/2777802/how-to-write-to-file-in-ruby

If you have any further questions drop me a message!

Cheers, Marvin

gimmebytes avatar Nov 15 '16 08:11 gimmebytes