mirror of
https://github.com/inspec/inspec
synced 2024-11-26 14:40:26 +00:00
Remove description of custom resource
- will be superseded by compliance profiles
This commit is contained in:
parent
bf0ab1b7cd
commit
c4dcd17f82
1 changed files with 0 additions and 37 deletions
37
README.md
37
README.md
|
@ -152,43 +152,6 @@ Which will provide you with:
|
|||
{"family":"ubuntu","release":"14.04","arch":null}
|
||||
```
|
||||
|
||||
## Custom InSpec resources
|
||||
|
||||
You can easily create your own resources. Here is a custom resource for an
|
||||
application called Gordon. It is saved as `gordon_config.rb`.
|
||||
|
||||
```ruby
|
||||
require 'yaml'
|
||||
|
||||
class GordonConfig < Inspec.resource(1)
|
||||
name 'gordon_config'
|
||||
|
||||
def initialize
|
||||
@path = '/etc/gordon/config.yaml'
|
||||
@config = inspec.file(@path).content
|
||||
@params = YAML.load(@config)
|
||||
end
|
||||
|
||||
def method_missing(name)
|
||||
@params[name.to_s]
|
||||
end
|
||||
end
|
||||
```
|
||||
|
||||
Include this file in your `test.rb`:
|
||||
|
||||
```ruby
|
||||
require_relative 'gordon_config'
|
||||
```
|
||||
|
||||
Now you can start using your new resource:
|
||||
|
||||
```ruby
|
||||
describe gordon_config do
|
||||
its('Version') { should eq('1.0') }
|
||||
end
|
||||
```
|
||||
|
||||
## Documentation
|
||||
|
||||
Documentation is available: https://github.com/chef/inspec/tree/master/docs
|
||||
|
|
Loading…
Reference in a new issue