<commit_before>require 'rubygems'
require 'nokogiri'
require 'liquid'

require 'fileutils'
require 'pp'

class GitScribe

  SCRIBE_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))

  def initialize(args)
    @command = args.shift
    @args = args
  end

  def self.start(args)
    GitScribe.new(args).run
  end

  def run
    if @command && self.respond_to?(@command)
      self.send @command
    else
      help
    end
  end

  ## COMMANDS ##
 
  def help
    puts "No command: #{@command}"
    puts "TODO: tons of help"
  end

  # start a new scribe directory with skeleton structure
  def init
    name = @args.shift
    die("needs a directory name") if !name
    die("directory already exists") if File.exists?(name)

    puts "inititalizing #{name}"
    from_stdir = File.join(SCRIBE_ROOT, 'template')
    FileUtils.cp_r from_stdir, name
  end

  # check that we have everything needed
  def check
    # look for a2x (asciidoc, latex, xsltproc)
  end
<commit_msg>basic check functionality<commit_after>require 'rubygems'
require 'nokogiri'
require 'liquid'

require 'fileutils'
require 'pp'

class GitScribe

  SCRIBE_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))

  def initialize(args)
    @command = args.shift
    @args = args
  end

  def self.start(args)
    GitScribe.new(args).run
  end

  def run
    if @command && self.respond_to?(@command)
      self.send @command
    else
      help
    end
  end

  ## COMMANDS ##
 
  def help
    puts "No command: #{@command}"
    puts "TODO: tons of help"
  end

  # start a new scribe directory with skeleton structure
  def init
    name = @args.shift
    die("needs a directory name") if !name
    die("directory already exists") if File.exists?(name)

    puts "inititalizing #{name}"
    from_stdir = File.join(SCRIBE_ROOT, 'template')
    FileUtils.cp_r from_stdir, name
  end

  # check that we have everything needed
  def check
    # check for asciidoc
    if !check_can_run('asciidoc')
      puts "asciidoc is not present, please install it for anything to work"
    else
      puts "asciidoc - ok"
    end

    # check for xsltproc
    if !check_can_run('xsltproc --version')
      puts "xsltproc is not present, please install it for html generation"
    else
      puts "xsltproc - ok"
    end

    # check for a2x - should be installed with asciidoc, but you never know
    if !check_can_run('a2x')
      puts "a2x is not present, please install it for epub generation"
    else
      puts "a2x - ok"
    end

    # check for fop
    if !check_can_run('fop -version')
      puts "fop is not present, please install for PDF generation"
    else
      puts "fop - ok"
    end
  end

  def check_can_run(command)
    `#{command} 2>&1`
    $?.exitstatus == 0
  end

{'fraction_non_alphanumeric': 0.09685580050596314, 'fraction_numerical': 0.0028912179255511385, 'mean_word_length': 2.839112343966713, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, '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': '4180322', 'n_tokens_mistral': 958, 'n_tokens_neox': 936, 'n_words': 292}