Advertisement
Shell_Casing

module DeployToServers

Mar 14th, 2022
1,939
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.81 KB | None | 0 0
  1. require 'benchmark'
  2. require 'git'
  3.  
  4. module DeployToServers
  5.  
  6.  
  7.   def get_data_center_list
  8.  
  9.     Git.clone('git@github.csc.zw.corp:ncux/instances.git', 'data-centers.git')
  10.    
  11.     server_list_final = []
  12.    
  13.     Dir.chdir("data-centers.git") do |dir|
  14.       # search for files with rb extension and save in array
  15.       server_list = Dir.glob("app*.rb").map do |file|
  16.         #remove extension from name
  17.         file.sub(/.rb/, '')
  18.       end
  19.       server_list = server_list.select { |n| n.length < 7 && n.count("0-9") > 0 }
  20.       server_list_final = server_list
  21.  
  22.     end
  23.     server_list_final.map { |n| ':' + n }
  24.  
  25.   end
  26.  
  27.   PROD_SERVERS      = get_data_center_list  # how do I get this to work?
  28.  
  29.   ######################################################
  30.   # bucnh of other code in this module...
  31.  
  32. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement