Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions shared-modules/MTREADME.md.MT.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ checkResult $?;

AGENCY_NAME_LONG=$(tail -n 1 $AGENCY_NAME_FILE);
if [ -z "$AGENCY_NAME_LONG" ]; then
echo "$AGENCY_NAME_LONG is empty!";
echo "AGENCY_NAME_LONG is empty!";
exit 1;
fi

Expand All @@ -34,7 +34,7 @@ AGENCY_LOCATION_FILE="${CONFIG_DIR}/agency_location";
if [ -f "$AGENCY_LOCATION_FILE" ]; then
AGENCY_LOCATION_SHORT=$(head -n 1 $AGENCY_LOCATION_FILE);
if [ -z "$AGENCY_LOCATION_SHORT" ]; then
echo "$AGENCY_LOCATION_SHORT is empty!";
echo "AGENCY_LOCATION_SHORT is empty!";
exit 1;
fi
fi
Expand All @@ -61,7 +61,7 @@ fi

PKG=$(head -n 1 $PKG_FILE);
if [ -z "$PKG" ]; then
echo "$PKG is empty!";
echo "PKG is empty!";
exit 1;
fi

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ fi

AGENCY_NAME_SHORT=$(head -n 1 $AGENCY_NAME_FILE);
if [ -z "$AGENCY_NAME_SHORT" ]; then
echo "$AGENCY_NAME_SHORT is empty!";
echo "AGENCY_NAME_SHORT is empty!";
exit 1;
fi

AGENCY_NAME_LONG=$(tail -n 1 $AGENCY_NAME_FILE);
if [ -z "$AGENCY_NAME_LONG" ]; then
echo "$AGENCY_NAME_LONG is empty!";
echo "AGENCY_NAME_LONG is empty!";
exit 1;
fi

Expand All @@ -60,7 +60,7 @@ AGENCY_LOCATION_FILE="${CONFIG_DIR}/agency_location";
if [ -f "$AGENCY_LOCATION_FILE" ]; then
AGENCY_LOCATION_SHORT=$(head -n 1 $AGENCY_LOCATION_FILE);
if [ -z "$AGENCY_LOCATION_SHORT" ]; then
echo "$AGENCY_LOCATION_SHORT is empty!";
echo "AGENCY_LOCATION_SHORT is empty!";
exit 1;
fi
fi
Expand Down Expand Up @@ -90,7 +90,7 @@ if [ ! -f "$SOURCE_URL_FILE" ]; then
fi
SOURCE_URL=$(head -n 1 $SOURCE_URL_FILE);
if [ -z "$SOURCE_URL" ]; then
echo "$SOURCE_URL is empty!";
echo "SOURCE_URL is empty!";
exit 1;
fi

Expand All @@ -111,7 +111,7 @@ if [ ! -f "$CITIES_FILE" ]; then
fi
CITIES_LABEL=$(head -n 1 $CITIES_FILE);
if [ -z "$CITIES_LABEL" ]; then
echo "$CITIES_LABEL is empty!";
echo "CITIES_LABEL is empty in '$CITIES_FILE'!";
exit 1;
fi

Expand Down Expand Up @@ -331,6 +331,11 @@ setFeatureFlags;
GTFS_RT_FILE="${VALUES_DIR}/gtfs_real_time_values.xml";
if [ -f "${GTFS_RT_FILE}" ]; then
RT_PARTS=()
if grep -q "gtfs_real_time_agency_trip_updates_url" "${GTFS_RT_FILE}"; then
if [[ "${F_EXPORT_GTFS_RT_TRIP_UPDATES_PROVIDER}" == "true" ]]; then
RT_PARTS+=(" next departures")
fi
fi
if grep -q "gtfs_real_time_agency_service_alerts_url" "${GTFS_RT_FILE}"; then
RT_PARTS+=(" service alerts")
fi
Expand Down Expand Up @@ -389,7 +394,7 @@ EOL
PERMISSIONS_LINE="";

