Sha256: 71dc1056324afb8e8fc49d7b62b5ade3d58a09dca47f32eee0c80a2643730593

Contents?: true

Size: 670 Bytes

Versions: 2

Compression:

Stored size: 670 Bytes

Contents

module Ykutils
  require 'find'
  class Nginxconfigfiles
    def get_file_list(start_dir, re)
      @file_list = []

      Find.find(start_dir) { |x|
        if x =~ re
          # puts x
          @file_list << x
          Find.prune
        end
      }
      @file_list
    end

    def output(file_list)
      file_list.map { |fname|
        parent_dir_pn = Pathname.new(fname).cleanpath.parent
        vdomain = parent_dir_pn.basename
        output_fname = "#{vdomain}.conf"
        cli = Nginxconfig.new(fname)
        scope = nil
        File.open(output_fname, "w") { |f|
          x = cli.extract(scope)
          f.write(x)
        }
      }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ykutils-0.1.7 lib/ykutils/nginxconfigfiles.rb
ykutils-0.1.6 lib/ykutils/nginxconfigfiles.rb