Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
scripts
mahara-scripts
Commits
982b0f6f
Commit
982b0f6f
authored
Jun 01, 2011
by
Richard Mansfield
Browse files
Read language repo list from config file or from gitorious
parent
68679b5f
Changes
3
Hide whitespace changes
Inline
Side-by-side
debian/control
View file @
982b0f6f
...
...
@@ -7,7 +7,7 @@ Standards-Version: 3.9.1
Package: custom-site-mahara-langpacks
Architecture: all
Depends: ${misc:Depends}, apache2, php5-cli, perl, bash, debconf, git-core, libhtml-tiny-perl, liblocale-po-perl
Depends: ${misc:Depends}, apache2, php5-cli, perl, bash, debconf, git-core, libhtml-tiny-perl, liblocale-po-perl
, libwww-perl
Description: Mahara langpack repository scripts
Scripts to download mahara langpacks from gitorious, clean them up, and
make them available for HTTP download.
mahara-langpacks/langpacks.pl
View file @
982b0f6f
...
...
@@ -18,6 +18,7 @@
use
Data::
Dumper
;
use
FindBin
;
use
File::
Path
qw(mkpath rmtree)
;
use
LWP::
UserAgent
;
foreach
my
$c
qw(DATA DOCROOT)
{
exists
$ENV
{
$c
}
or
die
("
\$
ENV{
$c
} undefined
");
...
...
@@ -43,7 +44,42 @@ mkpath $TARBALLS;
print
STDERR
"
Checking langpacks for updates:
"
.
`
date
\
"+%Y-%m-%d %H:%M:%S
\
"
`;
my
@langs
=
qw(ar ca cs da de en_us es eu fi fr he it ja ko mi nl no_nb sl zh_tw)
;
# A language repo list can be put in the $DATA dir for testing. If there's not one
# there, try to get an up-to-date one out of the gitorious mahara-scripts repo
# (allows updates to the repo list without having to redeploy the package).
my
$repolist
;
if
(
-
f
"
$DATA
/language-repos.txt
"
)
{
print
STDERR
"
Using repository list in
$DATA
/language-repos.txt
\n
";
open
$repofh
,
'
<
',
"
$DATA
/language-repos.txt
"
or
die
$!
;
local
$/
=
undef
;
$repolist
=
<
$repofh
>
;
}
else
{
my
$repolisturl
=
'
https://gitorious.org/mahara/mahara-scripts/blobs/raw/master/mahara-langpacks/language-repos.txt
';
print
STDERR
"
Retrieving repository list from
$repolisturl
\n
";
my
$ua
=
LWP::
UserAgent
->
new
;
$ua
->
timeout
(
10
);
$ua
->
env_proxy
;
my
$response
=
$ua
->
get
(
$repolisturl
);
$repolist
=
$response
->
is_success
?
$response
->
content
:
undef
;
}
my
%langs
=
();
if
(
defined
$repolist
)
{
foreach
(
split
"
\n
",
$repolist
)
{
if
(
m/^([a-zA-Z_]{2,5})\s+(\S+)$/
)
{
$langs
{
$
1
}
=
{
repo
=>
$
2
};
}
}
}
my
@langkeys
=
sort
keys
%langs
;
if
(
scalar
@langkeys
<
1
)
{
@langkeys
=
qw(ar ca cs da de en_us es eu fi fr he it ja ko mi nl no_nb sl zh_tw)
;
}
print
STDERR
"
Languages:
"
.
join
('
',
@langkeys
)
.
"
\n
";
my
$last
;
my
$savefile
=
"
$TARBALLS
/mahara-langpacks.last
";
...
...
@@ -54,12 +90,16 @@ else {
$last
=
{};
}
foreach
my
$lang
(
@langs
)
{
foreach
my
$lang
(
@lang
key
s
)
{
if
(
!
defined
$last
->
{
$lang
}
)
{
$last
->
{
$lang
}
=
{
repo
=>
"
git://gitorious.org/mahara-lang/
$lang
.git
"
};
}
if
(
defined
$langs
{
$lang
}
->
{
repo
}
)
{
$last
->
{
$lang
}
->
{
repo
}
=
$langs
{
$lang
}
->
{
repo
};
}
my
$remote
=
$last
->
{
$lang
}
->
{
repo
};
my
$gitlangdir
=
"
$GITDIR
/
$lang
";
my
$dirtylangdir
=
"
$DIRTY
/
$lang
";
...
...
mahara-langpacks/language-repos.txt
0 → 100644
View file @
982b0f6f
ar git://gitorious.org/mahara-lang/ar.git
ca git://gitorious.org/mahara-lang/ca.git
cs git://gitorious.org/mahara-lang/cs.git
da git://gitorious.org/mahara-lang/da.git
de git://gitorious.org/mahara-lang/de.git
en_us git://gitorious.org/mahara-lang/en_us.git
es git://gitorious.org/mahara-lang/es.git
eu git://gitorious.org/mahara-lang/eu.git
fi git://gitorious.org/mahara-lang/fi.git
fr git://gitorious.org/mahara-lang/fr.git
he git://gitorious.org/mahara-lang/he.git
it git://gitorious.org/mahara-lang/it.git
ja git://gitorious.org/mahara-lang/ja.git
ko git://gitorious.org/mahara-lang/ko.git
mi git://gitorious.org/mahara-lang/mi.git
nl git://gitorious.org/mahara-lang/nl.git
no_nb git://gitorious.org/mahara-lang/no_nb.git
sl git://gitorious.org/mahara-lang/sl.git
zh_tw git://gitorious.org/mahara-lang/zh_tw.git
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment