Install components from components.json file.
761474
protected function installFromFile()
    {
        if (!file_exists($path = base_path('components.json'))) {
            $this->error("File 'components.json' does not exist in your project root.");

            return;
        }

        $components = Json::make($path);

        $dependencies = $components->get('require', []);

        foreach ($dependencies as $component) {
            $component = collect($component);

            $this->install(
                $component->get('name'),
                $component->get('version'),
                $component->get('type')
            );
        }
    }
959660
private function loadComponents()
    {
        if (!$this->componentsloaded) {
            foreach ($this->getSettings()->getComponents() as $componentClass) {
                $component = new $componentClass();
                if ($component instanceof ComponentInterface) {
                    $this->addComponent($component);
                }
            }
            $this->componentsloaded = true;
        }
    }
720370
def update_install_json():
        """"""
        if not os.path.isfile('install.json'):
            return

        with open('install.json', 'r') as f:
            install_json = json.load(f)

        if install_json.get('programMain'):
            install_json['programMain'] = 'run'

        # update features
        install_json['features'] = ['aotExecutionEnabled', 'appBuilderCompliant', 'secureParams']

        with open('install.json', 'w') as f:
            json.dump(install_json, f, indent=2, sort_keys=True)
1257370
public function install()
    {
        $this->ensureComponentDirectoryExists();
        $this->updatePackages();
        $this->updateWebpackConfiguration();
        $this->updateBootstrapping();
        $this->updateComponent();
        $this->removeNodeModules();
    }
723353
def install(
        config_file, store,
        overwrite=False, hooks=False, hook_type='pre-commit',
        skip_on_missing_conf=False,
):
    """"""
    if cmd_output('git', 'config', 'core.hooksPath', retcode=None)[1].strip():
        logger.error(
            'Cowardly refusing to install hooks with `core.hooksPath` set.\n'
            'hint: `git config --unset-all core.hooksPath`',
        )
        return 1

    hook_path, legacy_path = _hook_paths(hook_type)

    mkdirp(os.path.dirname(hook_path))

    # If we have an existing hook, move it to pre-commit.legacy
    if os.path.lexists(hook_path) and not is_our_script(hook_path):
        shutil.move(hook_path, legacy_path)

    # If we specify overwrite, we simply delete the legacy file
    if overwrite and os.path.exists(legacy_path):
        os.remove(legacy_path)
    elif os.path.exists(legacy_path):
        output.write_line(
            'Running in migration mode with existing hooks at {}\n'
            'Use -f to use only pre-commit.'.format(legacy_path),
        )

    params = {
        'CONFIG': config_file,
        'HOOK_TYPE': hook_type,
        'INSTALL_PYTHON': sys.executable,
        'SKIP_ON_MISSING_CONFIG': skip_on_missing_conf,
    }

    with io.open(hook_path, 'w') as hook_file:
        contents = resource_text('hook-tmpl')
        before, rest = contents.split(TEMPLATE_START)
        to_template, after = rest.split(TEMPLATE_END)

        before = before.replace('#!/usr/bin/env python3', shebang())

        hook_file.write(before + TEMPLATE_START)
        for line in to_template.splitlines():
            var = line.split()[0]
            hook_file.write('{} = {!r}\n'.format(var, params[var]))
        hook_file.write(TEMPLATE_END + after)
    make_executable(hook_path)

    output.write_line('pre-commit installed at {}'.format(hook_path))

    # If they requested we install all of the hooks, do so.
    if hooks:
        install_hooks(config_file, store)

    return 0
1202629
function install(definition, Component) {
  const Ctor = register(definition, Component);

  // no dependencies
  if (!definition.components) {
    return Ctor;
  }

  const components = definition.components || {};

  // avoid unnecessary re-registering for next time
  delete definition.components;

  // register components
  for (const name in components) {
    Ctor.component(name, register(components[name], Component));
    install(components[name], Component);
  }

  return Ctor;
}
984019
function install (presetName) {
  debug('run install from scripts, arguments: %o', arguments)

  const name = presetName || tryRequire(/elint-preset-/)[0]

  if (!name) {
    debug('can not fount preset, return')
    return
  }

  const nodeModulesDir = getNodeModulesDir()
  const keep = process.env.npm_config_keep || ''
  const presetModulePath = path.join(nodeModulesDir, name)

  link(presetModulePath, keep)
}
812278
def load_install_json(self, filename=None):
        
        if filename is None:
            filename = 'install.json'

        file_fqpn = os.path.join(self.app_path, filename)
        install_json = None
        if os.path.isfile(file_fqpn):
            try:
                with open(file_fqpn, 'r') as fh:
                    install_json = json.load(fh)
            except ValueError as e:
                self.handle_error('Failed to load "{}" file ({}).'.format(file_fqpn, e))
        else:
            self.handle_error('File "{}" could not be found.'.format(file_fqpn))
        return install_json
