Permalink
Browse files

Added bash configuration file

  • Loading branch information...
1 parent 93a558d commit 5e389f1e9a9f836629f026a2034cbca2cbeee69b @pingtimeout committed May 15, 2012
Showing with 354 additions and 0 deletions.
  1. +167 −0 environment/autocompletion.bash
  2. +53 −0 environment/environment.bash
  3. +93 −0 environment/functions.bash
  4. +41 −0 environment/prompt.bash
@@ -0,0 +1,167 @@
+function _rebuild-project()
+{
+ local cur prev opts
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+ opts='mwi-module access-module agm-module additional-musicbrainz-databroker-api availability-module batchservices-module avi-contribution-notification-job avi-databroker-api avi-databroker-server avi-databroker-service avi-index-controller-server avi-index-controller-technical-api avi-index-edi-format-2-1-r10 avi-index-edi-format avi-index-jobs avi-index-ui-api avi-index-ui-server avi-index-ui-service avi-rtf-controller-api avi-rtf-controller-server avi-rtf-controller-service avi-rtf-controller-technical-api avi-rtf-database-migration avi-rtf-databroker-api avi-rtf-databroker-server avi-rtf-databroker-service avi-rtf-edi-format-1-0-r9 avi-rtf-edi-format-1-1-r2 avi-rtf-edi-format-1-2-r3 avi-rtf-edi-format avi-rtf-jobs-test avi-rtf-jobs avi-upa-controller-api avi-upa-controller-server avi-upa-controller-service business-benefits-module ipi-module central-sql-materials cisac-constant-values common-additional-musicbrainz-api common-agm-api common-agm-dao common-agm-index common-agm-query-utils common-api common-avi-api common-avi-contribution-configuration common-avi-index-api common-avi-index-configuration common-avi-index-dao common-avi-index-matching common-avi-query-utils common-avi-rtf-api common-avi-rtf-configuration common-avi-rtf-controller-api common-avi-rtf-controller-test-utils common-avi-rtf-dao common-avi-rtf-query-utils common-avi-rtf-test-utils common-avi-work-standardization common-batchservices-matching-config common-batchservices-matching-dao common-batchservices-matching-test-utils common-batchservices-matching-utils common-batchservices-matching common-bridge-utils common-client common-combinedview-api common-combinedview common-config common-csi-api common-dao common-databroker common-file-transfer-api common-ipi-api common-ipi-dao common-ipi-index common-ipi-query-utils common-loader common-locator-api common-locator-business-objects common-mwi-api common-mwi-combinedview common-mwi-dao common-mwi-data-store-dao common-mwi-data-store common-mwi-databroker-config common-mwi-index common-mwi-indexer common-mwi-loader common-mwi-odi-api common-mwi-odi-dao common-mwi-odi-query-utils common-mwi-odi common-mwi-query-utils common-mwi-rtf-api common-mwi-rtf-dao common-mwi-rtf-query-utils common-mwi-rtf-test-utils common-mwi-rtf common-mwi-statistics-api common-mwi-test-utils common-pdf common-query-api common-security-client common-security-server common-security-utils common-spring-utils common-test-utils common-utils common-xml-loader configuration-api configuration-maker configuration-materials configuration-server configuration-service configuration-utils csi-databroker-api edi-av-request-pdf edi-av-response-pdf edi-format locator-api locator-client locator-manager locator-proxy-cache-server locator-proxy-cache-service locator-server locator-service maintenance-controller-api maintenance-controller-server maintenance-controller-service pubavi reference-api reference-client-test reference-server reference-utils search-engine societies-sql-materials standardization-rules standardization-utils standards-api webservices-soapui-tests security-module'
+
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+}
+
+complete -F _rebuild-project rebuild-project
+complete -F _rebuild-project rebuild-project-without-tests
+
+
+
+
+
+_mvn()
+{
+ local cur prev opts
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+ opts="-am|-amd|-B|-C|-c|-cpu|-D|-e|-emp|-ep|-f|-fae|-ff|-fn|-gs|-h|-l|-N|-npr|-npu|-nsu|-o|-P|-pl|-q|-rf|-s|-T|-t|-U|-up|-V|-v|-X"
+ long_opts="--also-make|--also-make-dependents|--batch-mode|--strict-checksums|--lax-checksums|--check-plugin-updates|--define|--errors|--encrypt-master-password|--encrypt-password|--file|--fail-at-end|--fail-fast|--fail-never|--global-settings|--help|--log-file|--non-recursive|--no-plugin-registry|--no-plugin-updates|--no-snapshot-updates|--offline|--activate-profiles|--projects|--quiet|--resume-from|--settings|--threads|--toolchains|--update-snapshots|--update-plugins|--show-version|--version|--debug"
+
+ common_lifecycle_phases="clean|process-resources|compile|process-test-resources|test-compile|test|package|install|deploy|site"
+ common_plugins="deploy|failsafe|install|site|surefire|checkstyle|javadoc|jxr|pmd|ant|antrun|archetype|assembly|dependency|enforcer|gpg|help|release|repository|source|eclipse|idea|jetty|cargo|jboss|tomcat|tomcat6|tomcat7|exec|versions|war|ear|ejb|android|scm|nexus|repository|sonar|license|hibernate3|liquibase"
+
+ plugin_goals_deploy="deploy:deploy-file"
+ plugin_goals_failsafe="failsafe:integration-test|failsafe:verify"
+ plugin_goals_install="install:install-file"
+ plugin_goals_site="site:site|site:deploy|site:run|site:stage|site:stage-deploy"
+ plugin_goals_surefire="surefire:test"
+
+ plugin_goals_checkstyle="checkstyle:checkstyle|checkstyle:check"
+ plugin_goals_javadoc="javadoc:javadoc|javadoc:jar|javadoc:aggregate"
+ plugin_goals_jxr="jxr:jxr"
+ plugin_goals_pmd="pmd:pmd|pmd:cpd|pmd:check|pmd:cpd-check"
+
+ plugin_goals_ant="ant:ant|ant:clean"
+ plugin_goals_antrun="antrun:run"
+ plugin_goals_archetype="archetype:generate|archetype:create-from-project|archetype:crawl"
+ plugin_goals_assembly="assembly:single|assembly:assembly"
+ plugin_goals_dependency="dependency:analyze|dependency:list|dependency:resolve|dependency:tree"
+ plugin_goals_enforcer="enforcer:enforce"
+ plugin_goals_gpg="gpg:sign|gpg:sign-and-deploy-file"
+ plugin_goals_help="help:active-profiles|help:all-profiles|help:describe|help:effective-pom|help:effective-settings|help:evaluate|help:expressions|help:system"
+ plugin_goals_release="release:clean|release:prepare|release:rollback|release:perform|release:stage|release:branch|release:update-versions"
+ plugin_goals_repository="repository:bundle-create|repository:bundle-pack"
+ plugin_goals_source="source:aggregate|source:jar|source:jar-no-fork"
+
+ plugin_goals_eclipse="eclipse:clean|eclipse:eclipse"
+ plugin_goals_idea="idea:clean|idea:idea"
+
+ plugin_goals_jetty="jetty:run|jetty:run-exploded"
+ plugin_goals_cargo="cargo:start|cargo:run|cargo:stop|cargo:deploy|cargo:undeploy|cargo:help"
+ plugin_goals_jboss="jboss:start|jboss:stop|jboss:deploy|jboss:undeploy|jboss:redeploy"
+ plugin_goals_tomcat="tomcat:start|tomcat:stop|tomcat:deploy|tomcat:undeploy|tomcat:undeploy"
+ plugin_goals_tomcat6="tomcat6:run|tomcat6:run-war|tomcat6:run-war-only|tomcat6:stop|tomcat6:deploy|tomcat6:undeploy"
+ plugin_goals_tomcat7="tomcat7:run|tomcat7:run-war|tomcat7:run-war-only|tomcat7:deploy"
+ plugin_goals_exec="exec:exec|exec:java"
+ plugin_goals_versions="versions:display-dependency-updates|versions:display-plugin-updates|versions:display-property-updates|versions:update-parent|versions:update-properties|versions:update-child-modules|versions:lock-snapshots|versions:unlock-snapshots|versions:resolve-ranges|versions:set|versions:use-releases|versions:use-next-releases|versions:use-latest-releases|versions:use-next-snapshots|versions:use-latest-snapshots|versions:use-next-versions|versions:use-latest-versions|versions:commit|versions:revert"
+ plugin_goals_scm="scm:add|scm:checkin|scm:checkout|scm:update|scm:status"
+
+ plugin_goals_war="war:war|war:exploded|war:inplace|war:manifest"
+ plugin_goals_ear="ear:ear|ear:generate-application-xml"
+ plugin_goals_ejb="ejb:ejb"
+ plugin_goals_android="android:apk|android:apklib|android:deploy|android:deploy-dependencies|android:dex|android:emulator-start|android:emulator-stop|android:emulator-stop-all|android:generate-sources|android:help|android:instrument|android:manifest-update|android:pull|android:push|android:redeploy|android:run|android:undeploy|android:unpack|android:version-update|android:zipalign"
+ plugin_goals_nexus="nexus:staging-list|nexus:staging-close|nexus:staging-drop|nexus:staging-release|nexus:staging-build-promotion|nexus:staging-profiles-list|nexus:settings-download"
+ plugin_goals_repository="repository:bundle-create|repository:bundle-pack|repository:help"
+
+ plugin_goals_sonar="sonar:sonar"
+ plugin_goals_license="license:format|license:check"
+ plugin_goals_hibernate3="hibernate3:hbm2ddl|hibernate3:help"
+ plugin_goals_liquibase="liquibase:changelogSync|liquibase:changelogSyncSQL|liquibase:clearCheckSums|liquibase:dbDoc|liquibase:diff|liquibase:dropAll|liquibase:help|liquibase:migrate|liquibase:listLocks|liquibase:migrateSQL|liquibase:releaseLocks|liquibase:rollback|liquibase:rollbackSQL|liquibase:status|liquibase:tag|liquibase:update|liquibase:updateSQL|liquibase:updateTestingRollback"
+
+ options="-Dmaven.test.skip=true|-DskipTests|-Dmaven.surefire.debug|-DenableCiProfile|-Dpmd.skip=true|-Dcheckstyle.skip=true"
+
+ profile_settings=`[ -e ~/.m2/settings.xml ] && grep -e "<profile>" -A 1 ~/.m2/settings.xml | grep -e "<id>.*</id>" | sed 's/.*<id>/-P/' | sed 's/<\/id>//g'`
+ profile_pom=`[ -e pom.xml ] && grep -e "<profile>" -A 1 pom.xml | grep -e "<id>.*</id>" | sed 's/.*<id>/-P/' | sed 's/<\/id>//g'`
+
+ local IFS=$'|\n'
+
+ if [[ ${cur} == -D* ]] ; then
+ COMPREPLY=( $(compgen -S ' ' -W "${options}" -- ${cur}) )
+
+ elif [[ ${cur} == -P* ]] ; then
+ COMPREPLY=( $(compgen -S ' ' -W "${profile_settings}|${profile_pom}" -- ${cur}) )
+
+ elif [[ ${cur} == --* ]] ; then
+ COMPREPLY=( $(compgen -W "${long_opts}" -S ' ' -- ${cur}) )
+
+ elif [[ ${cur} == -* ]] ; then
+ COMPREPLY=( $(compgen -W "${opts}" -S ' ' -- ${cur}) )
+
+ elif [[ ${prev} == -pl ]] ; then
+ if [[ ${cur} == *,* ]] ; then
+ COMPREPLY=( $(compgen -d -S ',' -P "${cur%,*}," -- ${cur##*,}) )
+ else
+ COMPREPLY=( $(compgen -d -S ',' -- ${cur}) )
+ fi
+
+ elif [[ ${prev} == -rf || ${prev} == --resume-from ]] ; then
+ COMPREPLY=( $(compgen -d -S ' ' -- ${cur}) )
+
+ elif [[ ${cur} == *:* ]] ; then
+ for plugin in $common_plugins; do
+ if [[ ${cur} == ${plugin}:* ]]; then
+ var_name="plugin_goals_${plugin}"
+ COMPREPLY=( $(compgen -W "${!var_name}" -S ' ' -- ${cur}) )
+ fi
+ done
+
+ else
+ if echo "${common_lifecycle_phases}" | tr '|' '\n' | grep -q -e "^${cur}" ; then
+ COMPREPLY=( $(compgen -S ' ' -W "${common_lifecycle_phases}" -- ${cur}) )
+ elif echo "${common_plugins}" | tr '|' '\n' | grep -q -e "^${cur}"; then
+ COMPREPLY=( $(compgen -S ':' -W "${common_plugins}" -- ${cur}) )
+ fi
+ fi
+}
+
+complete -F _mvn mvn
+
+
+
+
+
+function _rebuild-module()
+{
+ local cur prev opts
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ opts='access-module agm-module availability-module batchservices-module business-benefits-module ipi-module mwi-module security-module search-engine'
+
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+}
+
+complete -F _rebuild-module rebuild-module
+
+
+
+
+
+function _colortail-logs()
+{
+ local cur prev opts
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ opts='ipi-databroker-service-1.1.0 search-engine-4.4.0'
+
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+}
+
+complete -F _colortail-logs colortail-logs
+complete -F _colortail-logs colorgrep-logs
+
+
+
+
+
@@ -0,0 +1,53 @@
+export APPS_HOME=~/Dev/Applications
+export LANG_HOME=~/Dev/Langages
+export SRV_HOME=~/Dev/Serveurs
+
+export JAVA_HOME=$LANG_HOME/jdk1.6.0_30
+#export JAVA_HOME=$LANG_HOME/jdk1.7.0_03
+export PATH=$JAVA_HOME/bin:$PATH
+
+#export CLOJURE_HOME=$APPS_HOME/clojure-1.3.0
+#export SCALA_HOME=$APPS_HOME/scala-2.9.1-1
+#export PATH=$PATH:$CLOJURE_HOME:$SCALA_HOME/bin
+
+export CATALINA_HOME=$SRV_HOME/apache-tomcat-7.0.27
+export GLASSFISH_HOME=$SRV_HOME/glassfish
+export PATH=$PATH:$GLASSFISH_HOME/bin
+
+#export M2_HOME=$APPS_HOME/apache-maven-2.2.1
+export M3_HOME=$APPS_HOME/apache-maven-3.0.4
+export MAVEN_HOME=$M3_HOME
+export PATH=$PATH:$MAVEN_HOME/bin
+
+export SOAPUI_HOME=$APPS_HOME/soapui-4.5.0
+export PATH=$PATH:$SOAPUI_HOME/bin
+
+export SQUIRREL_HOME=$APPS_HOME/squirrel-sql-3.3.0
+export PATH=$PATH:$SQUIRREL_HOME/
+
+export H2_HOME=$APPS_HOME/h2
+export PATH=$PATH:$H2_HOME/bin
+
+export SPARK_HOME=$APPS_HOME/Spark
+export PATH=$PATH:$SPARK_HOME/
+
+export ANT_HOME=$APPS_HOME/apache-ant-1.8.2
+export PATH=$PATH:$ANT_HOME/bin
+
+export TOMCAT_HOME=$APPS_HOME/apache-tomcat-7.0.26
+export CATALINA_HOME=$TOMCAT_HOME
+export PATH=$PATH:$CATALINA_HOME/bin
+
+export IDEA_HOME=$APPS_HOME/idea-IU-117.117
+export PATH=$PATH:$IDEA_HOME/bin
+
+export GEPHI_HOME=$APPS_HOME/gephi
+export PATH=$PATH:$GEPHI_HOME/bin
+
+export YED_HOME=$APPS_HOME/yed-3.9.1
+export PATH=$PATH:$YED_HOME/
+
+
+# Do not add anything after this line
+export ENV_SET=1
+
View
@@ -0,0 +1,93 @@
+alias mvn="grc `which mvn`"
+alias colortail='grc tail -f -n 1000 '
+alias clearlogs-domain1='echo "" > $GLASSFISH_HOME/domains/domain1/logs/server.log'
+
+
+function colortail-logs()
+{
+ local domain=$1
+ local file=`echo $1 | perl -pe 's#-\d.\d.\d##g'`
+ shift
+ colortail $SRV_HOME/workingdir/$domain/logs/$file.log $@
+}
+
+
+function colorgrep-logs()
+{
+ local domain=$1
+ local file=`echo $1 | perl -pe 's#-\d.\d.\d##g'`
+ shift
+ grc grep $@ $SRV_HOME/workingdir/$domain/logs/$file.log
+}
+
+
+function rebuild-project()
+{
+ echo "" > /tmp/rebuildProject.log
+ for __project in "$@"
+ do
+ pushd ~/git/fasttrack/${__project}
+ grc mvn clean install | tee -a /tmp/rebuildProject.log
+ popd
+ done
+}
+
+
+function rebuild-project-without-tests()
+{
+ echo "" > /tmp/rebuildProjectWithoutTests.log
+ for __project in "$@"
+ do
+ pushd ~/git/fasttrack/${__project}
+ grc mvn clean install -Dmaven.test.skip=true | tee -a /tmp/rebuildProjectWithoutTests.log
+ popd
+ done
+}
+
+
+function clean-hardcoded-paths ()
+{
+ find -name D: -type d -exec rm -rf {} \;
+ find -name d: -type d -exec rm -rf {} \;
+}
+
+
+function rebuild-module()
+{
+ pushd ~/git/fasttrack/$1
+
+ if mvn clean install -DskipTests --fail-at-end
+ then git tag -f $1/compile/ok
+ else git tag -f $1/compile/ko
+ fi
+
+ if mvn clean install --fail-at-end
+ then git tag -f $1/test/ok
+ else git tag -f $1/test/ko
+ fi
+
+ popd
+}
+
+
+function restart-domain1()
+{
+ asadmin stop-domain domain1
+ clearlogs-domain1
+ asadmin start-domain domain1
+}
+
+
+function redeploy-war()
+{
+ local war=$1
+ local component=`echo $1 | perl -pe 's#^.*/|.war##g'`
+
+ echo "Undeploying $component if it exists"
+ asadmin undeploy $component
+
+ echo "Deploying $component using file $war"
+ asadmin deploy --contextroot $component --name $component $war
+}
+
+
View
@@ -0,0 +1,41 @@
+
+function __list-active-domains()
+{
+ local __domains=`ps aux | egrep 'com.sun.aas.domainName=\S+' --color -o | grep -v grep | awk -F= '{print $2}' | grep -v S\+`
+ if [ -n "$__domains" ]; then
+ printf -- "${1:- (%s)}" $__domains
+ fi
+}
+
+function __get_exit_status()
+{
+ es=$?
+ if [ $es -eq 0 ]
+ then
+ echo -e "\e[1;32m${es}\e[m"
+ else
+ echo -e "\e[1;31m${es}\e[m"
+ fi
+}
+
+
+__first_fragment_pattern='\033[38;5;104m(\e[0m%s\033[38;5;104m)\e[0m'
+__other_fragment_pattern='\033[38;5;104m--(\e[0m%s\033[38;5;104m)\e[0m'
+
+GIT_PS1_SHOWDIRTYSTATE=1
+GIT_PS1_SHOWUNTRACKEDFILES=1
+GIT_PS1_SHOWSTASHSTATE=1
+GIT_PS1_SHOWUPSTREAM="verbose"
+
+PS1="\n"
+PS1="$PS1`printf -- $__first_fragment_pattern '$(__get_exit_status)'`" # Return code of previous command
+PS1="$PS1`printf -- $__other_fragment_pattern '\u@\h'`" # Login and hostname
+PS1="$PS1`printf -- $__other_fragment_pattern '\w'`" # Current folder
+PS1="$PS1`printf -- '$(__git_ps1 "$__other_fragment_pattern")'`" # Git PS1 addon
+PS1="$PS1`printf -- '$(__list-active-domains "$__other_fragment_pattern")'`" # Glassfish running domains
+PS1="$PS1\n\\$ "
+
+export PS1
+
+unset __list_domains_function
+

0 comments on commit 5e389f1

Please sign in to comment.