Skip to content

Commit ae24870

Browse files
committed
update per ryans
1 parent b1178ac commit ae24870

File tree

1 file changed

+28
-36
lines changed

1 file changed

+28
-36
lines changed

.github/actions/make_mdx.sh renamed to scripts/make_mdx.sh

Lines changed: 28 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@
77
# ex: ./make_mdx.sh /Users/potter/dest /Users/potter/src
88

99
# make temp directory
10-
WORK_DIR=`mktemp -d`
10+
WORK_DIR=$(mktemp -d)
1111

1212
PY_DEST_REPO="docs/source/ingest/destination_connectors/code/python/"
1313
SH_DEST_REPO="docs/source/ingest/destination_connectors/code/bash/"
14-
DEST_DIR=$1 # first argument to script
14+
DEST_TARGET_DIR=$1 # first argument to script
1515
PY_SRC_REPO="docs/source/ingest/source_connectors/code/python/"
1616
SH_SRC_REPO="docs/source/ingest/source_connectors/code/bash/"
17-
SRC_DIR=$2 # second argument to script
17+
SRC_TARGET_DIR=$2 # second argument to script
1818

1919
# Clone the correct directories in the open source repo
20-
cd $WORK_DIR
20+
cd "$WORK_DIR"
2121
git init
2222
git remote add -f origin https://github.com/Unstructured-IO/unstructured
2323
git config core.sparseCheckout true
@@ -27,41 +27,33 @@ echo "$PY_SRC_REPO" >> .git/info/sparse-checkout
2727
echo "$SH_SRC_REPO" >> .git/info/sparse-checkout
2828
git pull origin main
2929

30-
cp -R $WORK_DIR/$PY_DEST_REPO/. $DEST_DIR/
31-
cp -R $WORK_DIR/$SH_DEST_REPO/. $DEST_DIR/
32-
cp -R $WORK_DIR/$PY_SRC_REPO/. $SRC_DIR/
33-
cp -R $WORK_DIR/$SH_SRC_REPO/. $SRC_DIR/
30+
cp -R "$WORK_DIR/$PY_DEST_REPO/." "$DEST_TARGET_DIR/"
31+
cp -R "$WORK_DIR/$SH_DEST_REPO/." "$DEST_TARGET_DIR/"
32+
cp -R "$WORK_DIR/$PY_SRC_REPO/." "$SRC_TARGET_DIR/"
33+
cp -R "$WORK_DIR/$SH_SRC_REPO/." "$SRC_TARGET_DIR/"
34+
35+
function to_mdx() {
36+
for f in *.py
37+
do sed -i '1i```python\' $f
38+
sed -i '$ a ```' $f
39+
mv $f $f.mdx
40+
done
41+
42+
for f in *.sh
43+
do sed -i '1i```bash\' $f
44+
sed -i '$ a ```' $f
45+
mv $f $f.mdx
46+
done
47+
}
3448

3549
# Convert the destination_connectors to markdown
36-
cd $DEST_DIR
37-
38-
for f in *.py
39-
do sed -i '1i```python\' $f
40-
sed -i '$ a ```' $f
41-
mv $f $f.mdx
42-
done
43-
44-
for f in *.sh
45-
do sed -i '1i```bash\' $f
46-
sed -i '$ a ```' $f
47-
mv $f $f.mdx
48-
done
50+
cd "$DEST_TARGET_DIR"
51+
to_mdx
4952

5053
# Convert the source_connectors to markdown
51-
cd $SRC_DIR
52-
53-
for f in *.py
54-
do sed -i '1i```python\' $f
55-
sed -i '$ a ```' $f
56-
mv $f $f.mdx
57-
done
58-
59-
for f in *.sh
60-
do sed -i '1i```bash\' $f
61-
sed -i '$ a ```' $f
62-
mv $f $f.mdx
63-
done
54+
cd "$SRC_TARGET_DIR"
55+
to_mdx
6456

65-
rm -rf $WORK_DIR
57+
rm -rf "$WORK_DIR"
6658

67-
echo "Markdown files created in $DEST_DIR and $SRC_DIR"
59+
echo "Markdown files created in $DEST_TARGET_DIR and $SRC_TARGET_DIR"

0 commit comments

Comments
 (0)