Sha256: 991c047c657735e120c9ff20ad0c63b7baaede62fac0be93d794170430ec3181

Contents?: true

Size: 705 Bytes

Versions: 4

Compression:

Stored size: 705 Bytes

Contents

require "find"
require_relative "nginxconfig"

module Ykxutils
  class Nginxconfigfiles
    def get_file_list(start_dir, rex)
      @file_list = []

      Find.find(start_dir) do |x|
        if x =~ rex
          @file_list << x
          Find.prune
        end
      end
      @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 = ::Ykxutils::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

4 entries across 4 versions & 1 rubygems

Version Path
ykxutils-0.1.14 lib/ykxutils/nginxconfigfiles.rb
ykxutils-0.1.13 lib/ykxutils/nginxconfigfiles.rb
ykxutils-0.1.12 lib/ykxutils/nginxconfigfiles.rb
ykxutils-0.1.11 lib/ykxutils/nginxconfigfiles.rb