<commit_before>require 'roll/kernel'

module Roll
  VERSION = "2.0"  #:till: VERSION = "<%= version %>"

  # Get environment.

  def self.env(name=nil)
    if name
      env = Environment.new(name)
    else
      env = Environment.new
    end
    env
  end

  def self.index(name=nil)
    if name
      env = Environment.new(name)
    else
      env = Environment.new
    end
    env.to_h.to_yaml
  end

  # Synchronize an environment by +name+. If a +name+
  # is not given the current environment is synchronized.

  def self.sync(name=nil)
    env = name ? Environment.new(name) : Environment.new
    env.sync
    env.save
  end

  # Add path to current environment.

  def self.in(path, depth=3)
    env = Environment.new

    locals = env.locals
    locals.append(path, depth)
    locals.save

    env.sync
    env.save

    return path, locals.file
  end

  # Remove path from current environment.

  def self.out(path)
    env = Environment.new

    locals = env.locals
    locals.delete(path)
    locals.save

    env.sync
    env.save

    return path, locals.file
  end

  # Go thru each roll lib and collect bin paths.

  def self.path
    binpaths = []
    Library.list.each do |name|
      lib = Library[name]
      if lib.bindir?
        binpaths << lib.bindir
      end
    end
    binpaths
  end

end
<commit_msg>minor: adjust roll.rb commands for changes to Environment<commit_after>require 'roll/kernel'

module Roll
  VERSION = "2.0"  #:till: VERSION = "<%= version %>"

  # Get environment.

  def self.env(name=nil)
    if name
      env = Environment.new(name)
    else
      env = Environment.new
    end
    env
  end

  def self.index(name=nil)
    #if name
    #  env = Environment.new(name)
    #else
    #  env = Environment.new
    #end
    env(name).index.to_h.to_yaml
  end

  # Synchronize an environment by +name+. If a +name+
  # is not given the current environment is synchronized.

  def self.sync(name=nil)
    env = env(name)
    env.sync
    env.save
  end

  # Add path to current environment.

  def self.in(path, depth=3)
    env = Environment.new

    lookup = env.lookup
    lookup.append(path, depth)
    lookup.save

    env.sync
    env.save

    return path, lookup.file
  end

  # Remove path from current environment.

  def self.out(path)
    env = Environment.new

    lookup = env.lookup
    lookup.delete(path)
    lookup.save

    env.sync
    env.save

    return path, lookup.file
  end

  # Go thru each roll lib and collect bin paths.

  def self.path
    binpaths = []
    Library.list.each do |name|
      lib = Library[name]
      if lib.bindir?
        binpaths << lib.bindir
      end
    end
    binpaths
  end

end

{'fraction_non_alphanumeric': 0.0924683072334079, 'fraction_numerical': 0.0022371364653243847, 'mean_word_length': 2.2016706443914082, 'pattern_counts': {'":': 0, '<': 9, '<?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': '1485919', 'n_tokens_mistral': 915, 'n_tokens_neox': 877, 'n_words': 257}