# encoding: utf-8 module FeduxOrgStdlib module Project class Plan private attr_reader :main_file, :additional_files public # Create a new project plan # # @param [String] main_file # The main project file # @param [Array] additional_files # Additional files containing information about project plan def initialize( main_file: File.expand_path('plan.tjp'), additional_files: [] ) @main_file = main_file @additional_files = Array(additional_files) end # Does the plan needs to be compiled # # @param [String] base_file # The output file which should be used to determine if the report is # older then the project plan # @return [true,false] # Result of comparism def needs_to_be_compiled?(base_file) (Array(main_file) + additional_files).any? { |f| File.mtime(f) > File.mtime(base_file) } end # Output a textual representation of self # # @return [String] # The path to the main file of the project plan def to_s main_file end end end end