Skip to content

Commit 9fa3a28

Browse files
committed
Adding workspace for messages_api-ruby-sms-v0.0.1
1 parent 369c129 commit 9fa3a28

File tree

12 files changed

+236
-0
lines changed

12 files changed

+236
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/sh
2+
3+
# First file: Toggle "enabled" between true and false
4+
OFOSFILE="./.vscode/ofos.json"
5+
if [ -f "$OFOSFILE" ]; then
6+
sed -i.bak 's/"enabled": true/"enabled": false/' "$OFOSFILE"
7+
rm -f "${OFOSFILE}.bak" # Remove backup
8+
else
9+
echo "File not found: $OFOSFILE"
10+
fi
11+
12+
# Second file: Change "runOn": "folderOpen" to "runOn": "default"
13+
TASKSFILE="./.vscode/tasks.json"
14+
if [ -f "$TASKSFILE" ]; then
15+
sed -i.bak 's/"runOn": "folderOpen"/"runOn": "default"/' "$TASKSFILE"
16+
rm -f "${TASKSFILE}.bak" # Remove backup
17+
else
18+
echo "File not found: $TASKSFILE"
19+
fi
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
# Process YML_ variables
4+
env | grep '^YML_' | while IFS='=' read -r name value; do
5+
new_name=${name#YML_}
6+
export $new_name=\"$value\"
7+
done
8+
9+
# Write VONAGE_ variables to .env
10+
env | grep -o '^VONAGE_[^=]*' | while read varname; do
11+
echo "$varname=${!varname}" >> .env
12+
done
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"enabled": true,
3+
"startupfiles": ["server.rb"]
4+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/sh
2+
3+
# Change VS Browser Column to "Three" and URL for 2nd Browser
4+
SETTINGSFILE="./.vscode/settings.json"
5+
if [ -f "$SETTINGSFILE" ]; then
6+
sed -i.bak 's|"vs-browser\.url": ".*"|"vs-browser.url": "https://www.example.com"|' \
7+
"$SETTINGSFILE"
8+
rm -f "${SETTINGSFILE}.bak"
9+
else
10+
echo "File not found: $SETTINGSFILE"
11+
fi
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"files.exclude": {
3+
"**/.DS_Store": true,
4+
".vscode/": true,
5+
"setup.json": true,
6+
"vcr.yml": true,
7+
},
8+
"vs-browser.url": "https://Vonage-Community.github.io/tutorial-interactive_tutorials/tutorials/messages_api-ruby-sms/0.0.1/",
9+
"vs-browser.columnToShowIn": "Beside",
10+
"vs-browser.reload.onSave": false,
11+
"workbench.startupEditor": "none"
12+
}
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "OpenContentView",
6+
"command": "${input:openBrowser}",
7+
"presentation": {
8+
"reveal": "never",
9+
"close": true
10+
}
11+
},
12+
{
13+
"label": "OpenPreviewView",
14+
"command": "${input:openBrowser}",
15+
"presentation": {
16+
"reveal": "never",
17+
"close": true
18+
}
19+
},
20+
{
21+
"label": "OpenTerminal",
22+
"command": "${input:openNewTerminal}",
23+
"presentation": {
24+
"reveal": "never",
25+
"close": true
26+
}
27+
},
28+
{
29+
"label": "ExportEnv",
30+
"type": "shell",
31+
"command": "chmod +x ./.vscode/envs.sh; ./.vscode/envs.sh",
32+
"presentation": {
33+
"reveal": "never",
34+
"close": true
35+
}
36+
},
37+
{
38+
"label": "ConfigurePreview",
39+
"type": "shell",
40+
"command": "chmod +x ./.vscode/preview.sh; ./.vscode/preview.sh",
41+
"presentation": {
42+
"reveal": "never",
43+
"close": true
44+
}
45+
},
46+
{
47+
"label": "CleanUp",
48+
"type": "shell",
49+
"command": "chmod +x ./.vscode/cleanup.sh; ./.vscode/cleanup.sh",
50+
"presentation": {
51+
"reveal": "never",
52+
"close": true
53+
}
54+
},
55+
{
56+
"label": "Run",
57+
"dependsOn": ["ExportEnv", "OpenContentView", "ConfigurePreview", "OpenTerminal", "CleanUp", "OpenPreviewView"],
58+
"dependsOrder": "sequence",
59+
"runOptions": {
60+
"runOn": "folderOpen"
61+
}
62+
}
63+
],
64+
"inputs": [
65+
{
66+
"id": "openBrowser",
67+
"type": "command",
68+
"command": "vs-browser.start"
69+
},
70+
{
71+
"id": "openNewTerminal",
72+
"type": "command",
73+
"command": "workbench.action.terminal.new"
74+
}
75+
]
76+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Starter Onboarding Tutorial
2+
3+
This is a starter tutorial.
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#!/bin/bash
2+
3+
URL=$1
4+
CONFIG_FILE="tutorial-config.json"
5+
6+
# Ensure URL is passed as an argument
7+
if [ -z "$1" ]; then
8+
echo "Error: URL must be provided as a parameter. Aborting."
9+
exit 1
10+
fi
11+
12+
# Check if CONFIG_FILE exists
13+
if [ ! -f "$CONFIG_FILE" ]; then
14+
echo "Error: Configuration file $CONFIG_FILE not found. Aborting."
15+
exit 1
16+
fi
17+
18+
# Read JSON configuration
19+
SLUG=$(jq -r '.slug' "$CONFIG_FILE")
20+
VERSION=$(jq -r '.version' "$CONFIG_FILE")
21+
FILES=$(jq -r '.files[]' "$CONFIG_FILE")
22+
PANELS=$(jq -r '.panels[]' "$CONFIG_FILE")
23+
24+
# Create files from the "files" array
25+
for FILE in $FILES; do
26+
if [ ! -f "$FILE" ]; then
27+
touch "$FILE"
28+
echo "Created file: $FILE"
29+
else
30+
echo "File already exists: $FILE"
31+
fi
32+
done
33+
34+
# Update settings.json using a temporary file
35+
SETTINGS_FILE=".vscode/settings.json"
36+
if [ -f "$SETTINGS_FILE" ]; then
37+
TEMP_FILE=$(mktemp)
38+
sed "s|\"vs-browser.url\": \".*\"|\"vs-browser.url\": \"$URL\"|" "$SETTINGS_FILE" > "$TEMP_FILE" && mv "$TEMP_FILE" "$SETTINGS_FILE"
39+
echo "Updated $SETTINGS_FILE with URL: $URL"
40+
else
41+
echo "$SETTINGS_FILE not found."
42+
fi
43+
44+
# Update ofos.json using a temporary file
45+
OFOS_FILE=".vscode/ofos.json"
46+
if [ -f "$OFOS_FILE" ]; then
47+
TEMP_FILE=$(mktemp)
48+
FILES_ARRAY=$(printf '"%s",' $FILES)
49+
FILES_ARRAY="[${FILES_ARRAY%,}]"
50+
sed "s|<FILES>|$FILES_ARRAY|" "$OFOS_FILE" > "$TEMP_FILE" && mv "$TEMP_FILE" "$OFOS_FILE"
51+
echo "Updated $OFOS_FILE with files: $FILES_ARRAY"
52+
else
53+
echo "$OFOS_FILE not found."
54+
fi
55+
56+
# Update tasks.json using a temporary file
57+
if echo "${PANELS[@]}" | grep -q "browser"; then
58+
TASKS='["ExportEnv", "OpenContentView", "ConfigurePreview", "OpenTerminal", "CleanUp", "OpenPreviewView"]'
59+
else
60+
TASKS='["ExportEnv", "OpenContentView", "OpenTerminal", "CleanUp"]'
61+
fi
62+
63+
TASKS_FILE=".vscode/tasks.json"
64+
if [ -f "$TASKS_FILE" ]; then
65+
TEMP_FILE=$(mktemp)
66+
sed "s|<TASKS>|$TASKS|" "$TASKS_FILE" > "$TEMP_FILE" && mv "$TEMP_FILE" "$TASKS_FILE"
67+
echo "Updated $TASKS_FILE with tasks: $TASKS"
68+
else
69+
echo "$TASKS_FILE not found."
70+
fi

tutorials/messages_api-ruby-sms/ws/server.rb

Whitespace-only changes.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"data": [
3+
{
4+
"type": "PHONE_NUMBER",
5+
"title": "Vonage Number",
6+
"description": "You need to link a Vonage number for the tutorial.",
7+
"features": ["VOICE", "SMS"],
8+
"name": "VONAGE_NUMBER"
9+
}
10+
]
11+
}

0 commit comments

Comments
 (0)