Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Dynare
website
Commits
46f19d1b
Verified
Commit
46f19d1b
authored
Sep 13, 2019
by
Houtan Bastani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
run shellcheck
parent
b4cc50ab
Pipeline
#1835
passed with stages
in 39 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
20 deletions
+19
-20
setup-download-links.sh
setup-download-links.sh
+19
-20
No files found.
setup-download-links.sh
View file @
46f19d1b
#!/
bin/
bash
#!/
usr/bin/env
bash
set
-e
...
...
@@ -18,16 +18,11 @@ do
for
dir
in
"
${
arr
[@]
}
"
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
timestamps < <
(
jq .[].date
"
$dir
.json"
)
fi
readarray
-t
filenames < <
(
jq .[].filename
"
$dir
.json"
)
readarray
-t
timestamps < <
(
jq .[].date
"
$dir
.json"
)
n
=
$(
jq length
"
$dir
.json"
)
includeFilename
=
"download-
$branch
-
$dir
.html"
echo
""
>
$includeFilename
echo
""
>
"
$includeFilename
"
for
((
i
=
0
;
i < n
;
i++
))
do
filename
=
"
${
filenames
[i]%\
"}"
...
...
@@ -41,26 +36,30 @@ do
version=
${
split
[1]%.*
}
ext=
${
filename
##*.
}
else
ext=
`
echo
${
split
[1]
}
| rev |
cut
-d
.
-f2
-f
1
| rev
`
version=
`
echo
${
split
[1]
}
|
cut
-d
.
-f1
-f2
-f3
`
ext=
"
$(
echo
"
${
split
[1]
}
"
| rev |
cut
-d
.
-f2
,
1 | rev
)
"
version=
"
$(
echo
"
${
split
[1]
}
"
|
cut
-d
.
-f1
,2,3
)
"
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
timestamp="
${
timestamps
[i]%\
"}"
timestamp=
"
${
timestamp
#\
"}"
if [[
"
$OSTYPE
"
==
"darwin"
* ]]; then
datestr=
`
date
-r
$timestamp
`
datestr=
"
$(
date
-r
"
$timestamp
"
)
"
else
datestr=
`
date
-d
@
$timestamp
`
datestr=
"
$(
date
-d
@
"
$timestamp
"
)
"
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_cell_right
\"
><a href=
\"
#
\"
>
$filename
</a></div>"
>>
$includeFilename
echo
"</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_left
\"
><i class=
\"
fas fa-file-download
\"
></i>
$datestr
</div>"
echo
" <div class=
\"
download_cell_right
\"
><a href=
\"
#
\"
>
$filename
</a></div>"
echo
"</div>"
}
>> "
$includeFilename
"
fi
done
done
rm -- *
.
json
rm -- *json
*
cd ..
done
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