Sha256: b90b0f0dc409cae09651fd1b52a254601776819c0b4ee5d6d96dd537a3512182

Contents?: true

Size: 802 Bytes

Versions: 6

Compression:

Stored size: 802 Bytes

Contents

module Serverspec
  module Helper
    module Type
      types = %w(
        base cgroup command cron default_gateway file group host iis_website iis_app_pool 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_hot_fix 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

6 entries across 6 versions & 1 rubygems

Version Path
serverspec-1.5.0 lib/serverspec/helper/type.rb
serverspec-2.0.0.beta2 lib/serverspec/helper/type.rb
serverspec-1.4.2 lib/serverspec/helper/type.rb
serverspec-2.0.0.beta1 lib/serverspec/helper/type.rb
serverspec-1.4.1 lib/serverspec/helper/type.rb
serverspec-1.4.0 lib/serverspec/helper/type.rb