mirror of
https://github.com/tenrok/bootstrap.git
synced 2026-06-17 19:21:23 +03:00
add templates for doc generation
This commit is contained in:
+27
@@ -0,0 +1,27 @@
|
||||
require 'json'
|
||||
require 'yaml'
|
||||
|
||||
# Our custom YAML tags must retain their magic.
|
||||
%w[ code ].each do |tag|
|
||||
YAML::add_builtin_type(tag) { |_,val| val.merge(:__tag__ => tag) }
|
||||
end
|
||||
|
||||
desc 'Build all alternate versions of the specs.'
|
||||
multitask :build => [ 'build:json' ]
|
||||
|
||||
namespace :build do
|
||||
note = 'Do not edit this file; changes belong in the appropriate YAML file.'
|
||||
|
||||
desc 'Build JSON versions of the specs.'
|
||||
task :json do
|
||||
rm(Dir['specs/*.json'], :verbose => false)
|
||||
Dir.glob('specs/*.yml').each do |filename|
|
||||
json_file = filename.gsub('.yml', '.json')
|
||||
|
||||
File.open(json_file, 'w') do |file|
|
||||
doc = YAML.load_file(filename)
|
||||
file << doc.merge(:__ATTN__ => note).to_json()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user