Commit 7729ed5ade99480ea5db1f44641f6550409062af

Authored by Diego Camarinha
Committed by Paulo Meireles
1 parent b02af6ba

[Mezuro] Database script now works for Postgresql.

plugins/mezuro/script/delete_all_kalibro_entries.sh
1 1 #!/bin/bash
2 2  
3   -DATABASE="kalibro_tests"
4   -USER="kalibro"
5   -PASSWORD="kalibro"
6   -MYSQL_PARAMS="$DATABASE -u $USER -p$PASSWORD"
7   -TABLES=($(mysql $MYSQL_PARAMS -e "show tables"))
8   -LENGTH=${#TABLES}
  3 +DATABASE="kalibro_test"
9 4  
10   -i=1
11   -while [ $i -le $LENGTH ]
12   - do if [ ${#TABLES[$i]} -ne 0 ]
13   - then mysql $MYSQL_PARAMS -e "SET FOREIGN_KEY_CHECKS = 0; delete from $DATABASE.${TABLES[$i]}; SET FOREIGN_KEY_CHECKS = 1;"
14   - fi
15   - i=$(($i+1))
16   -done
17 5 \ No newline at end of file
  6 +sudo su postgres -c "export PGPASSWORD=\"kalibro\" && psql -q -t -d $DATABASE -c \"SELECT 'DELETE FROM ' || n.nspname || '.' || c.relname || ' CASCADE;' FROM pg_catalog.pg_class AS c LEFT JOIN pg_catalog.pg_namespace AS n ON n.oid = c.relnamespace WHERE relkind = 'r' AND n.nspname NOT IN ('pg_catalog', 'pg_toast') AND pg_catalog.pg_table_is_visible(c.oid)\" | sed '/sequences/d' > /tmp/query && psql -q -d $DATABASE -f /tmp/query && rm /tmp/query"
... ...
plugins/mezuro/script/run_acceptance_tests.sh
... ... @@ -14,7 +14,7 @@ KALIBRO_HOME='/usr/share/tomcat6/.kalibro'
14 14 echo "--> Creating tests directory"
15 15 sudo mkdir $KALIBRO_HOME/tests
16 16 echo "--> Copying test settings"
17   -sudo cp $KALIBRO_HOME/kalibro_tests.settings $KALIBRO_HOME/tests/kalibro.settings
  17 +sudo cp $KALIBRO_HOME/kalibro_test.settings $KALIBRO_HOME/tests/kalibro.settings
18 18 echo "--> Changing owner of tests directory to tomcat6"
19 19 sudo chown -R tomcat6:tomcat6 $KALIBRO_HOME/tests
20 20  
... ...
plugins/mezuro/views/content_viewer/show_configuration.rhtml
... ... @@ -28,7 +28,7 @@
28 28 <br/>
29 29  
30 30 <% if owner %>
31   - <%= link_to "#{image_tag ('/plugins/mezuro/images/plus.png')}Add Metric", :controller => "mezuro_plugin_metric_configuration",
  31 + <%= link_to "#{image_tag('/plugins/mezuro/images/plus.png')}Add Metric", :controller => "mezuro_plugin_metric_configuration",
32 32 :profile => @page.profile.identifier,
33 33 :action => "choose_metric",
34 34 :id => @configuration_content.id %><br/>
... ...