-
Notifications
You must be signed in to change notification settings - Fork 2
/
create_plugin.sh
58 lines (40 loc) · 1.89 KB
/
create_plugin.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!bin/bash
git clone https://github.com/Asitha/nooba-plugin-speedmismatch.git
plugin_name="$1"
SPEEDMISMATCH="SPEEDMISMATCH"
speedmismatch="speedmismatch"
Speedmismatch="Speedmismatch"
PLUGIN_NAME="${plugin_name^^}"
plugin_name="${plugin_name,,}"
Plugin_name="${plugin_name^}"
mv ./nooba-plugin-speedmismatch $(echo "nooba-plugin-speedmismatch" | sed "s/$speedmismatch/$plugin_name/g") > /dev/null 2>&1
cd ./$(echo "nooba-plugin-speedmismatch" | sed "s/$speedmismatch/$plugin_name/g")
#changing directories
for i in 1 2 3; do
for f in $(find -type d -not -path "*/.git*"); do
mv $f $(echo "$f" | sed "s/$SPEEDMISMATCH/$PLUGIN_NAME/g") > /dev/null 2>&1
mv $f $(echo $f | sed "s/$speedmismatch/$plugin_name/g") > /dev/null 2>&1
mv $f $(echo $f | sed "s/$Speedmismatch/$Plugin_name/g") > /dev/null 2>&1
done
done
#changing filenames
for i in 1 2 3; do
for f in $(find -type f -not -path "*/.git*"); do
mv $f $(echo $f | sed "s/$SPEEDMISMATCH/$PLUGIN_NAME/g") > /dev/null 2>&1
mv $f $(echo $f | sed "s/$speedmismatch/$plugin_name/g") > /dev/null 2>&1
mv $f $(echo $f | sed "s/$Speedmismatch/$Plugin_name/g")> /dev/null 2>&1
done
done
#changing file content
for i in 1 2 3; do
for f in $(find -type f -not -path "*/.git*"); do
sed -i "s/$SPEEDMISMATCH/$PLUGIN_NAME/g" $f > /dev/null 2>&1
sed -i "s/$speedmismatch/$plugin_name/g" $f > /dev/null 2>&1
sed -i "s/$Speedmismatch/$Plugin_name/g" $f > /dev/null 2>&1
done
done
#restoring SPEEDMISMATCH keyword at the speedmismatch of the project library
sed -i "s/$PLUGIN_NAME = lib/$SPEEDMISMATCH = lib/g" $(echo "./SpeedmismatchPlugin/SpeedmismatchPlugin.pro" | sed "s/$Speedmismatch/$Plugin_name/g") > /dev/null 2>&1
#changing TARGET name
sed -i "s/TARGET = TestPlugin/TARGET = ${Plugin_name}Plugin/g" $(echo "./SpeedmismatchPlugin/SpeedmismatchPlugin.pro" | sed "s/$Speedmismatch/$Plugin_name/g") > /dev/null 2>&1
sudo chown $USER -R ./*