Sha256: fa93cc0832dc8a913f102f3099ee9fe24625a5a287983676d9a175562434fe1e

Contents?: true

Size: 1.17 KB

Versions: 56

Compression:

Stored size: 1.17 KB

Contents

# encoding: utf-8
module FeduxOrgStdlib
  module Project
    # Plan file
    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

Version data entries

56 entries across 56 versions & 1 rubygems

Version Path
fedux_org-stdlib-0.11.18 lib/fedux_org_stdlib/project/plan.rb
fedux_org-stdlib-0.11.17 lib/fedux_org_stdlib/project/plan.rb
fedux_org-stdlib-0.11.16 lib/fedux_org_stdlib/project/plan.rb
fedux_org-stdlib-0.11.15 lib/fedux_org_stdlib/project/plan.rb
fedux_org-stdlib-0.11.14 lib/fedux_org_stdlib/project/plan.rb
fedux_org-stdlib-0.11.12 lib/fedux_org_stdlib/project/plan.rb
fedux_org-stdlib-0.11.11 lib/fedux_org_stdlib/project/plan.rb
fedux_org-stdlib-0.11.9 lib/fedux_org_stdlib/project/plan.rb
fedux_org-stdlib-0.11.8 lib/fedux_org_stdlib/project/plan.rb
fedux_org-stdlib-0.11.7 lib/fedux_org_stdlib/project/plan.rb
fedux_org-stdlib-0.11.6 lib/fedux_org_stdlib/project/plan.rb
fedux_org-stdlib-0.11.5 lib/fedux_org_stdlib/project/plan.rb
fedux_org-stdlib-0.11.4 lib/fedux_org_stdlib/project/plan.rb
fedux_org-stdlib-0.11.3 lib/fedux_org_stdlib/project/plan.rb
fedux_org-stdlib-0.11.2 lib/fedux_org_stdlib/project/plan.rb
fedux_org-stdlib-0.11.1 lib/fedux_org_stdlib/project/plan.rb
fedux_org-stdlib-0.11.0 lib/fedux_org_stdlib/project/plan.rb
fedux_org-stdlib-0.10.9 lib/fedux_org_stdlib/project/plan.rb
fedux_org-stdlib-0.10.8 lib/fedux_org_stdlib/project/plan.rb
fedux_org-stdlib-0.10.7 lib/fedux_org_stdlib/project/plan.rb