<commit_before>require 'tempfile'
require 'pathname'
require 'yaml'
require 'fileutils'

module Helpers
  module Generator
    ROOT = File.join(Dir.tmpdir,'ore')

    def generate!(path,options={})
      path = File.join(ROOT,path)

      Ore::Generator.new(
        [path],
        options.merge(:quiet => true)
      ).invoke_all

      @path = Pathname.new(path)
      @gemspec = YAML.load_file(@path.join('gemspec.yml'))
    end

    def rspec_opts
      @path.join('.rspec').read
    end

    def yard_opts
      @path.join('.yardopts').read
    end

    def document
      lines = []

      @path.join('.document').read.each_line do |line|
        unless (line.empty? && line =~ /\s*\#/)
          lines << line.strip
        end
      end

      return lines
    end

    def gitignore
      lines = []

      @path.join('.gitignore').read.each_line do |line|
        unless (line.empty? && line =~ /\s*\#/)
          lines << line.strip
        end
      end

      return lines
    end

    def cleanup!
      FileUtils.rm_r(ROOT)
    end
  end
end
<commit_msg>Store the generator in the @generator ivar.<commit_after>require 'tempfile'
require 'pathname'
require 'yaml'
require 'fileutils'

module Helpers
  module Generator
    ROOT = File.join(Dir.tmpdir,'ore')

    def generate!(path,options={})
      path = File.join(ROOT,path)

      @generator = Ore::Generator.new(
        [path],
        options.merge(:quiet => true)
      )
      @generator.invoke_all

      @path = Pathname.new(path)
      @gemspec = YAML.load_file(@path.join('gemspec.yml'))
    end

    def rspec_opts
      @path.join('.rspec').read
    end

    def yard_opts
      @path.join('.yardopts').read
    end

    def document
      lines = []

      @path.join('.document').read.each_line do |line|
        unless (line.empty? && line =~ /\s*\#/)
          lines << line.strip
        end
      end

      return lines
    end

    def gitignore
      lines = []

      @path.join('.gitignore').read.each_line do |line|
        unless (line.empty? && line =~ /\s*\#/)
          lines << line.strip
        end
      end

      return lines
    end

    def cleanup!
      FileUtils.rm_r(ROOT)
    end
  end
end

{'fraction_non_alphanumeric': 0.1340909090909091, 'fraction_numerical': 0.0, 'mean_word_length': 1.9783491204330177, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 5, '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': '4195440', 'n_tokens_mistral': 733, 'n_tokens_neox': 696, 'n_words': 159}