<commit_before>
require 'fulmar_shell'

module Fulmar
  module Infrastructure
    module Service
      module Transfer

        class Base

          DEFAULT_CONFIG = {
              debug: false,
              host: nil,
              user: '',
              password: '',
              remote_path: nil,
              local_path: '.',
              type: :rsync_with_versions
          }

          attr_accessor :config

          def initialize(config)
            @config = DEFAULT_CONFIG.merge(config)

            # Remove trailing slashes
            @config[:local_path] = @config[:local_path].chomp('/') if @config[:local_path]
            @config[:remote_path] = @config[:remote_path].chomp('/') if @config[:remote_path]

            @prepared = false
          end

          # Test the supplied config for required parameters
          def test_config
            required = [:host, :remote_path, :local_path]
            required.each {|key| raise "Configuration is missing required setting '#{key}'." if !@config.include?(key) or @config[key].empty? }
          end

          def prepare
            @local_shell = Fulmar::Infrastructure::Service::ShellService.new @config[:local_path]
            @local_shell.debug = @config[:debug]<commit_msg>[CHANGE] Require path to be absolute<commit_after>
require 'fulmar_shell'

module Fulmar
  module Infrastructure
    module Service
      module Transfer

        class Base

          DEFAULT_CONFIG = {
              debug: false,
              host: nil,
              user: '',
              password: '',
              remote_path: nil,
              local_path: '.',
              type: :rsync_with_versions
          }

          attr_accessor :config

          def initialize(config)
            @config = DEFAULT_CONFIG.merge(config)

            # Remove trailing slashes
            @config[:local_path] = @config[:local_path].chomp('/') if @config[:local_path]
            @config[:remote_path] = @config[:remote_path].chomp('/') if @config[:remote_path]

            @prepared = false
          end

          # Test the supplied config for required parameters
          def test_config
            required = [:host, :remote_path, :local_path]
            required.each {|key| raise "Configuration is missing required setting '#{key}'." if !@config.include?(key) or @config[key].empty? }
            raise ':remote_path must be absolute' if @config[:remote_path][0,1] != '/'
          end

          def prepare
            @local_shell = Fulmar::Infrastructure::Service::ShellService.new @config[:local_path]
            @local_shell.debug = @config[:debug]
{'fraction_non_alphanumeric': 0.10592255125284739, 'fraction_numerical': 0.0007593014426727411, 'mean_word_length': 1.9606741573033708, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4970381', 'n_tokens_mistral': 695, 'n_tokens_neox': 670, 'n_words': 169}