File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -56,6 +56,13 @@ def config():
5656 if codemeta_file is not None or codemeta_file != "" :
5757 options ["codemeta_file" ] = codemeta_file
5858
59+ options ["no_sync_julia" ] = not typer .confirm (
60+ "Do you want to sync to a Project.toml(Julia) file?" , default = True
61+ )
62+ julia_file = typer .prompt ("Project.toml(Julia) file path" , default = "Project.toml" )
63+ if julia_file is not None or julia_file != "" :
64+ options ["julia_file" ] = julia_file
65+
5966 options ["show_info" ] = typer .confirm (
6067 "Do you want to show info about the sync process?"
6168 )
Original file line number Diff line number Diff line change @@ -101,6 +101,24 @@ def sync(
101101 resolve_path = True ,
102102 help = "Custom codemeta.json file path" ,
103103 ),
104+ no_sync_julia : bool = typer .Option (
105+ None ,
106+ "--no-sync-julia" ,
107+ "-M" ,
108+ help = "Do not sync Project.toml(Julia) file" ,
109+ ),
110+ julia_file : Path = typer .Option (
111+ None ,
112+ "--julia-file" ,
113+ "-m" ,
114+ exists = True ,
115+ file_okay = True ,
116+ dir_okay = False ,
117+ writable = True ,
118+ readable = True ,
119+ resolve_path = True ,
120+ help = "Custom Project.toml(Julia) file path" ,
121+ ),
104122):
105123 """Sync project metadata input with metadata files."""
106124 somesy_input = resolved_somesy_input (
@@ -113,6 +131,8 @@ def sync(
113131 package_json_file = package_json_file ,
114132 no_sync_codemeta = no_sync_codemeta ,
115133 codemeta_file = codemeta_file ,
134+ no_sync_julia = no_sync_julia ,
135+ julia_file = julia_file ,
116136 )
117137 run_sync (somesy_input )
118138
Original file line number Diff line number Diff line change 77from somesy .cff .writer import CFF
88from somesy .codemeta import Codemeta
99from somesy .core .models import ProjectMetadata , SomesyInput
10+ from somesy .julia .writer import Julia
1011from somesy .package_json .writer import PackageJSON
1112from somesy .pyproject .writer import Pyproject
1213
@@ -36,6 +37,9 @@ def sync(somesy_input: SomesyInput):
3637 if not conf .no_sync_codemeta :
3738 _sync_codemeta (metadata , conf .codemeta_file )
3839
40+ if not conf .no_sync_julia :
41+ _sync_julia (metadata , conf .julia_file )
42+
3943
4044def _sync_python (
4145 metadata : ProjectMetadata ,
@@ -107,3 +111,21 @@ def _sync_codemeta(
107111 cm .sync (metadata )
108112 cm .save ()
109113 logger .verbose (f"New codemeta graph written to { codemeta_file } ." )
114+
115+
116+ def _sync_julia (
117+ metadata : ProjectMetadata ,
118+ julia_file : Path ,
119+ ):
120+ """Sync Project.toml file using project metadata.
121+
122+ Args:
123+ metadata (ProjectMetadata): project metadata to sync pyproject.toml file.
124+ julia_file (Path, optional): Project.toml file path if wanted to be synced. Defaults to None.
125+ """
126+ logger .verbose ("Loading Project.toml file." )
127+ cm = Julia (julia_file )
128+ logger .verbose ("Syncing Project.toml file." )
129+ cm .sync (metadata )
130+ cm .save ()
131+ logger .verbose (f"Saved synced Project.toml file to { julia_file } ." )
You can’t perform that action at this time.
0 commit comments