<commit_before>#!/bin/sh

${RABBITMQ_NODENAME:="rabbit"}
${RABBITMQCTL:="sudo rabbitmqctl -n $RABBITMQ_NODENAME"}
${RABBITMQ_PLUGINS:="sudo rabbitmq-plugins"}

# guest:guest has full access to /

$RABBITMQCTL add_vhost /
$RABBITMQCTL add_user guest guest
$RABBITMQCTL set_permissions -p / guest ".*" ".*" ".*"


# bunny_gem:bunny_password has full access to bunny_testbed

$RABBITMQCTL add_vhost bunny_testbed
$RABBITMQCTL add_user bunny_gem bunny_password
$RABBITMQCTL set_permissions -p bunny_testbed bunny_gem ".*" ".*" ".*"


# guest:guest has full access to bunny_testbed

$RABBITMQCTL set_permissions -p bunny_testbed guest ".*" ".*" ".*"


# bunny_reader:reader_password has read access to bunny_testbed

$RABBITMQCTL add_user bunny_reader reader_password
$RABBITMQCTL set_permissions -p bunny_testbed bunny_reader "^---$" "^---$" ".*"

# requires RabbitMQ 3.0+
# $RABBITMQ_PLUGINS enable rabbitmq_consistent_hash_exchange<commit_msg>before_build.sh runs in bash (or any other shell)<commit_after>#!/usr/bin/env ruby

@nodename = ENV.fetch("RABBITMQ_NODENAME", "rabbit")

def rabbit_control(args)
  command = "sudo rabbitmqctl -n #{@nodename} #{args}"
  system command
end

def rabbit_plugins(args)
  command = "sudo rabbitmq-plugins #{args}"
  system command
end


# guest:guest has full access to /

rabbit_control 'add_vhost /'
rabbit_control 'add_user guest guest'
rabbit_control 'set_permissions -p / guest ".*" ".*" ".*"'


# bunny_gem:bunny_password has full access to bunny_testbed

rabbit_control 'add_vhost bunny_testbed'
rabbit_control 'add_user bunny_gem bunny_password'
rabbit_control 'set_permissions -p bunny_testbed bunny_gem ".*" ".*" ".*"'


# guest:guest has full access to bunny_testbed

rabbit_control 'set_permissions -p bunny_testbed guest ".*" ".*" ".*"'


# bunny_reader:reader_password has read access to bunny_testbed

rabbit_control 'add_user bunny_reader reader_password'
rabbit_control 'set_permissions -p bunny_testbed bunny_reader "^---$" "^---$" ".*"'

# requires RabbitMQ 3.0+
# rabbit_plugins 'enable rabbitmq_consistent_hash_exchange'
{'fraction_non_alphanumeric': 0.1203659123736158, 'fraction_numerical': 0.0019258545979778526, 'mean_word_length': 5.703225806451613, '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': '2320932', 'n_tokens_mistral': 858, 'n_tokens_neox': 752, 'n_words': 169}