if [ -f "${BIKE_STATION_FILE}" ]; then
if [ -z "$PERMISSIONS_LINES" ]; then
if [ -z "$PERMISSIONS_LINE" ]; then
echo "" >> "${FULL_DESCRIPTION_FILE}";
echo "Permissions:" >> "${FULL_DESCRIPTION_FILE}";
checkResult $?;
Expand All @@ -401,15 +406,15 @@ if [ -f "${BIKE_STATION_FILE}" ]; then
fi

if [ -f "${GTFS_RT_FILE}" ]; then
if [ -z "$PERMISSIONS_LINES" ]; then
if [ -z "$PERMISSIONS_LINE" ]; then
echo "" >> "${FULL_DESCRIPTION_FILE}";
echo "Permissions:" >> "${FULL_DESCRIPTION_FILE}";
checkResult $?;
PERMISSIONS_LINE="- Other: required to download";
else
PERMISSIONS_LINE="${PERMISSIONS_LINE} and";
fi
PERMISSIONS_LINE="${PERMISSIONS_LINE} real-time service alerts";
PERMISSIONS_LINE="${PERMISSIONS_LINE} real-time information";
Comment thread
mmathieum marked this conversation as resolved.
fi
if [[ -f "${RSS_FILE}" || -f "${TWITTER_FILE}" || -f "${YOUTUBE_FILE}" ]]; then
if [ -z "$PERMISSIONS_LINE" ]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,13 @@ fi

AGENCY_NAME_LONG=$(tail -n 1 $AGENCY_NAME_FILE);
if [ -z "$AGENCY_NAME_LONG" ]; then
echo "$AGENCY_NAME_LONG is empty!";
echo "AGENCY_NAME_LONG is empty!";
exit 1;
fi

AGENCY_NAME_SHORT=$(head -n 1 $AGENCY_NAME_FILE);
if [ -z "$AGENCY_NAME_SHORT" ]; then
echo "AGENCY_NAME_SHORT is empty!";
exit 1;
fi
Comment thread
mmathieum marked this conversation as resolved.

Expand All @@ -52,13 +58,11 @@ AGENCY_LOCATION_FILE="${CONFIG_DIR}/agency_location";
if [ -f "$AGENCY_LOCATION_FILE" ]; then
AGENCY_LOCATION_SHORT=$(head -n 1 $AGENCY_LOCATION_FILE);
if [ -z "$AGENCY_LOCATION_SHORT" ]; then
echo "$AGENCY_LOCATION_SHORT is empty!";
echo "AGENCY_LOCATION_SHORT is empty!";
exit 1;
fi
fi

AGENCY_LABEL=$AGENCY_NAME_LONG;

requireCommand "xmllint" "libxml2-utils";
requireCommand "jq";

Expand Down Expand Up @@ -111,12 +115,13 @@ if [ -f "$AGENCY_TYPE_FILE" ]; then
fi
fi

SHORT_DESC="$AGENCY_NAME_LONG $TYPE_LABEL for MonTransit.";

AGENCY_LABEL=$AGENCY_NAME_SHORT;
if [ -n "$AGENCY_LOCATION_SHORT" ]; then
SHORT_DESC="$AGENCY_LOCATION_SHORT $SHORT_DESC"
AGENCY_LABEL="$AGENCY_LOCATION_SHORT $AGENCY_LABEL"
Comment thread
mmathieum marked this conversation as resolved.
fi

SHORT_DESC="$AGENCY_LABEL $TYPE_LABEL for MonTransit.";

if [ -f "$BIKE_STATION_VALUES_FILE" ]; then
SHORT_DESC="${SHORT_DESC} Availability.";
fi
Expand All @@ -129,6 +134,7 @@ setFeatureFlags;

