Azure-plugin not sending REST calls to Azure cloud
[multicloud/azure.git] / azure / aria / aria-extension-cloudify / src / aria / examples / clearwater / scripts / live-test / create.sh
1 #!/bin/bash
2 # Licensed to the Apache Software Foundation (ASF) under one or more
3 # contributor license agreements.  See the NOTICE file distributed with
4 # this work for additional information regarding copyright ownership.
5 # The ASF licenses this file to You under the Apache License, Version 2.0
6 # (the "License"); you may not use this file except in compliance with
7 # the License.  You may obtain a copy of the License at
8 #
9 #     http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16
17 set -e
18
19 LIB=/opt/clearwater-live-test
20 COMMAND=/usr/bin/clearwater-live-test
21 RUBY_VERSION=1.9.3
22 RVM=/usr/local/rvm
23 QUAFF_OLD_URL=git@github.com:metaswitch/quaff.git
24 QUAFF_NEW_URL=https://github.com/Metaswitch/quaff.git
25
26 # Build requirements
27 yes | aptdcon --hide-terminal --install build-essential
28 yes | aptdcon --hide-terminal --install bundler
29 yes | aptdcon --hide-terminal --install git
30
31 # Required by nokogiri Ruby gem
32 yes | aptdcon --hide-terminal --install zlib1g-dev
33
34 # Install Ruby enVironment Manager
35 if [ ! -d "$RVM" ]; then
36         # Install
37         curl --location https://get.rvm.io | bash -s stable
38 fi
39
40 # Install Ruby using RVM
41 . "$RVM/scripts/rvm"
42 rvm autolibs enable
43 rvm install "$RUBY_VERSION"
44 rvm use "$RUBY_VERSION@global"
45
46 # Install Clearwater Live Test
47 if [ ! -d "$LIB" ]; then
48         mkdir --parents /opt
49         cd /opt
50         git clone --depth 1 https://github.com/Metaswitch/clearwater-live-test.git
51         cd clearwater-live-test
52         chmod a+rw -R .
53
54         # Note: we must fix the URLs for Quaff
55         sed --in-place --expression "s,$QUAFF_OLD_URL,$QUAFF_NEW_URL,g" Gemfile Gemfile.lock
56
57         # Install required Ruby gems 
58         bundle install
59 fi
60
61 # Create command
62 echo "#!/bin/bash" > "$COMMAND"
63 echo ". \"$RVM/scripts/rvm\"" >> "$COMMAND"
64 echo "rvm use \"$RUBY_VERSION@global\"" >> "$COMMAND"
65 echo "cd \"$LIB\"" >> "$COMMAND"
66 echo "rake \"\$@\"" >> "$COMMAND"
67 chmod a+x "$COMMAND"
68
69 # clearwater-live-test test[example.com] SIGNUP_CODE=secret PROXY=192.168.1.171 ELLIS=192.168.1.171