Sha256: ebb8758a6095af005ba67cc6fe7ceda218dd68a1e8bc9f08ae2e786455e7a7ac

Contents?: true

Size: 761 Bytes

Versions: 3

Compression:

Stored size: 761 Bytes

Contents

module Serverspec
  module Helper
    module Type
      types = %w(
        base cgroup command cron default_gateway file group host interface
        ipfilter ipnat iptables kernel_module linux_kernel_parameter lxc mail_alias
        package php_config port process routing_table selinux service user yumrepo
        windows_feature windows_registry_key zfs
      )

      types.each {|type| require "serverspec/type/#{type}" }

      types.each do |type|
        define_method type do |*args|
          name = args.first
          self.class.const_get('Serverspec').const_get('Type').const_get(camelize(type)).new(name)
        end
      end

      def camelize(string)
        string.split("_").each {|s| s.capitalize! }.join("")
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
serverspec-0.15.3 lib/serverspec/helper/type.rb
serverspec-0.15.2 lib/serverspec/helper/type.rb
serverspec-0.15.1 lib/serverspec/helper/type.rb