lib/akamai_cloudlet_manager/policy_version.rb
def generate_path_rules(options={})
      return [] if options[:file_path].nil? || options[:file_path].empty?

      options     = options.merge(match_operator: 'contains', match_type: 'path')
      counter     = 0
      match_value = []

      file = File.new(options[:file_path], "r")
      while (line = file.gets)
        match_value << line
        counter += 1
      end
      file.close

      puts "Total rules read from file: #{counter}\n"

      match_value = match_value.join(' ').gsub(/\n/, '')

      match_rules(match_value, options)
    rescue => err
      puts "Exception: #{err.formatted_exception("Path rules generation failed!")}"
      err
    end
def generate_path_rules(options={})
      return [] if options[:file_path].nil? || options[:file_path].empty?

      options     = options.merge(match_operator: 'contains', match_type: 'path')
      counter     = 0
      match_value = []

      file = File.new(options[:file_path], "r")
      while (line = file.gets)
        match_value << line
        counter += 1
      end
      file.close

      puts "Total rules read from file: #{counter}\n"

      match_value = match_value.join(' ').gsub(/\n/, '')

      match_rules(match_value, options)
    rescue => err
      puts "Exception: #{err.formatted_exception("Path rules generation failed!")}"
      err
    end
def generate_path_rules ( options = { } ) return [ ] if options [ :file_path ] . nil? || options [ :file_path ] . empty? options = options . merge ( match_operator : 'contains' , match_type : 'path' ) counter = 0 match_value = [ ] file = File . new ( options [ :file_path ] , "r" ) while ( line = file . gets ) match_value << line counter += 1 end file . close puts "Total rules read from file: #{counter}\n" match_value = match_value . join ( ' ' ) . gsub ( / \n / , '' ) match_rules ( match_value , options ) rescue => err puts "Exception: #{err.formatted_exception("Path rules generation failed!")}" err end
All the path rules from one file will be added under same match, space separated
All the path rules from one file will be added under same match space separated