798676
public static function setup(): void
    {
        $aComponents          = Components::available();
        self::$aContainers    = [];
        self::$aLoadedHelpers = [];
        $aDiscoveredServices  = [
            'nails/common' => self::findServicesForComponent('nails/common'),
        ];

        foreach ($aComponents as $oComponent) {
            $aDiscoveredServices[$oComponent->slug] = self::findServicesForComponent($oComponent->slug);
        }

        $aDiscoveredServices['app'] = self::findServicesForApp();
        $aDiscoveredServices        = array_filter($aDiscoveredServices);

        foreach ($aDiscoveredServices as $sComponentName => $aComponentServices) {

            //  Properties
            if (!empty($aComponentServices['properties'])) {
                if (empty(self::$aContainers[$sComponentName]['properties'])) {
                    self::$aContainers[$sComponentName]['properties'] = new Container();
                }
                foreach ($aComponentServices['properties'] as $sKey => $mValue) {
                    self::$aContainers[$sComponentName]['properties'][$sKey] = $mValue;
                }
            }

            // --------------------------------------------------------------------------

            /**
             * SERVICES
             * All services are wrapped in a closure, this is so that on fetch we can
             * pass in any additional arguments as parameters which can be used in the
             * item's constructor
             */
            if (!empty($aComponentServices['services'])) {
                if (empty(self::$aContainers[$sComponentName]['services'])) {
                    self::$aContainers[$sComponentName]['services'] = new Container();
                }
                foreach ($aComponentServices['services'] as $sKey => $cCallable) {
                    self::$aContainers[$sComponentName]['services'][$sKey] = function () use ($sKey, $cCallable) {
                        return $cCallable;
                    };;
                }
            }

            // --------------------------------------------------------------------------

            /**
             * MODELS
             * All models are wrapped in a closure, this is so that on fetch we can
             * pass in any additional arguments as parameters which can be used in the
             * item's constructor
             */
            if (!empty($aComponentServices['models'])) {
                if (empty(self::$aContainers[$sComponentName]['models'])) {
                    self::$aContainers[$sComponentName]['models'] = new Container();
                }
                foreach ($aComponentServices['models'] as $sKey => $cCallable) {
                    self::$aContainers[$sComponentName]['models'][$sKey] = function () use ($cCallable) {
                        return $cCallable;
                    };
                }
            }

            // --------------------------------------------------------------------------

            /**
             * FACTORIES
             * All factories are wrapped in a closure, this is so that on fetch we can
             * pass in any additional arguments as parameters which can be used in the
             * item's constructor
             */
            if (!empty($aComponentServices['factories'])) {
                if (empty(self::$aContainers[$sComponentName]['factories'])) {
                    self::$aContainers[$sComponentName]['factories'] = new Container();
                }
                foreach ($aComponentServices['factories'] as $sKey => $cCallable) {

                    $cWrapper = function () use ($cCallable) {
                        return $cCallable;
                    };

                    self::$aContainers[$sComponentName]['factories'][$sKey] = self::$aContainers[$sComponentName]['factories']
                        ->factory($cWrapper);
                }
            }

            // --------------------------------------------------------------------------

            /**
             * FACTORIES
             * All factories are wrapped in a closure, this is so that on fetch we can
             * pass in any additional arguments as parameters which can be used in the
             * item's constructor
             */
            if (!empty($aComponentServices['resources'])) {
                if (empty(self::$aContainers[$sComponentName]['resources'])) {
                    self::$aContainers[$sComponentName]['resources'] = new Container();
                }
                foreach ($aComponentServices['resources'] as $sKey => $cCallable) {

                    $cWrapper = function () use ($cCallable) {
                        return $cCallable;
                    };

                    self::$aContainers[$sComponentName]['resources'][$sKey] = self::$aContainers[$sComponentName]['resources']
                        ->factory($cWrapper);
                }
            }
        }
    }
