Build our root node here. The root node is special in that it lives below
 the 'endpoints' directory, and so we need to manually check if it exists.
358231
def build_root_node(requester)
      if defined?(self.implementation_root)
        root_endpoint_file = File.join(
          self.implementation_root,
          'root_endpoint.rb'
        )
        if File.file?(root_endpoint_file)
          warn "[DEPRECATION] `root_endpoint.rb` is deprecated. Please use `ABSOLUTE_PATH` in your endpoints."
          # Load it and create our base endpoint
          require(root_endpoint_file)
          # RootEndpoint is the special class name for a root endpoint
          root_node_class = self.implementation_module::RootEndpoint
        else
          # 'root_endpoint.rb' doesn't exist, so create a dummy endpoint
          root_node_class = Saddle::RootEndpoint
        end
      else
        # we don't even have an implementation root, so create a dummy endpoint
        root_node_class = Saddle::RootEndpoint
      end
      root_node_class.new(requester, nil, self)
    end
1123604
def setupnode(overwrite=False):
    
    if not port_is_open():
        if not skip_disable_root():
            disable_root()
        port_changed = change_ssh_port()
    #avoid trying to take shortcuts if setupnode did not finish 
    #on previous execution
    if server_state('setupnode-incomplete'):
        env.overwrite=True
    else: set_server_state('setupnode-incomplete')
    upload_ssh_key()
    restrict_ssh()
    add_repositories()
    upgrade_packages()
    setup_ufw()
    uninstall_packages()
    install_packages()

    upload_etc()
    post_install_package()
    setup_ufw_rules()
    set_timezone()
    set_server_state('setupnode-incomplete',delete=True)
    #stop and start webservers - and reload nginx
    for s in webserver_list():
        stop_webserver(s)
        start_webserver(s)
614713
protected static void buildTree(EndpointPart parent, String[] parts, int index, String endpointType) {
        // Check if operation qualifier is part of last element
        String name = parts[index];
        String qualifier = null;

        if (index == parts.length - 1) {
            qualifier = EndpointUtil.decodeEndpointOperation(parts[index], false);
            name = EndpointUtil.decodeEndpointURI(parts[index]);
        }

        // Check if part is defined in the parent
        EndpointPart child = parent.addChild(name);

        if (index < parts.length - 1) {
            buildTree(child, parts, index + 1, endpointType);
        } else {
            // Check if part has an operation qualifier
            if (qualifier != null) {
                child = child.addChild(qualifier);
                child.setQualifier(true);
            }
            child.setEndpointType(endpointType);
        }
    }
1133832
function () {
        // Find the root node which transform needs update;
        var rootNodeIsDirty = this;
        while (rootNodeIsDirty && rootNodeIsDirty.getParent()
            && rootNodeIsDirty.getParent().transformNeedsUpdate()
        ) {
            rootNodeIsDirty = rootNodeIsDirty.getParent();
        }
        rootNodeIsDirty.update();
    }
194623
protected void createRootNode() {
		final Node<K, V> node = createLeafNode();
		node.allocId();
		rootIdx = node.id;
		height = 1;
		elements = 0;
		putNode(node);
	}
4618
function create_node_in_parent(error, parentDirectoryNode) {
    if(error) {
      callback(error);
    } else if(parentDirectoryNode.type !== NODE_TYPE_DIRECTORY) {
      callback(new Errors.ENOTDIR('a component of the path prefix is not a directory', path));
    } else {
      parentNode = parentDirectoryNode;
      find_node(context, path, check_if_node_exists);
    }
  }
301658
def ensure_working_tree(self):
        
        if not self.supports_working_tree:
            raise MissingWorkingTreeError(compact("""
                A working tree is required but the local {friendly_name}
                repository at {directory} doesn't support a working tree!
            """, friendly_name=self.friendly_name, directory=format_path(self.local)))
88103
protected function checkRootNode()
    {
        $id = (int)Application::getRequest()->get('id');

        $repository = $this->getEntityManager()->getRepository($this->entityName);
        /** @var $node Category */
        if ($node = $repository->find($id)) {
            return $node->getLevel() > 1;
        }

        return false;
    }
1243489
def _build_and_attach_node(endpoint_class, method_name=nil)
      # Create the new endpoint
      endpoint_instance = endpoint_class.new(@requester, method_name, self)
      # Attach the endpoint as an instance variable and method
      method_name ||= endpoint_class.name.demodulize.underscore
      self.instance_variable_set("@#{method_name}", endpoint_instance)
      self.define_singleton_method(method_name.to_s) { endpoint_instance }
      endpoint_instance
    end
294901
@Override
    public void checkRepositoryStatus() throws IOException {
        if (!exists(null)) {
            throw new FileNotFoundException("Could not find " + _root);
        }
        if (!hasChildren(null)) {
            throw new IOException("The root (" + _root + " is not a directory ");
        }
    }
718952
def build(self, *args, **kwargs):
        """"""
        # Allocate here if not done yet!
        if not self.allocated: self.allocate()

        self.indir.makedirs()
        self.outdir.makedirs()
        self.tmpdir.makedirs()

        # Check the nodeid file in workdir
        nodeid_path = os.path.join(self.workdir, ".nodeid")

        if os.path.exists(nodeid_path):
            with open(nodeid_path, "rt") as fh:
                node_id = int(fh.read())

            if self.node_id != node_id:
                msg = ("\nFound node_id %s in file:\n\n  %s\n\nwhile the node_id of the present flow is %d.\n"
                       "This means that you are trying to build a new flow in a directory already used by another flow.\n"
                       "Possible solutions:\n"
                       "   1) Change the workdir of the new flow.\n"
                       "   2) remove the old directory either with `rm -r` or by calling the method flow.rmtree()\n"
                        % (node_id, nodeid_path, self.node_id))
                raise RuntimeError(msg)

        else:
            with open(nodeid_path, "wt") as fh:
                fh.write(str(self.node_id))

        if self.pyfile and os.path.isfile(self.pyfile):
            shutil.copy(self.pyfile, self.workdir)

        for work in self:
            work.build(*args, **kwargs)