GTFS_RT_FILE="${VALUES_DIR}/gtfs_real_time_values.xml";
if [ -f "${GTFS_RT_FILE}" ]; then
SHORT_DESC="${SHORT_DESC} Real-Time.";
if grep -q "gtfs_real_time_agency_service_alerts_url" "${GTFS_RT_FILE}"; then
SHORT_DESC="${SHORT_DESC} Alerts.";
fi
Expand All @@ -137,7 +143,13 @@ if [ -f "${GTFS_RT_FILE}" ]; then
SHORT_DESC="${SHORT_DESC} Vehicles.";
fi
fi
if grep -q "gtfs_real_time_agency_trip_updates_url" "${GTFS_RT_FILE}"; then
if [[ "${F_EXPORT_GTFS_RT_TRIP_UPDATES_PROVIDER}" == "true" ]]; then
SHORT_DESC="${SHORT_DESC} Departures.";
fi
fi
fi
# TODO: support other real-time providers

RSS_FILE="${VALUES_DIR}/rss_values.xml";
TWITTER_FILE="${VALUES_DIR}/twitter_values.xml";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ fi

AGENCY_NAME_SHORT=$(head -n 1 $AGENCY_NAME_FILE);
if [ -z "$AGENCY_NAME_SHORT" ]; then
echo "$AGENCY_NAME_SHORT is empty!";
echo "AGENCY_NAME_SHORT is empty!";
exit 1;
fi

Expand All @@ -57,7 +57,7 @@ AGENCY_LOCATION_FILE="${CONFIG_DIR}/agency_location";
if [ -f "$AGENCY_LOCATION_FILE" ]; then
AGENCY_LOCATION_SHORT=$(head -n 1 $AGENCY_LOCATION_FILE);
if [ -z "$AGENCY_LOCATION_SHORT" ]; then
echo "$AGENCY_LOCATION_SHORT is empty!";
echo "AGENCY_LOCATION_SHORT is empty!";
exit 1;
fi
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ fi

AGENCY_NAME_SHORT=$(head -n 1 $AGENCY_NAME_FILE);
if [ -z "$AGENCY_NAME_SHORT" ]; then
echo "$AGENCY_NAME_SHORT is empty!";
echo "AGENCY_NAME_SHORT is empty!";
exit 1;
fi

Expand Down Expand Up @@ -100,7 +100,7 @@ if [ ! -f "$CITIES_FILE" ]; then
fi
CITIES_LABEL=$(head -n 1 $CITIES_FILE);
if [ -z "$CITIES_LABEL" ]; then
echo "$CITIES_LABEL is empty!";
echo "CITIES_LABEL is empty in '$CITIES_FILE'!";
exit 1;
fi

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,24 @@ if [ ! -d "$CONFIG_DIR" ]; then
exit 1;
fi

AGENCY_NAME_FILE="${CONFIG_DIR}/agency_name";
AGENCY_NAME_FILE="${CONFIG_DIR}/fr/agency_name";
if [ ! -f "$AGENCY_NAME_FILE" ]; then
AGENCY_NAME_FILE="${CONFIG_DIR}/agency_name";
fi
Comment thread
mmathieum marked this conversation as resolved.
if [ ! -f "$AGENCY_NAME_FILE" ]; then
echo "$AGENCY_NAME_FILE doesn't exist!";
exit 1;
fi

AGENCY_NAME_SHORT=$(head -n 1 $AGENCY_NAME_FILE);
if [ -z "$AGENCY_NAME_SHORT" ]; then
echo "$AGENCY_NAME_SHORT is empty!";
echo "AGENCY_NAME_SHORT is empty!";
exit 1;
fi

AGENCY_NAME_LONG=$(tail -n 1 $AGENCY_NAME_FILE);
if [ -z "$AGENCY_NAME_LONG" ]; then
echo "$AGENCY_NAME_LONG is empty!";
echo "AGENCY_NAME_LONG is empty!";
exit 1;
fi

