<commit_before>
module Progenitor
  class AssetDeployer
    def initialize(rsa_private_key, asset_location)
     @rsa_private_key = rsa_private_key
     @asset_location = asset_location
   end

    def deploy( players, folders )
      players = [] unless players
      players = [players] unless players.is_a? Array
      folders = [folders] unless folders.is_a? Array

      folders = filter_bogus_folders( folders )
      players.product(folders) do |player, folder|
        scp_folder_to( folder, player )
        execute_over_ssh( "./killSpallaApp.sh", player )
        execute_over_ssh( "./startSpallaApp.sh", player )
      end
    end

    def available_assets
      Dir.glob("#{@asset_location}/*")
        .select{ |path| File.directory? path }
        .map{ |path| File.basename path }
    end

    private

    def execute_over_ssh( command, player )
      command_args = [ 'ssh',
        '-i', @rsa_private_key,
        '-o', 'UserKnownHostsFile=/dev/null',
        '-o', 'StrictHostKeyChecking=no',<commit_msg>chmod private key<commit_after>
module Progenitor
  class AssetDeployer
    def initialize(rsa_private_key, asset_location)
     system('chmod', '600', rsa_private_key)
     @rsa_private_key = rsa_private_key
     @asset_location = asset_location
   end

    def deploy( players, folders )
      players = [] unless players
      players = [players] unless players.is_a? Array
      folders = [folders] unless folders.is_a? Array

      folders = filter_bogus_folders( folders )
      players.product(folders) do |player, folder|
        scp_folder_to( folder, player )
        execute_over_ssh( "./killSpallaApp.sh", player )
        execute_over_ssh( "./startSpallaApp.sh", player )
      end
    end

    def available_assets
      Dir.glob("#{@asset_location}/*")
        .select{ |path| File.directory? path }
        .map{ |path| File.basename path }
    end

    private

    def execute_over_ssh( command, player )
      command_args = [ 'ssh',
        '-i', @rsa_private_key,
        '-o', 'UserKnownHostsFile=/dev/null',
        '-o', 'StrictHostKeyChecking=no',
{'fraction_non_alphanumeric': 0.10883054892601432, 'fraction_numerical': 0.001431980906921241, 'mean_word_length': 2.8178506375227688, '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': '4916586', 'n_tokens_mistral': 695, 'n_tokens_neox': 668, 'n_words': 150}