Sha256: 3f75bf58c2ea4cfa81c0a329e256f808d9a4a46d12b8dbcd9e28e3446333e34f
Contents?: true
Size: 1.71 KB
Versions: 4
Compression:
Stored size: 1.71 KB
Contents
module Helper def get_environemnt_variables(exception='') result = {} ENV.each do |key,value| if not exception.include? key $log.writer.debug "Add environment variable #{key} with value #{value} to configuration hash" result[key] = value end end result end module_function :get_environemnt_variables def parse_version(version) result = {} begin result = JSON.parse(version) rescue $log.writer.debug "Given version string is not a JSON object" result = {"app" => version, "cdb" => "", "depsw" => ""} end result end module_function :parse_version def cleanup_workspace!(workspace, sub_dirs) Helper.validates_presence_of workspace begin unless sub_dirs.respond_to?(:each) sub_dirs = ["**/*"] end sub_dirs.each do |sub_dir| FileUtils.rm_rf Dir.glob("#{workspace}/#{sub_dir}") $log.writer.debug "Cleaning Workspace #{workspace}/#{sub_dir}" end rescue Exception => e $log.writer.error "Can not cleanup Workspace!" $log.writer.error e.message exit 1 end end module_function :cleanup_workspace! def init_workspace(workspace) Helper.validates_presence_of workspace $log.writer.debug "Initialize Workspace" initial_dirs = %w{source target config keep log} begin initial_dirs.each do |dir| FileUtils.mkdir_p( File.join(workspace, dir) ) $log.writer.debug "Create directory #{File.join(workspace, dir)}" end rescue Exception => e $log.writer.error "Can not create initial directories in workspace!" $log.writer.error e.message exit 1 end end module_function :init_workspace end
Version data entries
4 entries across 4 versions & 1 rubygems