From 3272e8c609c6b89c41a5e609dadf4ef11095d553 Mon Sep 17 00:00:00 2001 From: j-dunham Date: Thu, 1 Sep 2022 15:14:01 -0400 Subject: [PATCH] update forecast data in setup --- azure_devops/bootstrap/setup | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/azure_devops/bootstrap/setup b/azure_devops/bootstrap/setup index e7e0533..ba4cfed 100755 --- a/azure_devops/bootstrap/setup +++ b/azure_devops/bootstrap/setup @@ -3,11 +3,13 @@ require "json" require "net/http" require "optparse" require "pathname" +require "date" options = { code_assets_dir: "code", pipeline_assets_dir: "pipelines", - root_dir: File.join(ENV["CODESPACE_VSCODE_FOLDER"], "azure_devops/bootstrap") + root_dir: File.join(ENV["CODESPACE_VSCODE_FOLDER"], "azure_devops/bootstrap"), + forecast_source_file: File.join(".", "azure_devops/jobs_data.json") } OptionParser.new do |opt| @@ -168,10 +170,18 @@ def create_classic_pipelines(options, repository) end end +def update_forecast_source_file(options) + puts "Updating forecast data" + jobs_data = File.read(options[:forecast_source_file]) + today = Date.today.strftime("%Y-%m-%d") + jobs_data.gsub!(/20[0-2][0-9]-[0-1][0-9]-[0-3][0-9]/, today) + File.write(options[:forecast_source_file], jobs_data) +end create_project(options) repository = create_repository(options) create_yaml_pipelines(options, repository) create_classic_pipelines(options, repository) +update_forecast_source_file(options) -puts "Success!" \ No newline at end of file +puts "Success!"