Commit 334e55115c1264f5e74807a1e317c502d10053e8

Authored by Antonio Terceiro
1 parent 1b036cdc

Generalize the quick-start script

script/install-dependencies/debian-squeeze.sh 0 → 100644
@@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
  1 +# needed to run noosfero
  2 +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')
  3 +run sudo apt-get -y install $runtime_dependencies
  4 +
  5 +# needed for development
  6 +run sudo apt-get -y install libtidy-ruby libhpricot-ruby libmocha-ruby imagemagick po4a xvfb libxml2-dev libxslt-dev
  7 +gem which bundler >/dev/null 2>&1 || run gem install bundler
  8 +run bundle install
script/quick-start 0 → 100755
@@ -0,0 +1,70 @@ @@ -0,0 +1,70 @@
  1 +#!/bin/sh
  2 +
  3 +say() {
  4 + msg="$@"
  5 + printf "\033[33;01m%s\033[m\n" "$msg"
  6 +}
  7 +
  8 +complain() {
  9 + msg="$@"
  10 + printf "\033[1;31;40m%s\033[m\n" "$msg"
  11 +}
  12 +
  13 +run() {
  14 + say "\$ $@"
  15 + echo "$@" | sh
  16 + status="$?"
  17 + if [ $status -ne 0 ]; then
  18 + complain "E: The command \"$@\" failed with status code $status, we cannot proceed."
  19 + complain "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/)."
  20 + exit 1
  21 + fi
  22 +}
  23 +
  24 +if gem which system_timer >/dev/null 2>&1 && which xvfb-run >/dev/null 2>&1; then
  25 + say "Assuming dependencies are already installed. Pass --install to force their installation"
  26 +else
  27 + if !which lsb_release >/dev/null 2>&1; then
  28 + complain "E: lsb_release not available! (Try installing the lsb-release package)"
  29 + exit 1
  30 + fi
  31 + system=$(echo $(lsb_release -sic) | awk '{print(tolower($1) "-" tolower($2))}')
  32 + install_script="$(dirname $0)/install-dependencies/${system}.sh"
  33 + if test -f "$install_script"; then
  34 + . $install_script
  35 + else
  36 + # FIXME the Ruby stuff could be installed with Rubygems
  37 + # FIXME but there is not generic way to install the non-Ruby stuff
  38 + complain "E: $install_script not found, cannot install dependencies."
  39 + exit 1
  40 + fi
  41 +fi
  42 +
  43 +# setup solr
  44 +run 'rake solr:download || true'
  45 +if ! test -f vendor/plugins/acts_as_solr_reloaded/solr/start.jar; then
  46 + complain "Failed to download solr!"
  47 + exit 1
  48 +fi
  49 +
  50 +run cp config/solr.yml.dist config/solr.yml
  51 +
  52 +# create the database with sample data
  53 +run cp config/database.yml.sqlite3 config/database.yml
  54 +run rake db:schema:load
  55 +run rake db:data:minimal
  56 +run rake db:test:prepare
  57 +
  58 +# compile translations
  59 +run rake noosfero:translations:compile
  60 +
  61 +# create needed directory
  62 +mkdir -p tmp/pids
  63 +
  64 +# use default gitignore rules
  65 +ln -s gitignore.example .gitignore
  66 +
  67 +# you can now start the server
  68 +say "I: Congratulations, you are ready to run Noosfero."
  69 +say "I: To execute Noosfero in development mode, run \`/script/development\` and browse to http://localhost:3000"
  70 +say "I: To execute Noosfero tests, run \`rake\`."
script/quick-start-debian
@@ -1,50 +0,0 @@ @@ -1,50 +0,0 @@
1 -#!/bin/sh  
2 -  
3 -say() {  
4 - msg="$@"  
5 - printf "\033[33;01m%s\033[m\n" "$msg"  
6 -}  
7 -  
8 -run() {  
9 - say "\$ $@"  
10 - echo "$@" | sh  
11 - status="$?"  
12 - if [ $status -ne 0 ]; then  
13 - say "E: The command \"$@\" failed with status code $status, we cannot proceed."  
14 - 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/)."  
15 - exit 1  
16 - fi  
17 -}  
18 -  
19 -# needed to run noosfero  
20 -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')  
21 -run sudo apt-get -y install $runtime_dependencies  
22 -  
23 -# needed for development  
24 -run sudo apt-get -y install libtidy-ruby libhpricot-ruby libmocha-ruby imagemagick po4a xvfb libxml2-dev libxslt-dev  
25 -gem which bundler >/dev/null 2>&1 || run gem install bundler  
26 -run bundle install  
27 -  
28 -# setup solr  
29 -run rake solr:download  
30 -run cp config/solr.yml.dist config/solr.yml  
31 -  
32 -# create the database with sample data  
33 -run cp config/database.yml.sqlite3 config/database.yml  
34 -run rake db:schema:load  
35 -run rake db:data:minimal  
36 -run rake db:test:prepare  
37 -  
38 -# compile translations  
39 -run rake noosfero:translations:compile  
40 -  
41 -# create needed directory  
42 -mkdir -p tmp/pids  
43 -  
44 -# use default gitignore rules  
45 -ln -s gitignore.example .gitignore  
46 -  
47 -# you can now start the server  
48 -say "I: Congratulations, you are ready to run Noosfero."  
49 -say "I: To execute Noosfero in development mode, run \`/script/development\` and browse to http://localhost:3000"  
50 -say "I: To execute Noosfero tests, run \`rake\`."