summaryrefslogtreecommitdiffstats
path: root/tests/acceptance/run.sh
blob: 2a6afbfd21bd992aeb340da375090d1decbf430e (plain)
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
# ownCloud - News
#
# @author Bernhard Posselt
# @copyright 2013 Bernhard Posselt dev@bernhard-posselt.com
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
# License as published by the Free Software Foundation; either
# version 3 of the License, or any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU AFFERO GENERAL PUBLIC LICENSE for more details.
#
# You should have received a copy of the GNU Affero General Public
# License along with this library.  If not, see <http://www.gnu.org/licenses/>.



# set up rvm and xvfb dependencies
if [[ ! -e "/usr/bin/xvfb-run" ]]; then

	# archlinux
	if [[ -e "/usr/bin/pacman" ]]; then
		echo "installing xvfb, please enter password..."
		sudo pacman -S xorg-server-xvfb

	# fedora
	elif [[ -e "/usr/bin/yum" ]]; then
		echo "installing xvfb, please enter password..."
		yum install xorg-x11-server-Xvfb

	# debian
	elif [[ -e "/usr/bin/apt-get" ]]; then
		echo "installing xvfb, please enter password..."
		sudo apt-get install xvfb

	else
		echo "You have to install xvfb in order to run the test suite"
		exit 1
	fi
fi


# dont use --user-install for gems since this breaks rvm. abort setup in case it
# exists
if [[ -e "/etc/gemrc" ]]; then
	if grep -qe "^[^#].*user-install" /etc/gemrc; then
		echo "Found --user-install in /etc/gemrc"
		echo "Please remove it, as it will break rubygems in RVM."
		exit 1
	fi
fi

# set up rvm
if [[ -f "$HOME/.rvm/scripts/rvm" ]]; then
	source "$HOME/.rvm/scripts/rvm"
elif [[ -f "/usr/local/rvm/scripts/rvm" ]]; then
	source "/usr/local/rvm/scripts/rvm"
else
	# set up a local rvm installation
	curl -L get.rvm.io | bash -s stable
	[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
fi


# Set the gemset and ruby version
rvm install 2.0.0
rvm use ruby-2.0.0@oc_news_acceptance --create

# install dep libraries
bundle install

# if the OWNCLOUD_HOST variable is not set it will default to localhost/owncloud
if [[ -z "$OWNCLOUD_HOST" ]]; then
	export OWNCLOUD_HOST='localhost/owncloud'
fi

cucumber -f json -o ./logs/owncloud.json -f pretty HOST=$OWNCLOUD_HOST features