<commit_before>module Front
  module CLI
    class Vagrant
      attr_reader :id
      attr_reader :path
      attr_accessor :wait
      attr_accessor :script

      def initialize(id, path, script)
        @id = id
        @path = path
        @wait = true
        @script = script
      end

      def up
        run('up')
      end

      def destroy
        run('destroy -f')
      end

      def reload
        run('reload')
      end

      def ssh
        run('ssh')
      end

      def ssh_config
        capture('ssh-config')
      end

      def ssh_port
        output = ssh_config()
        re = /^\s*Port\s*(\d+)$/m

        matches = output.match(re)
        return matches[1]
      end

      def status
        output = capture('status')
        re = /^(\w+\s+\w+ \(\w+\))/m
        matches = output.match(re)
        if matches
          return matches[1]
        else
          'pending'
        end
      end

      def get_log_file
        "#{path}/front.log"
      end

      def run(cmd)
        cmd = "vagrant #{cmd}"
        options = {}
        options[:chdir] = path

        if wait
          pid = Kernel.spawn(cmd, options)<commit_msg>Adds default ssh_port<commit_after>module Front
  module CLI
    class Vagrant
      attr_reader :id
      attr_reader :path
      attr_accessor :wait
      attr_accessor :script

      def initialize(id, path, script)
        @id = id
        @path = path
        @wait = true
        @script = script
      end

      def up
        run('up')
      end

      def destroy
        run('destroy -f')
      end

      def reload
        run('reload')
      end

      def ssh
        run('ssh')
      end

      def ssh_config
        capture('ssh-config')
      end

      def ssh_port
        output = ssh_config()
        re = /^\s*Port\s*(\d+)$/m

        matches = output.match(re)
        return matches[1] unless matches.nil?
        return '2222'
      end

      def status
        output = capture('status')
        re = /^(\w+\s+\w+ \(\w+\))/m
        matches = output.match(re)
        if matches
          return matches[1]
        else
          'pending'
        end
      end

      def get_log_file
        "#{path}/front.log"
      end

      def run(cmd)
        cmd = "vagrant #{cmd}"
        options = {}
        options[:chdir] = path

        if wait
          pid = Kernel.spawn(cmd, options)
{'fraction_non_alphanumeric': 0.10336134453781512, 'fraction_numerical': 0.0033613445378151263, 'mean_word_length': 1.320662768031189, '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': '3273850', 'n_tokens_mistral': 759, 'n_tokens_neox': 713, 'n_words': 191}