-
Notifications
You must be signed in to change notification settings - Fork 3
/
bootstrap.sh
130 lines (106 loc) · 5.08 KB
/
bootstrap.sh
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#!/usr/bin/env bash
case $(id -u) in
0)
sudo apt-get update
sudo apt-get install unzip -y
sudo apt-get install python-software-properties -y
sudo apt-get install curl -y
curl -sL https://deb.nodesource.com/setup | sudo bash -
sudo apt-get install -y nodejs
sudo apt-get install git -y
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install libncurses5:i386 libstdc++6:i386 zlib1g:i386 -y
sudo apt-get install openjdk-7-jdk -y
gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3
curl -sSL https://get.rvm.io | bash -s stable --ruby
source /home/vagrant/.rvm/scripts/rvm
echo "export PATH=/home/vagrant/.rvm/scripts/rvm:$PATH" >> ~/.bashrc
export PATH=/home/vagrant/.rvm/scripts/rvm:$PATH
sudo -u vagrant -i $0
;;
*)
## Ruby
gem install --no-rdoc --no-ri bundler
gem install --no-rdoc --no-ri appium_console
gem cleanup
##################################################################################################
# Node
##################################################################################################
# Enable npm to be used without sudo
npm config set prefix ~/npm
npm install -g grunt grunt-cli
# Add ~/npm/bin to the PATH variable
echo "export PATH=$HOME/npm/bin:$PATH" >> ~/.bashrc
export PATH=$HOME/npm/bin:$PATH
# Execute the .bashrc file
##################################################################################################
# ADT
##################################################################################################
# Download ADT
curl -O https://dl.google.com/android/adt/adt-bundle-linux-x86_64-20140702.zip
# Extract ADT archive
unzip adt-bundle-linux-x86_64-20140702.zip
# Define new ANDROID_HOME env var inside .bashrc
echo "export ANDROID_HOME=/home/vagrant/adt-bundle-linux-x86_64-20140702/sdk" >> ~/.bashrc
export ANDROID_HOME="/home/vagrant/adt-bundle-linux-x86_64-20140702/sdk"
# Add ~/npm/bin to the PATH variable
echo "export PATH=$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$PATH" >> ~/.bashrc
# Execute the .bashrc file
export PATH=$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$PATH
#./android update sdk -u
( sleep 5 && while [ 1 ]; do sleep 1; echo y; done ) | ~/adt-bundle-linux-x86_64-20140702/sdk/tools/android update sdk -u -a --filter tools,platform-tools,build-tools-21.1.1,android-19,sys-img-x86-android-19
##################################################################################################
# Ant
##################################################################################################
# Download ant
curl -O http://mirror.gopotato.co.uk/apache//ant/binaries/apache-ant-1.9.4-bin.tar.gz
# Extract ant
tar -zxvf apache-ant-1.9.4-bin.tar.gz
# Add ant/bin to the PATH variable
echo "export PATH=$HOME/apache-ant-1.9.4/bin:$PATH" >> ~/.bashrc
# Execute the .bashrc file
export PATH=$HOME/apache-ant-1.9.4/bin:$PATH
##################################################################################################
# Enable USB devices
##################################################################################################
# Samsung Galaxy
sudo cp /vagrant/android.rules /etc/udev/rules.d/51-android.rules
sudo chmod 644 /etc/udev/rules.d/51-android.rules
sudo chown root. /etc/udev/rules.d/51-android.rules
sudo service udev restart
sudo killall adb
##################################################################################################
# Appium
##################################################################################################
# Clone Appium
git clone https://github.com/appium/appium.git
# Change to the appium directory
cd appium
# Reset appium
# Running the reset.sh script doesn't seem to work correctly via the script.
# This could be fixed with some TLC.
#./reset.sh --android --verbose
##################################################################################################
# Launching VM
##################################################################################################
echo "################################################################"
echo "Bootstrap finished:"
echo " > Please run 'vagrant ssh' to launch VM"
echo "################################################################"
##################################################################################################
# Connecting USB devices
##################################################################################################
echo "USB Device setup:"
echo " > Please connect your device via USB"
echo " > \$ANDROID_HOME/platform-tools/adb devices"
echo "################################################################"
##################################################################################################
# Next steps...
##################################################################################################
echo "Manual steps:"
echo " > cd ~/appium"
echo " > ./reset.sh --android"
echo " > node ."
;;
esac