<commit_before>namespace :emitter do
  task :rocco do
    require 'rocco'
  end
  
  task :docs => :rocco do
    FileUtils.mkdir_p File.join('.', 'doc')
    %w(carbon_model characterization data summarization).each do |file|
      puts "[docs] #{file}.rb"
      File.open(File.join('.', 'doc', "#{file}.html"), 'wb') { |fd| fd.write(Rocco.new(File.join('.', 'lib', File.basename(Dir.pwd), "#{file}.rb")).to_html) }
    end
  end
end<commit_msg>Pull fancy rocco->gh-pages task from https://github.com/rtomayko/rocco/blob/master/Rakefile<commit_after># Bring in Rocco tasks
require 'rocco/tasks'
Rocco::make 'docs/', 'lib/flight/carbon_model.rb'

desc 'Build rocco docs'
task :docs => :rocco
directory 'docs/'

# GITHUB PAGES ===============================================================

desc 'Update gh-pages branch'
task :pages => ['docs/.git', :docs] do
  rev = `git rev-parse --short HEAD`.strip
  Dir.chdir 'docs' do
    sh "git add *.html"
    sh "git commit -m 'rebuild pages from #{rev}'" do |ok,res|
      if ok
        verbose { puts "gh-pages updated" }
        sh "git push -q o HEAD:gh-pages"
      end
    end
  end
end

# Update the pages/ directory clone
file 'docs/.git' => ['docs/', '.git/refs/heads/gh-pages'] do |f|
  sh "cd docs && git init -q && git remote add o ../.git" if !File.exist?(f.name)
  sh "cd docs && git fetch -q o && git reset -q --hard o/gh-pages && touch ."
end
CLOBBER.include 'docs/.git'

{'fraction_non_alphanumeric': 0.2106368089573128, 'fraction_numerical': 0.0, 'mean_word_length': 3.294294294294294, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3907749', 'n_tokens_mistral': 526, 'n_tokens_neox': 497, 'n_words': 149}