<commit_before><commit_msg>Script for deploying provisioning brick<commit_after># encoding: utf-8

require 'gooddata'

require_relative '../config'

DEFAULT_CRON = '0 0 * * *'

GoodData.with_connection($CONFIG[:username], $CONFIG[:password], :server => $CONFIG[:server], :verify_ssl => false) do |client|
  project = client.projects($CONFIG[:projects][:service])
  puts JSON.pretty_generate(project.json)

  path = '${PUBLIC_APPSTORE}:branch/tma:/apps/provisioning_brick'

  process = project.deploy_process(path, name: 'Provisioning Brick')
  puts JSON.pretty_generate(process.json)

  options = {
    params: {
      organization: $CONFIG[:domain],
      CLIENT_GDC_PROTOCOL: 'https',
      CLIENT_GDC_HOSTNAME: $CONFIG[:hostname],
      ads_client: {
        username: $CONFIG[:ads][:username],
        password: $CONFIG[:<PASSWORD>],
        ads_id: $CONFIG[:ads][:id]
      },
      input_source: {
        type: 'ads',
        query: $CONFIG[:ads][:query][:provisioning]
      },
      technical_user: [
        $CONFIG[:username]
      ],
      user_for_deployment: {
        login: $CONFIG[:username],
        password: $CONFIG[:password],
        server: $CONFIG[:server],
        verify_ssl: false
      },
      GDC_USERNAME: $CONFIG[:username]
    },
    hidden_params: {
      GDC_PASSWORD: $CONFIG[:password],
      additional_hidden_params: {
        GD_ADS_PASSWORD: $CONFIG[:ads][:password]
      }
    }
  }

  #  process.create_schedule(DEFAULT_CRON, 'main.rb', options)
  schedule = process.create_schedule(DEFAULT_CRON, 'main.rb', options)
  puts JSON.pretty_generate(schedule.json)
  schedule.disable!
end

{'fraction_non_alphanumeric': 0.14557739557739557, 'fraction_numerical': 0.0018427518427518428, 'mean_word_length': 3.525, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 6, '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': '6702546', 'n_tokens_mistral': 529, 'n_tokens_neox': 518, 'n_words': 85}