# [Makit](https://gems-rb.gitlab.io/makit/) Makit allows CI/CI tasks to be easily and clearly managed by a single Rakefile Primary objective: CLEAN,CONCISE,READABLE Rakefile CI/CD DevOps move fast, keep it simple, shift left, flatten, test, deliver
✔ git --version ```shell git version 2.39.3 (Apple Git-146) ```
git --version - [ ] .proto - [ ] artifacts: nuget, docker image, console application, desktop Application - [ ] docker container management - [ ] program installation management - [ ] CI/CD build management - [ ] rapid dev in ruby, as features settle, let a rust cli incorporate features ## Local NuGet Server [LiGet](https://github.com/ai-traders/liget) # directory code/data/liget/data require "raykit" task :setup do run "docker pull loicsharma/baget" end task :start_nuget_server do # https://loic-sharma.github.io/BaGet/installation/docker/ FileUtils.mkdir_p "baget" unless Dir.exist? "baget" run "docker run --rm --name nuget-server -p 5555:80 --env-file baget.env -v \"C:/Users/lparslow/code/localhost_services/baget/baget-data:/var/baget\" loicsharma/baget:latest" # dotnet nuget push -s http://localhost:5555/v3/index.json -k NUGET-SERVER-API-KEY package.1.0.0.nupkg # dotnet nuget push -s http://localhost:5555/v3/index.json -k NUGET-SERVER-API-KEY symbol.package.1.0.0.snupkg end task :update_baget_packages => [:start_nuget_server] do start_task :update_baget_packages nuget_source_dir = "P:/code/nuget" baget_push_url = ENV["BAGET_PUSH_URL"] baget_api_key = ENV["BAGET_API_KEY"] # Check if local NuGet directory exists unless Dir.exist?(nuget_source_dir) puts "NuGet source directory does not exist." exit 1 end if baget_push_url && baget_api_key && !baget_api_key.empty? packages = latest_packages(nuget_source_dir) puts "Found #{packages.length} packages to push to BaGet." push_packages(nuget_source_dir, packages, baget_push_url, baget_api_key) else puts "Missing BaGet API key or push URL." end end # Method to identify the latest version of each package def latest_packages(nuget_source_dir) packages = {} puts "scanning #{nuget_source_dir} for packages..." Dir.glob("#{nuget_source_dir}/**/*.nupkg").each do |file| filename = File.basename(file, ".nupkg") relative_filename = file.sub("#{nuget_source_dir}/", "") # the name if the first segment of the relative_filename name = relative_filename.split("/").first parts = filename.split(".") version = parts.pop id = parts.join(".") if packages[id].nil? || Gem::Version.new(version) > Gem::Version.new(packages[id]) #packages[id] = version #puts "Found #{id} version #{version}." #puts "file #{file}" #puts "rel_file #{relative_filename}" #puts "name #{name}" #puts "version #{version}" packages[name] = filename end end packages end # Push the latest packages to BaGet def push_packages(nuget_source_dir, packages, baget_push_url, baget_api_key) packages.each do |name, filename| package_filename = filename #"#{nuget_source_dir}/#{id}.#{version}.nupkg" push_command = "dotnet nuget push -s #{baget_push_url} -k #{baget_api_key} --skip-duplicate #{package_filename}" puts "Pushing #{filename}..." system(push_command) if $?.success? puts "Package #{filename} pushed successfully." else puts "Failed to push package #{filename}." end end end