<commit_before>---
# This playbook should be executed using 
# ansible-playbook jenkinsbox.yml
# command
# Developed for ansible version >= 1.7
# drupal subfolder with repo_subfolder name will be prepared after execution.

- hosts: 127.0.0.1
  connection: local
  gather_facts: no

  roles:

  vars:
    repo_subfolder: DEMO # name of the future project, should be changed manually
    drupal_subfolder: docroot
    installation_profile_name: pp
    drupal_version: 7
    with_vm: True
    with_tests: True
    with_reinstall: True

  pre_tasks:

  - name: Creating project folder
    shell: "mkdir {{ repo_subfolder }} || true"

  - name: Creating drupal folder
    file: path={{ repo_subfolder }}/{{ drupal_subfolder }} state=directory
    register: drupal_stat

  - name: Downloading drupal to {{ drupal_subfolder }} subfolder
    shell: "cd {{ repo_subfolder }} && drush -y --drupal-project-rename={{ drupal_subfolder }} dl drupal-{{ drupal_version }}.x"
    when: drupal_stat.changed == True
    register: drupal_dl

  - name: Inject pp profile into drupal
    file: path={{ repo_subfolder }}/{{ drupal_subfolder }}/profiles/{{ installation_profile_name }} state=directory
    register: is_profile

  - name: Copy local profile files to drupal directory
    synchronize: src=files/drupal{{ drupal_version }}/profiles/{{ installation_profile_name }}/ dest={{ repo_subfolder }}/{{ drupal_subfolder }}/profiles/{{ installation_profile_name }}/ recursive=yes archive=no
    register: profile_copy

  - name: Create a folder placeholders for sniffers
    shell: "mkdir {{ repo_subfolder }}/{{ drupal_subfolder }}/{{ item }}/"
    ignore_errors: yes
    with_items:
      - sites/all/modules/custom
      - sites/all/modules/contrib
      - sites/all/themes/custom
      - sites/all/themes/contrib
      - sites/all/modules/features

  - name: Create empty readme files for placeholders
    file: path={{ repo_subfolder }}/{{ drupal_subfolder }}/{{ item }}/readme.txt state=touch
    with_items:
      - sites/all/modules/custom
      - sites/all/modules/contrib
      - sites/all/themes/custom
      - sites/all/themes/contrib
      - sites/all/modules/features

  - name: Restrict access to YAML files
    lineinfile:
      dest: '{{ repo_subfolder }}/{{ drupal_subfolder }}/.htaccess'
      line: '# Restrict access to YAML files.\n<Files ~ "\.yml$">\n  Order Allow,Deny\n  Deny from All\n</Files>'

  - name: Injecting behat tests into repo
    synchronize: src=files/tests dest={{ repo_subfolder }}/ recursive=yes archive=no
    when: with_vm == True
    register: vmbox

  - name: Injecting vmbox into repo
    synchronize: src=files/vagrant/box/ dest={{ repo_subfolder }}/ recursive=yes archive=no
    when: with_tests == True
    register: tests

  - name: Add ansible roles to vagrant box
    synchronize: src=../roles/ dest={{ repo_subfolder }}/provisioning/ansible/roles/ recursive=yes archive=no
    when: with_vm == True
    register: vmbox

  - name: Copying installation scripts - reinstall.sh and playbook reinstall.yml
    synchronize: src=files/drupal{{ drupal_version }}/scripts/ dest={{ repo_subfolder }}/{{ drupal_subfolder }}/ recursive=yes archive=no
    when: with_reinstall == True

  - name: Setting permissions for drupal tree
    file: path={{ repo_subfolder }} state=directory mode=777 recurse=yes
    when: drupal_dl.changed == True or profile_copy.changed == True or vmbox.changed == True

  handlers:<commit_msg>Fix GitHub project builder<commit_after>---
