@@ -45,7 +45,11 @@ pub struct Makefile {}
4545pub struct GhCI { }
4646
4747#[ derive( Template ) ]
48- #[ template( path = ".cpa/prettier.json" , escape = "none" ) ]
48+ #[ template( path = "base/ci.yaml" , escape = "none" ) ]
49+ pub struct GhCIBase { }
50+
51+ #[ derive( Template ) ]
52+ #[ template( path = ".ci/prettier.json" , escape = "none" ) ]
4953pub struct Prettier { }
5054
5155#[ derive( Template ) ]
@@ -54,17 +58,17 @@ pub struct PreCommitConfig {
5458 pub language : String ,
5559}
5660
61+ #[ derive( Template ) ]
62+ #[ template( path = "base/.pre-commit-config.yaml" , escape = "none" ) ]
63+ pub struct PreCommitConfigBase { }
64+
5765////////////////////////////////////
5866// PYTHON
5967////////////////////////////////////
6068#[ derive( Template ) ]
6169#[ template( path = "python/Dockerfile" , escape = "none" ) ]
6270pub struct PyDockerfile { }
6371
64- #[ derive( Template ) ]
65- #[ template( path = "python/main.py" , escape = "none" ) ]
66- pub struct PyMain { }
67-
6872#[ derive( Template ) ]
6973#[ template( path = "python/pyproject.toml" , escape = "none" ) ]
7074pub struct PyProject {
@@ -74,7 +78,7 @@ pub struct PyProject {
7478}
7579
7680#[ derive( Template ) ]
77- #[ template( path = ".cpa /flake8.cfg" , escape = "none" ) ]
81+ #[ template( path = ".ci /flake8.cfg" , escape = "none" ) ]
7882pub struct Flake8 { }
7983
8084////////////////////////////////////
@@ -98,7 +102,7 @@ pub fn common(name: &str, create: bool, lang: &Language) -> String {
98102 let prefix: String = if create { format ! ( "./{}" , name) } else { "./" . to_string ( ) } ;
99103
100104 // Create needed dirs
101- let _ = fs:: create_dir_all ( format ! ( "{}/.cpa " , prefix) ) ;
105+ let _ = fs:: create_dir_all ( format ! ( "{}/.ci " , prefix) ) ;
102106 let _ = fs:: create_dir_all ( format ! ( "{}/.vscode" , prefix) ) ;
103107 let _ = fs:: create_dir_all ( format ! ( "{}/.github/workflows" , prefix) ) ;
104108
@@ -110,7 +114,7 @@ pub fn common(name: &str, create: bool, lang: &Language) -> String {
110114 language : lang. language . to_string ( ) ,
111115 }
112116 . write ( & prefix, ".pre-commit-config.yaml" ) ;
113- Prettier { } . write ( & prefix, ".cpa /prettier.json" ) ;
117+ Prettier { } . write ( & prefix, ".ci /prettier.json" ) ;
114118 VSCodeSettings { } . write ( & prefix, ".vscode/settings.json" ) ;
115119 VSCodeExtensions { } . write ( & prefix, ".vscode/extensions.json" ) ;
116120 prefix
@@ -120,8 +124,7 @@ pub fn python(name: &str, prefix: &str, lang: &Language) {
120124 let black_target_ver = format ! ( "py{}" , lang. ver. replace( '.' , "" ) ) ;
121125
122126 // Render Python-specific files
123- Flake8 { } . write ( prefix, ".cpa/flake8.cfg" ) ;
124- PyMain { } . write ( prefix, "main.py" ) ;
127+ Flake8 { } . write ( prefix, ".ci/flake8.cfg" ) ;
125128 PyDockerfile { } . write ( prefix, "Dockerfile" ) ;
126129
127130 let pyproj: PyProject = PyProject {
@@ -140,3 +143,19 @@ pub fn rust(name: &str, prefix: &str) {
140143 CargoToml { name : name. to_string ( ) } . write ( prefix, "Cargo.toml" ) ;
141144 RustFmt { } . write ( prefix, "rustfmt.toml" ) ;
142145}
146+
147+ pub fn base ( name : & str , create : bool , _lang : & Language ) -> String {
148+ let prefix: String = if create { format ! ( "./{}" , name) } else { "./" . to_string ( ) } ;
149+
150+ // Create needed dirs
151+ let _ = fs:: create_dir_all ( format ! ( "{}/.ci" , prefix) ) ;
152+ let _ = fs:: create_dir_all ( format ! ( "{}/.github/workflows" , prefix) ) ;
153+
154+ // Render common files
155+ GhCIBase { } . write ( & prefix, ".github/workflows/ci.yaml" ) ;
156+ GitIgnore { } . write ( & prefix, ".gitignore" ) ;
157+ Makefile { } . write ( & prefix, "Makefile" ) ;
158+ PreCommitConfigBase { } . write ( & prefix, ".pre-commit-config.yaml" ) ;
159+ Prettier { } . write ( & prefix, ".ci/prettier.json" ) ;
160+ prefix
161+ }
0 commit comments