Workspace Service

Summary

Lifecycle

initialize {
	initializeRemoteVaults :=
	if initializeRemoteVaults {
		syncVaults
	}
}
syncVaults {
	workspaces :=
	workspaces.map ws => cloneWorkspace

}
cloneWorkspace {
	git := simpleGit
	git.clone
}

Create Workspace

createWorkspace {
	if useSelfContainedVault {
		createSelfContainedVaultWorkspace
	}
}
createSelfContainedVaultWorkspace(wsRoot, vaults) {
	ws = new WorkspaceService(wsRoot)
	if vaults {
		...
		vaults.map v {standardToSelfContainedVault }

		selfContainedVaults.forEach v {
			ws.createSelfContainedVaultv {
				addToCodeWorkspace: false,
				addToConfig: false
			}
		}
	}
}
createSelfContainedVault {
	...
	note := createRoot
	schema := ...
	vaultPath :=
	...
	// create dendron.yml
	DConfig.getOrCreate(vaultPath)
	WorkspaceConfig.write(vaultPath)
	createGitIgnore
	if addToConfig {
		this.addVault
	}
	if addToCodeWorkspace {
		this.addVaultToCodeWorkspace
	}
}
addVault(vault) {
	vaults := getVaults
	vaults.unshift vault
	ConfigUtils.setVaults(vaults)
}

Reference

standardToSelfContainedVault

if vault.isSelfContained return vault

if vault.remote {
	...
} else {
	vault.fsPath = DEPENDENCIES, LOCAL_DEPENDENCY, basename(vault.fsPath)
	vault.selfContained = true
}
return vault

Cook

Past Tasks


Backlinks