-
-
Notifications
You must be signed in to change notification settings - Fork 228
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add env + config for package + settings locations
fix #229
- Loading branch information
1 parent
83c4029
commit b8aa9a4
Showing
7 changed files
with
190 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
DUB settings & packages directory placement overhauled | ||
|
||
You can now configure where DUB places its downloaded packages and where the user configuration is stored through environment variables or through the dub configuration. You need to use an environment variable or the system-wide dub configuration to specify where the user configuration is stored. | ||
|
||
By default DUB stores the packages on | ||
- Windows: `%APPDATA%/dub/settings.json` + `%LOCALAPPDATA%/dub/packages/` | ||
- Posix: `$HOME/.dub/{packages/,settings.json}` | ||
|
||
now if the `DUB_HOME` environment variable is set it instead stores the packages (and other config) in | ||
- `$DUB_HOME/{packages/,settings.json}` | ||
|
||
alternatively if `DUB_HOME` isn't set, but `DPATH` is set, the following path is used: | ||
- `$DPATH/dub/{packages/,settings.json}` | ||
|
||
The `DPATH` environment variable is intended to be used by all D tooling related things doing user-space installation of things. It can be used to avoid cluttering the home folder. | ||
|
||
Additionally to environment variables it is possible to configure the package placement path + settings.json path through DUB's settings.json file. To configure where the user-editable settings.json is placed you need to adjust the system-wide dub configuration. | ||
|
||
In the settings.json you can set the following fields: | ||
|
||
```json | ||
{ | ||
"dubHome": "/path/to/dub", // sets both package store and config location | ||
|
||
// OR | ||
|
||
"userSettings": "/path/to/dub/settings/folder", | ||
"localRepository": "/path/to/dub/repository/folder" | ||
} | ||
``` | ||
|
||
Additionally, these config paths will have environment variables using the `$VARIABLE` syntax resolved. | ||
|
||
The following list describes which path is going to be picked, from top to bottom, stopping whenever one is found: | ||
|
||
- `$DUB_HOME` environment variable | ||
- `$DPATH` environment variable | ||
- system-wide settings.json: `"userSettings"` property | ||
- system-wide settings.json: `"dubHome"` property (only for userSettings) | ||
- through all settings.json: `"localRepository"` property | ||
- through all settings.json: `"dubHome"` property (only for localRepository) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env bash | ||
|
||
. $(dirname "${BASH_SOURCE[0]}")/common.sh | ||
export DPATH="${CURR_DIR}/dpath-variable/dpath" | ||
rm -rf "$DPATH" | ||
cd ${CURR_DIR}/dpath-variable | ||
${DUB} upgrade | ||
|
||
if [[ ! -f "$DPATH/dub/packages/gitcompatibledubpackage-1.0.1/gitcompatibledubpackage/dub.json" ]]; then | ||
die $LINENO 'Did not get dependencies installed into $DPATH.' | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
dpath |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "dpath-variable", | ||
"dependencies": { | ||
"gitcompatibledubpackage": "1.0.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
void main() | ||
{ | ||
} |