<commit_before>- name: setup the edxapp env
  notify:
  - "restart edxapp"
  - "restart edxapp_workers"
  template: >
    src=edxapp_env.j2 dest={{ edxapp_app_dir }}/edxapp_env
    owner={{ edxapp_user }}  group={{ common_web_user }}
    mode=0644

# Optional auth for git
- name: create ssh script for git (not authenticated)
  template: >
    src=git_ssh_noauth.sh.j2 dest={{ edxapp_git_ssh }}
    owner={{ edxapp_user }} mode=750
  when: not EDXAPP_USE_GIT_IDENTITY

- name: create ssh script for git (authenticated)
  template: >
    src=git_ssh_auth.sh.j2 dest={{ edxapp_git_ssh }}
    owner={{ edxapp_user }} mode=750
  when: EDXAPP_USE_GIT_IDENTITY

- name: install read-only ssh key
  copy: >
    content="{{ EDXAPP_GIT_IDENTITY }}" dest={{ edxapp_git_identity }}
    force=yes owner={{ edxapp_user }} mode=0600
  when: EDXAPP_USE_GIT_IDENTITY

# Do A Checkout
- name: checkout edx-platform repo into {{edxapp_code_dir}}
  git: dest={{edxapp_code_dir}} repo={{edx_platform_repo}} version={{edx_platform_version}}
  register: chkout
  sudo_user: "{{ edxapp_user }}"
  environment:
    GIT_SSH: "{{ edxapp_git_ssh }}"
  notify:
  - "restart edxapp"
  - "restart edxapp_workers"

- name: git clean after checking out edx-platform
  shell: cd {{edxapp_code_dir}} && git clean -xdf
  sudo_user: "{{ edxapp_user }}"
  notify:
  - "restart edxapp"
  - "restart edxapp_workers"

- name: checkout theme
  git: dest={{ edxapp_app_dir }}/themes/{{edxapp_theme_name}} repo={{edxapp_theme_source_repo}} version={{edxapp_theme_version}}
  when: edxapp_theme_name != ''
  sudo_user: "{{ edxapp_user }}"
  environment:
    GIT_SSH: "{{ edxapp_git_ssh }}"
  notify:
  - "restart edxapp"
  - "restart edxapp_workers"

- name: create checksum for requirements, package.json and Gemfile
  shell: >
    /usr/bin/md5sum {{ " ".join(edxapp_chksum_req_files) }} 2>/dev/null > /var/tmp/edxapp.req.new
  sudo_user: "{{ edxapp_user }}"
  ignore_errors: true

- stat: path=/var/tmp/edxapp.req.new
  register: new
  sudo_user: "{{ edxapp_user }}"

- stat: path=/var/tmp/edxapp.req.installed
  register: inst
  sudo_user: "{{ edxapp_user }}"

# Substitute github mirror in all requirements files
# This is run on every single deploy
- name: Updating requirement files for git mirror
  command: |
    /bin/sed -i -e 's/github\.com/{{ COMMON_GIT_MIRROR }}/g' {{ " ".join(edxapp_all_req_files) }}
  sudo_user: "{{ edxapp_user }}"
  notify:
  - "restart edxapp"
  - "restart edxapp_workers"

# Ruby plays that need to be run after platform updates.
- name: gem install bundler
  shell: >
    gem install bundle
      chdir={{ edxapp_code_dir }}
      executable=/bin/bash
  environment: "{{ edxapp_environment }}"
  sudo_user: "{{ edxapp_user }}"
  notify:
  - "restart edxapp"
  - "restart edxapp_workers"

- name: bundle install
  shell: >
    bundle install --binstubs
      chdir={{ edxapp_code_dir }}
      executable=/bin/bash
  sudo_user: "{{ edxapp_user }}"
  environment: "{{ edxapp_environment }}"
  notify:
  - "restart edxapp"
  - "restart edxapp_workers"

