Created
May 30, 2013 18:36
-
-
Save jackboberg/5680058 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def template(from, to) | |
erb = File.read(File.expand_path("../../templates/#{from}", __FILE__)) | |
put ERB.new(erb).result(binding), to | |
end | |
def set_default(name, *args, &block) | |
set(name, *args, &block) unless exists?(name) | |
end | |
def remote_file_exists?(path) | |
if path[0] == '~' | |
home = '' | |
run("echo -n $HOME") { |ch, stream, out| home = out } | |
path = home + path[1..-1] unless home.empty? | |
end | |
is_file = false | |
run("if [ -e '#{path}' ]; then echo -n 'true'; fi") do |ch, stream, out| | |
is_file = (out == 'true') | |
end | |
is_file | |
end | |
namespace :deploy do | |
namespace :install do | |
desc "Install everything onto the server" | |
task :default do | |
aptitude | |
git | |
dependencies | |
end | |
desc "Install aptitude" | |
task :aptitude do | |
run "#{sudo} apt-get -y update" | |
run "#{sudo} DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::=\"--force-confdef\" -o Dpkg::Options::=\"--force-confold\" dist-upgrade" | |
if (run "command -v aptitude >/dev/null") | |
puts 'Installing aptitude' | |
run "#{sudo} sudo apt-get install -y aptitude" | |
end | |
run "#{sudo} aptitude update" | |
run "#{sudo} aptitude -y dist-upgrade" | |
end | |
desc "Install git" | |
task :git do | |
run "#{sudo} aptitude install -y git" | |
end | |
before 'install:git', 'install:aptitude' | |
desc "Install build dependencies" | |
task :dependencies do | |
run "#{sudo} aptitude install -y libxslt1-dev libcurl4-openssl-dev libksba8 libksba-dev libqtwebkit-dev" | |
end | |
before 'install:dependencies', 'install:aptitude' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment