Add configuration. See #5 #8.

What's new:
- --config flag to pass a INI config file to parse. See config.ini.
- Updated the modules scripts for configuration. Now needs to unset
  variables passed by CLI or config.
- Fix release directory that was added in love file (maybe).
- Properly escapes sed arguments.
- chmod +x to getopt.sh and read_ini.sh
- Fix #12
This commit is contained in:
Antonin Décimo
2014-08-22 14:07:44 +02:00
parent 83a5f111b7
commit 5bbf17401a
12 changed files with 502 additions and 18 deletions

View File

@@ -2,6 +2,23 @@
init_module "Android"
# Configuration
if [ "$CONFIG" = true ]; then
if [ -n "${INI__android__activity}" ]; then
ACTIVITY=${INI__android__activity}
fi
if [ -n "${INI__android__package_name}" ]; then
PACKAGE_NAME=${INI__android__package_name}
fi
if [ -n "${INI__android__package_version}" ]; then
PACKAGE_VERSION=${INI__android__package_version}
fi
if [ -n "${INI__android__maintainer_name}" ]; then
MAINTAINER_NAME=${INI__android__maintainer_name}
fi
fi
# Options
activity_defined_argument=false
package_name_defined_argument=false
@@ -104,5 +121,6 @@ else
fi
unset ACTIVITY PACKAGE_NAME PACKAGE_VERSION MAINTAINER_NAME
exit_module

View File

@@ -1,6 +1,28 @@
# Debian package
init_module "Debian"
# Configuration
if [ "$CONFIG" = true ]; then
if [ -n "${INI__debian__package_version}" ]; then
PACKAGE_VERSION=${INI__debian__package_version}
fi
if [ -n "${INI__debian__homepage}" ]; then
PROJECT_HOMEPAGE=${INI__debian__homepage}
fi
if [ -n "${INI__debian__description}" ]; then
PROJECT_DESCRIPTION=${INI__debian__description}
fi
if [ -n "${INI__debian__maintainer_name}" ]; then
MAINTAINER_NAME=${INI__debian__maintainer_name}
fi
if [ -n "${INI__debian__maintainer_email}" ]; then
MAINTAINER_EMAIL=${INI__debian__maintainer_email}
fi
if [ -n "${INI__android__package_name}" ]; then
PACKAGE_NAME=${INI__debian__package_name}
fi
fi
# Options
package_name_defined_argument=false
@@ -111,5 +133,6 @@ cd "$RELEASE_DIR"
rm -rf $TEMP
unset PROJECT_DESCRIPTION PROJECT_HOMEPAGE MAINTAINER_NAME MAINTAINER_EMAIL PACKAGE_NAME PACKAGE_VERSION
exit_module

View File

@@ -12,6 +12,8 @@
# To create a new module, you have to create a file in this directory,
# and to edit the main love-release script.
# If you wish to submit a new module, please also edit README.md and love-release.1
# You could add configuration options in config.ini too,
# but the name of the section must be the same as the name of the script.
# Love-release script
@@ -31,7 +33,7 @@ SHORT_HELP=" -q Create an Example application"
while getoptex "$SCRIPT_ARGS" "$@"
do
if [ "$OPTOPT" = "q" ]; then
source "$PLATFORMS_DIR"/love.sh
source "$PLATFORMS_DIR"/example.sh
fi
done
@@ -52,7 +54,21 @@ done
### $1: Module name
init_module "Example"
## 2. Parse the options
## 2. Read the configuration
# Syntax is ${INI__section__variable}
if [ "$CONFIG" = true ]; then
if [ -n "${INI__q__wer}" ]; then
WER=${INI__q__wer}
fi
if [ -n "${INI__q__ty}" ]; then
TY=${INI_q_ty}
fi
if [ -n "${INI__q__uiop}" ]; then
UIOP=true
fi
fi
## 3. Parse the options
# $OPTOPT holds the option and $OPTARG holds the eventual argument passed to it.
while getoptex "$SCRIPT_ARGS" "$@"
do
@@ -65,13 +81,18 @@ do
fi
done
## 3. Create the love file
## 4. Create the love file
### $1: Compression level 0-9
create_love_file 9
## 4. Write your code
## 5. Exit the module
## 5. Write your code
## 6. Unset every variable passed by configuration or command-line
unset WER TY UIOP
## 7. Exit the module
### $1: exit code. 0 - success, other - failure
### $2: error message
exit_module

View File

@@ -2,6 +2,17 @@
init_module "Mac OS X"
# Configuration
if [ "$CONFIG" = true ]; then
if [ -n "${INI__macosx__maintainer_name}" ]; then
MAINTAINER_NAME=${INI__macosx__maintainer_name}
fi
if [ -n "${INI__macosx__icon}" ]; then
PROJECT_ICNS=${INI__macosx__icon}
fi
fi
# Options
while getoptex "$SCRIPT_ARGS" "$@"
do
@@ -137,5 +148,6 @@ else
fi
unset PROJECT_ICNS
exit_module

View File

@@ -2,6 +2,16 @@
init_module "Windows"
# Configuration
if [ "$CONFIG" = true ]; then
RELEASE_WIN_32=true
RELEASE_WIN_64=true
if [ -n "${INI__windows__icon}" ]; then
PROJECT_ICO=${INI__windows__icon}
fi
fi
# Options
while getoptex "$SCRIPT_ARGS" "$@"
do
@@ -80,10 +90,10 @@ if [ "$RELEASE_WIN_64" = true ] && [ "$LOVE_GT_080" = true ]; then
cp "$CACHE_DIR"/love-$LOVE_VERSION-win-x64.zip ./love-$LOVE_VERSION-win64.zip
fi
fi
unzip -qq love-$LOVE_VERSION-win64.zip
rm -rf "$PROJECT_NAME"-win64.zip 2> /dev/null
if [ "$FOUND_WINE" = true ] && [ -n "$PROJECT_ICO" ]; then
WINEPREFIX="$WINEPREFIX" wine "$RESHACKER" -addoverwrite "love-$LOVE_VERSION-win32/love.exe,love-$LOVE_VERSION-win32/love.exe,"$PROJECT_ICO",ICONGROUP,MAINICON,0" 2> /dev/null
fi
@@ -95,5 +105,6 @@ if [ "$RELEASE_WIN_64" = true ] && [ "$LOVE_GT_080" = true ]; then
fi
unset PROJECT_ICO
exit_module