Sha256: 120445bf107d095df693faf41a6c7852f70fcdc340ebaf04ea4bc9334f057295

Contents?: true

Size: 639 Bytes

Versions: 2

Compression:

Stored size: 639 Bytes

Contents

module Ykutils
  class Nginxconfigfiles
    def get_file_list(start_dir_pn, reg)
      @file_list = []

      start_dir_pn.find { |x|
        next unless x.to_s =~ reg

        # puts x
        @file_list << x
      }
      @file_list
    end

    def output(file_list)
      file_list.map do |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") do |f|
          x = cli.extract(scope)
          f.write(x)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ykutils-0.1.10 lib/ykutils/nginxconfigfiles.rb
ykutils-0.1.8 lib/ykutils/nginxconfigfiles.rb