Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
osug-doi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OSUG
Pôle Numérique
osug-doi
Commits
fd1c94f4
Commit
fd1c94f4
authored
6 years ago
by
bourgesl
Browse files
Options
Downloads
Patches
Plain Diff
ignore orphan projects in generate Embedded pages
parent
e4a89956
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/fr/osug/doi/GenerateRedirectPipeline.java
+33
-29
33 additions, 29 deletions
src/main/java/fr/osug/doi/GenerateRedirectPipeline.java
src/main/java/fr/osug/util/FileUtils.java
+2
-2
2 additions, 2 deletions
src/main/java/fr/osug/util/FileUtils.java
with
35 additions
and
31 deletions
src/main/java/fr/osug/doi/GenerateRedirectPipeline.java
+
33
−
29
View file @
fd1c94f4
...
...
@@ -152,38 +152,42 @@ public final class GenerateRedirectPipeline extends AbstractPipeline<PipelineCom
for
(
Project
p
:
projects
)
{
final
String
projectName
=
p
.
getName
();
final
ProjectConfig
projectConfig
=
pipeData
.
getProjectConfigAll
(
projectName
);
if
(
projectConfig
.
getPropertyBoolean
(
ProjectConfig
.
CONF_KEY_GENERATE_EMBEDDED
))
{
// // [public/staging]/PROJECT/embed/DOI_SUFFIX[.html]
sb
.
append
(
"\n# Project "
).
append
(
projectName
);
/*
RedirectMatch "^/embed/AMMA-CATCH.CE.RainD_Nc([-]*)(.*)" "/staging/AMMA-CATCH/embed/AMMA-CATCH.CE.RainD_Nc$1$2.html"
/embed/AMMA-CATCH.CE.RainD_Nc => /staging/AMMA-CATCH/embed/AMMA-CATCH.CE.RainD_Nc.html
/embed/AMMA-CATCH.CE.RainD_Nc-header => /staging/AMMA-CATCH/embed/AMMA-CATCH.CE.RainD_Nc-header.html
/embed/AMMA-CATCH.CE.RainD_Nc-meta => /staging/AMMA-CATCH/embed/AMMA-CATCH.CE.RainD_Nc-meta.html
*/
final
List
<
Doi
>
dois
=
dr
.
findByProject
(
projectName
);
logger
.
info
(
"Dois for project[{}]: {}"
,
projectName
,
dois
.
size
());
for
(
Doi
doi
:
dois
)
{
final
String
doiSuffix
=
doi
.
getIdentifier
();
// ^/embed/
sb
.
append
(
"\nRedirectMatch \"^/"
).
append
(
Paths
.
DIR_WEB_EMBED
).
append
(
'/'
);
sb
.
append
(
doiSuffix
).
append
(
"([-]*)(.*)\" \""
);
final
List
<
Doi
>
dois
=
dr
.
findByProject
(
projectName
);
if
(
doi
.
getStatus
()
==
Status
.
PUBLIC
)
{
sb
.
append
(
'/'
).
append
(
Paths
.
DIR_WEB_PUBLIC
).
append
(
'/'
);
}
else
{
sb
.
append
(
'/'
).
append
(
Paths
.
DIR_WEB_STAGING
).
append
(
'/'
);
logger
.
info
(
"Dois for project[{}]: {}"
,
projectName
,
dois
.
size
());
// skip empty projects (orphans)
if
(!
dois
.
isEmpty
())
{
final
ProjectConfig
projectConfig
=
pipeData
.
getProjectConfigAll
(
projectName
);
if
(
projectConfig
.
getPropertyBoolean
(
ProjectConfig
.
CONF_KEY_GENERATE_EMBEDDED
))
{
// // [public/staging]/PROJECT/embed/DOI_SUFFIX[.html]
sb
.
append
(
"\n# Project "
).
append
(
projectName
);
/*
RedirectMatch "^/embed/AMMA-CATCH.CE.RainD_Nc([-]*)(.*)" "/staging/AMMA-CATCH/embed/AMMA-CATCH.CE.RainD_Nc$1$2.html"
/embed/AMMA-CATCH.CE.RainD_Nc => /staging/AMMA-CATCH/embed/AMMA-CATCH.CE.RainD_Nc.html
/embed/AMMA-CATCH.CE.RainD_Nc-header => /staging/AMMA-CATCH/embed/AMMA-CATCH.CE.RainD_Nc-header.html
/embed/AMMA-CATCH.CE.RainD_Nc-meta => /staging/AMMA-CATCH/embed/AMMA-CATCH.CE.RainD_Nc-meta.html
*/
for
(
Doi
doi
:
dois
)
{
final
String
doiSuffix
=
doi
.
getIdentifier
();
// ^/embed/
sb
.
append
(
"\nRedirectMatch \"^/"
).
append
(
Paths
.
DIR_WEB_EMBED
).
append
(
'/'
);
sb
.
append
(
doiSuffix
).
append
(
"([-]*)(.*)\" \""
);
if
(
doi
.
getStatus
()
==
Status
.
PUBLIC
)
{
sb
.
append
(
'/'
).
append
(
Paths
.
DIR_WEB_PUBLIC
).
append
(
'/'
);
}
else
{
sb
.
append
(
'/'
).
append
(
Paths
.
DIR_WEB_STAGING
).
append
(
'/'
);
}
sb
.
append
(
projectName
).
append
(
'/'
).
append
(
Paths
.
DIR_WEB_EMBED
).
append
(
'/'
).
append
(
doiSuffix
);
sb
.
append
(
"$1$2"
).
append
(
GeneratePipeline
.
HTML_EXT
).
append
(
'\"'
);
}
sb
.
append
(
projectName
).
append
(
'/'
).
append
(
Paths
.
DIR_WEB_EMBED
).
append
(
'/'
).
append
(
doiSuffix
);
sb
.
append
(
"$1$2"
).
append
(
GeneratePipeline
.
HTML_EXT
).
append
(
'\"'
);
sb
.
append
(
'\n'
);
}
sb
.
append
(
'\n'
);
}
}
sb
.
append
(
'\n'
);
...
...
This diff is collapsed.
Click to expand it.
src/main/java/fr/osug/util/FileUtils.java
+
2
−
2
View file @
fd1c94f4
...
...
@@ -180,7 +180,7 @@ public final class FileUtils {
if
(
dir
!=
null
)
{
return
dir
;
}
throw
new
FileNotFoundException
(
"Invalid directory '"
+
((
dir
==
null
)
?
null
:
dir
.
getAbsolutePath
())
+
"' !"
);
throw
new
FileNotFoundException
(
"Invalid directory '"
+
((
dir
==
null
)
?
path
:
dir
.
getAbsolutePath
())
+
"' !"
);
}
/**
...
...
@@ -240,7 +240,7 @@ public final class FileUtils {
if
(
file
!=
null
)
{
return
file
;
}
throw
new
FileNotFoundException
(
"Invalid file '"
+
((
file
==
null
)
?
null
:
file
.
getAbsolutePath
())
+
"' !"
);
throw
new
FileNotFoundException
(
"Invalid file '"
+
((
file
==
null
)
?
path
:
file
.
getAbsolutePath
())
+
"' !"
);
}
// writers :
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment