<commit_before>require 'fileutils'
require 'set'

module Coffer
  module Installer

    CACHE_DIR = '/tmp/coffer/cache'
    BIN_DIR = '/tmp/coffer/bin'

    def build
      FileUtils.mkdir_p CACHE_DIR
      FileUtils.mkdir_p BIN_DIR

      clone
      # preconfigure

      Dir.chdir( File.join( repo_path, 'src') ) do
        FileUtils.mkdir 'obj' unless File.exists?('obj')
        make

        check_results
      end

      copy_built_executable
      create_directories
      create_config
      start
    end

    def clone
      Dir.chdir(CACHE_DIR) do
        `git clone '#{ git_repo }' '#{ self.class.to_s.downcase }'`
      end
    end

    def copy_built_executable
      FileUtils.cp built_executable_path, installed_executable_path
    end

    def create_directories
      FileUtils.mkdir wallet_home_directory, :mode => 0600
    end

    def wallet_home_directory
      File.expand_path("~/.#{ directory }")
    end

    def create_config
      File.open( File.join( wallet_home_path, config_file ), 'w' ) do |f|
        "config file"
      end
    end

    def start
      `#{ installed_executable_path } -daemon`
    end

    def check_results
      raise "Build failed. No executable!" unless built_executable_exists?
    end

    def make
      puts `make -f '#{ makefile_name }'`
    end

    def makefile_name
      sys = `uname`.chomp.downcase

      if sys == 'darwin'
        'makefile.osx'
      elsif sys == 'linux'
        'makefile.unix'
      end
    end

    def repo_path
      File.join CACHE_DIR, self.class.to_s.downcase
    end

    def installed_executable_path
      File.join BIN_PATH, wallet_executable
    end

    def built_executable_path
      File.join repo_path, 'src', wallet_executable
    end<commit_msg>er, yeah. bin_dir<commit_after>require 'fileutils'
require 'set'

module Coffer
  module Installer

    CACHE_DIR = '/tmp/coffer/cache'
    BIN_DIR = '/tmp/coffer/bin'

    def build
      FileUtils.mkdir_p CACHE_DIR
      FileUtils.mkdir_p BIN_DIR

      clone
      # preconfigure

      Dir.chdir( File.join( repo_path, 'src') ) do
        FileUtils.mkdir 'obj' unless File.exists?('obj')
        make

        check_results
      end

      copy_built_executable
      create_directories
      create_config
      start
    end

    def clone
      Dir.chdir(CACHE_DIR) do
        `git clone '#{ git_repo }' '#{ self.class.to_s.downcase }'`
      end
    end

    def copy_built_executable
      FileUtils.cp built_executable_path, installed_executable_path
    end

    def create_directories
      FileUtils.mkdir wallet_home_directory, :mode => 0600
    end

    def wallet_home_directory
      File.expand_path("~/.#{ directory }")
    end

    def create_config
      File.open( File.join( wallet_home_path, config_file ), 'w' ) do |f|
        "config file"
      end
    end

    def start
      `#{ installed_executable_path } -daemon`
    end

    def check_results
      raise "Build failed. No executable!" unless built_executable_exists?
    end

    def make
      puts `make -f '#{ makefile_name }'`
    end

    def makefile_name
      sys = `uname`.chomp.downcase

      if sys == 'darwin'
        'makefile.osx'
      elsif sys == 'linux'
        'makefile.unix'
      end
    end

    def repo_path
      File.join CACHE_DIR, self.class.to_s.downcase
    end

    def installed_executable_path
      File.join BIN_DIR, wallet_executable
    end

    def built_executable_path
      File.join repo_path, 'src', wallet_executable
    end
{'fraction_non_alphanumeric': 0.08036477628954118, 'fraction_numerical': 0.002279851809632374, 'mean_word_length': 2.243992606284658, 'pattern_counts': {'":': 0, '<': 3, '<?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': '4004595', 'n_tokens_mistral': 1189, 'n_tokens_neox': 1132, 'n_words': 267}