Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
website
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sébastien Villemot
website
Commits
46f19d1b
Verified
Commit
46f19d1b
authored
Sep 13, 2019
by
Houtan Bastani
Browse files
Options
Downloads
Patches
Plain Diff
run shellcheck
parent
b4cc50ab
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
setup-download-links.sh
+19
-20
19 additions, 20 deletions
setup-download-links.sh
with
19 additions
and
20 deletions
setup-download-links.sh
+
19
−
20
View file @
46f19d1b
#!/
bin/
bash
#!/
usr/bin/env
bash
set
-e
set
-e
...
@@ -18,16 +18,11 @@ do
...
@@ -18,16 +18,11 @@ do
for
dir
in
"
${
arr
[@]
}
"
for
dir
in
"
${
arr
[@]
}
"
do
do
if
[[
"
$OSTYPE
"
==
"darwin"
*
]]
;
then
filenames
=(
`
jq .[].filename
$dir
.json
`
)
timestamps
=(
`
jq .[].date
$dir
.json
`
)
else
readarray
-t
filenames < <
(
jq .[].filename
"
$dir
.json"
)
readarray
-t
filenames < <
(
jq .[].filename
"
$dir
.json"
)
readarray
-t
timestamps < <
(
jq .[].date
"
$dir
.json"
)
readarray
-t
timestamps < <
(
jq .[].date
"
$dir
.json"
)
fi
n
=
$(
jq length
"
$dir
.json"
)
n
=
$(
jq length
"
$dir
.json"
)
includeFilename
=
"download-
$branch
-
$dir
.html"
includeFilename
=
"download-
$branch
-
$dir
.html"
echo
""
>
$includeFilename
echo
""
>
"
$includeFilename
"
for
((
i
=
0
;
i < n
;
i++
))
for
((
i
=
0
;
i < n
;
i++
))
do
do
filename
=
"
${
filenames
[i]%\
"}"
filename
=
"
${
filenames
[i]%\
"}"
...
@@ -41,26 +36,30 @@ do
...
@@ -41,26 +36,30 @@ do
version=
${
split
[1]%.*
}
version=
${
split
[1]%.*
}
ext=
${
filename
##*.
}
ext=
${
filename
##*.
}
else
else
ext=
`
echo
${
split
[1]
}
| rev |
cut
-d
.
-f2
-f
1
| rev
`
ext=
"
$(
echo
"
${
split
[1]
}
"
| rev |
cut
-d
.
-f2
,
1 | rev
)
"
version=
`
echo
${
split
[1]
}
|
cut
-d
.
-f1
-f2
-f3
`
version=
"
$(
echo
"
${
split
[1]
}
"
|
cut
-d
.
-f1
,2,3
)
"
fi
fi
echo
"<a href=
\"
https://www.dynare.org/
$branch
/
$dir
/
$filename
\"
>Dynare
$version
(
$ext
)</a>"
>>
$includeFilename
{
echo
"<a href=
\"
https://www.dynare.org/
$branch
/
$dir
/
$filename
.sig
\"
>[signature]</a>"
>>
$includeFilename
echo
"<a href=
\"
https://www.dynare.org/
$branch
/
$dir
/
$filename
\"
>Dynare
$version
(
$ext
)</a>"
echo
"<a href=
\"
https://www.dynare.org/
$branch
/
$dir
/
$filename
.sig
\"
>[signature]</a>"
}
>> "
$includeFilename
"
else
else
timestamp="
${
timestamps
[i]%\
"}"
timestamp="
${
timestamps
[i]%\
"}"
timestamp=
"
${
timestamp
#\
"}"
timestamp=
"
${
timestamp
#\
"}"
if [[
"
$OSTYPE
"
==
"darwin"
* ]]; then
if [[
"
$OSTYPE
"
==
"darwin"
* ]]; then
datestr=
`
date
-r
$timestamp
`
datestr=
"
$(
date
-r
"
$timestamp
"
)
"
else
else
datestr=
`
date
-d
@
$timestamp
`
datestr=
"
$(
date
-d
@
"
$timestamp
"
)
"
fi
fi
echo
"<div class=
\"
download_row
\"
onclick=
\"
document.location = 'https://www.dynare.org/
$branch
/
$dir
/
$filename
'
\"
onkeypress=
\"
document.location = 'https://www.dynare.org/
$branch
/
$dir
/
$filename
'
\"
>"
>>
$includeFilename
{
echo
" <div class=
\"
download_cell_left
\"
><i class=
\"
fas fa-file-download
\"
></i>
$datestr
</div>"
>>
$includeFilename
echo
"<div class=
\"
download_row
\"
onclick=
\"
document.location = 'https://www.dynare.org/
$branch
/
$dir
/
$filename
'
\"
onkeypress=
\"
document.location = 'https://www.dynare.org/
$branch
/
$dir
/
$filename
'
\"
>"
echo
" <div class=
\"
download_cell_right
\"
><a href=
\"
#
\"
>
$filename
</a></div>"
>>
$includeFilename
echo
" <div class=
\"
download_cell_left
\"
><i class=
\"
fas fa-file-download
\"
></i>
$datestr
</div>"
echo
"</div>"
>>
$includeFilename
echo
" <div class=
\"
download_cell_right
\"
><a href=
\"
#
\"
>
$filename
</a></div>"
echo
"</div>"
}
>> "
$includeFilename
"
fi
fi
done
done
done
done
rm -- *
.
json
rm -- *json
*
cd ..
cd ..
done
done
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