Sha256: cece3d552ae1e0843b5bc9fc73dbcc7a23625801c309db28f3a40c61fd359792

Contents?: true

Size: 657 Bytes

Versions: 5

Compression:

Stored size: 657 Bytes

Contents

module Serverspec
  module Helper
    module Type
      types = %w(
        base yumrepo service package port file cron command linux_kernel_parameter iptables host
        routing_table default_gateway selinux user group zfs ipnat ipfilter kernel_module
      )

      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

5 entries across 5 versions & 1 rubygems

Version Path
serverspec-0.6.11 lib/serverspec/helper/type.rb
serverspec-0.6.10 lib/serverspec/helper/type.rb
serverspec-0.6.9 lib/serverspec/helper/type.rb
serverspec-0.6.8 lib/serverspec/helper/type.rb
serverspec-0.6.7 lib/serverspec/helper/type.rb