-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
59 lines (48 loc) · 1.89 KB
/
Copy pathsetup.sh
File metadata and controls
59 lines (48 loc) · 1.89 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
#!/bin/bash
# Define project name
PROJECT_NAME="betunfair"
# Function to display an error message and exit
error_exit() {
echo "$1" 1>&2
exit 1
}
# # Check for Elixir
# if ! command -v elixir &> /dev/null; then
# error_exit "Elixir is not installed. Please install Elixir before running this script."
# fi
# # Check for Phoenix
# if ! mix help | grep phx.new &> /dev/null; then
# error_exit "Phoenix is not installed. Please install Phoenix by running: mix archive.install hex phx_new"
# fi
# Navigate to the project directory
echo "Navigating to the project directory..."
cd $PROJECT_NAME > /dev/null 2>&1 || error_exit "Failed to navigate to the project directory."
echo "Successfully navigated to the project directory."
echo
# Install dependencies
echo "Installing dependencies..."
mix deps.get > /dev/null 2>&1 || error_exit "Failed to install dependencies."
echo "Dependencies installed successfully."
echo
# Create and migrate the database
echo "Creating the database..."
mix ecto.create > /dev/null 2>&1 || error_exit "Failed to create the database."
echo "Database created successfully."
echo "Migrating the database..."
mix ecto.migrate > /dev/null 2>&1 || error_exit "Failed to migrate the database."
echo "Database migrated successfully."
echo
# Run tests
echo "Running tests..."
mix test test/betunfair/* && echo "Tests completed successfully." || echo "Some tests failed."
echo
# Generate project documentation
echo "Generating project documentation..."
mix docs > /dev/null 2>&1 || error_exit "Failed to generate project documentation."
echo "Project documentation generated successfully."
echo
# Start the Phoenix server
echo "Starting the Phoenix server, it may be accessed at http://localhost:4000"
iex -S mix phx.server || error_exit "Failed to start the Phoenix server."
# Output success message
echo "Phoenix server initialized and running. You can access it at http://localhost:4000"