1+ #! /bin/bash
2+ # #
3+ # # Instalacao Ambiente de Desenvolvimento
4+ # #
5+
6+ # nome do ambiente
7+ environment=$1
8+
9+ if [ $( whoami) != " root" ]; then
10+ echo " Tem que executar como root."
11+ exit 2
12+ fi
13+
14+ # #
15+ # # Configuracoes Basicas de Desenvolvimento
16+ # #
17+ ConfigureDevel ()
18+ {
19+ # desativa selinux
20+ [ -f /etc/selinux/config ] && sed -i.backup -e ' s/^SELINUX=.*$/SELINUX=disabled/' /etc/selinux/config
21+
22+ # configura editor svn
23+ if ! grep -q " SVN_EDITOR" /etc/bashrc ; then
24+ if [ -x /usr/bin/vim ] ; then
25+ printf ' export SVN_EDITOR=/usr/bin/vim\n' >> /etc/bashrc
26+ else
27+ printf ' export SVN_EDITOR=/usr/bin/vi\n' >> /etc/bashrc
28+ fi
29+ fi
30+
31+ # Melhorando visual bash
32+ cat << SETVAR >> /etc/bashrc
33+ if [ "$( id -u) " != "0" ] ; then
34+ PS1="\n(\e[31;1m\u\e[m - \w @\e[32;1m\t\e[m - Devel :: $environment ) \n\H: "
35+ else
36+ PS1="\n(\e[34;1m\u\e[m - \w @\e[32;1m\t\e[m - Devel :: $environment ) \n\H: "
37+ fi
38+ SETVAR
39+ }
40+
41+ # #
42+ # # Instala os pacotes necessarios para um ambiente de desenvolvimento
43+ # #
44+ InstallPackages () {
45+
46+ printf " \n Instalando Pacotes "
47+ printf " \n------------------------------------------------------------\n"
48+
49+ # instando EPEL
50+ wget " http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-7.noarch.rpm" -qO " /tmp/epel.rpm"
51+ rpm -ivh /tmp/epel.rpm
52+
53+ # instalando Pacotes necessarios para desenvolvimento
54+ yumList=(" php-pear curl gettext make man man-pages python-crypto python-hashlib
55+ python-nose python-simplejson python-twisted python-uuid rpm-build"
56+ " selinux-policy selinux-policy-targeted subversion sudo syslinux"
57+ " vim-enhanced wget yum-changelog yum-security yum-utils screen"
58+ " automake make rpm rpm-build rpm-devel curl-devel openssl-devel mysql"
59+ " mysql-server httpd gettext php php-devel php-mbstring php-mysql autoconf "
60+ " php-pdo php-xml php-gd php-pear php-pear-PHP-CodeSniffer php-pear-PHPUnit"
61+ " mod_ssl python python-twisted python-simplejson python-pycurl python-hashlib" );
62+ yum install $( printf " %s" " ${yumList[@]} " ) -y
63+
64+ # Pacotes de Ferramentas de Desenvolvedor
65+ yum groupinstall -y ' Development Tools'
66+ }
67+
68+ # #
69+ # # Node nao e querido, asm valido ter
70+ # #
71+ InstallNode () {
72+
73+ printf " INSTALADO Node JS, aguarde isto vai demorar ... \n\n" ;
74+
75+ wget " http://nodejs.org/dist/v0.8.1/node-v0.8.1.tar.gz" -O " node-v0.8.1.tar.gz"
76+ tar -vzxf node-v0.8.1.tar.gz
77+ cd node-v0.8.1; ./configure; make; make install
78+ rm -rf node-v0.8.1; rm-rf node-v0.8.1.tar.gz
79+ }
80+
81+ # #
82+ # # Instalando Softwares para Integracao continua em PHP
83+ # #
84+ InstallICPHP () {
85+
86+ # instalando Code Sniffer
87+ pear channel-update pear.php.net
88+ pear install PHP_CodeSniffer-1.4.1
89+
90+ # instalando PHP Documentor
91+ pear channel-discover pear.phpdoc.org
92+ pear install phpdoc/phpDocumentor-alpha
93+
94+ # PHP Unit
95+ pear channel-discover pear.phpunit.de
96+ pear channel-discover components.ez.no
97+ pear channel-discover pear.symfony-project.com
98+ pear channel-update pear.phpunit.de
99+ pear install pear.phpunit.de/PHPUnit
100+ pear install pear.phpunit.de/phpcpd
101+ pear install pear.phpunit.de/phploc
102+ pear install pear.phpunit.de/PHP_CodeCoverage
103+
104+ # php depend
105+ pear channel-discover pear.pdepend.org
106+ pear channel-update pear.pdepend.org
107+ pear install pdepend/PHP_Depend-beta
108+ }
109+
110+ # executando lista de acoes
111+
112+ # executa Instalacao de Pacotes
113+ InstallPackages;
114+
115+ # Configurando ambiente de Desenvolvimento
116+ ConfigureDevel;
117+
118+ # integracao continua
119+ InstallICPHP;
120+
121+ InstallNode;
0 commit comments