Compare commits
2 Commits
d78bfcc408
...
5083852c29
| Author | SHA1 | Date | |
|---|---|---|---|
|
5083852c29
|
|||
|
215e4aa545
|
@@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "hdlbuild"
|
name = "hdlbuild"
|
||||||
version = "0.5.1"
|
version = "0.5.2"
|
||||||
description = "Flexible FPGA Build System"
|
description = "Flexible FPGA Build System"
|
||||||
authors = ["0xMax42 <Mail@0xMax42.io>"]
|
authors = ["0xMax42 <Mail@0xMax42.io>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|||||||
@@ -15,25 +15,22 @@ class InitCommand:
|
|||||||
"""Initialize a new HDLBuild project."""
|
"""Initialize a new HDLBuild project."""
|
||||||
project_dir = Path.cwd()
|
project_dir = Path.cwd()
|
||||||
|
|
||||||
# Paths to templates
|
# Correctly resolve path to templates directory
|
||||||
template_dir = Path(__file__).parent / "templates"
|
script_dir = Path(__file__).parent.resolve()
|
||||||
|
template_dir = (script_dir / ".." / "templates").resolve()
|
||||||
|
|
||||||
# .gitignore
|
# Files to copy
|
||||||
gitignore_template = template_dir / "gitignore.template"
|
files = [
|
||||||
gitignore_target = project_dir / ".gitignore"
|
("gitignore.template", ".gitignore"),
|
||||||
|
("project.yml.template", "project.yml"),
|
||||||
|
]
|
||||||
|
|
||||||
if not gitignore_target.exists():
|
for template_name, target_name in files:
|
||||||
shutil.copy(gitignore_template, gitignore_target)
|
template_path = template_dir / template_name
|
||||||
self.console_utils.print("Created .gitignore")
|
target_path = project_dir / target_name
|
||||||
|
|
||||||
|
if not target_path.exists():
|
||||||
|
shutil.copy(template_path, target_path)
|
||||||
|
self.console_utils.print(f"Created {target_name}")
|
||||||
else:
|
else:
|
||||||
self.console_utils.print(".gitignore already exists, skipping.")
|
self.console_utils.print(f"{target_name} already exists, skipping.")
|
||||||
|
|
||||||
# project.yml
|
|
||||||
project_yml_template = template_dir / "project.yml.template"
|
|
||||||
project_yml_target = project_dir / "project.yml"
|
|
||||||
|
|
||||||
if not project_yml_target.exists():
|
|
||||||
shutil.copy(project_yml_template, project_yml_target)
|
|
||||||
self.console_utils.print("Created project.yml")
|
|
||||||
else:
|
|
||||||
self.console_utils.print("project.yml already exists, skipping.")
|
|
||||||
|
|||||||
Reference in New Issue
Block a user