This repository has been archived by the owner on Apr 22, 2018. It is now read-only.
forked from diaspora/diaspora
-
Notifications
You must be signed in to change notification settings - Fork 0
/
INSTALL_ON_OSX
119 lines (100 loc) · 4.55 KB
/
INSTALL_ON_OSX
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#to make this work, run
#rake install --rakefile INSTALL_ON_OSX
require 'rake'
task :install do
puts "this currently is untested, prepare for tragedy"
puts "****************************************************************************"
puts "****************************** HELLO! *************************************"
puts "****************************************************************************"
puts ""
puts "We're going to install a ton of stuff to get Diaspora running on your box."
puts "Grab a tasty beverage - this might take a while. Then let's get started!"
print "Hit enter once you have a drink! "
input = STDIN.gets
BREW_INSTALLED = installed?('brew')
RVM_INSTALLED = installed?('rvm')
MYSQL_INSTALLED = installed?('mysql')
REDIS_INSTALLED = installed?('redis-server')
IMAGEMAGICK_INSTALLED = installed?('mogrify')
XCODE_INSTALLED = installed?('gcc')
unless XCODE_INSTALLED
puts "Sadly, you need to install XCode before running this script. :("
puts "You can get it from your OSX install DVD, or download it from Apple's developer page."
Process.exit
end
puts "Hooray! You have XCode already!"
unless BREW_INSTALLED
puts "Installing homebrew..."
system("ruby -e \"$(curl -fsSL https://gist.github.com/raw/323731/install_homebrew.rb)\"")
end
system("brew update")
puts "homebrew is installed. Great job!"
unless RVM_INSTALLED
puts "Installing rvm..."
system("curl -s https://rvm.beginrescueend.com/install/rvm -o rvm-installer ; chmod +x rvm-installer ; ./rvm-installer")
system("echo '[[ -s \"$HOME/.rvm/scripts/rvm\" ]] && . \"$HOME/.rvm/scripts/rvm\" # Load RVM function' >> ~/.bash_profile")
system("rm rvm-installer")
if `. ~/.bash_profile; type rvm | head -1` != "rvm is a function\n"
puts "Meh, rvm install failed. Come talk to us in irc, at http://webchat.freenode.net/?channels=diaspora"
Process.exit
end
end
puts "rvm is installed. Great job!"
puts "Installing ruby enterprise edition (ree)..."
system(". ~/.bash_profile; rvm install ree")
$stdout.flush
puts "Setting up your gemset and .rvmrc..."
system(". ~/.bash_profile; rvm use ree; rvm gemset create diaspora")
system("echo 'rvm use ree@diaspora' >> .rvmrc")
puts "Done installing ree, creating gemset, and setting up .rvmrc!"
unless IMAGEMAGICK_INSTALLED
puts 'Installing imagemagick...'
system("brew install imagemagick")
end
puts 'imagemagick is installed. Great job!'
unless MYSQL_INSTALLED
puts 'Installing mysql...'
system("brew install mysql")
puts 'Configuring for first time use. Type in your Mac password when it asks.'
system("unset TMPDIR")
system("sudo mysql_install_db --verbose --user=`whoami` --basedir=\"$(brew --prefix mysql)\" --datadir=/usr/local/var/mysql --tmpdir=/tmp")
system("mkdir -p ~/Library/LaunchAgents")
plist_file = `brew list mysql | grep plist`.strip
system("cp #{plist_file} ~/Library/LaunchAgents/com.mysql.mysqld.plist")
system("launchctl load -w ~/Library/LaunchAgents/com.mysql.mysqld.plist")
end
puts 'mysql is installed. Great job!'
unless REDIS_INSTALLED
puts 'Installing redis...'
system("brew install redis")
end
puts 'redis is installed. Great job!'
puts 'Installing bundler...'
system(". ~/.bash_profile; rvm use ree@diaspora; gem install bundler")
puts 'bundler is installed. Great Job!'
puts 'Installing diaspora gems...'
system(". ~/.bash_profile; rvm use ree@diaspora; bundle install")
puts "Creating and migrating your database..."
system(". ~/.bash_profile; rvm use ree@diaspora; rake db:create; rake db:migrate")
puts "Setting up your default app configuration..."
system("cp config/app_config.yml.example config/app_config.yml")
puts "Setting up your default database configuration..."
system("cp config/database.yml.example config/database.yml")
puts "****************************************************************************"
puts "***************************** CONGRATS! ***********************************"
puts "****************************************************************************"
puts ""
puts "Everything is installed! How was that beer?"
puts "Run the following commands to start up the Diaspora server:"
puts ""
puts "source ~/.bash_profile"
puts "cd .."
puts "cd diaspora"
puts "script/server"
puts ""
puts "Next time, all you'll need to do is script/server."
puts "Once you've started script/server, visit your local Diaspora in your browser at http://localhost:3000"
end
def installed?(program)
`which #{program}`=='' ? false : true
end