Sha256: 7a57c3ab161fdab48619d0cfdf797d7d0434b49271ffa94646f231ca8486358a

Contents?: true

Size: 1.45 KB

Versions: 2

Compression:

Stored size: 1.45 KB

Contents

# encoding: utf-8
require 'fedux_org_stdlib/require_files'
require_library %w{ command_exec }

require 'fedux_org_stdlib/project/logger'

module FeduxOrgStdlib
  module Project
    module Generators
      class Taskjuggler
        # Generate report
        #
        # @param [String] directory
        #   The directory where the report should be generated
        # @param [Plan] plan
        #   The project plan to use
        def generate_report(directory, plan)
          FeduxOrgStdlib::Project.logger.debug "Start generating report."

          begin
            command = CommandExec::Command.new(:tj3 , 
                                               :parameter          => "-o #{directory} #{plan}",
                                               :error_detection_on => [:return_code],
                                               :error_indicators   => {
                                                 :allowed_return_code => [0],
                                               },
                                               :on_error_do => :raise_error,
                                              )
            command.run
          rescue CommandExec::Exceptions::CommandExecutionFailed
            FeduxOrgStdlib::Project.logger.fatal "Failed to generate report:\n\n#{ command.result.stderr.join( "\n" ) }"
            exit 1
          end

          FeduxOrgStdlib::Project.logger.info "Generating report succeeded."
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fedux_org-stdlib-0.7.21 lib/fedux_org_stdlib/project/generators/taskjuggler.rb
fedux_org-stdlib-0.7.20 lib/fedux_org_stdlib/project/generators/taskjuggler.rb