# Set the npm registry
- name: Set the npm registry
  shell:
    npm config set registry 'http://registry.npmjs.org'
    creates="{{ edxapp_app_dir }}/.npmrc"
  sudo_user: "{{ edxapp_user }}"
  environment: "{{ edxapp_environment }}"
  notify:
  - "restart edxapp"
  - "restart edxapp_workers"

# Node play that need to be run after platform updates.
- name: Install edx-platform npm dependencies
  shell: npm install chdir={{ edxapp_code_dir }}
  sudo_user: "{{ edxapp_user }}"
  environment: "{{ edxapp_environment }}"
  notify:
  - "restart edxapp"
  - "restart edxapp_workers"


# Install the python pre requirements into {{ edxapp_venv_dir }}
- name : install python pre-requirements
  pip: >
    requirements="{{pre_requirements_file}}"
    virtualenv="{{edxapp_venv_dir}}"
    state=present
    extra_args="-i {{ COMMON_PYPI_MIRROR_URL }}"
  sudo_user: "{{ edxapp_user }}"
  environment: "{{ edxapp_environment }}"
  notify:
  - "restart edxapp"
  - "restart edxapp_workers"
  when: not inst.stat.exists or new.stat.md5 != inst.stat.md5

# Install the python modules into {{ edxapp_venv_dir }}
- name : install python base-requirements
  # Need to use shell rather than pip so that we can maintain the context of our current working directory; some
  # requirements are pathed relative to the edx-platform repo. Using the pip from inside the virtual environment implicitly
  # installs everything into that virtual environment.
  shell: >
    {{ edxapp_venv_dir }}/bin/pip install -i {{ COMMON_PYPI_MIRROR_URL }} --exists-action w --use-mirrors -r {{ base_requirements_file }}
    chdir={{ edxapp_code_dir }}
  environment: "{{ edxapp_environment }}"
  sudo_user: "{{ edxapp_user }}"
  notify:
  - "restart edxapp"
  - "restart edxapp_workers"
  when: not inst.stat.exists or new.stat.md5 != inst.stat.md5

# Install the python post requirements into {{ edxapp_venv_dir }}
- name : install python post-requirements
  pip: >
    requirements="{{post_requirements_file}}"
    virtualenv="{{edxapp_venv_dir}}"
    state=present
    extra_args="-i {{ COMMON_PYPI_MIRROR_URL }}"
  sudo_user: "{{ edxapp_user }}"
  environment: "{{ edxapp_environment }}"
  notify:
  - "restart edxapp"
  - "restart edxapp_workers"
  when: not inst.stat.exists or new.stat.md5 != inst.stat.md5

# Install the python paver requirements into {{ edxapp_venv_dir }}
- name : install python paver-requirements
  pip: >
    requirements="{{paver_requirements_file}}"
    virtualenv="{{edxapp_venv_dir}}"
    state=present
    extra_args="-i {{ COMMON_PYPI_MIRROR_URL }}"
  sudo_user: "{{ edxapp_user }}"
  environment: "{{ edxapp_environment }}"
  notify:
  - "restart edxapp"
  - "restart edxapp_workers"
  when: not inst.stat.exists or new.stat.md5 != inst.stat.md5

# Install the final python modules into {{ edxapp_venv_dir }}
- name : install python post-post requirements
  # Need to use shell rather than pip so that we can maintain the context of our current working directory; some
  # requirements are pathed relative to the edx-platform repo. Using the pip from inside the virtual environment implicitly
  # installs everything into that virtual environment.
  shell: >
    {{ edxapp_venv_dir }}/bin/pip install -i {{ COMMON_PYPI_MIRROR_URL }} --exists-action w --use-mirrors -r {{ item }}
    chdir={{ edxapp_code_dir }}
  with_items:
  - "{{ repo_requirements_file }}"
  - "{{ github_requirements_file }}"
  - "{{ local_requirements_file }}"
  sudo_user: "{{ edxapp_user }}"
  notify:
  - "restart edxapp"
  - "restart edxapp_workers"<commit_msg>taking out paver task for now<commit_after>- name: setup the edxapp env
  notify:
  - "restart edxapp"
  - "restart edxapp_workers"
  template: >
    src=edxapp_env.j2 dest={{ edxapp_app_dir }}/edxapp_env
    owner={{ edxapp_user }}  group={{ common_web_user }}
    mode=0644