993412
def install_frontend(instance='default', forcereload=False, forcerebuild=False,
                     forcecopy=True, install=True, development=False, build_type='dist'):
    """"""

    hfoslog("Updating frontend components", emitter='BUILDER')
    components = {}
    loadable_components = {}
    # TODO: Fix this up, it is probably not a sane way to get at the real root
    if development:
        frontendroot = os.path.abspath(os.path.dirname(os.path.realpath(
            __file__)) + "../../../frontend")
    else:
        frontendroot = '/opt/hfos/frontend'
    frontendtarget = os.path.join('/var/lib/hfos', instance, 'frontend')

    if install:
        cmdline = ["npm", "install"]

        hfoslog("Running", cmdline, lvl=verbose,
                emitter='BUILDER')
        npminstall = Popen(cmdline, cwd=frontendroot)
        out, err = npminstall.communicate()

        npminstall.wait()

        hfoslog("Frontend dependency installing done: ", out,
                err, lvl=debug, emitter='BUILDER')

    if True:  # try:
        from pkg_resources import iter_entry_points

        entry_point_tuple = (
            iter_entry_points(group='hfos.base', name=None),
            iter_entry_points(group='hfos.sails', name=None),
            iter_entry_points(group='hfos.components', name=None)
        )

        for iterator in entry_point_tuple:
            for entry_point in iterator:
                try:
                    name = entry_point.name
                    location = entry_point.dist.location
                    loaded = entry_point.load()

                    hfoslog("Entry point: ", entry_point,
                            name,
                            entry_point.resolve().__module__, lvl=debug,
                            emitter='BUILDER')
                    component_name = entry_point.resolve().__module__.split('.')[1]

                    hfoslog("Loaded: ", loaded, lvl=verbose, emitter='BUILDER')
                    comp = {
                        'location': location,
                        'version': str(entry_point.dist.parsed_version),
                        'description': loaded.__doc__
                    }

                    frontend = os.path.join(location, 'frontend')
                    hfoslog("Checking component frontend parts: ",
                            frontend, lvl=verbose, emitter='BUILDER')
                    if os.path.isdir(
                            frontend) and frontend != frontendroot:
                        comp['frontend'] = frontend
                    else:
                        hfoslog("Component without frontend "
                                "directory:", comp, lvl=debug,
                                emitter='BUILDER')

                    components[component_name] = comp
                    loadable_components[component_name] = loaded

                    hfoslog("Loaded component:", comp, lvl=verbose,
                            emitter='BUILDER')

                except Exception as e:
                    hfoslog("Could not inspect entrypoint: ", e,
                            type(e), entry_point, iterator, lvl=error,
                            exc=True, emitter='BUILDER')

    # except Exception as e:
    #    hfoslog("Error: ", e, type(e), lvl=error, exc=True, emitter='BUILDER')
    #    return

    hfoslog('Components after lookup:', sorted(list(components.keys())), emitter='BUILDER')

    def _update_frontends(install=True):
        hfoslog("Checking unique frontend locations: ",
                loadable_components, lvl=debug, emitter='BUILDER')

        importlines = []
        modules = []

        for name, component in components.items():
            if 'frontend' in component:
                origin = component['frontend']

                target = os.path.join(frontendroot, 'src', 'components',
                                      name)
                target = os.path.normpath(target)

                if install:
                    reqfile = os.path.join(origin, 'requirements.txt')

                    if os.path.exists(reqfile):
                        # TODO: Speed this up by collecting deps first then doing one single install call
                        hfoslog("Installing package dependencies", lvl=debug,
                                emitter='BUILDER')
                        with open(reqfile, 'r') as f:
                            cmdline = ["npm", "install"]
                            for line in f.readlines():
                                cmdline.append(line.replace("\n", ""))

                            hfoslog("Running", cmdline, lvl=verbose,
                                    emitter='BUILDER')
                            npminstall = Popen(cmdline, cwd=frontendroot)
                            out, err = npminstall.communicate()

                            npminstall.wait()

                            hfoslog("Frontend installing done: ", out,
                                    err, lvl=debug, emitter='BUILDER')

                # if target in ('/', '/boot', '/usr', '/home', '/root',
                # '/var'):
                #    hfoslog("Unsafe frontend deletion target path, "
                #            "NOT proceeding! ", target, lvl=critical,
                #            emitter='BUILDER')

                hfoslog("Copying:", origin, target, lvl=debug,
                        emitter='BUILDER')

                copytree(origin, target)

                for modulefilename in glob(target + '/*.module.js'):
                    modulename = os.path.basename(modulefilename).split(
                        ".module.js")[0]
                    line = u"import {s} from './components/{p}/{" \
                           u"s}.module';\nmodules.push({s});\n".format(
                        s=modulename, p=name)
                    if modulename not in modules:
                        importlines += line
                        modules.append(modulename)
            else:
                hfoslog("Module without frontend:", name, component,
                        lvl=debug, emitter='BUILDER')

        with open(os.path.join(frontendroot, 'src', 'main.tpl.js'),
                  "r") as f:
            main = "".join(f.readlines())

        parts = main.split("/* COMPONENT SECTION */")
        if len(parts) != 3:
            hfoslog("Frontend loader seems damaged! Please check!",
                    lvl=critical, emitter='BUILDER')
            return

        try:
            with open(os.path.join(frontendroot, 'src', 'main.js'),
                      "w") as f:
                f.write(parts[0])
                f.write("/* COMPONENT SECTION:BEGIN */\n")
                for line in importlines:
                    f.write(line)
                f.write("/* COMPONENT SECTION:END */\n")
                f.write(parts[2])
        except Exception as e:
            hfoslog("Error during frontend package info writing. Check "
                    "permissions! ", e, lvl=error, emitter='BUILDER')

    def _rebuild_frontend():
        hfoslog("Starting frontend build.", lvl=warn, emitter='BUILDER')

        npmbuild = Popen(["npm", "run", build_type], cwd=frontendroot)
        out, err = npmbuild.communicate()
        try:
            npmbuild.wait()
        except Exception as e:
            hfoslog("Error during frontend build", e, type(e),
                    exc=True, lvl=error, emitter='BUILDER')
            return

        hfoslog("Frontend build done: ", out, err, lvl=debug, emitter='BUILDER')

        copytree(os.path.join(frontendroot, build_type),
                 frontendtarget, hardlink=False)
        copytree(os.path.join(frontendroot, 'assets'),
                 os.path.join(frontendtarget, 'assets'),
                 hardlink=False)

        hfoslog("Frontend deployed", emitter='BUILDER')

    hfoslog("Checking component frontend bits in ", frontendroot,
            lvl=verbose, emitter='BUILDER')

    _update_frontends(install=install)
    if forcerebuild:
        _rebuild_frontend()

    hfoslog("Done: Install Frontend", emitter='BUILDER')
