devcreate 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- __init__.py +1 -0
- detector.py +18 -0
- devcreate-0.1.0.dist-info/METADATA +32 -0
- devcreate-0.1.0.dist-info/RECORD +10 -0
- devcreate-0.1.0.dist-info/WHEEL +5 -0
- devcreate-0.1.0.dist-info/entry_points.txt +2 -0
- devcreate-0.1.0.dist-info/licenses/LICENSE +21 -0
- devcreate-0.1.0.dist-info/top_level.txt +4 -0
- generator.py +97 -0
- main.py +19 -0
__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# DevCreate Package
|
detector.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
def detect_project():
|
|
4
|
+
if os.path.exists("package.json"):
|
|
5
|
+
return "node"
|
|
6
|
+
elif os.path.exists("requirements.txt"):
|
|
7
|
+
return "python"
|
|
8
|
+
elif os.path.exists("composer.json"):
|
|
9
|
+
return "php"
|
|
10
|
+
elif os.path.exists("go.mod"):
|
|
11
|
+
return "go"
|
|
12
|
+
elif any(f.endswith(".c") for f in os.listdir(".")):
|
|
13
|
+
return "c"
|
|
14
|
+
elif any(f.endswith(".cpp") for f in os.listdir(".")):
|
|
15
|
+
return "cpp"
|
|
16
|
+
elif os.path.exists("pom.xml") or any(f.endswith(".java") for f in os.listdir(".")):
|
|
17
|
+
return "java"
|
|
18
|
+
return None
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: devcreate
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Auto-generate Docker, K8s, and CI configs
|
|
5
|
+
Author: Ankit Sharma
|
|
6
|
+
Requires-Python: >=3.8
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Dynamic: license-file
|
|
10
|
+
|
|
11
|
+
# DevAutoGen
|
|
12
|
+
|
|
13
|
+
Auto-generates:
|
|
14
|
+
- Dockerfile
|
|
15
|
+
- docker-compose.yml
|
|
16
|
+
- Kubernetes deployment & service
|
|
17
|
+
- GitHub Actions CI
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
Copy this project directory to your main project directory:
|
|
21
|
+
Run
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
python main.py
|
|
25
|
+
```
|
|
26
|
+
You have to manually modify the files generated for you projects requirements to deploy, these files only are the templates.
|
|
27
|
+
|
|
28
|
+
# V0.1
|
|
29
|
+
The following languages support added for file generation:
|
|
30
|
+
- C
|
|
31
|
+
- C++
|
|
32
|
+
- Java
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
__init__.py,sha256=JxwhxgKrl3dD6mnQ9e_d0wj3A-VVPn0rsNeB-nv9N94,19
|
|
2
|
+
detector.py,sha256=YU5YvuLwM2TL08HVNn48h__nzxOEgY5zBYqJnDeuIQs,564
|
|
3
|
+
generator.py,sha256=q2gaMtJ54AMKBR7BSe0NhhIBC74HwpE5PtohaYuP020,2161
|
|
4
|
+
main.py,sha256=CnC-wmkiSV1-IGg6jajnMFxaffZMMvixkrg2cAebE7c,467
|
|
5
|
+
devcreate-0.1.0.dist-info/licenses/LICENSE,sha256=Gh_mMRsNqt-svORO9KJaCN4XozarQKBco2mVhUYnH3I,1069
|
|
6
|
+
devcreate-0.1.0.dist-info/METADATA,sha256=D7rGlFAE6uMoYH0Zb4wXVepVkr1K19zl-J8bYPcnV8k,662
|
|
7
|
+
devcreate-0.1.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
8
|
+
devcreate-0.1.0.dist-info/entry_points.txt,sha256=1BRshJrW9jZsZHEHa0K-kpppNdCJgEuRmD-WLNB7jWQ,50
|
|
9
|
+
devcreate-0.1.0.dist-info/top_level.txt,sha256=Nk_TbRIUveVEp3aQIf9IjR1-cs56mqyKPtiJhkToAYY,33
|
|
10
|
+
devcreate-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ankit Sharma
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
generator.py
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
def write_file(filename, content):
|
|
4
|
+
os.makedirs(os.path.dirname(filename), exist_ok=True) if "/" in filename else None
|
|
5
|
+
with open(filename, "w") as f:
|
|
6
|
+
f.write(content)
|
|
7
|
+
|
|
8
|
+
def generate_all(project_type):
|
|
9
|
+
port = "8080"
|
|
10
|
+
|
|
11
|
+
if project_type == "node":
|
|
12
|
+
port = "3000"
|
|
13
|
+
base = "node:18"
|
|
14
|
+
run_cmd = '["npm","start"]'
|
|
15
|
+
elif project_type == "python":
|
|
16
|
+
port = "8000"
|
|
17
|
+
base = "python:3.10-slim"
|
|
18
|
+
run_cmd = '["python","app.py"]'
|
|
19
|
+
elif project_type == "java":
|
|
20
|
+
base = "openjdk:17"
|
|
21
|
+
run_cmd = '["java","-jar","app.jar"]'
|
|
22
|
+
elif project_type in ["c","cpp"]:
|
|
23
|
+
base = "gcc:latest"
|
|
24
|
+
run_cmd = '["./app"]'
|
|
25
|
+
else:
|
|
26
|
+
base = "alpine"
|
|
27
|
+
run_cmd = '["sh"]'
|
|
28
|
+
|
|
29
|
+
dockerfile = f"""FROM {base}
|
|
30
|
+
WORKDIR /app
|
|
31
|
+
COPY . .
|
|
32
|
+
RUN if [ -f requirements.txt ]; then pip install -r requirements.txt; fi || true
|
|
33
|
+
RUN if [ -f package.json ]; then npm install; fi || true
|
|
34
|
+
RUN if ls *.c 1> /dev/null 2>&1; then gcc *.c -o app; fi || true
|
|
35
|
+
RUN if ls *.cpp 1> /dev/null 2>&1; then g++ *.cpp -o app; fi || true
|
|
36
|
+
EXPOSE {port}
|
|
37
|
+
CMD {run_cmd}
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
compose = f"""version: '3'
|
|
41
|
+
services:
|
|
42
|
+
app:
|
|
43
|
+
build: .
|
|
44
|
+
ports:
|
|
45
|
+
- "{port}:{port}"
|
|
46
|
+
"""
|
|
47
|
+
|
|
48
|
+
deployment = f"""apiVersion: apps/v1
|
|
49
|
+
kind: Deployment
|
|
50
|
+
metadata:
|
|
51
|
+
name: app-deployment
|
|
52
|
+
spec:
|
|
53
|
+
replicas: 2
|
|
54
|
+
selector:
|
|
55
|
+
matchLabels:
|
|
56
|
+
app: myapp
|
|
57
|
+
template:
|
|
58
|
+
metadata:
|
|
59
|
+
labels:
|
|
60
|
+
app: myapp
|
|
61
|
+
spec:
|
|
62
|
+
containers:
|
|
63
|
+
- name: app
|
|
64
|
+
image: myapp:latest
|
|
65
|
+
ports:
|
|
66
|
+
- containerPort: {port}
|
|
67
|
+
"""
|
|
68
|
+
|
|
69
|
+
service = f"""apiVersion: v1
|
|
70
|
+
kind: Service
|
|
71
|
+
metadata:
|
|
72
|
+
name: app-service
|
|
73
|
+
spec:
|
|
74
|
+
type: NodePort
|
|
75
|
+
selector:
|
|
76
|
+
app: myapp
|
|
77
|
+
ports:
|
|
78
|
+
- port: 80
|
|
79
|
+
targetPort: {port}
|
|
80
|
+
"""
|
|
81
|
+
|
|
82
|
+
github = """name: CI
|
|
83
|
+
on: [push]
|
|
84
|
+
jobs:
|
|
85
|
+
build:
|
|
86
|
+
runs-on: ubuntu-latest
|
|
87
|
+
steps:
|
|
88
|
+
- uses: actions/checkout@v3
|
|
89
|
+
- name: Build Docker Image
|
|
90
|
+
run: docker build -t myapp .
|
|
91
|
+
"""
|
|
92
|
+
|
|
93
|
+
write_file("Dockerfile", dockerfile)
|
|
94
|
+
write_file("docker-compose.yml", compose)
|
|
95
|
+
write_file("deployment.yaml", deployment)
|
|
96
|
+
write_file("service.yaml", service)
|
|
97
|
+
write_file(".github/workflows/ci.yml", github)
|
main.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
import os
|
|
3
|
+
from src.detector import detect_project
|
|
4
|
+
from src.generator import generate_all
|
|
5
|
+
|
|
6
|
+
def main():
|
|
7
|
+
print("🔍 Scanning project...")
|
|
8
|
+
project_type = detect_project()
|
|
9
|
+
|
|
10
|
+
if not project_type:
|
|
11
|
+
print("❌ Could not detect project type.")
|
|
12
|
+
return
|
|
13
|
+
|
|
14
|
+
print(f"✅ Detected project type: {project_type}")
|
|
15
|
+
generate_all(project_type)
|
|
16
|
+
print("🚀 Files generated successfully!")
|
|
17
|
+
|
|
18
|
+
if __name__ == "__main__":
|
|
19
|
+
main()
|