Skip to content

Commit a560048

Browse files
committed
feat: update the project root path logic(The process is in the same shell as the starting shell)
1 parent e985dda commit a560048

106 files changed

Lines changed: 194 additions & 215 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh
22

33
# include sdk of sparrow.
4-
source .work/include/sdk.sh
4+
. .work/include/sdk.sh
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh
22

33
# include sdk of sparrow.
4-
source .work/include/sdk.sh
4+
. .work/include/sdk.sh
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh
22

33
# include sdk of sparrow.
4-
source .work/include/sdk.sh
4+
. .work/include/sdk.sh
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh
22

33
# include sdk of sparrow.
4-
source .work/include/sdk.sh
4+
. .work/include/sdk.sh

.work/extra/service_example/make_app_image/run.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
#!/bin/sh
22

33
# cd base dir of project.
4-
CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd)
5-
cd $CUR_PATH && cd ../../
6-
BATH_PATH=$(pwd)
4+
# the process is in the same shell as the starting shell.
5+
cd $SPARROW_BASE_PATH
76

87
# define this service.
98
service_name="{{SERVICE}}"
109

1110
print_stage "try to pull/build sparrow-basic-${service_name} $IMAGE_BASIC_{{SERVICE_UPPER}}_VERSION"
1211
if pull basic $service_name $IMAGE_BASIC_{{SERVICE_UPPER}}_VERSION; then
1312
print_info "pull success"
14-
elif source "./${service_name}/make_basic_image/run.sh"; then
13+
elif . "./${service_name}/make_basic_image/run.sh"; then
1514
print_info "build success"
1615
else
1716
print_error "pull/build failed"

.work/extra/service_example/make_basic_image/run.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
#!/bin/sh
22

33
# cd base dir of project.
4-
CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd)
5-
cd $CUR_PATH && cd ../../
6-
BATH_PATH=$(pwd)
4+
# the process is in the same shell as the starting shell.
5+
cd $SPARROW_BASE_PATH
76

87
# define this service.
98
service_name="{{SERVICE}}"

.work/include/internal/constant.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
#!/bin/sh
22

33
# cd base dir of project.
4-
CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd)
5-
cd $CUR_PATH && cd ../../../
6-
BATH_PATH=$(pwd)
4+
# the process is in the same shell as the starting shell.
5+
cd $SPARROW_BASE_PATH
76

87
# only define variables, these variables may used defined environment variables in /env file.
98

.work/include/internal/dockerhub.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
#!/bin/sh
22

33
# cd base dir of project.
4-
CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd)
5-
cd $CUR_PATH && cd ../../../
6-
BATH_PATH=$(pwd)
4+
# the process is in the same shell as the starting shell.
5+
cd $SPARROW_BASE_PATH
76

87
# login of $DOCKERHUB_DOMAIN.
98
# to be safety, never allow login with account in the command, you must login manually in your local system firstly.

.work/include/internal/helper.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
#!/bin/sh
22

33
# cd base dir of project.
4-
CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd)
5-
cd $CUR_PATH && cd ../../../
6-
BATH_PATH=$(pwd)
4+
# the process is in the same shell as the starting shell.
5+
cd $SPARROW_BASE_PATH
76

87
# -----------------------define some basic helpers-----------------------
98

@@ -200,7 +199,7 @@ pull_or_build_app_image() {
200199
version=$(eval echo "$"$version_name)
201200
if pull app $service $version; then
202201
print_info "pull success: pull app $service $version"
203-
elif source "./$service/make_app_image/run.sh"; then
202+
elif . "./$service/make_app_image/run.sh"; then
204203
print_info "build success: run $service/make_app_image/run.sh"
205204
else
206205
print_error "pull and build sparrow-app-$service image error"

.work/include/sdk.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
#!/bin/sh
22

33
# cd base dir of project.
4-
CUR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd)
5-
cd $CUR_PATH && cd ../../
6-
BATH_PATH=$(pwd)
4+
# the process is in the same shell as the starting shell.
5+
cd $SPARROW_BASE_PATH
76

87
# only include defined variables and functions.
98
# this is no side effects.
10-
source .work/include/internal/constant.sh
11-
source .work/include/internal/helper.sh
12-
source .work/include/internal/dockerhub.sh
9+
. .work/include/internal/constant.sh
10+
. .work/include/internal/helper.sh
11+
. .work/include/internal/dockerhub.sh
1312

1413
# update /env file and export env variables.
1514
if ! upenv; then

0 commit comments

Comments
 (0)