1364093
def _internal_build(self):
        
        self.nodes = self.__tree.Nodes()
        self.edges = self.__tree.Edges()
        self.augmentedEdges = {}
        for key, val in self.__tree.AugmentedEdges().items():
            self.augmentedEdges[key] = list(val)
        self.root = self.__tree.Root()

        seen = set()
        self.branches = set()

        # Find all of the branching nodes in the tree, degree > 1
        # That is, they appear in more than one edge
        for e1, e2 in self.edges:
            if e1 not in seen:
                seen.add(e1)
            else:
                self.branches.add(e1)

            if e2 not in seen:
                seen.add(e2)
            else:
                self.branches.add(e2)

        # The nodes that are not branches are leaves
        self.leaves = set(self.nodes.keys()) - self.branches
        self.leaves.remove(self.root)
1282723
def add_node(namespace_inc_global, body, opts = {})
      data, _status_code, _headers = add_node_with_http_info(namespace_inc_global, body, opts)
      return data
    end
842942
def set_project_nodes(self, root_node, maximum_depth=1):
        

        root_directory = root_node.path
        for parent_directory, directories, files in foundations.walkers.depth_walker(root_directory, maximum_depth):
            if parent_directory == root_directory:
                parent_node = root_node
            else:
                parent_node = foundations.common.get_first_item(
                    [node for node in foundations.walkers.nodes_walker(root_node)
                     if node.family == "Directory" and node.path == parent_directory])

            if not parent_node:
                continue

            paths = [node.path for node in parent_node.children]
            for directory in sorted(directories):
                if directory.startswith("."):
                    continue

                path = os.path.join(parent_directory, directory)
                if path in paths:
                    continue

                directory_node = self.register_directory(path, parent_node)

            for file in sorted(files):
                if file.startswith("."):
                    continue

                path = os.path.join(parent_directory, file)
                if path in paths:
                    continue

                if foundations.io.is_readable(path):
                    if foundations.io.is_binary_file(path):
                        continue

                file_node = self.register_file(path, parent_node)
1158837
def create_new_node(project_root, environment)
      # Ask the hostname for node
      hostname = ask_not_existing_hostname(project_root, environment)
      # Ask IP for node
      ip = ask_ip(environment)
      # Node creation
      node = Bebox::Node.new(environment, project_root, hostname, ip)
      output = node.create
      ok _('wizard.node.creation_success')
      return output
    end
257655
def BuildNodes(self, nodes):
        
        if self.logstream is not None:
            # override stdout / stderr to write in log file
            oldStdout = sys.stdout
            sys.stdout = self.logstream
            oldStderr = sys.stderr
            sys.stderr = self.logstream

        # the engine assumes the current path is the SConstruct directory ...
        old_fs_dir = SConfFS.getcwd()
        old_os_dir = os.getcwd()
        SConfFS.chdir(SConfFS.Top, change_os_dir=1)

        # Because we take responsibility here for writing out our
        # own .sconsign info (see SConfBuildTask.execute(), above),
        # we override the store_info() method with a null place-holder
        # so we really control how it gets written.
        for n in nodes:
            n.store_info = 0
            if not hasattr(n, 'attributes'):
                n.attributes = SCons.Node.Node.Attrs()
            n.attributes.keep_targetinfo = 1

        ret = 1

        try:
            # ToDo: use user options for calc
            save_max_drift = SConfFS.get_max_drift()
            SConfFS.set_max_drift(0)
            tm = SCons.Taskmaster.Taskmaster(nodes, SConfBuildTask)
            # we don't want to build tests in parallel
            jobs = SCons.Job.Jobs(1, tm )
            jobs.run()
            for n in nodes:
                state = n.get_state()
                if (state != SCons.Node.executed and
                    state != SCons.Node.up_to_date):
                    # the node could not be built. we return 0 in this case
                    ret = 0
        finally:
            SConfFS.set_max_drift(save_max_drift)
            os.chdir(old_os_dir)
            SConfFS.chdir(old_fs_dir, change_os_dir=0)
            if self.logstream is not None:
                # restore stdout / stderr
                sys.stdout = oldStdout
                sys.stderr = oldStderr
        return ret
478694
function findRoot() {

  let rootPath;

  try {
    rootPath = glob.sync('../**/Drupal.php', {ignore: ['../vendor/**', '../node_modules/**']});
  } catch (err) {
    throw new Error('No Drupal root found.');
  }

  // If we found no results for Drupal.php..then bomb out.
  if (rootPath.length === 0) {
    throw new Error('No Drupal root found.');
  }

  // Glob returns an array, even though we've only got one item.
  rootPath = rootPath[0];

  const filePathParts = rootPath.split(path.sep);
  const coreDirPosition = filePathParts.indexOf('core');

  // If we found a Drupal.php file, but no core directory..then bomb out.
  if (coreDirPosition === -1) {
    throw new Error('No Drupal root found.');
  }

  return filePathParts.slice(0, coreDirPosition).join(path.sep);

}