-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.ps1
More file actions
127 lines (109 loc) · 3.24 KB
/
Copy pathsetup.ps1
File metadata and controls
127 lines (109 loc) · 3.24 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# PowerShell script to initialize the Email-LLM project with Apache Camel and Groovy
# Author: Project structure generator
# Date: 2025-05-17
# Exit on error
$ErrorActionPreference = "Stop"
# Colors for output
$GREEN = "`e[0;32m"
$BLUE = "`e[0;34m"
$YELLOW = "`e[1;33m"
$RED = "`e[0;31m"
$NC = "`e[0m" # No Color
# Function to display info messages
function Info {
param([string]$message)
Write-Host "${BLUE}[INFO]${NC} $message"
}
# Function to display success messages
function Success {
param([string]$message)
Write-Host "${GREEN}[SUCCESS]${NC} $message"
}
# Function to display warning messages
function Warning {
param([string]$message)
Write-Host "${YELLOW}[WARNING]${NC} $message"
}
# Function to display error messages
function Error {
param([string]$message)
Write-Host "${RED}[ERROR]${NC} $message"
exit 1
}
# Function to check requirements
function Check-Requirements {
Info "Checking system requirements..."
# Check Docker
if (-not (Get-Command docker -ErrorAction SilentlyContinue)) {
Error "Docker is not installed. Please install Docker before continuing."
}
# Check Docker Compose
if (-not (Get-Command docker-compose -ErrorAction SilentlyContinue)) {
Error "Docker Compose is not installed. Please install Docker Compose before continuing."
}
# Check curl
if (-not (Get-Command curl -ErrorAction SilentlyContinue)) {
Warning "curl is not installed. Some features may not work properly."
}
}
# Function to create directory structure
function Create-DirectoryStructure {
Info "Creating project directory structure..."
$directories = @(
"camel-groovy",
"camel-groovy/src",
"camel-groovy/src/main",
"camel-groovy/src/main/java",
"camel-groovy/src/main/resources",
"camel-groovy/src/test",
"camel-groovy/src/test/java",
"data",
"logs",
"gradle-cache",
"ollama_models"
)
foreach ($dir in $directories) {
if (-not (Test-Path $dir)) {
New-Item -ItemType Directory -Path $dir
Info "Created directory: $dir"
}
}
}
# Function to create project files
function Create-ProjectFiles {
Info "Creating project files..."
$files = @(
@{
Path = "camel-groovy/build.gradle";
Content = "// Gradle build file content"
},
@{
Path = "camel-groovy/src/main/resources/application.properties";
Content = "# Application properties"
},
@{
Path = "camel-groovy/src/main/java/EmailLLMApplication.groovy";
Content = "// Main application class"
}
)
foreach ($file in $files) {
if (-not (Test-Path $file.Path)) {
New-Item -ItemType File -Path $file.Path
Set-Content -Path $file.Path -Value $file.Content
Info "Created file: $($file.Path)"
}
}
}
# Main installation function
function Install-Project {
try {
Check-Requirements
Create-DirectoryStructure
Create-ProjectFiles
Success "Project setup completed successfully!"
} catch {
Error "An error occurred during installation: $_"
}
}
# Run installation
Install-Project