Skip to content

Commit 9b0aadf

Browse files
[UP] Adding utility to support bulky script
1 parent b3297f1 commit 9b0aadf

4 files changed

Lines changed: 100 additions & 18 deletions

File tree

src/otoolbox/addons/ubuntu/__init__.py

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -45,24 +45,32 @@ def init():
4545
verify=[utils.is_dir, utils.is_readable],
4646
)
4747

48-
env.add_resource(
49-
priority=RESOURCE_PRIORITY_DEFAULT,
50-
path="ubuntu-install-apps.sh",
51-
title="Ubuntu application installer",
52-
description="Install all required application in ubuntu.",
53-
init=[
54-
utils.constructor_copy_resource("addons/ubuntu/ubuntu-install-apps.sh"),
55-
utils.chmod_executable,
56-
utils.touch_file
57-
],
58-
updat=[
59-
utils.constructor_copy_resource("addons/ubuntu/ubuntu-install-apps.sh"),
60-
utils.chmod_executable,
61-
utils.touch_file
62-
],
63-
destroy=[utils.delete_file],
64-
verify=[utils.is_file, utils.is_executable],
65-
)
48+
scripts = [
49+
"bulk-commit.sh",
50+
"bulk-pre-commit.sh",
51+
"bulk-push-shielded.sh",
52+
"ubuntu-install-apps.sh",
53+
"ubuntu-office-conf.sh",
54+
]
55+
for script in scripts:
56+
env.add_resource(
57+
priority=RESOURCE_PRIORITY_DEFAULT,
58+
path=script,
59+
title=f"Ubuntu utility script {script}",
60+
description="Install all required application in ubuntu.",
61+
init=[
62+
utils.constructor_copy_resource(f"addons/ubuntu/{script}"),
63+
utils.chmod_executable,
64+
utils.touch_file
65+
],
66+
updat=[
67+
utils.constructor_copy_resource(f"addons/ubuntu/{script}"),
68+
utils.chmod_executable,
69+
utils.touch_file
70+
],
71+
destroy=[utils.delete_file],
72+
verify=[utils.is_file, utils.is_executable],
73+
)
6674

6775
# pipx install copier
6876
# pipx install pre-commit
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
# Constants
3+
WORKDIR="$(pwd)"
4+
PROCESS_DATE=$(date +%Y-%m-%d)
5+
LOG_FILE="$WORKDIR/commit-log-$PROCESS_DATE.log"
6+
7+
# copy changes to the moonsunsoft repo
8+
echo "Current directory is: $CURRENT_DIR"
9+
cd "$WORKDIR"
10+
11+
#For each folder in moonsun (it must be part of a shielded project)
12+
for dir in "$WORKDIR/odoonix"/*/; do
13+
if [ -d "$dir" ]; then
14+
project=$(basename "$dir")
15+
echo "Processing project: $project"
16+
cd "$WORKDIR/odoonix/$project"
17+
pwd
18+
# commit and push changes
19+
git add .
20+
git commit -m "[CP] Commit all changes due to bulky process (such as precommit) on $PROCESS_DATE" >> "$LOG_FILE" 2>&1
21+
fi
22+
done
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
# Constants
3+
WORKDIR="$(pwd)"
4+
PRECOMMIT_DATE=$(date +%Y-%m-%d)
5+
LOG_FILE="$WORKDIR/precommit-log-$PRECOMMIT_DATE.log"
6+
7+
# copy changes to the moonsunsoft repo
8+
echo "Current directory is: $CURRENT_DIR"
9+
cd "$WORKDIR"
10+
11+
#For each folder in moonsun (it must be part of a shielded project)
12+
for dir in "$WORKDIR/odoonix"/*/; do
13+
if [ -d "$dir" ]; then
14+
project=$(basename "$dir")
15+
echo "Processing project: $project"
16+
cd "$WORKDIR/odoonix/$project"
17+
pwd
18+
# commit and push changes
19+
pre-commit run -a
20+
fi
21+
done
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
# This script is used to apply changes to the Odoo modules based on recent edits.
3+
4+
# Login as worker (woker is a user with permissions to commit changes to moonsun)
5+
# su - worker
6+
7+
# Constants
8+
WORKDIR="$(pwd)"
9+
SYNC_DATE=$(date +%Y-%m-%d)
10+
LOG_FILE="$WORKDIR/sync-log-$SYNC_DATE.log"
11+
12+
# copy changes to the moonsunsoft repo
13+
echo "Current directory is: $CURRENT_DIR"
14+
echo "Copying changes to moonsunsoft repository..."
15+
cd "$WORKDIR"
16+
otoolbox repo sync-shielded > "$LOG_FILE" 2>&1
17+
18+
#For each folder in moonsun (it must be part of a shielded project)
19+
for dir in "$WORKDIR/moonsunsoft"/*/; do
20+
if [ -d "$dir" ]; then
21+
project=$(basename "$dir")
22+
echo "Processing project: $project"
23+
echo "push changes to moonsunsoft/$project" >> "$LOG_FILE" 2>&1
24+
cd "$WORKDIR/moonsunsoft/$project"
25+
# commit and push changes
26+
git pull >> "$LOG_FILE" 2>&1
27+
git add . >> "$LOG_FILE" 2>&1
28+
git commit -m "[SYNC] Update to the latest release on $SYNC_DATE" >> "$LOG_FILE" 2>&1
29+
git push >> "$LOG_FILE" 2>&1
30+
fi
31+
done

0 commit comments

Comments
 (0)