Class: FeduxOrgStdlib::Project::Plan

Inherits:
Object
  • Object
show all
Defined in:
lib/fedux_org_stdlib/project/plan.rb

Overview

Plan file

Instance Method Summary collapse

Constructor Details

#initialize(main_file: File.expand_path('plan.tjp'), additional_files: []) ⇒ Plan

Create a new project plan

Parameters:

  • main_file (String) (defaults to: File.expand_path('plan.tjp'))

    The main project file

  • additional_files (Array) (defaults to: [])

    Additional files containing information about project plan



18
19
20
21
22
23
24
# File 'lib/fedux_org_stdlib/project/plan.rb', line 18

def initialize(
  main_file: File.expand_path('plan.tjp'),
  additional_files: []
)
  @main_file        = main_file
  @additional_files = Array(additional_files)
end

Instance Method Details

#needs_to_be_compiled?(base_file) ⇒ true, false

Does the plan needs to be compiled

Parameters:

  • base_file (String)

    The output file which should be used to determine if the report is older then the project plan

Returns:

  • (true, false)

    Result of comparism



33
34
35
# File 'lib/fedux_org_stdlib/project/plan.rb', line 33

def needs_to_be_compiled?(base_file)
  (Array(main_file) + additional_files).any? { |f| File.mtime(f) > File.mtime(base_file) }
end

#to_sString

Output a textual representation of self

Returns:

  • (String)

    The path to the main file of the project plan



41
42
43
# File 'lib/fedux_org_stdlib/project/plan.rb', line 41

def to_s
  main_file
end