Display status info about the project.

@param {String} rootFolder - relative path to the rootFolder of the project
@param {Object} metadata - Metadata of the projectso we can give extra info.
@returns {void}
352145
async function displayStatusInfo(rootFolder, metadata) {
    const local = path.join(rootFolder, constants.META_DIR, constants.META_LOCAL);
    const remote = path.join(rootFolder, constants.META_DIR, constants.META_REMOTE);

    // Get valid extensions for code files
    const extensions = eaft.getCodeExtensions();

    const files = [];
    const keys = [];
    const data = [];
    data.local = JSON.parse(fs.readFileSync(local, 'utf8'));
    data.remote = JSON.parse(fs.readFileSync(remote, 'utf8'));

    // Construct array with filename, extension and environment as key
    for (const env in data) {
        for (const codeFile of data[env].files) {
            const extension = eaft.getExtensionFromFiletype(codeFile.type, extensions);
            const key = `${codeFile.name}${extension}.${env}`;
            keys.push(key);
            codeFile.environment = env;
            files[key] = codeFile;
        }
    }

    // Sort keys
    keys.sort();

    // Track what we need to print
    const addedFiles = [];
    const modifiedFiles = [];
    const deletedFiles = [];

    // Iterate over all keys
    for (let i = 0; i < keys.length; i++) {
        const file = files[keys[i]];
        const extension = eaft.getExtensionFromFiletype(file.type, extensions);
        const nextFile = files[keys[i + 1]];

        if (nextFile && file.name === nextFile.name && file.type === nextFile.type) {
            // We can skip 1 ahead
            i++;
            if (file.source !== nextFile.source) {
                modifiedFiles.push(file.name + extension);
            }
        } else if (file.environment === 'local') {
            addedFiles.push(file.name + extension);
        } else if (file.environment === 'remote') {
            deletedFiles.push(file.name + extension);
        }
    }

    // Display something if everything is ok
    if (addedFiles.length === 0 && modifiedFiles.length === 0 && deletedFiles.length === 0) {
        process.stdout.write(`Your local and remote project for '${metadata.name}' are in sync`);
        checkbox.display(`green`);
    } else {
        process.stdout.write(`There are some differences between your local and remote projectfiles for '${metadata.name}'`);
        console.log(``);

        // Display added files
        if (addedFiles.length > 0) {
            console.log(``);
        }
        for (const added of addedFiles) {
            console.log(`   + ${added}`.green);
        }

        // Display modified files
        if (modifiedFiles.length > 0) {
            console.log(``);
        }
        for (const modified of modifiedFiles) {
            console.log(`   ~ ${modified}`.yellow);
        }

        // Display removed files
        if (deletedFiles.length > 0) {
            console.log(``);
        }
        for (const deleted of deletedFiles) {
            console.log(`   - ${deleted}`.red);
        }
        console.log(``);
    }
}
246278
function notifyController($scope, $rootScope) {

    /**
     * Default settings
     */
    var DEFAULT_STATUS = "info";
    var DEFAULT_HEADING = "Browsersync:";
    var DEFAULT_MESSAGE = "Welcome to Browsersync";
    var DEFAULT_TIMEOUT = 2000;

    /**
     * Default state
     * @type {{visible: boolean, status: string, heading: string, text: string}}
     */
    $scope.ui = {
        status: DEFAULT_STATUS,
        heading: DEFAULT_HEADING,
        message: DEFAULT_MESSAGE
    };

    /**
     * @param evt
     * @param data
     */
    $scope.show = function (evt, data) {

        data = data || {};

        /**
         *
         * Clear any previous timers
         *
         */
        if ($scope._timer) {
            clearTimeout($scope._timer);
        }

        /**
         *
         * Set a reset timer
         *
         */
        $scope._timer = window.setTimeout($scope.reset, data.timeout || DEFAULT_TIMEOUT);

        /**
         *
         * Set UI flags
         *
         */
        $scope.ui.visible = true;
        $scope.ui.status = data.status || DEFAULT_STATUS;
        $scope.ui.heading = data.heading || DEFAULT_HEADING;
        $scope.ui.message = data.message || DEFAULT_HEADING;
    };

    /**
     * Reset the UI
     */
    $scope.reset = function () {
        $scope.ui.visible = false;
        $scope.$digest();
    };

    /**
     * Listen to events on the $rootScope
     */
    $rootScope.$on("notify:flash", $scope.show);
}
837895
def show_metadata_converter(self):
        """"""
        from safe.gui.tools.metadata_converter_dialog import (
            MetadataConverterDialog)
        dialog = MetadataConverterDialog(
            parent=self.iface.mainWindow(),
            iface=self.iface,
        )
        dialog.exec_()
