-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathspark
More file actions
executable file
·68 lines (47 loc) · 1.8 KB
/
spark
File metadata and controls
executable file
·68 lines (47 loc) · 1.8 KB
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
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env bash
# if no $1 provided, fresh install
if [ -z "$1" ]; then
cp -r couch-starter/* ./
# prompt for "Install new CouchCMS site?" (y/n)
read -rp "Install new CouchCMS site? (y/n): " install_response
# if "y"
if [ "$install_response" = "y" ]; then
# Clone CouchCMS
git clone https://github.com/CouchCMS/CouchCMS && mv CouchCMS/couch ./ && rm -rf CouchCMS
# Setup extended users config file
mv couch/addons/extended/config.example.php couch/addons/extended/config.php
# Move Spark config and kfunctions files
mv spark.config.php couch/config.php
mv spark.kfunctions.php couch/addons/kfunctions.php
# Set database credentials
read -rp "Enter database name: " db_name
read -rp "Enter database username (default: root): " db_user_input
db_user=${db_user_input:-root}
read -rp "Enter database password (default: root): " db_pass_input
db_pass=${db_pass_input:-root}
# Set site URL
this_dir=$(basename "$PWD")
site_url="http://localhost:8888/CouchCMS/$this_dir/"
# Prompt to remove footer link
read -rp "Remove footer link? (y/n, default: n): " footer_response
footer_response=${footer_response:-n}
case "${footer_response:-n}" in
[Yy] ) remove_footer_link="1" ;;
* ) remove_footer_link="0" ;;
esac
# find and replace in couch/config.php
sed -i '' "s|<spark-remove-footer-link>|${remove_footer_link}|" couch/config.php
sed -i '' "s|<spark-db-name>|${db_name}|" couch/config.php
sed -i '' "s|<spark-db-user>|${db_user}|" couch/config.php
sed -i '' "s|<spark-db-pass>|${db_pass}|" couch/config.php
sed -i '' "s|<spark-site-url>|${site_url}|" couch/config.php
rm -rf couch-starter
exit 0
else
# if "n"
echo "Exiting..."
exit 0
fi
fi
command=$1
# we'll add commands here later, such as "spark new template <template-name> (clonable) (routable)"