222493
private Map<String, Component> getComponents(JsonNode componentsNode) {
        Iterator<JsonNode> it = componentsNode.iterator();
        Map<String, Component> components = Maps.newHashMap();

        while(it.hasNext()){
            JsonNode componentNode = it.next();
            JsonNode pathNode = componentNode.path("path");
            JsonNode moduleNode = componentNode.path("moduleKey");
            components.put(componentNode.path("key").asText(),
                    new Component(pathNode.asText(), moduleNode.isMissingNode()?null:moduleNode.asText()));
        }

        return components;
    }
1217172
function install(Vue, options) {
  Vue.mixin(mixin);
  if (options && options.templates) {
    extendTemplates(options.templates);
  }
  if (options && options.mode) {
    setMode(options.mode);
  }
  if (options && options.Promise) {
    mixin.Promise = options.Promise;
  }
}
179647
function (component) {
            var pathParts = component === 'app' ? ['app'] : ['components'];
            if (component !== 'app') {
                pathParts.push(component);
            }
            pathParts.push('assets');

            return path.resolve(LAZO.FILE_REPO_PATH + path.sep + path.join.apply(this, pathParts));
        }
1100279
function loadComponentFile (meta, key, filepath, messages) {
  const ext = path.extname(filepath).slice(1)
  const loader = fileLoaders[ext] || fileLoaders.DEFAULT

  return loader(meta, key, filepath, messages)
}
380142
def build_components(components):
    
    component_list = []

    for comp in components:
        component = ea.Component()

        # id
        component.id = comp.get('id')

        # type
        component.type = comp.get('type')

        # asset, if available
        component.asset = comp.get('asset')

        # DOI
        component.doi = comp.get('doi')

        if component_title(comp) != '':
            component.title = component_title(comp)

        # Subtitle
        if comp.get('type') in ['supplementary-material', 'fig']:

            if comp.get('full_caption'):
                subtitle = comp.get('full_caption')
                subtitle = clean_abstract(subtitle)
                component.subtitle = subtitle

        # Mime type
        if comp.get('type') in ['abstract', 'table-wrap', 'sub-article',
                                'chem-struct-wrap', 'boxed-text']:
            component.mime_type = 'text/plain'
        if comp.get('type') in ['fig']:
            component.mime_type = 'image/tiff'
        elif comp.get('type') in ['media', 'supplementary-material']:
            if comp.get('mimetype') and comp.get('mime-subtype'):
                component.mime_type = (comp.get('mimetype') + '/'
                                       + comp.get('mime-subtype'))

        # Permissions
        component.permissions = comp.get('permissions')

        # Append it to our list of components
        component_list.append(component)

    return component_list
232125
def eager_load_components!
      $LOAD_PATH.each do |path|
        next unless path.match(/\/components$/)

        glob = File.join(path, '**', '*_component.rb')

        Dir[glob].each do |file|
          load(file)
        end
      end
    end
943405
public static function install()
    {
        static::updatePackages();
        static::updateBootstrapping();

        tap(new Filesystem, function ($filesystem) {
            $filesystem->deleteDirectory(resource_path('js/components'));
            $filesystem->delete(resource_path('sass/_variables.scss'));
            $filesystem->deleteDirectory(base_path('node_modules'));
            $filesystem->deleteDirectory(public_path('css'));
            $filesystem->deleteDirectory(public_path('js'));
        });
    }