Class PointyHairedBoss
In: bin/phb.rb
Parent: Object

A Pointy-Haired Boss:

  • Manages all Projects.
  • Keeps track of constants and project dependence on libraries and other projects.
  • Handles inclusion of paths to code, and recursive iteration over projects and libraries.
  • Knows the standard directory structure.

CAUTION:

  • Requires environmental variable ‘DevRoot’.
  • Presumes directory structure defined by:
    • DevRootRelativeDirs
    • ProjectRelativeDirs

Methods

Included Modules

Singleton

Attributes

dependencies_loaded  [RW]  Map keys are project names. Values are Arrays of project or library names.
library_map  [RW]  Map keys are project names. Values are Arrays of project or library names.
project_map  [RW]  Map keys are project names. Values are Arrays of project or library names.
project_stack  [RW]  Map keys are project names. Values are Arrays of project or library names.
vars  [RW]  Map keys are project names. Values are Arrays of project or library names.

Public Class methods

Public Instance methods

Raises an exception if the key is missing

Constants ======

=================================================================

Three ways to execute a command synchronously, with optional result capture.

Under OS X all three of these work equally well. Under Windows, all three work when tested in test_phb.rb, but _osExecute_backtick and _osExecute_popen raise:

     "Errno::ENOEXEC: Exec format error"

when invoked from test_Rakefile_system.rb. Do not know why: the same command can be executed in a new shell. Think %x{} is synonomous with ``. Other possible implementations could possibly be based on:

  open4, open3, win32/open3, Kernel.fork,  Kernel.exec,  IO.pipe,  Kernel.open (with | as first char of fileneme)

Note: sh is defined in rake.rb: it calls Kernel::system.

Does not check for conflicts

Convert DevRoot relative fileName to an absolute file name

Recursively prepend to load path the specified directory within each required project. The path for the root project is included. This is necessary if code is to be accessed without installation. Projects we depend upon are prepended first: the path for the specified project is prepended last (that way it can override the stuff it depends on).

Does not add source paths

Return to pristine state. Used by some tests

Returns the local part of the project name (not the complete path) Argument can be"

      the path (absolute or project-relative) to a rakefile
      nil, if invoked within the project directory.

Returns the absolute path for file external to the projects, but within DevBase. directoryName is a Symbol within DevRootRelativeDirs

Identical to [](key), but silently returns nil if the key is not in use

Returns the absolute path for a file internal to the project. directoryName is a Symbol within ProjectRelativeDirs projectName and fileName are local (not absolute)

Similar to File.join, except:

  • Does not convert relative paths to absolute paths. For example, File.join(’’, ‘foo’)
  • Does remove trailing separator

Returns absolute paths.

Recursively load dependency information It’s recursive because dependencies.rb invokes requires_projects. This is identical to _load_dependencies, except that this will only execute once.

Returns a string of path arguments suitable for the ‘ruby’ command line.

Returns an absolute path for a project

Name is only the local part only, not the complete path

Name is only the local part only, not the complete path

Returns absolute paths

Returns absolute paths

FIXME we want local paths when displaying a dialog, but absolute paths for most other purposes.

Given an absolute path to a file within a project, strips off the prefix up to and including the directory that holds all the projects. Returns nil if the pathString does not start with the absolute path common to all projects.

Runs rakefile for specified project, with the specified taskName If projectName is nil, uses the DevRoot Rakefile ProjectName can also be an absolute unix path to the project’s directory. Absolute paths work under Windows, but they need to be unix paths that begin with ’/’. Caution: under Windows (but not OS X) this sometimes seems to fail to execute, unless pipeTo is provided. Have not adequately investigaged. The regression tests all include pipeTo

Runs rakefile with specified taskName for all required projects: optionally also run for the root project.

Most of the time we don’t care about which library is required for what project, and we don’t want duplicates

Sometimes we don’t care about the order of the required projects. extras, if specified, is an Array of names of additonal projects that will be incorporated into the list.

This probably should have been a property, but it’s now coded into the tests.

Execute a one-arg block for each (recursively determined) required project name. The required projects are visited before the named project.

Writes a table of two aligned columns: each row must be a two element Array. Rows are sorted by the value in the first column. Default rows describe the Project directory structure: in this case, the first column is a relative path, the second is a directory description

[Validate]