# Optional auth for git
- name: create ssh script for git (not authenticated)
  template: >
    src=git_ssh_noauth.sh.j2 dest={{ edxapp_git_ssh }}
    owner={{ edxapp_user }} mode=750
  when: not EDXAPP_USE_GIT_IDENTITY

- name: create ssh script for git (authenticated)
  template: >
    src=git_ssh_auth.sh.j2 dest={{ edxapp_git_ssh }}
    owner={{ edxapp_user }} mode=750
  when: EDXAPP_USE_GIT_IDENTITY

- name: install read-only ssh key
  copy: >
    content="{{ EDXAPP_GIT_IDENTITY }}" dest={{ edxapp_git_identity }}
    force=yes owner={{ edxapp_user }} mode=0600
  when: EDXAPP_USE_GIT_IDENTITY

# Do A Checkout
- name: checkout edx-platform repo into {{edxapp_code_dir}}
  git: dest={{edxapp_code_dir}} repo={{edx_platform_repo}} version={{edx_platform_version}}
  register: chkout
  sudo_user: "{{ edxapp_user }}"
  environment:
    GIT_SSH: "{{ edxapp_git_ssh }}"
  notify:
  - "restart edxapp"
  - "restart edxapp_workers"

- name: git clean after checking out edx-platform
  shell: cd {{edxapp_code_dir}} && git clean -xdf
  sudo_user: "{{ edxapp_user }}"
  notify:
  - "restart edxapp"
  - "restart edxapp_workers"

- name: checkout theme
  git: dest={{ edxapp_app_dir }}/themes/{{edxapp_theme_name}} repo={{edxapp_theme_source_repo}} version={{edxapp_theme_version}}
  when: edxapp_theme_name != ''
  sudo_user: "{{ edxapp_user }}"
  environment:
    GIT_SSH: "{{ edxapp_git_ssh }}"
  notify:
  - "restart edxapp"
  - "restart edxapp_workers"

- name: create checksum for requirements, package.json and Gemfile
  shell: >
    /usr/bin/md5sum {{ " ".join(edxapp_chksum_req_files) }} 2>/dev/null > /var/tmp/edxapp.req.new
  sudo_user: "{{ edxapp_user }}"
  ignore_errors: true

- stat: path=/var/tmp/edxapp.req.new
  register: new
  sudo_user: "{{ edxapp_user }}"

- stat: path=/var/tmp/edxapp.req.installed
  register: inst
  sudo_user: "{{ edxapp_user }}"

# Substitute github mirror in all requirements files
# This is run on every single deploy
- name: Updating requirement files for git mirror
  command: |
    /bin/sed -i -e 's/github\.com/{{ COMMON_GIT_MIRROR }}/g' {{ " ".join(edxapp_all_req_files) }}
  sudo_user: "{{ edxapp_user }}"
  notify:
  - "restart edxapp"
  - "restart edxapp_workers"

# Ruby plays that need to be run after platform updates.
- name: gem install bundler
  shell: >
    gem install bundle
      chdir={{ edxapp_code_dir }}
      executable=/bin/bash
  environment: "{{ edxapp_environment }}"
  sudo_user: "{{ edxapp_user }}"
  notify:
  - "restart edxapp"
  - "restart edxapp_workers"

- name: bundle install
  shell: >
    bundle install --binstubs
      chdir={{ edxapp_code_dir }}
      executable=/bin/bash
  sudo_user: "{{ edxapp_user }}"
  environment: "{{ edxapp_environment }}"
  notify:
  - "restart edxapp"
  - "restart edxapp_workers"

