Sha256: 535044266c9a131a0c86d4ee11e0c015955bcba70204cee50090b43f72102f7a

Contents?: true

Size: 1.16 KB

Versions: 59

Compression:

Stored size: 1.16 KB

Contents

# 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.join(Dir.getwd, '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

Version data entries

59 entries across 59 versions & 1 rubygems

Version Path
fedux_org-stdlib-0.6.27 lib/fedux_org_stdlib/project/plan.rb
fedux_org-stdlib-0.6.26 lib/fedux_org_stdlib/project/plan.rb
fedux_org-stdlib-0.6.25 lib/fedux_org_stdlib/project/plan.rb
fedux_org-stdlib-0.6.23 lib/fedux_org_stdlib/project/plan.rb
fedux_org-stdlib-0.6.22 lib/fedux_org_stdlib/project/plan.rb
fedux_org-stdlib-0.6.21 lib/fedux_org_stdlib/project/plan.rb
fedux_org-stdlib-0.6.20 lib/fedux_org_stdlib/project/plan.rb
fedux_org-stdlib-0.6.18 lib/fedux_org_stdlib/project/plan.rb
fedux_org-stdlib-0.6.17 lib/fedux_org_stdlib/project/plan.rb
fedux_org-stdlib-0.6.16 lib/fedux_org_stdlib/project/plan.rb
fedux_org-stdlib-0.6.15 lib/fedux_org_stdlib/project/plan.rb
fedux_org-stdlib-0.6.14 lib/fedux_org_stdlib/project/plan.rb
fedux_org-stdlib-0.6.13 lib/fedux_org_stdlib/project/plan.rb
fedux_org-stdlib-0.6.12 lib/fedux_org_stdlib/project/plan.rb
fedux_org-stdlib-0.6.11 lib/fedux_org_stdlib/project/plan.rb
fedux_org-stdlib-0.6.9 lib/fedux_org_stdlib/project/plan.rb
fedux_org-stdlib-0.6.8 lib/fedux_org_stdlib/project/plan.rb
fedux_org-stdlib-0.6.7 lib/fedux_org_stdlib/project/plan.rb
fedux_org-stdlib-0.6.6 lib/fedux_org_stdlib/project/plan.rb