Skip to content

Commit c6098d0

Browse files
authored
🚀 RELEASE: Version 1.5.0 (#199)
* 🐛 FIX: #195 Allow lint-scripts.sh to be run locally * 🐛 FIX: #197 * 🐛 FIX: #194 * 🐛 FIX: #193 * 🐛 FIX: #196 * 🤖 TEST: #196 * 🐛 FIX: #196 * 🐛 FIX: #198 * 🤖 TEST: force docker image build * 🤖 TEST: #198 * 🐛 FIX: #198 * 🤖 TEST: force docker image build * 🐛 FIX: #159 * 🐛 FIX: #198 * 🐛 FIX: typo in #198 * 🤖 TEST: force docker image build * 🐛 FIX: #159 * 💡 UPDATE COMMENTS: fix * 🤖 TEST: force dockerm image build * 🤖 TEST: remove test install packages * 🐛 FIX: add sudo back in for composer update * 🐛 FIX: #196 * 🐛 FIX: #192 * 🤖 TEST: force docker image build
1 parent fdc77c3 commit c6098d0

13 files changed

+94
-80
lines changed

.gitpod.Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ RUN sudo bash -c ". /tmp/install-project-packages.sh" && rm /tmp/install-project
4646
# Download, compile, install and configure xdebug from source
4747
RUN sudo bash -c ". /tmp/install-xdebug.sh" && rm /tmp/install-xdebug.sh
4848

49-
# Update composer. TODO: https://github.com/apolopena/gitpod-laravel-starter/issues/159
50-
RUN sudo bash -c ". /tmp/update-composer.sh" && rm /tmp/update-composer.sh
49+
# Update composer
50+
RUN bash -c ". /tmp/update-composer.sh" && rm /tmp/update-composer.sh
5151

5252
# Scaffold the Laravel project
53-
RUN sudo bash -c ". /tmp/scaffold-project.sh" && rm /tmp/scaffold-project.sh
53+
RUN bash -c ". /tmp/scaffold-project.sh" && rm /tmp/scaffold-project.sh
5454

5555
# Force the docker image to build by incrementing this value
56-
ENV INVALIDATE_CACHE=226
56+
ENV INVALIDATE_CACHE=232

.gp/bash/init-gitpod.sh

Lines changed: 56 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
#
33
# SPDX-License-Identifier: MIT
4-
# Copyright © 2021 Apolo Pena
4+
# Copyright © 2022 Apolo Pena
55
#
66
# init-gitpod.sh
77
# Description:
@@ -24,34 +24,6 @@ stop_spinner $?
2424
# Globals
2525
current_php_version="$(bash .gp/bash/utils.sh php_version)"
2626

27-
# BEGIN: Autogenerate php-fpm.conf
28-
php_fpm_conf_path=".gp/conf/php-fpm/php-fpm.conf"
29-
active_php_version="$(. .gp/bash/utils.sh php_version)"
30-
msg="Autogenerating $php_fpm_conf_path for PHP $active_php_version"
31-
log_silent "$msg" && start_spinner "$msg"
32-
if bash .gp/bash/helpers.sh php_fpm_conf "$active_php_version" "$php_fpm_conf_path"; then
33-
stop_spinner $?
34-
log_silent "SUCCESS: $msg"
35-
else
36-
stop_spinner $?
37-
log -e "ERROR: $msg"
38-
fi
39-
# END: Autogenerate php-fpm.conf
40-
41-
# BEGIN: parse .vscode/settings.json
42-
if [[ $(bash .gp/bash/utils.sh parse_ini_value starter.ini development vscode_disable_preview_tab) == 1 ]]; then
43-
msg="parsing .vscode/settings.json as per starter.ini"
44-
log_silent "$msg" && start_spinner "$msg"
45-
if bash .gp/bash/utils.sh add_file_to_file_after '{' ".gp/conf/vscode/disable_preview_tab.txt" ".vscode/settings.json"; then
46-
stop_spinner $?
47-
log_silent "SUCCESS: $msg"
48-
else
49-
stop_spinner $?
50-
log -e "ERROR: $msg"
51-
fi
52-
fi
53-
# END: parse .vscode/settings.json
54-
5527
# BEGIN: Update npm if needed
5628
target_npm_ver='^8'
5729
min_target_npm_ver='8.3.2'
@@ -72,32 +44,64 @@ if [[ $update_npm == 1 ]]; then
7244
fi
7345
# END: Update npm if needed
7446

75-
# BEGIN: Install https://www.ioncube.com/loaders.php
76-
if [[ $(bash .gp/bash/utils.sh parse_ini_value starter.ini ioncube install) == 1 ]]; then
77-
if [[ $current_php_version == 7.4 ]]; then
78-
msg="Installing ioncube loader"
79-
log_silent "$msg" && start_spinner "$msg" \
80-
&& wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz -O /tmp/ioncube.tar.gz \
81-
&& tar xzf /tmp/ioncube.tar.gz -C /tmp \
82-
&& sudo cp /tmp/ioncube/ioncube_loader_lin_7.4.so /usr/lib/php/20190902/ioncube_loader_lin_7.4.so \
83-
&& sudo bash -c 'echo "zend_extension=ioncube_loader_lin_7.4.so" > /etc/php/7.4/apache2/conf.d/10-ioncube.ini' \
84-
&& sudo bash -c 'echo "zend_extension=ioncube_loader_lin_7.4.so" > /etc/php/7.4/cli/conf.d/10-ioncube.ini' \
85-
&& rm -rf /tmp/ioncube.tar.gz /tmp/ioncube
86-
err_code=$?
87-
if [[ $err_code != 0 ]]; then
88-
stop_spinner $err_code
89-
log -e "ERROR: $msg"
90-
else
91-
stop_spinner $err_code
92-
log "SUCCESS: $msg"
93-
fi
47+
# BEGIN: Install https://www.ioncube.com/loaders.php
48+
if [[ $(bash .gp/bash/utils.sh parse_ini_value starter.ini ioncube install) == 1 ]]; then
49+
if [[ $current_php_version == 7.4 ]]; then
50+
msg="Installing ioncube loader"
51+
log_silent "$msg" && start_spinner "$msg" \
52+
&& wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz -O /tmp/ioncube.tar.gz \
53+
&& tar xzf /tmp/ioncube.tar.gz -C /tmp \
54+
&& sudo cp /tmp/ioncube/ioncube_loader_lin_7.4.so /usr/lib/php/20190902/ioncube_loader_lin_7.4.so \
55+
&& sudo bash -c 'echo "zend_extension=ioncube_loader_lin_7.4.so" > /etc/php/7.4/apache2/conf.d/10-ioncube.ini' \
56+
&& sudo bash -c 'echo "zend_extension=ioncube_loader_lin_7.4.so" > /etc/php/7.4/cli/conf.d/10-ioncube.ini' \
57+
&& rm -rf /tmp/ioncube.tar.gz /tmp/ioncube
58+
err_code=$?
59+
if [[ $err_code != 0 ]]; then
60+
stop_spinner $err_code
61+
log -e "ERROR: $msg"
9462
else
95-
log "WARNING: ioncube loader cannot be installed with PHP $current_php_version. Fix your starter.ini"
63+
stop_spinner $err_code
64+
log "SUCCESS: $msg"
65+
fi
66+
else
67+
log "WARNING: ioncube loader cannot be installed with PHP $current_php_version. Fix your starter.ini"
68+
fi
69+
fi
70+
# END: Install https://www.ioncube.com/loaders.php
71+
72+
# BEGIN: Bootstrap non-laravel
73+
if [[ ! -d $GITPOD_REPO_ROOT/routes ]]; then
74+
# BEGIN: Autogenerate php-fpm.conf
75+
php_fpm_conf_path=".gp/conf/php-fpm/php-fpm.conf"
76+
active_php_version="$(. .gp/bash/utils.sh php_version)"
77+
msg="Autogenerating $php_fpm_conf_path for PHP $active_php_version"
78+
log_silent "$msg" && start_spinner "$msg"
79+
if bash .gp/bash/helpers.sh php_fpm_conf "$active_php_version" "$php_fpm_conf_path"; then
80+
stop_spinner $?
81+
log_silent "SUCCESS: $msg"
82+
else
83+
stop_spinner $?
84+
log -e "ERROR: $msg"
85+
fi
86+
# END: Autogenerate php-fpm.conf
87+
88+
# BEGIN: parse .vscode/settings.json
89+
if [[ $(bash .gp/bash/utils.sh parse_ini_value starter.ini development vscode_disable_preview_tab) == 1 ]]; then
90+
msg="parsing .vscode/settings.json as per starter.ini"
91+
log_silent "$msg" && start_spinner "$msg"
92+
if bash .gp/bash/utils.sh add_file_to_file_after '{' ".gp/conf/vscode/disable_preview_tab.txt" ".vscode/settings.json"; then
93+
stop_spinner $?
94+
log_silent "SUCCESS: $msg"
95+
else
96+
stop_spinner $?
97+
log -e "ERROR: $msg"
9698
fi
9799
fi
98-
# END: Install https://www.ioncube.com/loaders.php
100+
# END: parse .vscode/settings.json
101+
fi;
102+
# END: Bootstrap non-laravel
99103

100-
# BEGIN: Bootstrapping
104+
# BEGIN: Bootstrap Laravel
101105
if [ ! -d "$GITPOD_REPO_ROOT/vendor" ]; then
102106

103107
# Handle laravel README.md
@@ -255,4 +259,4 @@ if [ ! -d "$GITPOD_REPO_ROOT/vendor" ]; then
255259
log " --> Running of Laravel Mix complete"
256260
fi # end node_modules/ check
257261
fi # end vendor/ check for bootstrapping
258-
# END: Bootstrapping
262+
# END: Bootstrap Laravel

.gp/bash/install-core-packages.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/bin/bash
2+
# shellcheck disable=SC1091
23
#
34
# SPDX-License-Identifier: MIT
45
# Copyright © 2022 Apolo Pena

.gp/bash/install-project-packages.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
#!/bin/bash
2+
# shellcheck disable=SC1091
23
#
34
# SPDX-License-Identifier: MIT
4-
# Copyright © 2021 Apolo Pena
5+
# Copyright © 2022 Apolo Pena
56
#
67
# install-project-packages.sh
78
# Description:
8-
# Installs project specific packages
9+
# Installs project specific packages as per starter.ini
910
#
1011
# Notes:
1112
# This script assumes it is being run from .gitpod.Dockerfile as a sudo user
1213
# and that all of this scripts dependencies have already been copied to /tmp
1314
# If you change this script you must force a rebuild of the docker image
1415
#
1516

16-
# Put any packages you would like to install for your project here in single quotes delimited by a space
17-
packages=''
18-
17+
packages="$(bash /tmp/utils.sh parse_ini_value /tmp/starter.ini apt-get packages)"
1918
log='/var/log/workspace-image.log'
2019
IFS=" " read -r -a all_packages <<< "$packages"
2120

.gp/bash/install-xdebug.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#!/bin/bash
2+
# shellcheck disable=SC1091
23
#
34
# SPDX-License-Identifier: MIT
4-
# Copyright © 2021 Apolo Pena
5+
# Copyright © 2022 Apolo Pena
56
#
67
# install-xdebug.sh
78
# Description:

.gp/bash/lint-scripts.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
#
33
# SPDX-License-Identifier: MIT
4-
# Copyright © 2021 Apolo Pena
4+
# Copyright © 2022 Apolo Pena
55
#
66
# lint-scripts.sh
77
# Description:
@@ -13,6 +13,7 @@
1313
# Pass in an optional -V or --verbose if you would like to output a list of the files being checked
1414

1515
path() {
16+
[[ -z $GITPOD_REPO_ROOT ]] && GITPOD_REPO_ROOT="$(pwd)"
1617
echo "$GITPOD_REPO_ROOT/.gp"
1718
}
1819

.gp/bash/open-preview.sh

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
#
33
# SPDX-License-Identifier: MIT
4-
# Copyright © 2021 Apolo Pena
4+
# Copyright © 2022 Apolo Pena
55
#
66
# open-preview.sh
77
# Description:
@@ -11,22 +11,20 @@
1111
# Can take a port option to open a specific port, for example op -3005
1212
# In the case of using the port option, the path segment to open will be $2
1313

14-
[[ $(pwd) != "$GITPOD_REPO_ROOT" ]] &&
15-
echo -e "\e[1;31mThis command can only be run from the project root of a gitpod workspace:\e[0m $GITPOD_REPO_ROOT" &&
16-
exit 1
17-
1814
function main() {
15+
local rp="$GITPOD_REPO_ROOT/.gp/"
1916
local path port
20-
[[ $1 == '-h' || $1 == '--help' ]] && cat .gp/snippets/messages/op-help.txt && exit 0
17+
[[ $1 == '-h' || $1 == '--help' ]] && cat "$rp/snippets/messages/op-help.txt" && exit 0
2118
if [[ $1 =~ ^-[1-9][0-9]+$ ]]; then
2219
port="${1:1}"
2320
path="/$2"
2421
else
2522
path="/$1"
26-
port=$(bash .gp/bash/helpers.sh get_default_server_port)
23+
port=$(bash "$rp/bash/helpers.sh" get_default_server_port)
2724
fi
28-
if [[ $(bash .gp/bash/helpers.sh is_inited) == 0 ]]; then
29-
. .gp/bash/spinner.sh &&
25+
if [[ $(bash "$rp/bash/helpers.sh" is_inited) == 0 ]]; then
26+
# shellcheck disable=SC1090,SC1091
27+
. "$rp/bash/spinner.sh" &&
3028
start_spinner "Opening preview when system is ready..."
3129
gp sync-await gitpod-inited &&
3230
stop_spinner 0 &&

.gp/bash/php.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/bin/bash
2+
# shellcheck disable=SC1091
23
#
34
# SPDX-License-Identifier: MIT
45
# Copyright © 2022 Apolo Pena

.gp/bash/scaffold-project.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ _exitcode=$?
3838
if [ $_exitcode -ne 0 ]; then
3939
>&2 echo " ERROR $?: failed to create Laravel $_lv project scaffolding in $_scaff_dest" | tee -a $_log
4040
else
41-
chown -R gitpod:gitpod "$_scaff_dest"
41+
sudo chown -R gitpod:gitpod "$_scaff_dest"
4242
cd "$_scaff_dest" || exit 1
4343
echo " SUCCESS: $(php artisan --version) project scaffolding created in $_scaff_dest" | tee -a $_log
4444

@@ -49,7 +49,7 @@ else
4949
cd "$_scaff_dest/public" && composer create-project phpmyadmin/phpmyadmin
5050
_exitcode_phpmyadmin=$?
5151
if [ $_exitcode_phpmyadmin -eq 0 ]; then
52-
chown -R gitpod:gitpod "$_scaff_dest/public/phpmyadmin"
52+
sudo chown -R gitpod:gitpod "$_scaff_dest/public/phpmyadmin"
5353
echo " SUCCESS: phpmyadmin installed to $_scaff_dest/public" | tee -a $_log
5454
else
5555
>&2 echo " ERROR $?: phpmyadmin failed to install" | tee -a $_log

.gp/bash/update-composer.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,21 @@ fi
2121

2222
echo " Installing latest version of composer" | tee -a $LOG
2323
EXPECTED_CHECKSUM="$(wget -q -O - https://composer.github.io/installer.sig)"
24-
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
24+
sudo php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
2525
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
2626

2727
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]; then
2828
>&2 echo " ERROR: Invalid installer checksum - failed to install latest version of composer." | tee -a $LOG
29-
rm composer-setup.php
29+
sudo rm composer-setup.php
3030
else
31-
php composer-setup.php --install-dir=/usr/bin --filename=composer
31+
sudo php composer-setup.php --install-dir=/usr/bin --filename=composer
3232
COMP_VAL=$?
3333
if [ $COMP_VAL -ne 0 ]; then
3434
>&2 echo " ERROR $COMP_VAL: Failed to install latest version of composer." | tee -a $LOG
3535
else
3636
echo " SUCCESS: latest version of composer installed: $(composer --version)" | tee -a $LOG
3737
fi
38-
rm composer-setup.php
38+
sudo rm composer-setup.php
3939
fi
4040

4141
echo "END: update composer" | tee -a $LOG

0 commit comments

Comments
 (0)