223170
function(data, done) {
      if(!this._key) {
        done('no key found for metadata');
        return;
      }
      var key = data[this._key.getName()];
      var ix = -1;
      for(var i = 0; i < this._data.length; i++) {
        if(this._data[i][this._key.getName()] === key) {
          ix = i;
          break;
        }
      }
      if(ix === -1) {
        this._data.push(this._clone(data));
      } else {
        this._data[ix] = this._clone(data);
      }
      done(null);
    }
449930
def on_success(self, metadata):
        
        handler = self.handlers.get("on_success")
        if callable(handler):
            handler(metadata)
        handler = self.handlers.get("on_summary")
        if callable(handler):
            handler()
987576
function (target) {
    if (this.get('isResource') && !this.get('indexChild')) {
      // add index route if it does not exist
      this._route('index');
    }
    this.get('children').forEach(function (meta) {
      var args, methodName, isResource;
      args = [meta.get('name'), {path: meta.get('path')}];
      methodName = meta.get('methodName');
      isResource = meta.get('isResource');
      if (isResource) {
        args.push(meta.get('mapFunction'));
      }
      console[isResource && console.group ? 'group' : 'log'](
        '[enhanced-router] defining ' + meta
      );
      target[methodName].apply(target, args);
      if (isResource && console.group) {
        console.groupEnd();
      }
    });
  }
225652
function(filePath) {

    if( path.extname(filePath) === '.js' ) {
      filePath = path.dirname(filePath);
    }

    ////console.log(colors.gray('loading meta:'), filePath);

    this.filePath = filePath;

    var meta = require(filePath + '/meta');

    //set the name of the class to the last name value
    this.name = meta.name;

    if( typeof this.meta === 'object' ) {
      this.meta = merge(meta, this.meta);
    } else {
      this.meta = meta;
    }
  }
1147734
function(callback) {
      var t = this,
          dirs = [],
          pages = [],
          thisAppName = UI.Server.currentServer.thisAppName;
      callback = callback || function(){};

      // Synchronize the virtual /app directory
      if (t.get('path') === '/app') {
        for (var appName in UI.Server.currentServer.apps) {
          // Don't add me to the /app directory if I'm an app
          if (appName !== thisAppName) {
            var app = UI.Server.currentServer.apps[appName];
            dirs.push({
              id: appName,
              label: app.label || app.description || appName,
              path: Path.join(app.moduleDir, 'site_db', t.CONST.objectClass)
            });
          }
        }

        // Trim directory branches that have no contents
        t.trimDirs(dirs, function(error, trimmed) {
          if (error) {
            callback(error);
          }
          t.set({
            leaves: pages,
            branches: trimmed
          });
          return callback();
        });
        return;
      }

      // Get the directory at this level
      FS.readdir(t.dirPath, function(error, fileNames) {

        // Process errors
        if (error) {
          console.error('TreeProbe readdir error', error);
          return callback(error);
        }

        // Don't show the main 404 page (it's too confusing)
        if (t.CONST.objectClass === 'Page') {
          fileNames = _.reject(fileNames, function(name){
            return name === '404.json';
          });
        }

        // Perform a stat on all files for meta-info
        t.statFiles(fileNames, function(error, fileStats) {

          // Process errors
          if (error) {
            console.error('TreeProbe statFiles error', error);
            return callback(error);
          }

          // Process each file, recording directories and pages
          for (var i = 0, l = fileStats.length; i < l; i++) {
            var name = fileNames[i],
                stat = fileStats[i],
                id = Path.basename(name, '.json'),
                page = {id:id};

            if (stat.isDirectory()) {
              page.path = Path.join(t.dirPath, name);
              dirs.push(page);
            }
            else if (stat.isFile() && Path.extname(name).toLowerCase() === '.json') {
              pages.push(page);
            }
            else {
              console.error('Not a file or directory: ' + name);
            }
          }

          // Read each page for the display label and description
          t.readPages(pages, function(error) {

            // Process errors
            if (error) {
              console.error('PagesProbe readPages error', error);
              return callback(error);
            }

            // Add the virtual /app directory to the root
            if (t.dirPath === t.rootPath) {
              dirs.push({
                id:'app',
                label: t.CONST.appLabel,
                description: t.CONST.appDescription,
                path: Path.dirname(t.dirPath)
              });
            }

            // Trim directory branches that have no contents
            t.trimDirs(dirs, function(error, trimmed) {
              if (error) {
                callback(error);
              }

              t.set({
                leaves: pages,
                branches: trimmed
              });
              return callback();
            });
          });

        });
      });

    }
