forked from vieter-v/vieter
				
			Start of cron implementation
							parent
							
								
									8b2900d7f3
								
							
						
					
					
						commit
						41ee08045b
					
				|  | @ -0,0 +1,26 @@ | |||
| module cron | ||||
| 
 | ||||
| import cli | ||||
| import env | ||||
| 
 | ||||
| struct Config { | ||||
| pub: | ||||
| 	log_level    string = 'WARN' | ||||
| 	log_file     string = 'vieter.log' | ||||
| 	api_key      string | ||||
| 	address string | ||||
| 	base_image string = 'archlinux:base-devel' | ||||
| } | ||||
| 
 | ||||
| pub fn cmd() cli.Command { | ||||
| 	return cli.Command{ | ||||
| 		name: 'cron' | ||||
| 		description: 'Start the cron service that periodically runs builds.' | ||||
| 		execute: fn (cmd cli.Command) ? { | ||||
| 			config_file := cmd.flags.get_string('config-file') ? | ||||
| 			conf := env.load<Config>(config_file) ? | ||||
| 
 | ||||
| 			cron(conf) ? | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  | @ -0,0 +1,7 @@ | |||
| module cron | ||||
| 
 | ||||
| import git | ||||
| 
 | ||||
| pub fn cron(conf Config) ? { | ||||
| 	repos_map := git.get_repos(conf.address, conf.api_key) ? | ||||
| } | ||||
|  | @ -5,6 +5,7 @@ import server | |||
| import cli | ||||
| import build | ||||
| import git | ||||
| import cron | ||||
| 
 | ||||
| fn main() { | ||||
| 	mut app := cli.Command{ | ||||
|  | @ -25,6 +26,7 @@ fn main() { | |||
| 			server.cmd(), | ||||
| 			build.cmd(), | ||||
| 			git.cmd(), | ||||
| 			cron.cmd() | ||||
| 		] | ||||
| 	} | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue