Sha256: 71dfd7b4cdea59dcd40e334d5ba104c01d5b2cada38281bc625c0f70d178fb43
Contents?: true
Size: 1.79 KB
Versions: 61
Compression:
Stored size: 1.79 KB
Contents
# encoding: utf-8 require 'fedux_org_stdlib/require_files' require_library %w{ fileutils launchy } require 'fedux_org_stdlib/logging/logger' require 'fedux_org_stdlib/project/logger' require 'fedux_org_stdlib/project/generators/taskjuggler' module FeduxOrgStdlib module Project class Report attr_reader :directory, :file private attr_reader :output_file, :plan, :output_directory, :generator public # Create a new report # # @param [Plan] plan # Project plan to be used for report # @param [String] output_file # The main output file for the report # @param [Generator] generator # A generator to be used to be generator the report def initialize( plan:, output_file:, generator: FeduxOrgStdlib::Project::Generators::Taskjuggler.new ) @plan = plan @output_directory = File.dirname(output_file) @output_file = output_file @generator = generator end # Generate report def generate prepare_environment if output_file_does_not_exist? or plan_is_newer_than_output_file? generator.generate_report(output_directory, plan) else FeduxOrgStdlib::Project.logger.warn "No need to re-generate report. The plan file \"#{plan.to_s}\" is NOT newer than output \"#{@output_file}\"." end end # Open report in web browser def open Launchy.open(output_file) end private def prepare_environment FileUtils.mkdir_p output_directory end def output_file_does_not_exist? !File.exists? output_file end def plan_is_newer_than_output_file? plan.needs_to_be_compiled? output_file end end end end
Version data entries
61 entries across 61 versions & 1 rubygems
Version | Path |
---|---|
fedux_org-stdlib-0.6.6 | lib/fedux_org_stdlib/project/report.rb |