Expand All @@ -67,7 +70,7 @@ AGENCY_LOCATION_FILE="${CONFIG_DIR}/agency_location";
if [ -f "$AGENCY_LOCATION_FILE" ]; then
AGENCY_LOCATION_SHORT=$(head -n 1 $AGENCY_LOCATION_FILE);
if [ -z "$AGENCY_LOCATION_SHORT" ]; then
echo "$AGENCY_LOCATION_SHORT is empty!";
echo "AGENCY_LOCATION_SHORT is empty!";
exit 1;
fi
fi
Expand All @@ -90,7 +93,10 @@ fi
GIT_OWNER="mtransitapps"; #TODO extract de GIT_REMOTE_URL=$(git config --get remote.origin.url); # 'git@github.com:owner/repo.git' or 'https://github.com/owner/repo'.
CONTACT_WEBSITE_URL="https://github.com/$GIT_OWNER/$PROJECT_NAME";

SOURCE_URL_FILE="${CONFIG_DIR}/source_url_fr";
SOURCE_URL_FILE="${CONFIG_DIR}/fr/source_url";
if [ ! -f "$SOURCE_URL_FILE" ]; then
SOURCE_URL_FILE="${CONFIG_DIR}/source_url_fr"; # Deprecated
fi
if [ ! -f "$SOURCE_URL_FILE" ]; then
SOURCE_URL_FILE="${CONFIG_DIR}/source_url";
fi
Expand All @@ -100,7 +106,7 @@ if [ ! -f "$SOURCE_URL_FILE" ]; then
fi
SOURCE_URL=$(head -n 1 $SOURCE_URL_FILE);
if [ -z "$SOURCE_URL" ]; then
echo "$SOURCE_URL is empty!";
echo "SOURCE_URL is empty!";
exit 1;
fi

Expand All @@ -121,7 +127,7 @@ if [ ! -f "$CITIES_FILE" ]; then
fi
CITIES_LABEL=$(head -n 1 $CITIES_FILE);
if [ -z "$CITIES_LABEL" ]; then
echo "$CITIES_LABEL is empty!";
echo "CITIES_LABEL is empty in '$CITIES_FILE'!";
exit 1;
fi

Expand Down Expand Up @@ -335,6 +341,11 @@ setFeatureFlags;
GTFS_RT_FILE="${VALUES_DIR}/gtfs_real_time_values.xml";
if [ -f "${GTFS_RT_FILE}" ]; then
RT_PARTS=()
if grep -q "gtfs_real_time_agency_trip_updates_url" "${GTFS_RT_FILE}"; then
if [[ "${F_EXPORT_GTFS_RT_TRIP_UPDATES_PROVIDER}" == "true" ]]; then
RT_PARTS+=(" prochains départs")
fi
fi
if grep -q "gtfs_real_time_agency_service_alerts_url" "${GTFS_RT_FILE}"; then
RT_PARTS+=(" alertes de service")
fi
Expand Down Expand Up @@ -393,7 +404,7 @@ EOL
PERMISSIONS_LINE="";

if [ -f "${BIKE_STATION_FILE}" ]; then
if [ -z "$PERMISSIONS_LINES" ]; then
if [ -z "$PERMISSIONS_LINE" ]; then
echo "" >> "${FULL_DESCRIPTION_FILE}";
echo "Autorisations :" >> "${FULL_DESCRIPTION_FILE}";
checkResult $?;
Expand All @@ -405,15 +416,15 @@ if [ -f "${BIKE_STATION_FILE}" ]; then
fi

if [ -f "${GTFS_RT_FILE}" ]; then
if [ -z "$PERMISSIONS_LINES" ]; then
if [ -z "$PERMISSIONS_LINE" ]; then
echo "" >> "${FULL_DESCRIPTION_FILE}";
echo "Autorisations :" >> "${FULL_DESCRIPTION_FILE}";
checkResult $?;
PERMISSIONS_LINE="- Autres : requis pour le téléchargement des";
else
PERMISSIONS_LINE="${PERMISSIONS_LINE} et des";
fi
PERMISSIONS_LINE="${PERMISSIONS_LINE} alertes de service en temps-réel";
PERMISSIONS_LINE="${PERMISSIONS_LINE} information en temps-réel";
Comment thread
mmathieum marked this conversation as resolved.
fi
if [[ -f "${RSS_FILE}" || -f "${TWITTER_FILE}" || -f "${YOUTUBE_FILE}" ]]; then
if [ -z "$PERMISSIONS_LINE" ]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,24 @@ if [ ! -d "$CONFIG_DIR" ]; then
exit 1;
fi

