Merge branch 'develop' into new-guest-access

This commit is contained in:
David Baker 2017-06-06 11:39:47 +01:00
commit e30fcdba4c
57 changed files with 2000 additions and 296 deletions

View file

@ -9,15 +9,18 @@
// This could readily be automated, but it's nice to explicitly
// control when we languages are available.
const INCLUDE_LANGS = [
//'be' Omitted because no translations in react-sdk
'en_EN',
'da',
'de_DE',
'fr',
'be',
'pt',
'pt_BR',
'ru',
{'value': 'en_EN', 'label': 'English'},
{'value': 'en_US', 'label': 'English (US)'},
{'value': 'da', 'label': 'Dansk'},
{'value': 'nl', 'label': 'Nederlands'},
{'value': 'de_DE', 'label': 'Deutsch'},
{'value': 'fr', 'label': 'Français'},
{'value': 'pt', 'label': 'Português'},
{'value': 'pt_BR', 'label': 'Português do Brasil'},
{'value': 'ru', 'label': 'Русский'},
{'value': 'sv', 'label': 'Svenska'},
{'value': 'es', 'label': 'Español'},
{'value': 'zh_Hans', 'label': '中文'}
];
// cpx includes globbed parts of the filename in the destination, but excludes
@ -37,7 +40,7 @@ const COPY_LIST = [
INCLUDE_LANGS.forEach(function(l) {
COPY_LIST.push([
l, "webapp/i18n/", { lang: 1 },
l.value, "webapp/i18n/", { lang: 1 },
]);
});
@ -159,17 +162,22 @@ function genLangFile(lang, dest) {
function genLangList() {
const languages = {};
INCLUDE_LANGS.forEach(function(lang) {
const normalizedLanguage = lang.toLowerCase().replace("_", "-");
const normalizedLanguage = lang.value.toLowerCase().replace("_", "-");
const languageParts = normalizedLanguage.split('-');
if (languageParts.length == 2 && languageParts[0] == languageParts[1]) {
languages[languageParts[0]] = lang + '.json';
languages[languageParts[0]] = {'fileName': lang.value + '.json', 'label': lang.label};
} else {
languages[normalizedLanguage] = lang + '.json';
languages[normalizedLanguage] = {'fileName': lang.value + '.json', 'label': lang.label};
}
});
fs.writeFile('webapp/i18n/languages.json', JSON.stringify(languages, null, 4), function(err) {
if (err) {
console.error("Copy Error occured: " + err);
throw new Error("Failed to generate languages.json");
}
});
fs.writeFile('webapp/i18n/languages.json', JSON.stringify(languages, null, 4));
if (verbose) {
console.log("Generated language list");
console.log("Generated languages.json");
}
}

View file

@ -6,6 +6,10 @@
# the branch the current checkout is on, use that branch. Otherwise,
# use develop.
set -e
GIT_CLONE_ARGS=("$@")
# Look in the many different CI env vars for which branch we're
# building
if [[ "$TRAVIS" == true ]]; then
@ -23,41 +27,62 @@ fi
echo "Determined branch to be $curbranch"
# clone a specific branch of a github repo
function clone() {
org=$1
repo=$2
branch=$3
git clone https://github.com/$org/$repo.git $repo --branch $branch \
"${GIT_CLONE_ARGS[@]}"
}
function dodep() {
org=$1
repo=$2
rm -rf $repo || true
git clone https://github.com/$org/$repo.git $repo
pushd $repo
git checkout $curbranch || git checkout develop
echo "$repo set to branch "`git rev-parse --abbrev-ref HEAD`
popd
rm -rf $repo
clone $org $repo $curbranch || {
[ "$curbranch" != 'develop' ] && clone $org $repo develop
} || return $?
(
cd $repo
echo "$repo set to branch "`git rev-parse --abbrev-ref HEAD`
)
mkdir -p node_modules
rm -r "node_modules/$repo" 2>/dev/null || true
ln -sv "../$repo" node_modules/
}
echo -en 'travis_fold:start:matrix-js-sdk\r'
echo 'Setting up matrix-js-sdk'
dodep matrix-org matrix-js-sdk
(
cd node_modules/matrix-js-sdk
npm install
)
echo -en 'travis_fold:end:matrix-js-sdk\r'
echo -en 'travis_fold:start:matrix-react-sdk\r'
echo 'Setting up matrix-react-sdk'
dodep matrix-org matrix-react-sdk
mkdir -p node_modules
cd node_modules
mkdir -p node_modules/matrix-react-sdk/node_modules
ln -s ../../matrix-js-sdk node_modules/matrix-react-sdk/node_modules/
rm -r matrix-js-sdk 2> /dev/null
ln -s ../matrix-js-sdk ./
pushd matrix-js-sdk
npm install
popd
(
cd node_modules/matrix-react-sdk
npm install
)
echo -en 'travis_fold:end:matrix-react-sdk\r'
rm -r matrix-react-sdk 2> /dev/null
ln -s ../matrix-react-sdk ./
pushd matrix-react-sdk
mkdir -p node_modules
cd node_modules
ln -s ../../matrix-js-sdk matrix-js-sdk
cd ..
npm install
popd
# Link the reskindex binary in place: if we used npm link,
# npm would do this for us, but we don't because we'd have
# to define the npm prefix somewhere so it could put the
# intermediate symlinks there. Instead, we do it ourselves.
mkdir -p .bin
ln -sf ../matrix-react-sdk/scripts/reskindex.js .bin/reskindex
mkdir -p node_modules/.bin
ln -sfv ../matrix-react-sdk/scripts/reskindex.js node_modules/.bin/reskindex