-
Notifications
You must be signed in to change notification settings - Fork 178
Run Ballerina By Examples using the Go tool
After writing a Ballerina By Example, you can also run it to test and verify if the output is accurate. Follow the instructions below to do this.
-
Create a directory with the BBE directories, which you want to test and the
index.json
file (e.g.,/examples
). -
In the CLI, navigate to the
master
branch of the ballerina-release GitHub repo (i.e.,<BALLERINA_RELEASE_REPO_HOME>
). -
Execute the command below to build the BBEs.
Info: You need to change the properties of the above command accordingly. Also, the
<GEN_PLAYGROUND_LINKS>
property can be set tofalse
while testing BBEs locally since withtrue
it takes a longer time to run the tool. In the final run, you can set this totrue
.go run ballerinaByExample/tools/generate.go “<SOURCE-OF-THE-BBES>” “<RELEASE-VERSION>” “<OUTPUT-FOLDER>” “<WITH-OR-WITHOUT-FRONT-MATTER>” “<IF-LATEST-VERSION>” “<GEN_PLAYGROUND_LINKS>”
For example,
go run ballerinaByExample/tools/generate.go "/Documents/examples" "1.2" "by-example" "true" "true" "true"
-
Copy the generated
<BALLERINA_RELEASE_REPO_HOME>/by-example
directory. -
Replace the
<BALLERINA_DEV_WEBSITE_REPO_HOME>/<VERSION>/learn/by-example
directory with the directory you copied. -
In the CLI, navigate to the
master
branch of the ballerina-dev-website GitHub repo (i.e.,<BALLERINA_DEV_WEBSITE_REPO_HOME>
). -
Execute the
bundle exec jekyll serve
command to build the website locally.Note: Alternatively, execute the command below if you do not have Jekyll configured locally.
docker run -p 4000:4000 --volume="/home/shaf/Documents/source/public/ballerina-dev-website:/srv/jekyll" jekyll/builder:3.8 jekyll serve
-
Navigate to the Ballerina By Examples in the dev website built locally and test the BBE updates you did.