AGENCY_NAME_FILE="${CONFIG_DIR}/agency_name";
AGENCY_NAME_FILE="${CONFIG_DIR}/fr/agency_name";
if [ ! -f "$AGENCY_NAME_FILE" ]; then
AGENCY_NAME_FILE="${CONFIG_DIR}/agency_name";
fi
if [ ! -f "$AGENCY_NAME_FILE" ]; then
echo "$AGENCY_NAME_FILE doesn't exist!";
exit 1;
fi

AGENCY_NAME_LONG=$(tail -n 1 $AGENCY_NAME_FILE);
if [ -z "$AGENCY_NAME_LONG" ]; then
echo "$AGENCY_NAME_LONG is empty!";
echo "AGENCY_NAME_LONG is empty!";
exit 1;
fi

AGENCY_NAME_SHORT=$(head -n 1 $AGENCY_NAME_FILE);
if [ -z "$AGENCY_NAME_SHORT" ]; then
echo "AGENCY_NAME_SHORT is empty!";
exit 1;
fi
Comment thread
mmathieum marked this conversation as resolved.

Expand All @@ -59,13 +68,11 @@ AGENCY_LOCATION_FILE="${CONFIG_DIR}/agency_location";
if [ -f "$AGENCY_LOCATION_FILE" ]; then
AGENCY_LOCATION_SHORT=$(head -n 1 $AGENCY_LOCATION_FILE);
if [ -z "$AGENCY_LOCATION_SHORT" ]; then
echo "$AGENCY_LOCATION_SHORT is empty!";
echo "AGENCY_LOCATION_SHORT is empty!";
exit 1;
fi
fi

AGENCY_LABEL=$AGENCY_NAME_LONG;

requireCommand "xmllint" "libxml2-utils";
requireCommand "jq";

Expand Down Expand Up @@ -110,7 +117,7 @@ else
exit 1 # error
fi

AGENCY_LABEL=$AGENCY_NAME_LONG;
AGENCY_LABEL=$AGENCY_NAME_SHORT;
if [ -n "$AGENCY_LOCATION_SHORT" ]; then
AGENCY_LABEL="$AGENCY_LABEL de $AGENCY_LOCATION_SHORT"
fi
Expand All @@ -129,6 +136,7 @@ setFeatureFlags;

GTFS_RT_FILE="${VALUES_DIR}/gtfs_real_time_values.xml";
if [ -f "${GTFS_RT_FILE}" ]; then
SHORT_DESC="${SHORT_DESC} Temps-Réel.";
if grep -q "gtfs_real_time_agency_service_alerts_url" "${GTFS_RT_FILE}"; then
SHORT_DESC="${SHORT_DESC} Alertes.";
fi
Expand All @@ -137,7 +145,13 @@ if [ -f "${GTFS_RT_FILE}" ]; then
SHORT_DESC="${SHORT_DESC} Véhicules.";
fi
fi
if grep -q "gtfs_real_time_agency_trip_updates_url" "${GTFS_RT_FILE}"; then
if [[ "${F_EXPORT_GTFS_RT_TRIP_UPDATES_PROVIDER}" == "true" ]]; then
SHORT_DESC="${SHORT_DESC} Départs.";
fi
fi
fi
# TODO: support other real-time providers

RSS_FILE="${VALUES_DIR}/rss_values.xml";
TWITTER_FILE="${VALUES_DIR}/twitter_values.xml";
Expand Down
Loading