Sha256: 6bb5ad168aca97b40656e8385023d7e0c50da63b222e3240d00a7e95c77b8398
Contents?: true
Size: 1.23 KB
Versions: 10
Compression:
Stored size: 1.23 KB
Contents
#!/usr/bin/env ruby require 'sfn' print 'Generating command and configuration page...' klasses = Sfn::Config.constants.sort.map do |const| klass = Sfn::Config.const_get(const) klass if klass.is_a?(Class) && klass.respond_to?(:attributes) end.compact file = File.open(File.join(File.dirname(__FILE__), '..', 'docs', 'command-config.md'), 'w') file.puts <<-EOS --- title: "Commands and configuration" weight: 6 anchors: EOS klasses.each do |klass| file.puts " - title: \"#{klass.name.split('::').last} Command\"" file.puts " url: \"##{klass.name.split('::').last.downcase}-command\"" end file.puts '---' klasses.each do |klass| file.puts "## #{klass.name.split('::').last} Command" file.puts file.puts '~~~' file.puts "$ sfn #{klass.name.split('::').last.downcase}" file.puts '~~~' file.puts "\n" file.puts "| Option | Attribute | Value" file.puts "|--------|-----------|------" klass.attributes.sort_by(&:first).map do |name, value| file.puts "| `--#{name.to_s.tr('_', '-')}` | Description | #{value[:description]} |" file.puts "| | Valid | `#{[value[:type]].flatten.compact.join('`, `')}` |" file.puts "| | Default | #{value[:default].inspect unless value[:default].nil?}|\n" end file.puts end puts 'done'
Version data entries
10 entries across 10 versions & 1 rubygems