Sha256: d409e26cabf9e0000f86e56dce5365e09b22b2425f6bd60b419c516b0edcd0f6
Contents?: true
Size: 1.83 KB
Versions: 12
Compression:
Stored size: 1.83 KB
Contents
require 'fedux_org/stdlib/logging/logger' require 'fedux_org/stdlib/project/logger' require 'fedux_org/stdlib/project/generators/taskjuggler' require 'fileutils' begin require 'launchy' rescue LoadError => e $stderr.puts "You need to install the following gems to make it work: \"launchy\"." exit 1 end module FeduxOrg module Stdlib module Project class Report attr_reader :directory, :file def initialize( plan, generator = FeduxOrg::Stdlib::Project::Generators::Taskjuggler.new, output_directory = File.join( Dir.getwd, 'reports' ), output_file = nil ) @plan = plan @output_directory = output_directory @output_file = case output_file when nil File.join( @output_directory, 'Overview.html' ) else output_file end @generator = generator end def generate prepare_environment if output_file_exists? and plan_is_newer_than_output_file? FeduxOrg::Stdlib::Project.logger.warn "No need to re-generate report. The plan file \"#{@plan.file}\" is NOT newer than output \"#{@output_file}\"." else @generator.generate_report( @output_directory, @plan.file ) end end def open Launchy.open( @output_file ) end private def prepare_environment FileUtils.mkdir_p @output_directory end def output_file_exists? File.exists? @output_file end def plan_is_newer_than_output_file? File.mtime( @output_file ) > File.mtime( @plan.file) end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems