add init resource

This commit is contained in:
Christoph Hartmann 2015-11-24 13:05:34 +01:00 committed by Dominik Richter
parent 0657525f4d
commit 60e2a3512f
2 changed files with 24 additions and 0 deletions

View file

@ -74,3 +74,4 @@ require 'resources/yum'
require 'resources/json'
require 'resources/yaml'
require 'resources/csv'
require 'resources/ini'

23
lib/resources/ini.rb Normal file
View file

@ -0,0 +1,23 @@
# encoding: utf-8
# author: Christoph Hartmann
# author: Dominik Richter
require 'utils/simpleconfig'
# Parses a ini file
# Usage:
# descibe ini do
# its("auth_protocol") { should eq "https" }
# end
class IniConfig < JsonConfig
name 'ini'
# override file load and parse hash with simple config
def parse(content)
SimpleConfig.new(content).params
end
def to_s
"INI #{@path}"
end
end