code: function main() {
    if (whenNoShim()) return;
    var invoked = thisEmbark();
    var embarkJson = findEmbarkJson();
    var dappPath = embarkJson.dirname;
    process.chdir(dappPath);
    process.env.DAPP_PATH = dappPath;
    process.env.PWD = dappPath;
  
    /* attempt to find a "local" embark in or above but not below dappPath
  
       let `dappPath/(([../])*)bin/embark` be a "containing" embark
  
       let `dappPath/(([../])*)node_modules/embark/bin/embark` be an "installed"
       embark
  
       if containing and installed embarks are both found, and if containing
       embark is higher in the dir structure than installed embark, then
       containing embark will be selected
  
       according to the rule above: if an installed embark is found within a
       containing embark's own node_modules (that would be odd), installed embark
       will be selected
  
       invoked embark may find itself as local embark, but that is detected by
       comparing `binrealpath` props to avoid double-checking and infinite loops
  
       if no local embark is found then cmd execution will use invoked embark */
  
    var containing = findBinContaining(dappPath, invoked);
    var installed = findBinInstalled(dappPath, invoked);
    var local = selectLocal(containing, installed, invoked);
    var pkgJson = findPkgJson(dappPath, embarkJson, local);
    process.env.PKG_PATH = pkgJson.dirname;
    var embark = select(invoked, local);
    process.env.EMBARK_PATH = embark.pkgDir;
    embark.exec();
  }
docs: KEY ASSUMPTION: for a DApp to be valid, from embark's perspective, it must have a parsable embark.json file in its top-level directory; if that requirement changes in the future then this script must be revised. Hypothetical example of such a change: embark config info may be included in package.json under `{"embark": {...}}` -or- stored in an embark.json file.