diff options
| author | ckonstanski <ckonstanski@pippiandcarlos.com> | 2017-10-24 18:27:27 -0600 |
|---|---|---|
| committer | ckonstanski <ckonstanski@pippiandcarlos.com> | 2017-10-24 18:27:27 -0600 |
| commit | 0493747f5d1b30008b4170b3d48080abfa224700 (patch) | |
| tree | 4ee87ddb639f30a47e95861409a1b9d71d183e07 /bootstrap/pillar_config.rb | |
| parent | dd48453e079d5c93f7cf0af59843bd7d4180e186 (diff) | |
make it work for all 4 git branches
Diffstat (limited to 'bootstrap/pillar_config.rb')
| -rwxr-xr-x | bootstrap/pillar_config.rb | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/bootstrap/pillar_config.rb b/bootstrap/pillar_config.rb index 8b4abb4..9b0b1bb 100755 --- a/bootstrap/pillar_config.rb +++ b/bootstrap/pillar_config.rb @@ -2,6 +2,7 @@ require_relative 'http_client' require 'digest' +require 'getoptlong' require "json" require 'socket' require "yaml" @@ -27,7 +28,7 @@ def get_ip_address() end end -def get_jar_versions(yml) +def get_jar_versions(yml, branch) ret = Hash.new begin http_client = HttpClient.new(url: yml["jars"]["url"], @@ -35,7 +36,7 @@ def get_jar_versions(yml) password: yml["jars"]["password"]) http_client.do_http(method: :propfind) http_client.response.each_line do |line| - if line =~ /D:href.*\.jar/ + if line =~ /D:href.*#{branch}.*\.jar/ jar_name = line.chomp.split(/[<>]/)[2] jarparts = jar_name.split(/\//) name, *version_parts, junk1 = jarparts[jarparts.length - 1].split(".") @@ -72,8 +73,18 @@ def process_yaml() end def main() + branch = "" + opts = GetoptLong.new(["--branch", "-b", GetoptLong::REQUIRED_ARGUMENT]) + + opts.each do |opt, arg| + case opt + when "--branch" + branch = arg + end + end + yml = process_yaml() - puts yml.merge(get_jar_versions(yml)).to_json + puts yml.merge(get_jar_versions(yml, branch)).to_json end main() |
