diff --git a/apptools/install.sh b/apptools/install.sh new file mode 100755 index 0000000000..2edef801e3 --- /dev/null +++ b/apptools/install.sh @@ -0,0 +1,81 @@ +#!/bin/bash + +# -------------------------------------------------------------------------- # +# Copyright 2010-2012, C12G Labs S.L. # +# # +# Licensed under the C12G Commercial Open-source License (the # +# "License"); you may not use this file except in compliance # +# with the License. You may obtain a copy of the License as part # +# of the software distribution. # +# # +# Unless agreed to in writing, software distributed under the # +# License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES # +# OR CONDITIONS OF ANY KIND, either express or implied. See the # +# License for the specific language governing permissions and # +# limitations under the License. # +#--------------------------------------------------------------------------- # + +usage() { + echo + echo "Usage: install.sh [-d ONE_LOCATION] [-l] [-h]" + echo + echo "-d: target installation directory, if not defined it'd be root. Must be" + echo " an absolute path." + echo "-l: creates symlinks instead of copying files, useful for development" + echo "-h: prints this help" +} + +TEMP_OPT=`getopt -o hld: -n 'install.sh' -- "$@"` + +if [ $? != 0 ] ; then + usage + exit 1 +fi + +eval set -- "$TEMP_OPT" + +LINK="no" +SRC_DIR=$PWD + +while true ; do + case "$1" in + -h) usage; exit 0;; + -d) ROOT="$2" ; shift 2 ;; + -l) LINK="yes" ; shift ;; + --) shift ; break ;; + *) usage; exit 1 ;; + esac +done + +if [ -z "$ROOT" ]; then + SUNSTONE_LOCATION="/usr/lib/one/sunstone" +else + SUNSTONE_LOCATION="$ROOT/lib/sunstone" +fi + +do_file() { + if [ "$UNINSTALL" = "yes" ]; then + rm $2/`basename $1` + else + if [ "$LINK" = "yes" ]; then + ln -s $SRC_DIR/$1 $2 + else + cp -R $SRC_DIR/$1 $2 + fi + fi +} + +copy_files() { + FILES=$1 + DST=$DESTDIR$2 + + mkdir -p $DST + + for f in $FILES; do + do_file $f $DST + done +} + +copy_files "sunstone/public/images/*" "$SUNSTONE_LOCATION/public/images" +copy_files "sunstone/public/js/user-plugins/*" "$SUNSTONE_LOCATION/public/js/user-plugins" + diff --git a/env/sunstone/public/images/appenv_icon.png b/apptools/sunstone/public/images/appenv_icon.png similarity index 100% rename from env/sunstone/public/images/appenv_icon.png rename to apptools/sunstone/public/images/appenv_icon.png diff --git a/env/sunstone/public/images/appflow_icon.png b/apptools/sunstone/public/images/appflow_icon.png similarity index 100% rename from env/sunstone/public/images/appflow_icon.png rename to apptools/sunstone/public/images/appflow_icon.png diff --git a/env/sunstone/public/images/appmarket_icon.png b/apptools/sunstone/public/images/appmarket_icon.png similarity index 100% rename from env/sunstone/public/images/appmarket_icon.png rename to apptools/sunstone/public/images/appmarket_icon.png diff --git a/env/sunstone/public/images/apptools_icon.png b/apptools/sunstone/public/images/apptools_icon.png similarity index 100% rename from env/sunstone/public/images/apptools_icon.png rename to apptools/sunstone/public/images/apptools_icon.png diff --git a/env/sunstone/public/js/user-plugins/apptools.js b/apptools/sunstone/public/js/user-plugins/apptools.js similarity index 100% rename from env/sunstone/public/js/user-plugins/apptools.js rename to apptools/sunstone/public/js/user-plugins/apptools.js diff --git a/env/install.sh b/env/install.sh index b7c9505ebc..7def4c78d4 100755 --- a/env/install.sh +++ b/env/install.sh @@ -87,7 +87,6 @@ copy_files() { copy_files "lib/* cli/*" "$LIB_LOCATION" copy_files "bin/*" "$BIN_LOCATION" copy_files "share/packages/*" "$PACKAGES_LOCATION" -copy_files "sunstone/public/images/*" "$SUNSTONE_LOCATION/public/images" copy_files "sunstone/public/js/user-plugins/*" "$SUNSTONE_LOCATION/public/js/user-plugins" copy_files "sunstone/routes/*" "$SUNSTONE_LOCATION/routes" diff --git a/flow/install.sh b/flow/install.sh index d332f8fccf..eed3439b1f 100755 --- a/flow/install.sh +++ b/flow/install.sh @@ -41,11 +41,13 @@ if [ -z "$ROOT" ]; then BIN_LOCATION="/usr/bin" ETC_LOCATION="/etc/one" LOG_LOCATION="/var/log/one/appflow" + SUNSTONE_LOCATION="/usr/lib/one/sunstone" else LIB_LOCATION="$ROOT/lib/ruby/apptools/flow" BIN_LOCATION="$ROOT/bin" ETC_LOCATION="$ROOT/etc" LOG_LOCATION="$ROOT/var/appflow" + SUNSTONE_LOCATION="$ROOT/lib/sunstone" fi DIRECTORIES="$LIB_LOCATION $BIN_LOCATION $ETC_LOCATION $LOG_LOCATION" @@ -89,7 +91,13 @@ copy_files "controllers models public views lcm" "$LIB_LOCATION" copy_files "lib/* models.rb config.ru Gemfile Gemfile.lock \ Rakefile" "$LIB_LOCATION" +# Sunstone +copy_files "sunstone/public/js/user-plugins/*" \ + "$SUNSTONE_LOCATION/public/js/user-plugins" +copy_files "sunstone/routes/*" "$SUNSTONE_LOCATION/routes" + # Do not link the ETC files LINK="no" copy_files "config/appflow.yaml" "$ETC_LOCATION" + diff --git a/flow/sunstone/public/js/user-plugins/appflow.js b/flow/sunstone/public/js/user-plugins/appflow.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/flow/sunstone/routes/appflow.rb b/flow/sunstone/routes/appflow.rb new file mode 100644 index 0000000000..e69de29bb2 diff --git a/market/install.sh b/market/install.sh index ef1e3a6134..24d93bc617 100755 --- a/market/install.sh +++ b/market/install.sh @@ -40,10 +40,12 @@ if [ -z "$ROOT" ]; then LIB_LOCATION="/usr/lib/one/ruby/apptools/market" BIN_LOCATION="/usr/bin" ETC_LOCATION="/etc/one" + SUNSTONE_LOCATION="/usr/lib/one/sunstone" else LIB_LOCATION="$ROOT/lib/ruby/apptools/market" BIN_LOCATION="$ROOT/bin" ETC_LOCATION="$ROOT/etc" + SUNSTONE_LOCATION="$ROOT/lib/sunstone" fi DIRECTORIES="$LIB_LOCATION $BIN_LOCATION $ETC_LOCATION" @@ -87,6 +89,11 @@ copy_files "controllers models public views" "$LIB_LOCATION" copy_files "lib/* models.rb config.ru Gemfile Gemfile.lock \ Rakefile config/init.rb" "$LIB_LOCATION" +# Sunstone +copy_files "sunstone/public/js/user-plugins/*" \ + "$SUNSTONE_LOCATION/public/js/user-plugins" +copy_files "sunstone/routes/*" "$SUNSTONE_LOCATION/routes" + # Do not link the ETC files LINK="no" copy_files "config/appmarket.yaml" "$ETC_LOCATION" diff --git a/market/sunstone/public/js/user-plugins/appmarket.js b/market/sunstone/public/js/user-plugins/appmarket.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/market/sunstone/routes/appmarket.rb b/market/sunstone/routes/appmarket.rb new file mode 100644 index 0000000000..e69de29bb2