Sha256: 9465f2b87ac73222613430003ae02d1b16da12c5c191c3ce5cebd055f26ea19e

Contents?: true

Size: 1.86 KB

Versions: 3

Compression:

Stored size: 1.86 KB

Contents

#!/usr/bin/env ruby
require 'fileutils'

unless(system("yardoc"))
  $stderr.puts 'ACK: Failed to create docs!'
  exit -1
end

FileUtils.mkdir_p('doc/UserDocs')

Dir.glob('docs/**/*').each do |path|
  next unless File.file?(path)
  content = File.read(path)
  rel_path = path.sub(/.*?docs\//, '')
  new_path = File.join('doc/UserDocs', rel_path)
  user_doc_root = (['..'] * rel_path.scan('/').size).join('/')
  unless(user_doc_root.to_s.empty?)
    user_doc_root << '/'
  end
  FileUtils.mkdir_p(File.dirname(new_path))
  File.open(new_path, 'w') do |file|
    file.puts content
  end
  if(new_path.end_with?('.md'))
    File.open(new_path.sub('.md', '.html'), 'w') do |file|
      file.print "<!DOCTYPE html><html><head><title>SparkleFormation CLI User Documentation</title><script src=\"#{user_doc_root}v/0.3.2/marked.js\"></script><script src=\"#{user_doc_root}v/jquery-2.1.3.min.js\"></script><script src=\"#{user_doc_root}v/loader.js\"></script><script src=\"#{user_doc_root}v/highlight.min.js\"></script><link rel=\"stylesheet\" href=\"#{user_doc_root}v/bootstrap.min.css\"></link><link rel=\"stylesheet\" href=\"#{user_doc_root}v/highlight.min.css\"></link><link rel=\"stylesheet\" href=\"#{user_doc_root}v/finalizer.css\"></link>"
      file.print "</head><body><div class=\"markdown-body\"><div class=\"navbar navbar-top\"><div class=\"navbar-inner\"><div class=\"container\"><div class=\"navbar-brand\"><a href=\"#{user_doc_root}README.html\">SparkleFormation - User documentation</a></div></div></div></div><div class=\"panel panel-default\"><div class=\"panel-body\" id=\"content\"></div></div></div>"
      file.print "</body></html>"
    end
  end
end

File.open('doc/UserDocs/index.html', 'w') do |file|
  file.puts '<html><head><meta http-equiv="refresh" content="0; url=README.html" /></head></html>'
end

FileUtils.mkdir('doc/img')
FileUtils.cp('img/sfn.jpg', 'doc/img/')

puts 'done.'

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sfn-3.1.8 bin/generate_sfn_docs
sfn-3.1.6 bin/generate_sfn_docs
sfn-3.1.4 bin/generate_sfn_docs