Created
March 14, 2013 10:50
-
-
Save kaosf/5160421 to your computer and use it in GitHub Desktop.
tiapp.xml を切り替えるシェルスクリプト書いたし ref: http://qiita.com/items/a2c57d2e3b216033ad8b
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /bin/sh | |
| ./tiapp_xml-converter $1 | |
| ti build # ここは各自でちゃんと書いてね | |
| ./tiapp_xml-reverter |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| hostname: my.development.com |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var s = Ti.App.Properties.getString('varname'); | |
| alert(s); // alert "mystring" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <ti:app xmlns:ti="http://ti.appcelerator.org"> | |
| ... | |
| <property name="varname" type="string">mystring</property> | |
| ... | |
| </ti:app> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /bin/sh | |
| BUILD_TYPE=$1 | |
| if [ -z "$BUILD_TYPE" ]; then | |
| BUILD_TYPE=production | |
| fi | |
| if [ \ | |
| $BUILD_TYPE != 'development' -a \ | |
| $BUILD_TYPE != 'staging' -a \ | |
| $BUILD_TYPE != 'production' \ | |
| ]; then | |
| echo 'the argument should be in [development, staging, production]' 1>&2 | |
| exit 1 | |
| fi | |
| if [ $BUILD_TYPE = 'development' -a ! -e env ]; then | |
| echo "local environment file \"env\" doesn't exist" 1>&2 | |
| exit 1 | |
| fi | |
| if [ $BUILD_TYPE = 'development' ]; then | |
| HOSTNAME=$(cat env | grep 'hostname:' | awk '{print $2}') | |
| elif [ $BUILD_TYPE = 'staging' ]; then | |
| HOSTNAME=staging.example.com | |
| fi | |
| if [ $BUILD_TYPE != 'production' ]; then | |
| cp tiapp.xml tiapp.xml.bk | |
| sed -e "s/<name>\(.*\?\)<\/name>/<name>\1${BUILD_TYPE}<\/name>/" tiapp.xml -i | |
| sed -e "s/<id>\(.*\?\)<\/id>/<id>\1${BUILD_TYPE}<\/id>/" tiapp.xml -i | |
| sed -e "s/<property name=\"appenv\" type=\"string\">.*\?<\/property>/<property name=\"appenv\" type=\"string\">${BUILD_TYPE}<\/property>/" tiapp.xml -i | |
| sed -e "s/<property name=\"hostname\" type=\"string\">.*\?<\/property>/<property name=\"hostname\" type=\"string\">${HOSTNAME}<\/property>/" tiapp.xml -i | |
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /bin/sh | |
| if [ -e tiapp.xml.bk ]; then | |
| mv tiapp.xml.bk tiapp.xml | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment