Skip to content

Commit 344c08f

Browse files
Allow dirty
1 parent 8c88a11 commit 344c08f

File tree

17 files changed

+137
-102
lines changed

17 files changed

+137
-102
lines changed

Packages

Lines changed: 0 additions & 9 deletions
This file was deleted.

bin/mush

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -762,8 +762,12 @@ run_legacy() {
762762

763763
if grep -q "\[legacy\]" "$MUSH_MANIFEST_DIR/Manifest.toml"; then
764764
legacy_line=$(grep -n -m 1 "\[legacy\]" "$MUSH_MANIFEST_DIR/Manifest.toml" | cut -d: -f1)
765+
legacy_tail=$(expr ${legacy_line} + 1)
765766
echo "The section '[legacy]' exists in the INI file at ${legacy_line}."
766-
sed -i "$((legacy_line+1))i${module_name} = \"${module_url}\"" "$MUSH_MANIFEST_DIR/Manifest.toml"
767+
head -n ${legacy_line} "$MUSH_MANIFEST_DIR/Manifest.toml" > "$MUSH_MANIFEST_DIR/Manifest.toml.tmp"
768+
echo "${module_name} = \"${module_url}\"" >> "$MUSH_MANIFEST_DIR/Manifest.toml.tmp"
769+
tail -n +${legacy_line} "$MUSH_MANIFEST_DIR/Manifest.toml.tmp"
770+
mv "$MUSH_MANIFEST_DIR/Manifest.toml.tmp" "$MUSH_MANIFEST_DIR/Manifest.toml"
767771
else
768772
echo "[legacy]" >> "$MUSH_MANIFEST_DIR/Manifest.toml"
769773
echo "${module_name} = \"${module_url}\"" >> "$MUSH_MANIFEST_DIR/Manifest.toml"
@@ -856,7 +860,9 @@ parser_definition_publish() {
856860

857861
msg -- 'OPTIONS:'
858862
flag FLAG_C -c --flag-c
863+
flag ALLOW_DIRTY --allow-dirty -- "Build artifacts in release mode, with optimizations"
859864
param MODULE_NAME -n --name
865+
860866
param BUILD_TARGET -t --target
861867
disp :usage -h --help
862868
}
@@ -867,7 +873,7 @@ run_publish() {
867873
eval "set -- $REST"
868874
#echo "FLAG_C: $FLAG_C"
869875
#echo "MODULE_NAME: $MODULE_NAME"
870-
#echo "BUILD_TARGET: $BUILD_TARGET"
876+
echo "ALLOW_DIRTY: $ALLOW_DIRTY"
871877

872878
MUSH_TARGET_DIR=target/dist
873879

@@ -1433,8 +1439,9 @@ compile_scan_embed() {
14331439
}
14341440

14351441
exec_publish() {
1436-
local bin_file=/usr/local/bin/mush
1437-
local final_file=target/dist/mush
1442+
local bin_name=${MUSH_PACKAGE_NAME}
1443+
local bin_file=/usr/local/bin/${bin_name}
1444+
local final_file=target/dist/${bin_name}
14381445
local package_name="${MUSH_PACKAGE_NAME}"
14391446
local release_tag="${MUSH_PACKAGE_VERSION}"
14401447

@@ -1447,6 +1454,11 @@ exec_publish() {
14471454
# warning: manifest has no documentation, homepage or repository.
14481455
# See https://mush.javanile.org/manifest.html#package-metadata for more info.
14491456

1457+
if [ -n "${ALLOW_DIRTY}" ]; then
1458+
git add .
1459+
git commit -am "Allow dirty"
1460+
fi
1461+
14501462
if [ ! -z "$(git status --porcelain)" ]; then
14511463
local changed_files="$(git status -s | cut -c4-)"
14521464
local error="some files in the working directory contain changes that were not yet committed into git:"

packages/console/LICENSE

Lines changed: 0 additions & 21 deletions
This file was deleted.

packages/console/README.md

Lines changed: 0 additions & 33 deletions
This file was deleted.

packages/getoptions/Manifest.toml

Lines changed: 0 additions & 8 deletions
This file was deleted.

packages/pipetest/Manifest.toml

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/commands/legacy.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,12 @@ run_legacy() {
3232

3333
if grep -q "\[legacy\]" "$MUSH_MANIFEST_DIR/Manifest.toml"; then
3434
legacy_line=$(grep -n -m 1 "\[legacy\]" "$MUSH_MANIFEST_DIR/Manifest.toml" | cut -d: -f1)
35+
legacy_tail=$(expr ${legacy_line} + 1)
3536
echo "The section '[legacy]' exists in the INI file at ${legacy_line}."
36-
sed -i "$((legacy_line+1))i${module_name} = \"${module_url}\"" "$MUSH_MANIFEST_DIR/Manifest.toml"
37+
head -n ${legacy_line} "$MUSH_MANIFEST_DIR/Manifest.toml" > "$MUSH_MANIFEST_DIR/Manifest.toml.tmp"
38+
echo "${module_name} = \"${module_url}\"" >> "$MUSH_MANIFEST_DIR/Manifest.toml.tmp"
39+
tail -n +${legacy_line} "$MUSH_MANIFEST_DIR/Manifest.toml.tmp"
40+
mv "$MUSH_MANIFEST_DIR/Manifest.toml.tmp" "$MUSH_MANIFEST_DIR/Manifest.toml"
3741
else
3842
echo "[legacy]" >> "$MUSH_MANIFEST_DIR/Manifest.toml"
3943
echo "${module_name} = \"${module_url}\"" >> "$MUSH_MANIFEST_DIR/Manifest.toml"

src/commands/publish.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ parser_definition_publish() {
66

77
msg -- 'OPTIONS:'
88
flag FLAG_C -c --flag-c
9+
flag ALLOW_DIRTY --allow-dirty -- "Build artifacts in release mode, with optimizations"
910
param MODULE_NAME -n --name
11+
1012
param BUILD_TARGET -t --target
1113
disp :usage -h --help
1214
}
@@ -17,7 +19,7 @@ run_publish() {
1719
eval "set -- $REST"
1820
#echo "FLAG_C: $FLAG_C"
1921
#echo "MODULE_NAME: $MODULE_NAME"
20-
#echo "BUILD_TARGET: $BUILD_TARGET"
22+
echo "ALLOW_DIRTY: $ALLOW_DIRTY"
2123

2224
MUSH_TARGET_DIR=target/dist
2325

src/tasks/publish.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11

22
exec_publish() {
3-
local bin_file=/usr/local/bin/mush
4-
local final_file=target/dist/mush
3+
local bin_name=${MUSH_PACKAGE_NAME}
4+
local bin_file=/usr/local/bin/${bin_name}
5+
local final_file=target/dist/${bin_name}
56
local package_name="${MUSH_PACKAGE_NAME}"
67
local release_tag="${MUSH_PACKAGE_VERSION}"
78

@@ -14,6 +15,11 @@ exec_publish() {
1415
# warning: manifest has no documentation, homepage or repository.
1516
# See https://mush.javanile.org/manifest.html#package-metadata for more info.
1617

18+
if [ -n "${ALLOW_DIRTY}" ]; then
19+
git add .
20+
git commit -am "Allow dirty"
21+
fi
22+
1723
if [ ! -z "$(git status --porcelain)" ]; then
1824
local changed_files="$(git status -s | cut -c4-)"
1925
local error="some files in the working directory contain changes that were not yet committed into git:"

target/debug/mush

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set -e
33

44
## BP002: Package and debug variables
55
MUSH_PACKAGE_NAME=mush
6-
MUSH_DEBUG_PATH=/home/francesco/Develop/Javanile/mush
6+
MUSH_DEBUG_PATH=/Users/francescobianco/Develop/Javanile/mush
77
MUSH_TARGET_PATH="${MUSH_DEBUG_PATH}/target/debug"
88

99
## BP003: Embedding debug api

0 commit comments

Comments
 (0)