Skip to content
Stephen Holdaway edited this page Oct 15, 2015 · 4 revisions

Refactor: Architecture clean up

The current on-going work on Beam is a clean up of the internals in the branch refactor. Things that are done on the lists below will be crossed off. Goals of this refactor are primarily:

  • Break down monolithic/god classes/methods
  • Make it possible for deep components (eg. DeploymentProvider) to be verbose or prompt (? maybe)

Architecture changes

Current state: Everything is centred around the Beam class. This looks like it was modelled after Composer, but has ended up a bit messy. It's currently difficult to add functionality without putting it in the Beam class. The Beam class (875 lines) currently handles:

  • Determining context by combining config options with command line options/arguments
  • Validating the resulting context
  • Managing files (exporting from Git, running local and remote commands)
  • Running the deployment (via a bunch of abstracted methods like "isUp", "doDryrun", and "doRun")

Beam existing architecture

Proposed architecture: Based more around components that can be created and controlled by a command. The same components are in use, but the Beam class is removed.

Beam proposed architecture

Todo

Monolithic classes/methods to be re-worked

  • Beam
  • TransferCommand::execute();

Restructuring

  • Rename DeploymentProvider to Transport
  • Split individual responsibilities from Beam into classes that can be used concurrently:
    • running a shell command
    • deploying files to a target
    • handling display output
  • Look at using library like react-php to make it easier to write async functionality

Functionality additions

Note that some of these things could be added without the a refactor.

  • Change .beamlog file to use JSON; document schema
  • Include git describe output in beam log
  • Allow notification of a url on deploy
  • Respect or remove no-interaction option (and other Symfony console default options)
  • #44 - send .beamlog to server when using path mode
  • #30 - command to view the status of a server
  • #14 - place source/target info after file list if the list was excessively large
  • Allow rolling back to commits on the same branch for locked targets
  • Add variable replacements to config processing (eg. %%target_name%% becomes live)
  • Allow deploying to multiple servers from the same prepared location (+ simultaneously would be nice)

Other/misc functionality

  • Error on use of tag that doesn't match any options
  • Autocomplete for path flag
  • Interactive init command
  • GUI config editor web tool
  • deploy-folder config option to allow deploying a sub directory of a project instead of the git root
  • Multithreaded FTP