Grant Ridder
82a478f2ba
Improve "Which Serverspec resources are available in InSpec?" doc
...
- Switch serverspec and inspec resource compare to a table and fix the links
- Add links for serverspec resources not in inspec
Serverspec to InSpec markdown table generated with:
```
mapping = {
bond: 'bond',
bridge: 'bridge',
command: 'command',
cron: 'crontab',
docker_container: 'docker_container',
docker_image: 'docker_image',
file: 'file',
group: 'group',
host: 'host',
interface: 'interface',
iis_website: 'iis_website',
iis_app_pool: 'iis_website',
iptables: 'iptables',
kernel_module: 'kernel_module',
linux_kernel_parameter: 'kernel_parameter',
mysql_config: 'mysql_conf',
package: 'package',
port: 'port',
ppa: 'apt',
process: 'processes',
service: 'service',
user: 'user',
windows_feature: 'windows_feature',
windows_registry_key: 'registry_key',
x509_certificate: 'x509_certificate',
yumrepo: 'yum',
zfs: 'zfs_pool'
}
serverspec_base = 'http://serverspec.org/resource_types.html# '
inspec_base = "https://www.inspec.io/docs/reference/resources/ "
serverspec_max = serverspec_base.length + mapping.max_by{|k,v| k.length}[0].length * 2 + 4
inspec_max = inspec_base.length + mapping.max_by{|k,v| v.length}[1].length * 2 + 5
serverspec_header_half = ' ' * ((serverspec_max - 'Serverspec'.length) / 2)
inspec_header_half = ' ' * ((inspec_max - 'InSpec'.length) / 2)
puts "| #{serverspec_header_half}Serverspec#{serverspec_header_half} | #{inspec_header_half}InSpec#{inspec_header_half} |"
puts "|:#{'-' * serverspec_max}:|:#{'-' * inspec_max}:|"
mapping.each do |serverspec, inspec|
serverspec_text = "[#{serverspec}](#{serverspec_base}#{serverspec})"
padding = serverspec_max - serverspec_text.length
serverspec_string = serverspec_text + ' ' * padding
inspec_text = "[#{inspec}](#{inspec_base}#{inspec}/)"
padding = inspec_max - inspec_text.length
inspec_string = inspec_text + ' ' * padding
puts "| #{serverspec_string} | #{inspec_string} |"
end
```
Signed-off-by: Grant Ridder <shortdudey123@gmail.com>
2017-04-28 15:03:04 -07:00