#!/bin/bash : ' @vendor Chorke Academia, Inc. @web https://cdn.chorke.org/docs/academia @version 1.0.00 @since 1.0.00 ' :<\n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ " EXT_HTM_BASIC_TAGS_FIND=' -->' EXT_HTM_BASIC_TAGS_FILL=" -->\n\ " EXT_HTM_INDEX_BODY_FIND='' EXT_HTM_INDEX_BODY_FILL="\n\
\n\
\n\
\n\ $app - Chorke Academia
\n\ Application Loading .....\n\
\n\
\n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ " sed -i "s|$EXT_HTM_INDEX_HEAD_FIND|$EXT_HTM_INDEX_HEAD_FILL|" "$EXT_HTM_FILE" sed -i "s|$EXT_HTM_BASIC_TAGS_FIND|$EXT_HTM_BASIC_TAGS_FILL|" "$EXT_HTM_FILE" sed -i "s|$EXT_HTM_INDEX_BODY_FIND|$EXT_HTM_INDEX_BODY_FILL|" "$EXT_HTM_FILE" } function descriptify_own(){ EXT_APP_FILE='app/Application.js' EXT_APP_SUPER_NAME_FIND=" extend: 'Ext.app.Application'," EXT_APP_SUPER_NAME_FILL=" extend: 'Ext.app.Application',\n\ namespace: '$app'," EXT_APP_CLASS_NAME_FIND=" name: '$app'," EXT_APP_CLASS_NAME_FILL=" name: '$app',\n\ \n\ requires: [\n\ 'Ext.app.*',\n\ 'Ext.state.CookieProvider',\n\ 'Ext.window.MessageBox',\n\ 'Ext.tip.QuickTipManager',\n\ 'Ext.chart.*',\n\ '$app.*'\n\ ]," EXT_APP_LANCH_FUNC_FIND=' launch: function () {' EXT_APP_LANCH_FUNC_FILL=" init: function() {\n\ var me = this;\n\ \n\ if ('nocss3' in Ext.Object.fromQueryString(location.search)) {\n\ Ext.supports.CSS3BorderRadius = false;\n\ Ext.getBody().addCls('x-nbr x-nlg');\n\ }\n\ \n\ // Ext.create('$app.store.Navigation', {\n\ // storeId: 'navigation'\n\ // });\n\ \n\ me.setDefaultToken('!');\n\ Ext.setGlyphFontFamily('Pictos');\n\ Ext.tip.QuickTipManager.init();\n\ \n\ if (!Ext.platformTags.test) {\n\ Ext.state.Manager.setProvider(Ext.create('Ext.state.CookieProvider'));\n\ }\n\ },\n\ \n\ launch: function () {\n\ if(window.Msc){\n\ Msc.loader.complete();\n\ }" sed -i "s|$EXT_APP_SUPER_NAME_FIND|$EXT_APP_SUPER_NAME_FILL|" "$EXT_APP_FILE" sed -i "s|$EXT_APP_CLASS_NAME_FIND|$EXT_APP_CLASS_NAME_FILL|" "$EXT_APP_FILE" sed -i "s|$EXT_APP_LANCH_FUNC_FIND|$EXT_APP_LANCH_FUNC_FILL|" "$EXT_APP_FILE" } function descriptify_mvn(){ if ls app/store/*.js &>/dev/null;then mv app/store/*.js src/main/js/app/store/;fi if [ -d 'app/view/main/' ];then mv app/view/main src/main/js/app/view/;fi touch app/{model,store,view}/.gitkeep rm -rf app/{*.md,{model,store}/*.md} mv app/*.js src/main/js/app/ touch resources/.gitkeep rm -rf resources/*.md } function descriptify_ant(){ # modify sencha ant build descriptor EXT_ANT_FILE='build.xml' EXT_ANT_BUILD_IMPL_FIND=' ' EXT_ANT_BUILD_IMPL_FILL=" \n\ " # class path updater EXT_ANT_BUILD_AFTR_FIND='' EXT_ANT_BUILD_AFTR_FILL=" \n\ \n\ \n\ \n\ \n\ \n\ " sed -i "s|$EXT_ANT_BUILD_IMPL_FIND|$EXT_ANT_BUILD_IMPL_FILL|" "$EXT_ANT_FILE" sed -i "s|$EXT_ANT_BUILD_AFTR_FIND|$EXT_ANT_BUILD_AFTR_FILL|" "$EXT_ANT_FILE" } function descriptify(){ mv Readme.md README.md descriptify_workspace descriptify_app descriptify_pwa descriptify_htm descriptify_own descriptify_mvn descriptify_ant } function download(){ EXT_LIB_SCRIPT_URL='https://cdn.chorke.org/repo/web/sencha/CKi.js' EXT_LIB_STYLES_URL='https://cdn.chorke.org/repo/web/sencha/CKi.css' EXT_APP_HEADER_URL='https://cdn.chorke.org/repo/ant/sencha/header.js' EXT_APP_FVICON_URL='https://cdn.chorke.org/repo/cmd/sencha/appicon.zip' EXT_GIT_IGNORE_URL='https://cdn.chorke.org/repo/git/sencha/gitignore.txt' EXT_ANT_BUILDI_URL='https://cdn.chorke.org/repo/ant/sencha/build-impl.xml' EXT_MVN_POMXML_URL='https://cdn.chorke.org/repo/mvn/sencha/academia/ecma/pom.xml' curl $EXT_MVN_POMXML_URL > pom.xml curl $EXT_GIT_IGNORE_URL > .gitignore curl $EXT_APP_HEADER_URL > .academia/antrun/header.js curl $EXT_ANT_BUILDI_URL > .academia/antrun/build-impl.xml curl $EXT_LIB_SCRIPT_URL > .academia/layout/resources/CKi.js curl $EXT_LIB_STYLES_URL > .academia/layout/resources/CKi.css curl $EXT_APP_FVICON_URL > .academia/layout/resources/appicon.zip unzip -q -o .academia/layout/resources/appicon.zip -d .academia/layout/resources/ rm -rf .academia/layout/resources/appicon.zip } function config_mac(){ printf "\n%-20s \033[0;32m Configuring 'gnu-sed'! \033[0m:)\n" "$OS" if [ -x "$(command -v brew)" ];then export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH" if [ ! -f '/usr/local/opt/gnu-sed/libexec/gnubin/sed' ];then brew install gnu-sed fi SED_PATH="`which sed`" if [ "$SED_PATH" != '/usr/local/opt/gnu-sed/libexec/gnubin/sed' ];then printf "\n%-20s \033[0;31mNot Supported 'gnu-sed'! \033[0m:(\n" "$OS" exit 1 fi else printf "\nHomebrew \033[0;31mNot Found! \033[0m:(\n" exit 1 fi } function config_nux(){ printf "\n%-20s \033[0;32m Supported 'gnu-sed'! \033[0m:)\n" "$OS" } function config_nix(){ printf "\n%-20s \033[0;31mNot Supported 'gnu-sed'! \033[0m:(\n" "$OS" exit 1 } function config(){ case "$OSTYPE" in darwin*) config_mac ;; linux* |msys*|cygwin) config_nux ;; solaris*|bsd* |*) config_nix ;; esac } function mavenify(){ structurify descriptify download trackify } function init(){ if [ -d "$dir" ];then cd $dir mavenify cd .. elif [ "$(basename $(pwd))" == "$dir" ];then mavenify elif [ "$(basename $(dirname $(pwd)))" == "$dir" ];then back="$(basename $(pwd))" cd .. mavenify if [ -d "$back" ];then cd $back fi else printf "\nExtApp $app \033[0;31mNot Found! \033[0m:(\n" fi } config init