quick-start-debian 1.6 KB
#!/bin/sh

say() {
  msg="$@"
  printf "\033[33;01m%s\033[m\n" "$msg"
}

run() {
  say "\$ $@"
  echo "$@" | sh
  status="$?"
  if [ $status -ne 0 ]; then
    say "E: The command \"$@\" failed with status code $status, we cannot proceed."
    say "I: If you have no idea of what went wrong, please feel free to ask for help in the Noosfero community. Check the contact information in the project website (http://noosfero.org/)."
    exit 1
  fi
}

# needed to run noosfero
runtime_dependencies=$(sed -e '1,/^Depends:/d; /^Recommends:/,$ d; s/([^)]*)//g; s/,\s*/\n/g' debian/control | grep -v 'memcached\|debconf\|dbconfig-common\|postgresql\|misc:Depends\|adduser\|mail-transport-agent')
run sudo apt-get -y install $runtime_dependencies

# needed for development
run sudo apt-get -y install libtidy-ruby libhpricot-ruby libmocha-ruby imagemagick po4a xvfb libxml2-dev libxslt-dev
gem which bundler >/dev/null 2>&1 || run gem install bundler
run bundle install

# setup solr
run rake solr:download
run cp config/solr.yml.dist config/solr.yml

# create the database with sample data
run cp config/database.yml.sqlite3 config/database.yml
run rake db:schema:load
run rake db:data:minimal
run rake db:test:prepare

# compile translations
run rake noosfero:translations:compile

# create needed directory
mkdir -p tmp/pids

# use default gitignore rules
ln -s gitignore.example .gitignore

# you can now start the server
say "I: Congratulations, you are ready to run Noosfero."
say "I: To execute Noosfero in development mode, run \`/script/development\` and browse to http://localhost:3000"
say "I: To execute Noosfero tests, run \`rake\`."