FIX: make configurable from app
188676
function truncateUrl(url, limit) {
  limit = limit || 30
  url = url.replace(/http[s]?:\/\/(www\.)?/i, '')
  if (url.length <= limit) return url
  var segment = Math.floor(limit / 2) - 1
  return url.slice(0, segment) + '..' + url.slice(url.length - segment) 
}
860723
function init(app) {
    var keys = Object.keys(DependenciesMap);
    var allDeps = _.uniq(_.flatten(_.values(DependenciesMap)));

    allDeps.forEach(function (d) {
        if (!_.contains(keys, d)) {
            throw new Error("Unresolved dependency: " + d)
        }
    });


    keys.forEach(function (k) {
        var dep = DependenciesMap[k];
        if (_.contains(dep, k)) {
            throw new Error('Circular dependency: key: ' + k);
        }

        if (dep.length == 0) {
            HandlerArray.push(getHandler(app, k, PluginsData[k]));
        }
    });

    async.series(HandlerArray, function (err, end) {
        if (err)
            throw err;

        saveSchemas(app);
    });
}
1343625
def make_app(env, commandadapter=None):
    
    mconfig = import_module('app.config.%s' % env, pass_errors=True)
    if mconfig is None and paths.app_exists():
        print(colored('Configuration for "%s" environment is not found' % env, 'red'))
        return None
    mstart = import_module('app.start')
    mroutes = import_module('app.routes')
    mcontrollers = import_module('app.controllers')
    before = mstart.before

    return Glim(commandadapter, mconfig, mroutes, mcontrollers, env, before)
227780
def setConfiguration(self, configuration):
        
        """
        if isinstance(configuration, Configuration):
           configuration = configuration.value

        self.dev.set_configuration(configuration)
645691
function ConfigurableTaskFactory(recipes, registry, expose) {
	this.recipes = recipes;
	this.registry = registry;
	this.expose = expose;
}
1371609
protected void configureWebApp () throws Exception
    {
        //finally, finish configuring the webapp
        for (int i=0;i<_configurations.length;i++)
        {
            _configurations[i].setWebApplicationContext(this);
            _configurations[i].configureWebApp();
        }
        
    }
426436
function () {
			if (!this._oViewSettings) {

				// init the view settings
				this._initViewSettings();

				// apply app settings
				this.getOwnerComponent().getEventBus().publish("app", "applyAppConfiguration", {
					themeActive: this._oViewSettings.themeActive,
					compactOn: this._oViewSettings.compactOn
				});

			}
		}
963331
def init_app(self, app):
        
        app.config.setdefault('EDITS_URL', '/edits')
        app.config.setdefault('EDITS_PREVIEW', True)
        app.config.setdefault('EDITS_SUMMERNOTE', False)

        if 'EDITS_PATH' not in app.config:
            raise Exception('EDITS_PATH not set in app configuration.')

        if os.path.isfile(app.config['EDITS_PATH']):
            with open(app.config['EDITS_PATH']) as f:
                _db = json.loads(f.read(), object_pairs_hook=OrderedDict)
        else:
            _db = OrderedDict()

        app.jinja_env.add_extension('flask.ext.edits.EditableExtension')
        app.jinja_env.edits = _db
        app.jinja_env.edits_preview = app.config['EDITS_PREVIEW']
        app.jinja_env.edits_cache = copy_cache(app.jinja_env.cache)

        if app.config['EDITS_PREVIEW']:
            app.jinja_env.cache = None

        app.register_blueprint(edits, url_prefix=app.config['EDITS_URL'])
673698
protected function configureApp ()
    {
        $this->envData['APP_ENV']   = $this->choice ("Choose environment. [local|production]", ['local', 'production'], 0);
        $this->envData['APP_KEY']   = "";
        $this->envData['APP_DEBUG'] = $this->confirm ("Enable debugging?", 'yes') ? "true" : "false";
        $this->envData['APP_URL']   = http_validate($this->ask ("Your application url", "http://localhost") . "\n");
        $this->info('By default application presumes the page is http://');
        //TODO implement the letsEncrypt
    }
527054
def make_app(config=None):
    
    config = config or {}
    app = CoolMagicApplication(config)

    # static stuff
    app = SharedDataMiddleware(
        app, {"/public": path.join(path.dirname(__file__), "public")}
    )

    # clean up locals
    app = local_manager.make_middleware(app)

    return app
795369
def fix_config(self, options):
        
        opt = "incremental"
        if opt not in options:
            options[opt] = False
        if opt not in self.help:
            self.help[opt] = "Whether to load the dataset incrementally (bool)."

        opt = "use_custom_loader"
        if opt not in options:
            options[opt] = False
        if opt not in self.help:
            self.help[opt] = "Whether to use a custom loader."

        opt = "custom_loader"
        if opt not in options:
            options[opt] = converters.Loader(classname="weka.core.converters.ArffLoader")
        if opt not in self.help:
            self.help[opt] = "The custom loader to use (Loader)."

        return super(LoadDataset, self).fix_config(options)
1306547
public static void putAppConfig(String appName, FaultToleranceConfig value) {
        if (appName == null) {
            if (LOGGER.isWarnEnabled()) {
                LOGGER.warn("App name is null when put fault-tolerance config");
            }
            return;
        }
        if (value != null) {
            APP_CONFIGS.put(appName, value);
            if (LOGGER.isInfoEnabled(appName)) {
                LOGGER.infoWithApp(appName, "Get a new resource, value[" + value + "]");
            }
        } else {
            APP_CONFIGS.remove(appName);
            if (LOGGER.isInfoEnabled(appName)) {
                LOGGER.infoWithApp(appName, "Remove a resource, key[" + appName + "]");
            }
        }
        calcEnable();
    }
1275736
function(target, type, listener, configure, trigger, fromOverwrite) {
	configure = configure || {};
	// Check whether target is a configuration variable;
	if (String(target) === "[object Object]") {
		var data = target;
		target = data.target; delete data.target;
		///
		if (data.type && data.listener) {
			type = data.type; delete data.type;
			listener = data.listener; delete data.listener;
			for (var key in data) {
				configure[key] = data[key];
			}
		} else { // specialness
			for (var param in data) {
				var value = data[param];
				if (typeof(value) === "function") continue;
				configure[param] = value;
			}
			///
			var ret = {};
			for (var key in data) {
				var param = key.split(",");
				var o = data[key];
				var conf = {};
				for (var k in configure) { // clone base configuration
					conf[k] = configure[k];
				}
				///
				if (typeof(o) === "function") { // without configuration
					var listener = o;
				} else if (typeof(o.listener) === "function") { // with configuration
					var listener = o.listener;
					for (var k in o) { // merge configure into base configuration
						if (typeof(o[k]) === "function") continue;
						conf[k] = o[k];
					}
				} else { // not a listener
					continue;
				}
				///
				for (var n = 0; n < param.length; n ++) {
					ret[key] = eventjs.add(target, param[n], listener, conf, trigger);
				}
			}
			return ret;
		}
	}
	///
	if (!target || !type || !listener) return;
	// Check for element to load on interval (before onload).
	if (typeof(target) === "string" && type === "ready") {
		if (window.eventjs_stallOnReady) { /// force stall for scripts to load
			type = "load";
			target = window;
		} else { //
			var time = (new Date()).getTime();
			var timeout = configure.timeout;
			var ms = configure.interval || 1000 / 60;
			var interval = window.setInterval(function() {
				if ((new Date()).getTime() - time > timeout) {
					window.clearInterval(interval);
				}
				if (document.querySelector(target)) {
					window.clearInterval(interval);
					setTimeout(listener, 1);
				}
			}, ms);
			return;
		}
	}
	// Get DOM element from Query Selector.
	if (typeof(target) === "string") {
		target = document.querySelectorAll(target);
		if (target.length === 0) return createError("Missing target on listener!", arguments); // No results.
		if (target.length === 1) { // Single target.
			target = target[0];
		}
	}

	/// Handle multiple targets.
	var event;
	var events = {};
	if (target.length > 0 && target !== window) { 
		for (var n0 = 0, length0 = target.length; n0 < length0; n0 ++) {
			event = eventManager(target[n0], type, listener, clone(configure), trigger);
			if (event) events[n0] = event;
		}	
		return createBatchCommands(events);
	}

	/// Check for multiple events in one string.
	if (typeof(type) === "string") {
		type = type.toLowerCase();
		if (type.indexOf(" ") !== -1) {
			type = type.split(" ");
		} else if (type.indexOf(",") !== -1) {
			type = type.split(",");
		}
	}
	
	/// Attach or remove multiple events associated with a target.
	if (typeof(type) !== "string") { // Has multiple events.
		if (typeof(type.length) === "number") { // Handle multiple listeners glued together.
			for (var n1 = 0, length1 = type.length; n1 < length1; n1 ++) { // Array [type]
				event = eventManager(target, type[n1], listener, clone(configure), trigger);
				if (event) events[type[n1]] = event;
			}
		} else { // Handle multiple listeners.
			for (var key in type) { // Object {type}
				if (typeof(type[key]) === "function") { // without configuration.
					event = eventManager(target, key, type[key], clone(configure), trigger);
				} else { // with configuration.
					event = eventManager(target, key, type[key].listener, clone(type[key]), trigger);
				}
				if (event) events[key] = event;
			}
		}
		return createBatchCommands(events);
	} else if (type.indexOf("on") === 0) { // to support things like "onclick" instead of "click"
		type = type.substr(2);
	}

	// Ensure listener is a function.
	if (typeof(target) !== "object") return createError("Target is not defined!", arguments);
	if (typeof(listener) !== "function") return createError("Listener is not a function!", arguments);

	// Generate a unique wrapper identifier.
	var useCapture = configure.useCapture || false;
	var id = getID(target) + "." + getID(listener) + "." + (useCapture ? 1 : 0);
	// Handle the event.
	if (root.Gesture && root.Gesture._gestureHandlers[type]) { // Fire custom event.
		id = type + id;
		if (trigger === "remove") { // Remove event listener.
			if (!wrappers[id]) return; // Already removed.
			wrappers[id].remove();
			delete wrappers[id];
		} else if (trigger === "add") { // Attach event listener.
			if (wrappers[id]) {
				wrappers[id].add();
				return wrappers[id]; // Already attached.
			}
			// Retains "this" orientation.
			if (configure.useCall && !root.modifyEventListener) {
				var tmp = listener;
				listener = function(event, self) {
					for (var key in self) event[key] = self[key];
					return tmp.call(target, event);
				};
			}
			// Create listener proxy.
			configure.gesture = type; 
			configure.target = target;
			configure.listener = listener;
			configure.fromOverwrite = fromOverwrite;
			// Record wrapper.
			wrappers[id] = root.proxy[type](configure); 
		}
		return wrappers[id];
	} else { // Fire native event.
		var eventList = getEventList(type);
		for (var n = 0, eventId; n < eventList.length; n ++) {
			type = eventList[n];
			eventId = type + "." + id;
			if (trigger === "remove") { // Remove event listener.
				if (!wrappers[eventId]) continue; // Already removed.
				target[remove](type, listener, useCapture); 
				delete wrappers[eventId];
			} else if (trigger === "add") { // Attach event listener.
				if (wrappers[eventId]) return wrappers[eventId]; // Already attached.
				target[add](type, listener, useCapture); 
				// Record wrapper.
				wrappers[eventId] = { 
					id: eventId,
					type: type,
					target: target,
					listener: listener,
					remove: function() {
						for (var n = 0; n < eventList.length; n ++) {
							root.remove(target, eventList[n], listener, configure);
						}
					}
				};
			}
		}
		return wrappers[eventId];
	}
}
919075
def init_app(self, app, **kwargs):
        """"""
        self.init_config(app)
        state = _AppState(app=app, cache=kwargs.get('cache'))
        app.extensions['invenio-collections'] = state
        return state
479486
function expander(app) {
  var config = new utils.Expand(app.options);

  config.field('username', 'string', {
    normalize: function(val, key, config, schema) {
      if (utils.isString(val)) return val;
      if (typeof val === 'undefined') {
        schema.update('author', config);
        config.author = config.author || {};
      }

      val = config[key] = utils.repo.username(config, schema.options);
      if (utils.isString(val)) {
        config.author.username = val;
        return val;
      }
    }
  });

  config.field('twitter', 'string', {
    normalize: function(val, key, config, schema) {
      if (utils.isString(val)) return val;
      if (typeof val === 'undefined') {
        schema.update('username', config);
      }
      config.author = config.author || {};
      val = schema.options.twitter || config.author.username;
      if (utils.isString(val)) {
        config.author.twitter = val;
        return val;
      }
    }
  });

  config.field('alias', 'string', {
    normalize: function(val, key, config, schema) {
      var name = config.name || '';
      var toAlias = schema.options.toAlias;
      if (typeof toAlias === 'function') {
        val = toAlias.call(config, name);
      } else {
        val = name.slice(name.lastIndexOf('-') + 1);
        val = utils.camelcase(val);
      }
      config[key] = val;
      set(app, key, val);
      return val;
    }
  });

  config.field('varname', 'string', {
    normalize: function(val, key, config, schema) {
      if (utils.isString(val)) {
        set(app, key, val);
        return val;
      }
      var name = config.name;
      if (typeof schema.options.varname === 'function') {
        config[key] = schema.option.varname(name, config);
      } else {
        config[key] = utils.namify(name);
      }
      val = app.cache.data[key] = config[key];
      set(app, key, val);
      return val;
    }
  });

  if (app.options.config && app.options.config.fields) {
    var fields = app.options.config.fields;

    for (var key in fields) {
      if (fields.hasOwnProperty(key)) {
        config[key] = fields[key];
      }
    }
  }
  return config;
}
894535
def configurate_app(config_file=''):
    
    # Load config
    app.config.from_pyfile('defaults.py')
    app.config.from_pyfile(config_file, silent=True)

    if app.config.get('MINIFY_HTML', False):
        app.jinja_env.add_extension('flask_utils.jinja2htmlcompress.HTMLCompress')

    # Setup web assets
    assets = Environment(app)

    js = Bundle('common.js', filters='jsmin', output='gen/main.%(version)s.js')
    css = Bundle('common.css', filters='cssmin', output='gen/main.%(version)s.css')

    assets.register('js_all', js)
    assets.register('css_all', css)

    # Set host and port
    port = app.config.get('PORT', 5000)
    host = app.config.get('HOST', '127.0.0.1')

    return app, host, port
526172
function ConfigUtil() {

    var self = this; //, mainConfig

    /**
     * Init
     * @contructor
     * */
    var init = function() {

        if ( !ConfigUtil.instance ) {
            try {
                self.paths = getContext('paths')
            } catch (err) {
                self.paths = {}
            }

            var path = new _(__dirname).toUnixStyle();
            self.__dirname =  _( path.substring(0, (path.length - 4)) );

            ConfigUtil.instance = self;
            return self
        } else {
            self = ConfigUtil.instance;
            return ConfigUtil.instance
        }
    }


    /**
     * Set config file if !exists
     *
     * @param {string} app - App name
     * @param {string} file - File to save
     * @param {object} content - JSON content to save
     * */
    this.set = function(app, file, content, callback){
        switch (app) {
            case 'gina':
            case 'gina.utils':
                setFile(app, file, content, function(err){
                    callback(err);
                });
                break;
        }
    }

    /**
     * Get config file if exists
     *
     * @param {string} project - Project name
     * @param {strins} key - File name to save + .ext
     *
     * @callback callback
     * @param {string|boolean} err
     * @param {object} config - Bundle Configuration
     * */
    this.get = function(project, file, callback){

        var config = null, err = false;

        switch (project) {
            case 'gina':
            case 'gina.utils':
                try {
                    //You are under gina.utils/lib/...
                    if ( typeof(self.value) != "undefined" ) {

                        try {
                            config = self.value;//????
                        } catch (err) {
                            err = 'Utils.Config.get(...) : self.value['+file+'] : key not found.\n' + err;
                        }

                    } else {
                        //Getting paths.
                        if ( typeof(self.paths.root) != 'undefined' ) {
                            //console.error("requiring :=> ",  self.paths.root + '/.gna/locals.json');
                            try {
                                config = require(self.paths.root  + '/.gna/' + file);
                                self.value = config;
                                self.paths = config['paths'];

                            } catch (err) {
                                //Means that the file was not found..
                                console.error(err.stack || err.message);
                                err = new Error(self.__dirname  + '/.gna/locals.json: project configuration file not found.');
                                process.exit(1)
                            }
                        }
                    }
                    callback(err, config)

                } catch (err) {
                    var err = new Error('.gna/locals.json: project configuration file not found. \n' + (err.stack||err.message));
                    //logger.error('gina', 'UTILS:CONFIG:ERR:3', err, __stack);
                    callback(err);
                }
                break;

            default :
                callback('Config.get('+project+'): case not found');
        }
    }

    /**
     * Get sync config file if exists
     *
     * @param {string} app - App name
     * @return {object} config - App Configuration
     *
     * @private
     * */
    this.getSync = function(project, file, i){
        var maxRetry    = 7
            , delay     = 300
            , i         = i || 0;

        if (typeof(file) == 'undefined') {
            var file = 'locals.json'
        }

        if ( typeof(self.value) != "undefined" ) {
            return self.value;
        } else {
            var filename = self.paths.root +'/.gna/'+ file;
            if (i > 0) {
                console.debug('retrying [ '+i+' ] to load: ' + filename)
            }

            try {
                if ( fs.existsSync(filename) ) {
                    return require(filename)
                } else {
                    // you might just be experimenting some latencies
                    if (i < maxRetry) {
                        console.debug('retrying to load config after timeout');
                        setTimeout(function(){
                            console.debug('It is time re reload config');
                            self.getSync(project, file, i+1)
                        }, delay);
                        //return
                    } else {
                        var err = new Error(filename+ ' not found');
                        console.emerg(err.stack||err.message);
                        process.exit(1);
                    }
                }
            } catch (err) {
                if (i < maxRetry) {
                    console.debug('(catched) retrying to load config after timeout');
                    setTimeout(function(){
                        console.debug('It is time re reload config');
                        self.getSync(project, file, i+1)
                    }, delay);
                } else {
                    console.error(err.stack);
                    throw new Error(err.message);
                }
            }
        }
    }

    /**
     * Create a config file
     *
     * @param {string} app - Targeted application
     * @param {string} file - File save
     * @param {string} content - Content fo the file to save
     *
     *
     * TOTO - Avoid systematics file override.
     * @private
     * */

    var setFile = function(app, file, content, callback) {

        var paths = {
            root : content.paths.root,
            utils : content.paths.utils
        };
        var gnaFolder = content.paths.root + '/.gna';

        self.project = content.project;

        self.paths = paths;

        //Create path.
        var createFolder = function(){
            if ( fs.existsSync(gnaFolder) ) {
                if ( !fs.existsSync(gnaFolder +'/'+ file) ) {
                    createContent(gnaFolder +'/'+ file, gnaFolder, content, function(err){
                        setTimeout(function(){
                            callback(err)
                        }, 500)
                    })
                } else { // already existing ... won't overwrite
                    callback(false)
                }

            } else {
                fs.mkdir(gnaFolder, 0777, function(err){
                    if (err) {
                        console.error(err.stack);
                        callback(err)
                    } else {
                        //Creating content.
                        createContent(gnaFolder+ '/' +file, gnaFolder, content, function(err){
                            setTimeout(function(){
                                callback(err)
                            }, 500)
                        })
                    }
                })
            }

        };

        fs.exists(gnaFolder, function(exists){
            if (!exists) {
                createFolder()
            } else {
                // test if decalred path matches real path and overwrite if not the same
                // in case you move your project
                var filename        = _(gnaFolder +'/'+ file, true);
                var checksumFileOld = _(gnaFolder +'/'+ math.checkSumSync( JSON.stringify( require(filename) ), 'sha1'), true) + '.txt';
                var checksumFile    = _(gnaFolder +'/'+ math.checkSumSync( JSON.stringify(content), 'sha1'), true) + '.txt';

                var verified        = (checksumFileOld == checksumFile) ? true : false;


                if ( !fs.existsSync(checksumFile) && fs.existsSync(filename) || !fs.existsSync(filename) || !verified) {
                    if ( fs.existsSync(filename) ) fs.unlinkSync(filename);
                    if ( fs.existsSync(checksumFile) ) fs.unlinkSync(checksumFile);

                    createContent(filename, gnaFolder, content, function(err){
                        fs.openSync(checksumFile, 'w');
                        setTimeout(function(){
                            callback(err)
                        }, 500)
                    })
                } else if ( fs.existsSync(filename) ) {

                    var locals = require(gnaFolder +'/'+ file);

                    if (paths.utils != locals.paths.utils) {

                        new _(gnaFolder).rm( function(err){
                            if (err) {
                                console.warn('found error while trying to remove `.gna`\n' + err.stack)
                            }

                            //setTimeout(function(){
                                //console.debug('Done removing `gnaFolder` : '+ gnaFolder);
                            createFolder();
                            //}, 200);
                        })
                    } else {
                        callback(false)// nothing to do
                    }
                } else {
                    callback(false)// nothing to do
                }
            }
        })
    }


    /**
     * Remove symbolic link
     *
     * @param {string} path
     * @callback callback
     *
     * @private
     * */
    var removeSymlink = function(path, callback){

        fs.exists(path, function(exists){
            if (exists) {
                fs.lstat(path, function(err, stats){
                    if (err) console.error(err.stack);

                    if ( stats.isSymbolicLink() ) fs.unlink(path, function(err){
                        if (err) {
                            console.error(err.stack);
                            callback(err)
                        } else {
                            //Trigger.
                            onSymlinkRemoved(self.paths, function(err){
                                if (err) console.error(err.stack);

                                callback(false)
                            })
                        }
                    })
                })
            } else {
                //log & ignore. This is not a real issue.
                //logger.warn('gina', 'UTILS:CONFIG:WARN:1', 'Path not found: ' + path, __stack);
                console.warn( 'Path not found: ' + path, __stack);
                onSymlinkRemoved(self.paths, function(err){
                    //if (err) logger.error('gina', 'UTILS:CONFIG:ERR:9', err, __stack);
                    if (err) console.error(err.stack||err.message);

                    callback(false)
                })
            }
        })
    }

    /**
     * Symbolic link remove event
     *
     * @param {string} [err]
     * @callback callback
     *
     * @private
     * */
    var onSymlinkRemoved = function(paths, callback){
        //Remove original.
        var p = new _(paths.root + '/.gna');
        var path = p.toString();

        //Remove folers.
        fs.exists(path, function(exists){
            //delete when exists.
            if (exists) {
                //console.log("yeah about to delete main folder: ", p.toString());
                //Delete ans die here..
                p.rm(function(err, path){
                    //console.log("receives ", err, path);
                    if (err) {
                        //logger.error('gina', 'UTILS:CONFIG:ERR:8', err, __stack);
                        console.error(err.stack||err.message);
                        callback(err)
                    } else {
                        //logger.info('gina', 'UTILS:CONFIG:INFO:1', path +': deleted with success !');
                        console.info( path +': deleted with success !');
                        callback(false)
                    }
                })
            }
        })
    }

    /**
     * Create content
     *
     * @param {string} filename - Fullpath
     * @content {string} content
     *
     * @private
     * */
    var createContent = function(filename, gnaFolder, content, callback){
        if ( fs.existsSync(filename) ) {
            fs.unlinkSync(filename)
        }
        fs.appendFile(
            filename,
            JSON.stringify(content, null, '\t'),
            null,
            function(err){
                if (err) {
                    //logger.error('gina', 'UTILS:CONFIG:ERR:2', err, __stack);
                    console.error('`Error on while calling createContent()`: ' + err.stack||err.message);
                    callback(err)
                } else {
                    setTimeout(function(){
                        callback(err)
                    }, 1000)
                }
            }//EO function
        )//EO fs.appendFile
    }

    /**
     * Get var value by namespace
     *
     * @param {string} namespace
     * @param {object} [config ] - Config object
     * @return {*} value - Can be String or Array
     *
     * @private
     * */
    var getVar = function(namespace, config) {
        if ( typeof(config) == "undefined" )
            var config = self.getSync(app);

        if (config != null) {
            var split = namespace.split('.'), k=0;
            while (k<split.length) {
                config = config[split[k++]]
            }
            return config
        } else {
            return null
        }
    }

    /**
     * Get path by app & namespance
     *
     * @param {string} app
     * @param {string} namespace
     *
     * @callback callback
     * @param {string} err
     * @param {string} path
     *
     * @private
     * */
    var getPath = function(app, namespace, callback){

        self.get(app, function(err, config){
            if (err) {
                //logger.error('gina', 'UTILS:CONFIG:ERR:4', err, __stack);
                console.error(err.stack||err.message);
                callback(err + 'Utils.Config.get(...)');
            }

            try {
                callback( false, getVar('paths.' + namespace, config) );

            } catch (err) {
                var err = new Error('Config.getPath(app, cat, callback): cat not found');
                callback(err)
            }
        })
    }


    /**
     * Get project name
     *
     * @return {string} projectName
     *
     * */
    this.getProjectName = function(){
        if ( this.paths != undefined && this.paths.root != undefined ) {
            var arr = this.paths.root.split("/");
            return arr[arr.length-1]
        } else {
            return null
        }
    }

    return init()
}