# This playbook should be executed using 
# ansible-playbook jenkinsbox.yml
# command
# Developed for ansible version >= 1.7
# drupal subfolder with repo_subfolder name will be prepared after execution.

- hosts: 127.0.0.1
  connection: local
  gather_facts: no

  roles:

  vars:
    repo_subfolder: DEMO # name of the future project, should be changed manually
    drupal_subfolder: docroot
    installation_profile_name: pp
    drupal_version: 7
    with_vm: True
    with_tests: True
    with_reinstall: True

  pre_tasks:

  - name: Creating project folder
    shell: "mkdir {{ repo_subfolder }} || true"

  - name: Creating drupal folder
    file: path={{ repo_subfolder }}/{{ drupal_subfolder }} state=directory
    register: drupal_stat

  - name: Downloading drupal to {{ drupal_subfolder }} subfolder
    shell: "cd {{ repo_subfolder }} && drush -y --drupal-project-rename={{ drupal_subfolder }} dl drupal-{{ drupal_version }}.x"
    when: drupal_stat.changed == True
    register: drupal_dl

  - name: Inject pp profile into drupal
    file: path={{ repo_subfolder }}/{{ drupal_subfolder }}/profiles/{{ installation_profile_name }} state=directory
    register: is_profile

  - name: Copy local profile files to drupal directory
    synchronize: src=files/drupal{{ drupal_version }}/profiles/{{ installation_profile_name }}/ dest={{ repo_subfolder }}/{{ drupal_subfolder }}/profiles/{{ installation_profile_name }}/ recursive=yes archive=no
    register: profile_copy

  - name: Create a folder placeholders for sniffers
    shell: "mkdir {{ repo_subfolder }}/{{ drupal_subfolder }}/{{ item }}/"
    ignore_errors: yes
    with_items:
      - sites/all/modules/custom
      - sites/all/modules/contrib
      - sites/all/themes/custom
      - sites/all/themes/contrib
      - sites/all/modules/features

  - name: Create empty readme files for placeholders
    file: path={{ repo_subfolder }}/{{ drupal_subfolder }}/{{ item }}/readme.txt state=touch
    with_items:
      - sites/all/modules/custom
      - sites/all/modules/contrib
      - sites/all/themes/custom
      - sites/all/themes/contrib
      - sites/all/modules/features

  - name: Restrict access to YAML files
    lineinfile:
      dest: '{{ repo_subfolder }}/{{ drupal_subfolder }}/.htaccess'
      line: '# Restrict access to YAML files.\n<Files ~ "\.yml$">\n  Order Allow,Deny\n  Deny from All\n</Files>'

  - name: Injecting behat tests into repo
    synchronize: src=files/tests dest={{ repo_subfolder }}/ recursive=yes archive=no
    when: with_vm == True
    register: vmbox

  - name: Injecting vmbox into repo
    synchronize: src=files/vagrant/box/ dest={{ repo_subfolder }}/ recursive=yes archive=no
    when: with_tests == True
    register: tests

  - name: Add CIBox core and contrib roles to vagrant box
    shell: cp -R ../core/ ../contrib/ {{ repo_subfolder }}/provisioning/ansible/roles/
    when: with_vm == True

  - name: Copying installation scripts - reinstall.sh and playbook reinstall.yml
    synchronize: src=files/drupal{{ drupal_version }}/scripts/ dest={{ repo_subfolder }}/{{ drupal_subfolder }}/ recursive=yes archive=no
    when: with_reinstall == True

  - name: Setting permissions for drupal tree
    file: path={{ repo_subfolder }} state=directory mode=777 recurse=yes
    when: drupal_dl.changed == True or profile_copy.changed == True

  handlers:
{'fraction_non_alphanumeric': 0.11291264972246567, 'fraction_numerical': 0.0035056967572304996, 'mean_word_length': 3.4751633986928105, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3662291', 'n_tokens_mistral': 2167, 'n_tokens_neox': 2109, 'n_words': 584}