-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnovo.rb
executable file
·66 lines (53 loc) · 1.97 KB
/
novo.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env ruby
def prompt(question, commands)
print "#{question} (y/n): "
input = gets.chomp
while (input !~ /[yn]/) do
print "#{question}? Digite (y) para Sim e (n) para Não: "
input = gets.chomp
end
system commands if input == "y"
end
if `whoami`.chomp != "root"
puts "Você deve usar esse script como um super usuário."
exit 1
end
# Commands
rails = <<RR
echo '\n>> Instalando Ruby 1.8\n' &&
echo 'apt-get -y install ruby1.8 libxml-ruby1.8 libxml2-dev libxslt1-dev libreadline-ruby1.8 irb1.8 ruby1.8-dev ri1.8 rdoc1.8' &&
echo '\n>> Instalando RubyGems a partir do código-fonte\n' &&
echo 'wget -nv http://rubyforge.org/frs/download.php/57643/rubygems-1.3.4.tgz' && echo 'tar -xzf rubygems-1.3.4.tgz' &&
echo 'cd rubygems-1.3.4 && ruby setup.rb install && cd .. && rm -rf rubygems-1.3.4' &&
echo 'gem sources -a http://gems.github.com && gem update' &&
echo '\n>> Instalando Rails\n' &&
echo 'gem install rails'"
RR
git = <<GIT
echo '\n>> Instalando Git\n' &&
echo 'apt-get -y install git-core git-doc git-gui gitk'"
GIT
sqlite = <<SQ
echo '\n>> Instalando Sqlite\n' &&
apt-get -y install sqlite3 libsqlite3-ruby libsqlite3-dev libdbd-sqlite3-ruby libsqlite3-ruby &&
echo '\n>> Instalando a Gem do Sqlite\n' &&
gem install sqlite3-ruby"
SQ
mysql = <<MY
echo '\n>> Instalando MySql\n' &&
apt-get -y install mysql-client-5.0 mysql-server-5.0 mysql-admin python-mysqldb libmysql-ruby libmysqlclient15-dev mysql-query-browser &&
echo '\n>> Instalando a Gem do MySql\n' &&
gem install mysql
MY
postgres = <<PG
echo '\n>> Instalando Postgres\n' &&
apt-get -y install libpq-dev libpgsql-ruby pgadmin3 postgresql-8.3 postgresql-client-8.3 postgresql-client-common postgresql-common postgresql-contrib-8.3 &&
echo '\n>> Instalando a Gem do Postgres\n' &&
gem install postgres
PG
puts "Iniciando..."
prompt("Instalar Ruby e Rails?", rails)
prompt("Instalar Git?", git)
prompt("Instalar Sqlite?", sqlite)
prompt("Instalar MySql?", mysql)
prompt("Instalar PostGres?", postgres)