1237013
function addGitIgnore(rootFolder) {

    // If no .gitignore files exists, add one
    const gitignore = path.join(rootFolder, '.gitignore');
    if (!fs.existsSync(gitignore)) {
        fs.writeFileSync(gitignore, gitignoreContent);
    }
}
1242823
function setBaseUrl(projectBaseUrl) {
        var context = _getProjectViewStateContext();

        projectBaseUrl = model.setBaseUrl(projectBaseUrl);

        PreferencesManager.setViewState("project.baseUrl", projectBaseUrl, context);
    }
902003
static File getProjectArchiveFolder(File rootArchiveFolder, MavenProject project)
  {
    return new File(new File(new File(rootArchiveFolder, "artifacts"), project.getGroupId()), project.getArtifactId());
  }
413311
function MetaData() {

    // the key for the storing
    this.key = null;
    // data to store
    this.value = null;
    // temporary filename for the cached file because filenames cannot represend urls completely
    this.filename = null;
    // expirydate of the entry
    this.expires = null;
    // size of the current entry
    this.size = null;
}
1010157
public void show() {
        if (!(container instanceof RootPanel)) {
            if (!(container instanceof MaterialDialog)) {
                container.getElement().getStyle().setPosition(Style.Position.RELATIVE);
            }
            div.getElement().getStyle().setPosition(Style.Position.ABSOLUTE);
        }
        if (scrollDisabled) {
            RootPanel.get().getElement().getStyle().setOverflow(Style.Overflow.HIDDEN);
        }
        if (type == LoaderType.CIRCULAR) {
            div.setStyleName(CssName.VALIGN_WRAPPER + " " + CssName.LOADER_WRAPPER);
            div.add(preLoader);
        } else if (type == LoaderType.PROGRESS) {
            div.setStyleName(CssName.VALIGN_WRAPPER + " " + CssName.PROGRESS_WRAPPER);
            progress.getElement().getStyle().setProperty("margin", "auto");
            div.add(progress);
        }
        container.add(div);
    }
1295768
function listFile(docRoot) {

    return function (req, res, next) {
        //var folder = path.join(docRoot, req.baseUrl);
        var folder = path.join(docRoot, req.originalUrl);
        if (!fs.existsSync(folder)) {
            res.status(404).send('folder ' + folder + ' doesn\'t exist');
            return;
        }
        // TODO: decide if it is a file or folder
        var stat = fs.statSync(folder);
        if (!stat.isDirectory()) {
            folder = path.dirname(folder);
        }

        var markdown = {content: '', toc: ''};
        var dir = folderUtil.readDir(folder);

        if (stat.isDirectory() && dir.readMe) {
            markdown = render.withToc(fs.readFileSync(dir.readMe, {encoding: 'UTF-8'}));
        }

        res.locals.dir = dir.files;
        res.locals.markdown = markdown;


        next();
    };
}
840294
function(dir) {

        // Return if the node_modules directory doesn't exist.
        try {
          FS.statSync(dir);
        } catch (e) {return;}

        // Check each direcory for a monitor-dashboard app
        FS.readdirSync(dir).forEach(function(moduleName) {

          // See if this is a monitor app, and load if it is
          // then load sub-modules
          var moduleDir = dir + '/' + moduleName;
          if (testAppDir(moduleDir) || moduleName === 'monitor') {

            // If it is a monitor-app, process any sub node_modules
            loadNodeModulesDir(moduleDir + '/node_modules');
          }
        });
      }
418052
def module_root
      metadata_path = find_upwards('metadata.json')
      if metadata_path
        File.dirname(metadata_path)
      elsif in_module_root?
        Dir.pwd
      else
        nil
      end
    end
1049740
function(project, relativeFilePath, appPath){
			var deferred = new Deferred();
			var self = this;

			if(project.ContentLocation === relativeFilePath){
				/* use the project root as deployment path */
				deferred.resolve({
					path: relativeFilePath,
					appPath: appPath
				});

				return deferred;
			}

			/* use the project as deployment path */
			deferred.resolve({
				path: relativeFilePath,
				appPath: appPath || "" /* Note that the appPath has to be updated as well */
			});

			return deferred;
		}