Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
6
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
V
vitis
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
6
Issues
6
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Eugene 'Vindex' Stulin
vitis
Commits
f724bef8
Commit
f724bef8
authored
Dec 03, 2019
by
Eugene 'Vindex' Stulin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Symlinks (aliases) to categories doesn't have '/' in path ending from now
parent
67af3772
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
23 deletions
+27
-23
source/module_assign.d
source/module_assign.d
+10
-6
source/module_vitis_base.d
source/module_vitis_base.d
+2
-2
testing/testing.sh
testing/testing.sh
+15
-15
No files found.
source/module_assign.d
View file @
f724bef8
...
...
@@ -234,7 +234,8 @@ void assignAliases(string category,
auto
pseudonymPath
=
vpath
~
pseudonym
;
if
(!
exists
(
pseudonymPath
))
{
symlink
(
getCatDirPath
(
category
),
vpath
~
pseudonym
);
string
catDir
=
category
.
getCatDirPath
.
stripRight
(
'/'
);
symlink
(
catDir
,
vpath
~
pseudonym
);
continue
;
}
"warning"
.
tprintln
(
pseudonym
~
": this category already exists."
.
_s
);
...
...
@@ -251,7 +252,8 @@ void assignAliases(string category,
if
(!
userDenial
&&
(
answer
||
userConfirmation
))
{
"simple"
.
tprintln
(
"The categories are combining."
.
_s
);
combineCategories
(
category
,
pseudonym
);
symlink
(
getCatDirPath
(
category
),
vpath
~
pseudonym
);
string
catDir
=
category
.
getCatDirPath
.
stripRight
(
'/'
);
symlink
(
catDir
,
vpath
~
pseudonym
);
}
else
{
"warning"
.
tprintln
(
"The request is skipped."
.
_s
);
}
...
...
@@ -260,7 +262,6 @@ void assignAliases(string category,
void
combineCategories
(
string
mainCategory
,
string
oldCategory
)
{
string
pathToMainCategory
=
getCatDirPath
(
mainCategory
);
string
pathToOldCategory
=
getCatDirPath
(
oldCategory
);
string
[]
catDirList
=
amalthea
.
fs
.
getDirListRecurse
(
pathToOldCategory
);
catDirList
=
pathToOldCategory
~
catDirList
;
...
...
@@ -269,7 +270,8 @@ void combineCategories(string mainCategory, string oldCategory) {
string
oldSubcategory
=
oldCategory
~
"/"
~
currSubcategory
;
string
newSubcategory
=
mainCategory
~
"/"
~
currSubcategory
;
createNonExistentCategory
(
newSubcategory
,
true
,
false
);
string
pathToNewSubcategory
=
getCatDirPath
(
newSubcategory
);
string
pathToNewSubcategory
;
pathToNewSubcategory
=
newSubcategory
.
getCatDirPath
.
stripRight
(
'/'
);
if
(
oldSubcategory
.
isGlobalSubCategory
)
{
auto
globPath
=
getCatDirPath
(
oldSubcategory
.
baseName
);
globPath
=
globPath
.
stripRight
(
'/'
);
...
...
@@ -493,6 +495,8 @@ void assignCategoriesToNetLinks(string[] categories,
* The function assigns new name for the category.
*/
void
assignNewNameToCategory
(
string
category
,
string
newName
)
{
category
=
category
.
stripRight
(
'/'
);
newName
=
newName
.
stripRight
(
'/'
);
string
msg
;
if
(
getCatDirPath
(
category
).
empty
)
{
msg
=
category
~
": this category doesn't exist."
.
_s
;
...
...
@@ -515,12 +519,12 @@ void assignNewNameToCategory(string category, string newName) {
if
(!
msg
.
empty
)
throw
new
FileWarning
(
msg
);
string
categoryPath
=
getCatDirPath
(
category
);
string
categoryPath
=
getCatDirPath
(
category
)
.
stripRight
(
'/'
)
;
string
superCategory
=
std
.
path
.
dirName
(
vpath
~
newName
);
if
(!
superCategory
.
exists
)
{
std
.
file
.
mkdirRecurse
(
superCategory
);
}
std
.
file
.
rename
(
categoryPath
.
stripRight
(
'/'
)
,
vpath
~
newName
);
std
.
file
.
rename
(
categoryPath
,
vpath
~
newName
);
categoryPath
=
vpath
~
newName
;
if
(
newName
.
canFind
(
'/'
))
{
...
...
source/module_vitis_base.d
View file @
f724bef8
...
...
@@ -347,10 +347,10 @@ bool isGlobalSubCategory(string thing) {
if
(!
thing
.
canFind
(
"/"
))
{
//only: cat/subcat
return
false
;
}
auto
fullPath
=
getCatDirPath
(
thing
);
auto
fullPath
=
getCatDirPath
(
thing
)
.
stripRight
(
'/'
)
;
auto
globPath
=
getCatDirPath
(
thing
.
baseName
).
stripRight
(
'/'
);
if
(
fullPath
.
empty
||
globPath
.
empty
)
return
false
;
if
(
globPath
.
isSymlink
&&
globPath
.
readLink
==
fullPath
)
{
if
(
globPath
.
isSymlink
&&
globPath
.
readLink
.
stripRight
(
'/'
)
==
fullPath
)
{
return
true
;
}
return
false
;
...
...
testing/testing.sh
View file @
f724bef8
...
...
@@ -585,7 +585,7 @@ case_2_1_1() {
$vitis
create Moon
$OPTCONF
CMD
=
"
$vitis
assign Moon -a Luna"
$CMD
$OPTCONF
if
[[
-L
${
VTS
}
/Luna
&&
`
readlink
${
VTS
}
/Luna
`
==
${
VTS
}
/Moon
/
]]
;
then
if
[[
-L
${
VTS
}
/Luna
&&
`
readlink
${
VTS
}
/Luna
`
==
${
VTS
}
/Moon
]]
;
then
pass
"
${
CMD
}
"
else
fail
"
${
CMD
}
"
...
...
@@ -598,7 +598,7 @@ case_2_1_2() {
$vitis
create Moon
$OPTCONF
CMD
=
"
$vitis
assign -c Moon -a Luna"
$CMD
$OPTCONF
if
[[
-L
${
VTS
}
/Luna
&&
`
readlink
${
VTS
}
/Luna
`
==
${
VTS
}
/Moon
/
]]
;
then
if
[[
-L
${
VTS
}
/Luna
&&
`
readlink
${
VTS
}
/Luna
`
==
${
VTS
}
/Moon
]]
;
then
pass
"
${
CMD
}
"
else
fail
"
${
CMD
}
"
...
...
@@ -612,9 +612,9 @@ case_2_1_3() {
CMD
=
"
$vitis
assign -c Moon -a Luna Hologram Nazi_Base"
# ;-)
$CMD
$OPTCONF
if
[[
-L
${
VTS
}
/Luna
&&
-L
${
VTS
}
/Hologram
&&
-L
${
VTS
}
/Nazi_Base
&&
`
readlink
${
VTS
}
/Luna
`
==
${
VTS
}
/Moon
/
&&
`
readlink
${
VTS
}
/Hologram
`
==
${
VTS
}
/Moon
/
&&
`
readlink
${
VTS
}
/Nazi_Base
`
==
${
VTS
}
/Moon
/
]]
;
then
&&
`
readlink
${
VTS
}
/Luna
`
==
${
VTS
}
/Moon
&&
`
readlink
${
VTS
}
/Hologram
`
==
${
VTS
}
/Moon
&&
`
readlink
${
VTS
}
/Nazi_Base
`
==
${
VTS
}
/Moon
]]
;
then
pass
"
${
CMD
}
"
else
fail
"
${
CMD
}
"
...
...
@@ -628,9 +628,9 @@ case_2_1_4() {
CMD
=
"
$vitis
assign Moon -a Luna Hologram Nazi_Base"
# ;-)
$CMD
$OPTCONF
if
[[
-L
${
VTS
}
/Luna
&&
-L
${
VTS
}
/Hologram
&&
-L
${
VTS
}
/Nazi_Base
&&
`
readlink
${
VTS
}
/Luna
`
==
${
VTS
}
/Moon
/
&&
`
readlink
${
VTS
}
/Hologram
`
==
${
VTS
}
/Moon
/
&&
`
readlink
${
VTS
}
/Nazi_Base
`
==
${
VTS
}
/Moon
/
]]
;
then
&&
`
readlink
${
VTS
}
/Luna
`
==
${
VTS
}
/Moon
&&
`
readlink
${
VTS
}
/Hologram
`
==
${
VTS
}
/Moon
&&
`
readlink
${
VTS
}
/Nazi_Base
`
==
${
VTS
}
/Moon
]]
;
then
pass
"
${
CMD
}
"
else
fail
"
${
CMD
}
"
...
...
@@ -675,7 +675,7 @@ case_2_1_7() {
$CMD
$OPTCONF
alias_path
=
"
${
VTS
}
/Our_Galaxy"
if
[[
-d
${
VTS
}
/Milky_Way
&&
-L
"
$alias_path
"
&&
`
readlink
"
$alias_path
"
`
==
${
VTS
}
/Milky_Way
/
]]
&&
`
readlink
"
$alias_path
"
`
==
${
VTS
}
/Milky_Way
]]
then
pass
"
${
CMD
}
"
else
...
...
@@ -716,7 +716,7 @@ The request is skipped."
case_2_1_10
()
{
subtitle
"Case 10: Alias for autocategories"
CMD
=
"
$vitis
assign NetworkBookmarks -a Entries"
category_path
=
${
VTS
}
/__auto/N/NetworkBookmarks
/
category_path
=
${
VTS
}
/__auto/N/NetworkBookmarks
alias_path
=
${
VTS
}
/Entries
$CMD
$OPTCONF
if
[[
-L
"
${
alias_path
}
"
...
...
@@ -752,11 +752,11 @@ case_2_1_12() {
CMD
=
"
$vitis
assign Retrowave -a Synthwave --yes"
output
=
$(
$CMD
$OPTCONF
2>&1
)
if
[[
-L
"
${
VTS
}
/Synthwave"
&&
-L
"
${
VTS
}
/Synthwave/file1.txt"
&&
`
readlink
"
${
VTS
}
/Synthwave"
`
==
"
${
VTS
}
/Retrowave
/
"
&&
`
readlink
"
${
VTS
}
/Synthwave"
`
==
"
${
VTS
}
/Retrowave"
&&
`
readlink
"
${
VTS
}
/Retrowave/file1.txt"
`
==
$FILE1
&&
-L
"
${
VTS
}
/Retrowave/1/file2.txt"
&&
`
readlink
"
${
VTS
}
/Retrowave/1/file2.txt"
`
==
$FILE2
&&
`
readlink
"
${
VTS
}
/1"
`
==
"
${
VTS
}
/Retrowave/1
/
"
]]
&&
`
readlink
"
${
VTS
}
/1"
`
==
"
${
VTS
}
/Retrowave/1"
]]
then
pass
"
${
CMD
}
"
else
...
...
@@ -2419,7 +2419,7 @@ case_2_12_1() {
$vitis
create Audiofiles
$OPTCONF
CMD
=
"
$vitis
assign Audiofiles -s Music"
$CMD
$OPTCONF
if
[[
`
readlink
${
VTS
}
/Music
`
==
${
VTS
}
/Audiofiles/Music
/
if
[[
`
readlink
${
VTS
}
/Music
`
==
${
VTS
}
/Audiofiles/Music
&&
-d
${
VTS
}
/Audiofiles/Music
]]
;
then
pass
"
${
CMD
}
"
else
...
...
@@ -2436,7 +2436,7 @@ case_2_12_2() {
CMD
=
"
$vitis
assign Audiofiles -s Music --no"
output
=
$(
$CMD
$OPTCONF
2>&1
)
expected
=
"Music: this category already exists.
/tmp/Vitis/Music -> /tmp/Vitis/Audioclips
/
/tmp/Vitis/Music -> /tmp/Vitis/Audioclips
The request is skipped."
if
[[
"
$expected
"
==
"
$output
"
]]
;
then
pass
"
${
CMD
}
"
...
...
@@ -2497,7 +2497,7 @@ case_2_12_6() {
CMD
=
"
$vitis
assign Audiofiles -s Music"
$CMD
$OPTCONF
if
[[
`
readlink
${
VTS
}
/Audiofiles/Music/track.mp3
`
==
/tmp/track.mp3
&&
`
readlink
${
VTS
}
/Music
`
==
${
VTS
}
/Audiofiles/Music
/
]]
;
then
&&
`
readlink
${
VTS
}
/Music
`
==
${
VTS
}
/Audiofiles/Music
]]
;
then
pass
"
${
CMD
}
"
else
fail
"
${
CMD
}
"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment