Skip to content

Commit

Permalink
Add usage help to scripts and API addr flag
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonynsimon committed Feb 2, 2017
1 parent cdb86c9 commit 57d0dd5
Show file tree
Hide file tree
Showing 6 changed files with 254 additions and 4 deletions.
42 changes: 41 additions & 1 deletion scripts/buildweb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,47 @@
script_dir="${0%/*}"
cd $script_dir

/bin/bash ./../web-app/scripts/build.sh && \
API_ADDRESS=https://localhost/api/v1

display_usage() {
echo -e "buildweb installs depenencies and builds the web app for Parrot.\n"
echo -e "Usage:"
echo -e "\t./buildweb.sh [flag] [value]\n"
echo -e "The flags are:"
echo -e "\n\t-api | --api-address\tthe address where the Parrot API is localed."
echo -e "\tExample: ./buildweb.sh -api http://localhost:8080"
echo -e "\n"
}

if [ $# -eq 1 ]
then
display_usage
exit 1
fi

while [[ $# -gt 1 ]]
do

key="$1"
case $key in
-h|--help)
display_usage
exit 1
;;
-api|--api-address)
API_ADDRESS="$2"
shift # past argument
;;
--default)
;;
*)
# unknown option
;;
esac
shift # past argument or value
done

/bin/bash ./../web-app/scripts/build.sh -api $API_ADDRESS && \
echo "Copying web-app distribution to nginx for static serving..." && \
rm -rf ./../nginx/public && mkdir ./../nginx/public && \
cp -rf ./../web-app/dist/* ./../nginx/public
20 changes: 20 additions & 0 deletions scripts/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,33 @@
script_dir="${0%/*}"
cd $script_dir/..

display_usage() {
echo -e "start the services for Parrot.\n"
echo -e "Usage:"
echo -e "\t./start.sh [flag] [value]\n"
echo -e "The flags are:"
echo -e "\n\t-dbp | --db-port\tthe port that docker will bind the database to"
echo -e "\tExample: ./start.sh -dbp 5432"
echo -e "\n"
}

if [ $# -eq 1 ]
then
display_usage
exit 1
fi

DB_PORT=5432

while [[ $# -gt 1 ]]
do
key="$1"

case $key in
-h|--help)
display_usage
exit 1
;;
-dbp|--db-port)
DB_PORT="$2"
shift # past argument
Expand Down
Empty file added web-app/app.config.ts
Empty file.
166 changes: 166 additions & 0 deletions web-app/app.config.ts.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
export const AppConfig = {
apiUrl: '{{API_ADDRESS}}',
};

export interface ExportFormat {
name: string;
extension: string;
apiIdent: string;
}

export const UserRoles = [
'owner',
'editor',
'viewer',
'developer'
];

export const ErrorMap = {
'Register': {
'AlreadyExists': 'This email is already taken.',
'InvalidPassword': 'The provided password is invalid.',
'InvalidName': 'The provided name is invalid.',
'InvalidEmail': 'The provided email is invalid.',
'Unauthorized': 'Invalid credentials.',
'Forbiden': 'Invalid credentials.',
},
'Login': {
'InvalidEmail': 'The provided email is invalid.',
'InvalidPassword': 'The provided password is invalid.',
'Unauthorized': 'Invalid email and/or password.',
},
'CreateLocale': {
},
'AddProjectUser': {
'NotFound': 'No user found.',
},
'UpdateProjectClient': {
'AlreadyExists': 'The provided name is already in use for this project.',
},
}

export const LocaleExportFormats = [
{ apiIdent: 'keyvaluejson', name: 'Key Value JSON', extension: '.json' },
{ apiIdent: 'po', name: 'Gettext', extension: '.po' },
{ apiIdent: 'strings', name: 'Apple Strings', extension: '.strings' },
{ apiIdent: 'properties', name: 'Java Properties', extension: '.properties' },
{ apiIdent: 'xmlproperties', name: 'Java XML Properties', extension: '.xml' },
{ apiIdent: 'android', name: 'Android Resources', extension: '.xml' },
{ apiIdent: 'php', name: 'PHP Array', extension: '.php' },
{ apiIdent: 'xlsx', name: 'Excel', extension: '.xlsx' },
{ apiIdent: 'csv', name: 'CSV', extension: '.csv' },
{ apiIdent: 'yaml', name: 'YAML', extension: '.yaml' },
];

export const LocalesList = [
{ ident: 'sq_AL', language: 'Albanian', country: 'Albania' },
{ ident: 'ar_DZ', language: 'Arabic', country: 'Algeria' },
{ ident: 'ar_BH', language: 'Arabic', country: 'Bahrain' },
{ ident: 'ar_EG', language: 'Arabic', country: 'Egypt' },
{ ident: 'ar_IQ', language: 'Arabic', country: 'Iraq' },
{ ident: 'ar_JO', language: 'Arabic', country: 'Jordan' },
{ ident: 'ar_KW', language: 'Arabic', country: 'Kuwait' },
{ ident: 'ar_LB', language: 'Arabic', country: 'Lebanon' },
{ ident: 'ar_LY', language: 'Arabic', country: 'Libya' },
{ ident: 'ar_MA', language: 'Arabic', country: 'Morocco' },
{ ident: 'ar_OM', language: 'Arabic', country: 'Oman' },
{ ident: 'ar_QA', language: 'Arabic', country: 'Qatar' },
{ ident: 'ar_SA', language: 'Arabic', country: 'Saudi Arabia' },
{ ident: 'ar_SD', language: 'Arabic', country: 'Sudan' },
{ ident: 'ar_SY', language: 'Arabic', country: 'Syria' },
{ ident: 'ar_TN', language: 'Arabic', country: 'Tunisia' },
{ ident: 'ar_AE', language: 'Arabic', country: 'United Arab Emirates' },
{ ident: 'ar_YE', language: 'Arabic', country: 'Yemen' },
{ ident: 'be_BY', language: 'Belarusian', country: 'Belarus' },
{ ident: 'bg_BG', language: 'Bulgarian', country: 'Bulgaria' },
{ ident: 'ca_ES', language: 'Catalan', country: 'Spain' },
{ ident: 'zh_CN', language: 'Chinese (Simplified)', country: 'China' },
{ ident: 'zh_SG', language: 'Chinese (Simplified)', country: 'Singapore' },
{ ident: 'zh_HK', language: 'Chinese (Traditional)', country: 'Hong Kong' },
{ ident: 'zh_TW', language: 'Chinese (Traditional)', country: 'Taiwan' },
{ ident: 'hr_HR', language: 'Croatian', country: 'Croatia' },
{ ident: 'cs_CZ', language: 'Czech', country: 'Czech Republic' },
{ ident: 'da_DK', language: 'Danish', country: 'Denmark' },
{ ident: 'nl_BE', language: 'Dutch', country: 'Belgium' },
{ ident: 'nl_NL', language: 'Dutch', country: 'Netherlands' },
{ ident: 'en_AU', language: 'English', country: 'Australia' },
{ ident: 'en_CA', language: 'English', country: 'Canada' },
{ ident: 'en_IN', language: 'English', country: 'India' },
{ ident: 'en_IE', language: 'English', country: 'Ireland' },
{ ident: 'en_MT', language: 'English', country: 'Malta' },
{ ident: 'en_NZ', language: 'English', country: 'New Zealand' },
{ ident: 'en_PH', language: 'English', country: 'Philippines' },
{ ident: 'en_SG', language: 'English', country: 'Singapore' },
{ ident: 'en_ZA', language: 'English', country: 'South Africa' },
{ ident: 'en_GB', language: 'English', country: 'United Kingdom' },
{ ident: 'en_US', language: 'English', country: 'United States' },
{ ident: 'et_EE', language: 'Estonian', country: 'Estonia' },
{ ident: 'fi_FI', language: 'Finnish', country: 'Finland' },
{ ident: 'fr_BE', language: 'French', country: 'Belgium' },
{ ident: 'fr_CA', language: 'French', country: 'Canada' },
{ ident: 'fr_FR', language: 'French', country: 'France' },
{ ident: 'fr_LU', language: 'French', country: 'Luxembourg' },
{ ident: 'fr_CH', language: 'French', country: 'Switzerland' },
{ ident: 'de_AT', language: 'German', country: 'Austria' },
{ ident: 'de_DE', language: 'German', country: 'Germany' },
{ ident: 'de_LU', language: 'German', country: 'Luxembourg' },
{ ident: 'de_CH', language: 'German', country: 'Switzerland' },
{ ident: 'el_CY', language: 'Greek', country: 'Cyprus' },
{ ident: 'el_GR', language: 'Greek', country: 'Greece' },
{ ident: 'iw_IL', language: 'Hebrew', country: 'Israel' },
{ ident: 'hi_IN', language: 'Hindi', country: 'India' },
{ ident: 'hu_HU', language: 'Hungarian', country: 'Hungary' },
{ ident: 'is_IS', language: 'Icelandic', country: 'Iceland' },
{ ident: 'in_ID', language: 'Indonesian', country: 'Indonesia' },
{ ident: 'ga_IE', language: 'Irish', country: 'Ireland' },
{ ident: 'it_IT', language: 'Italian', country: 'Italy' },
{ ident: 'it_CH', language: 'Italian', country: 'Switzerland' },
{ ident: 'ja_JP', language: 'Japanese', country: 'Japan' },
{ ident: 'ko_KR', language: 'Korean', country: 'South Korea' },
{ ident: 'lv_LV', language: 'Latvian', country: 'Latvia' },
{ ident: 'lt_LT', language: 'Lithuanian', country: 'Lithuania' },
{ ident: 'mk_MK', language: 'Macedonian', country: 'Macedonia' },
{ ident: 'ms_MY', language: 'Malay', country: 'Malaysia' },
{ ident: 'mt_MT', language: 'Maltese', country: 'Malta' },
{ ident: 'no_NO', language: 'Norwegian (Bokmål)', country: 'Norway' },
{ ident: 'no_NO_NY', language: 'Norwegian (Nynorsk)', country: 'Norway' },
{ ident: 'pl_PL', language: 'Polish', country: 'Poland' },
{ ident: 'pt_BR', language: 'Portuguese', country: 'Brazil' },
{ ident: 'pt_PT', language: 'Portuguese', country: 'Portugal' },
{ ident: 'ro_RO', language: 'Romanian', country: 'Romania' },
{ ident: 'ru_RU', language: 'Russian', country: 'Russia' },
{ ident: 'sr_BA', language: 'Serbian (Cyrillic)', country: 'Bosnia and Herzegovina' },
{ ident: 'sr_ME', language: 'Serbian (Cyrillic)', country: 'Montenegro' },
{ ident: 'sr_RS', language: 'Serbian (Cyrillic)', country: 'Serbia' },
{ ident: 'sr_La_tn_BA', language: 'Serbian (Latin)', country: 'Bosnia and Herzegovina' },
{ ident: 'sr_La_tn_ME', language: 'Serbian (Latin)', country: 'Montenegro' },
{ ident: 'sr_La_tn_RS', language: 'Serbian (Latin)', country: 'Serbia' },
{ ident: 'sk_SK', language: 'Slovak', country: 'Slovakia' },
{ ident: 'sl_SI', language: 'Slovenian', country: 'Slovenia' },
{ ident: 'es_AR', language: 'Spanish', country: 'Argentina' },
{ ident: 'es_BO', language: 'Spanish', country: 'Bolivia' },
{ ident: 'es_CL', language: 'Spanish', country: 'Chile' },
{ ident: 'es_CO', language: 'Spanish', country: 'Colombia' },
{ ident: 'es_CR', language: 'Spanish', country: 'Costa Rica' },
{ ident: 'es_DO', language: 'Spanish', country: 'Dominican Republic' },
{ ident: 'es_EC', language: 'Spanish', country: 'Ecuador' },
{ ident: 'es_SV', language: 'Spanish', country: 'El Salvador' },
{ ident: 'es_GT', language: 'Spanish', country: 'Guatemala' },
{ ident: 'es_HN', language: 'Spanish', country: 'Honduras' },
{ ident: 'es_MX', language: 'Spanish', country: 'Mexico' },
{ ident: 'es_NI', language: 'Spanish', country: 'Nicaragua' },
{ ident: 'es_PA', language: 'Spanish', country: 'Panama' },
{ ident: 'es_PY', language: 'Spanish', country: 'Paraguay' },
{ ident: 'es_PE', language: 'Spanish', country: 'Peru' },
{ ident: 'es_PR', language: 'Spanish', country: 'Puerto Rico' },
{ ident: 'es_ES', language: 'Spanish', country: 'Spain' },
{ ident: 'es_US', language: 'Spanish', country: 'United States' },
{ ident: 'es_UY', language: 'Spanish', country: 'Uruguay' },
{ ident: 'es_VE', language: 'Spanish', country: 'Venezuela' },
{ ident: 'sv_SE', language: 'Swedish', country: 'Sweden' },
{ ident: 'th_TH', language: 'Thai (Western digits)', country: 'Thailand' },
{ ident: 'th_TH_TH', language: 'Thai (Thai digits)', country: 'Thailand' },
{ ident: 'tr_TR', language: 'Turkish', country: 'Turkey' },
{ ident: 'uk_UA', language: 'Ukrainian', country: 'Ukraine' },
{ ident: 'vi_VN', language: 'Vietnamese', country: 'Vietnam' },
];
28 changes: 26 additions & 2 deletions web-app/scripts/build.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,33 @@
#!/bin/bash

API_ADDRESS=https://localhost/api/v1

while [[ $# -gt 1 ]]
do

key="$1"

case $key in
-api|--api-address)
API_ADDRESS="$2"
shift # past argument
;;
--default)
;;
*)
# unknown option
;;
esac
shift # past argument or value
done

script_dir="${0%/*}"
cd $script_dir && \
cd $script_dir/.. && \
echo "Installing dependencies, this might take a few minutes..." && \
cd ./.. && npm install && \
npm install && \

echo "Configuring build..." && \
sed 's~{{API_ADDRESS}}~'$API_ADDRESS'~g' app.config.ts.tmpl > ./src/app/app.config.ts && \

echo "Building web app..." && \
npm run build && \
Expand Down
2 changes: 1 addition & 1 deletion web-app/src/app/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,4 @@ export const LocalesList = [
{ ident: 'tr_TR', language: 'Turkish', country: 'Turkey' },
{ ident: 'uk_UA', language: 'Ukrainian', country: 'Ukraine' },
{ ident: 'vi_VN', language: 'Vietnamese', country: 'Vietnam' },
];
];

0 comments on commit 57d0dd5

Please sign in to comment.