<commit_before>require 'spikor_forge'
require 'json'

class SpikorForge::Module
  attr_reader :path, :uripath, :metadata

  def initialize(path, uri_root_path)
    @path = path
    @uripath = path[uri_root_path.chomp('/').length..-1].chomp('/')

    @metadata = JSON.parse `tar -z -x -O --wildcards -f #{path} '*/metadata.json'`
  end

  def dependencies
    @metadata['dependencies'].collect do |dep|
      [dep['name'], dep['version_requirement'] || '' ]
    end
  end

  def version
    @metadata['version']
  end

  def name
    @metadata['name']
  end

  def to_hash
    {
      'file'         => @uripath,
      'version'      => version,
      'dependencies' => dependencies,
    }
  end
end<commit_msg>Handle dependencies without version spec better<commit_after>require 'spikor_forge'
require 'json'

class SpikorForge::Module
  attr_reader :path, :uripath, :metadata

  def initialize(path, uri_root_path)
    @path = path
    @uripath = path[uri_root_path.chomp('/').length..-1].chomp('/')

    @metadata = JSON.parse `tar -z -x -O --wildcards -f #{path} '*/metadata.json'`
  end

  def dependencies
    @metadata['dependencies'].collect do |dep|
      ret = [dep['name']]
      ret << dep['version_requirement'] if dep['version_requirement']
      ret
    end
  end

  def version
    @metadata['version']
  end

  def name
    @metadata['name']
  end

  def to_hash
    {
      'file'         => @uripath,
      'version'      => version,
      'dependencies' => dependencies,
    }
  end
end
{'fraction_non_alphanumeric': 0.1461794019933555, 'fraction_numerical': 0.00132890365448505, 'mean_word_length': 2.8418367346938775, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '1849068', 'n_tokens_mistral': 521, 'n_tokens_neox': 504, 'n_words': 119}