1
1
#! /bin/bash
2
2
3
+ set -eu
4
+
3
5
if
4
6
[[ " ${USER:- } " == " root" ]]
5
7
then
6
8
echo " This script works only with normal user, it wont work with root, please log in as normal user and try again." >&2
7
9
exit 1
8
10
fi
9
11
10
- set -e
11
-
12
- echo " Updates packages. Asks for your password."
12
+ echo " Update packages. Asks for your password. Please enter your password."
13
13
sudo apt-get update -y
14
14
15
- echo " Installs Node 10"
16
- sudo apt-get install -y snapd
17
- sudo snap install node --classic --channel=10
15
+ echo " Install packages. Enter your password when asked."
16
+ sudo apt-get --ignore-missing install build-essential git-core curl openssl libssl-dev libcurl4-openssl-dev zlib1g zlib1g-dev libreadline6-dev libyaml-dev libsqlite3-dev libsqlite3-0 sqlite3 libxml2-dev libxslt1-dev libffi-dev software-properties-common libgdm-dev libncurses5-dev automake autoconf libtool bison postgresql postgresql-contrib libpq-dev libc6-dev -y
18
17
19
- echo " Installs packages. Give your password when asked."
20
- sudo apt-get --ignore-missing install build-essential git-core curl openssl libssl-dev libcurl4-openssl-dev zlib1g zlib1g-dev libreadline6-dev libyaml-dev libsqlite3-dev libsqlite3-0 sqlite3 libxml2-dev libxslt1-dev libffi-dev software-properties-common libgdm-dev libncurses5-dev automake autoconf libtool bison postgresql postgresql-contrib libpq-dev pgadmin3 libc6-dev -y
18
+ echo " Install Node.js"
19
+ sudo apt-get install -y snapd
20
+ sudo snap install node --classic --channel=18
21
21
22
- echo " Installs ImageMagick for image processing"
22
+ echo " Install ImageMagick for image processing"
23
23
sudo apt-get install imagemagick --fix-missing -y
24
24
25
- echo " Installs RVM (Ruby Version Manager) for handling Ruby installation"
26
- # Retrieve the GPG key.
27
- curl -sSL https://rvm.io/pkuczynski.asc | gpg --import -
28
- curl -sSL https://get.rvm.io | bash -s stable
29
- source ~ /.rvm/scripts/rvm
25
+ echo " Install rbenv (Ruby version manager) for handling the Ruby installation"
26
+ echo " gem: --no-ri --no-rdoc" > ~ /.gemrc
30
27
31
- echo " Installs Ruby"
32
- rvm install 3.1.2
33
- rvm use 3.1.2 --default
28
+ RBENV_INSTALL_PATH=" $HOME /.rbenv"
29
+ if [ -d " $RBENV_INSTALL_PATH " ]; then
30
+ echo " rbenv already installed"
31
+ else
32
+ curl -fsSL https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-installer | bash
33
+
34
+ echo " Configuring rbenv for your Shell"
35
+ if [[ " $SHELL " == * " bash" ]]; then
36
+ echo ' eval "$($HOME/.rbenv/bin/rbenv init - bash)"' >> ~ /.bashrc
37
+ elif [[ " $SHELL " == * " zsh" ]]; then
38
+ echo ' eval "$($HOME/.rbenv/bin/rbenv init - zsh)"' >> ~ /.zshrc
39
+ else
40
+ echo " Unknown Shell. Please configure rbenv manually."
41
+ echo " Please visit: https://github.com/rbenv/rbenv"
42
+ fi
43
+ fi
34
44
45
+ echo " Load rbenv config in install script"
46
+ eval " $( $HOME /.rbenv/bin/rbenv init - bash) "
47
+
48
+ echo " Install Ruby"
49
+ RUBY_VERSION=3.1.3
50
+ rbenv install " $RUBY_VERSION "
51
+ rbenv global " $RUBY_VERSION "
52
+
53
+ echo " Install Rails"
35
54
echo " gem: --no-ri --no-rdoc" > ~ /.gemrc
36
- gem install rails
55
+ gem install bundler rails
37
56
38
57
echo -e " \n- - - - - -\n"
39
58
echo -e " Now we are going to print some information to check that everything is done:\n"
40
59
41
-
42
- echo -n " Should be sqlite 3.22.0 or higher: sqlite "
60
+ echo -n " Should be SQLite 3.22.0 or higher: sqlite "
43
61
sqlite3 --version
44
- echo -n " Should be rvm 1.29.8 or higher: "
45
- rvm --version | sed ' /^.*$/N;s/\n//g' | cut -c 1-11
46
- echo -n " Should be ruby 3.0 or higher: "
62
+ echo -n " Should be Ruby 3.1.3 or higher: "
47
63
ruby -v | cut -d " " -f 2
48
64
echo -n " Should be Rails 7.0 or higher: "
49
65
rails -v
@@ -55,12 +71,6 @@ and we will help you do the installation the manual way at the event.
55
71
56
72
Congrats!
57
73
58
- Make sure that all works well by running the application generator command:
59
- $ rails new railsgirls
60
-
61
- If you encounter the message:
62
- The program 'rails' is currently not installed.
63
-
64
- It is just a hiccup with the shell, solutions:
65
- $ source ~/.rvm/scripts/rvm
66
- Allow login shell, example http://rvm.io/integration/gnome-terminal/"
74
+ Open a new Terminal tab/window and make sure that all works well
75
+ by running the application generator command:
76
+ $ rails new railsgirls"
0 commit comments