# Set the npm registry
- name: Set the npm registry
  shell:
    npm config set registry 'http://registry.npmjs.org'
    creates="{{ edxapp_app_dir }}/.npmrc"
  sudo_user: "{{ edxapp_user }}"
  environment: "{{ edxapp_environment }}"
  notify:
  - "restart edxapp"
  - "restart edxapp_workers"

# Node play that need to be run after platform updates.
- name: Install edx-platform npm dependencies
  shell: npm install chdir={{ edxapp_code_dir }}
  sudo_user: "{{ edxapp_user }}"
  environment: "{{ edxapp_environment }}"
  notify:
  - "restart edxapp"
  - "restart edxapp_workers"


# Install the python pre requirements into {{ edxapp_venv_dir }}
- name : install python pre-requirements
  pip: >
    requirements="{{pre_requirements_file}}"
    virtualenv="{{edxapp_venv_dir}}"
    state=present
    extra_args="-i {{ COMMON_PYPI_MIRROR_URL }}"
  sudo_user: "{{ edxapp_user }}"
  environment: "{{ edxapp_environment }}"
  notify:
  - "restart edxapp"
  - "restart edxapp_workers"
  when: not inst.stat.exists or new.stat.md5 != inst.stat.md5

# Install the python modules into {{ edxapp_venv_dir }}
- name : install python base-requirements
  # Need to use shell rather than pip so that we can maintain the context of our current working directory; some
  # requirements are pathed relative to the edx-platform repo. Using the pip from inside the virtual environment implicitly
  # installs everything into that virtual environment.
  shell: >
    {{ edxapp_venv_dir }}/bin/pip install -i {{ COMMON_PYPI_MIRROR_URL }} --exists-action w --use-mirrors -r {{ base_requirements_file }}
    chdir={{ edxapp_code_dir }}
  environment: "{{ edxapp_environment }}"
  sudo_user: "{{ edxapp_user }}"
  notify:
  - "restart edxapp"
  - "restart edxapp_workers"
  when: not inst.stat.exists or new.stat.md5 != inst.stat.md5

# Install the python post requirements into {{ edxapp_venv_dir }}
- name : install python post-requirements
  pip: >
    requirements="{{post_requirements_file}}"
    virtualenv="{{edxapp_venv_dir}}"
    state=present
    extra_args="-i {{ COMMON_PYPI_MIRROR_URL }}"
  sudo_user: "{{ edxapp_user }}"
  environment: "{{ edxapp_environment }}"
  notify:
  - "restart edxapp"
  - "restart edxapp_workers"
  when: not inst.stat.exists or new.stat.md5 != inst.stat.md5

# Install the final python modules into {{ edxapp_venv_dir }}
- name : install python post-post requirements
  # Need to use shell rather than pip so that we can maintain the context of our current working directory; some
  # requirements are pathed relative to the edx-platform repo. Using the pip from inside the virtual environment implicitly
  # installs everything into that virtual environment.
  shell: >
    {{ edxapp_venv_dir }}/bin/pip install -i {{ COMMON_PYPI_MIRROR_URL }} --exists-action w --use-mirrors -r {{ item }}
    chdir={{ edxapp_code_dir }}
  with_items:
  - "{{ repo_requirements_file }}"
  - "{{ github_requirements_file }}"
  - "{{ local_requirements_file }}"
  sudo_user: "{{ edxapp_user }}"
  notify:
  - "restart edxapp"
  - "restart edxapp_workers"
{'fraction_non_alphanumeric': 0.12425243940824678, 'fraction_numerical': 0.004091910607491344, 'mean_word_length': 3.950915465523958, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 30, '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': '236891', 'n_tokens_mistral': 4634, 'n_tokens_neox': 4550, 'n_words': 1106}