<commit_before># Stop all services.
- name: stop edxapp services
  service: name=edxapp state=stopped
  when: celery_worker is not defined
  tags:
  - lms
  - lms-preview
  - cms
  - deploy

- name: stop edx workers
  service: name=edx-workers state=stopped
  when: celery_worker is defined
  tags:
  - deploy

# update json configs for the application

- include: lms.yml
  when: "'lms' in service_variants_enabled"
- include: cms.yml
  when: "'cms' in service_variants_enabled"
- include: lms-preview.yml
  when: "'lms-preview' in service_variants_enabled"


# Do A Checkout
- name: edxapp | checkout edx-platform repo into {{edx_platform_code_dir}}
  git: dest={{edx_platform_code_dir}} repo={{edx_platform_repo}} version={{edx_platform_commit}}
  register: edx_platform_checkout
  tags:
  - lms
  - cms
  - install
  - deploy

- name: git clean after checking out edx-platform
  shell: cd {{edx_platform_code_dir}} && git clean -xdf
  when: edx_platform_checkout.changed
  tags:
  - lms
  - cms
  - install
  - deploy

# Do Post Checkout Tasks.
- name: create platform code dir
  file: path={{edx_platform_code_dir}} state=directory owner=www-data group=www-data mode=755
  tags:
  - lms
  - cms
  - install
  - deploy

- name: checkout theme
  git: dest={{app_base_dir}}/themes/{{edxapp_theme_name}} repo={{edxapp_theme_source_repo}} version={{edxapp_theme_version}}
  when: edxapp_theme_name != ''
  tags:
  - cms
  - lms-preview
  - lms
  - update
  - deploy


# TODO: Check git.py _run_if_changed() to see if the logic there to skip running certain
# portions of the deploy needs to be incorporated here.

- name: sets permissions on platform code dir and contents
  file: path={{edx_platform_code_dir}} state=directory owner=www-data group=www-data recurse=yes
  # Post Checkout tasks will get run as handlers when the {{ edx_platform_code_dir }} is ready.
  # Look at the handlers/main.yml in this role for a description of the tasks stated below.
  when: edx_platform_checkout.changed
  tags:
  - lms
  - cms
  - install
  - deploy

# Ruby plays that need to be run after platform updates.
- name: gem | gem install bundler
  shell: >
    RBENV_ROOT={{ rbenv_root }} GEM_HOME={{ gem_home }} {{ rbenv_root }}/shims/gem install bundle 
      chdir={{ edx_platform_code_dir }}
  tags:
  - ruby
  - deploy
  - install

- name: bundle | bundle install
  shell: >
    RBENV_ROOT={{ rbenv_root }} GEM_HOME={{ gem_home }} {{ gem_home }}/bin/bundle install --binstubs 
      chdir={{ edx_platform_code_dir }}
  tags:
  - ruby
  - deploy
  - install

# Node play that need to be run after platform updates.
- name: Install edx-platform npm dependencies
  shell: npm install chdir={{ edx_platform_code_dir }}
  tags:
  - npm
  - update
  - deploy

# Python plays that need to be run after platform updates.

# Substitute github mirror in all requirements files
#
- name: Updating requirement files for git mirror
  command: |
    /bin/sed -i -e 's/github\.com/{{ GIT_MIRROR }}/g' {{ item }}
  with_items:
    - "{{ pre_requirements_file }}"
    - "{{ post_requirements_file }}"
    - "{{ repo_requirements_file }}"
    - "{{ github_requirements_file }}"
    - "{{ local_requirements_file }}"
  tags:
    - lms
    - cms
    - install
    - deploy

# Install the python pre requirements into {{ venv_dir }}
- name : install python pre-requirements
  pip: >
    requirements="{{pre_requirements_file}}" 
    virtualenv="{{venv_dir}}" <commit_msg>adding more requirements<commit_after># Stop all services.
- name: stop edxapp services
  service: name=edxapp state=stopped
  when: celery_worker is not defined
  tags:
  - lms
  - lms-preview
  - cms
  - deploy

- name: stop edx workers
  service: name=edx-workers state=stopped
  when: celery_worker is defined
  tags:
  - deploy

# update json configs for the application

- include: lms.yml
  when: "'lms' in service_variants_enabled"
- include: cms.yml
  when: "'cms' in service_variants_enabled"
- include: lms-preview.yml
  when: "'lms-preview' in service_variants_enabled"


# Do A Checkout
- name: edxapp | checkout edx-platform repo into {{edx_platform_code_dir}}
  git: dest={{edx_platform_code_dir}} repo={{edx_platform_repo}} version={{edx_platform_commit}}
  register: edx_platform_checkout
  tags:
  - lms
  - cms
  - install
  - deploy

- name: git clean after checking out edx-platform
  shell: cd {{edx_platform_code_dir}} && git clean -xdf
  when: edx_platform_checkout.changed
  tags:
  - lms
  - cms
  - install
  - deploy

# Do Post Checkout Tasks.
- name: create platform code dir
  file: path={{edx_platform_code_dir}} state=directory owner=www-data group=www-data mode=755
  tags:
  - lms
  - cms
  - install
  - deploy

- name: checkout theme
  git: dest={{app_base_dir}}/themes/{{edxapp_theme_name}} repo={{edxapp_theme_source_repo}} version={{edxapp_theme_version}}
  when: edxapp_theme_name != ''
  tags:
  - cms
  - lms-preview
  - lms
  - update
  - deploy


# TODO: Check git.py _run_if_changed() to see if the logic there to skip running certain
# portions of the deploy needs to be incorporated here.

- name: sets permissions on platform code dir and contents
  file: path={{edx_platform_code_dir}} state=directory owner=www-data group=www-data recurse=yes
  # Post Checkout tasks will get run as handlers when the {{ edx_platform_code_dir }} is ready.
  # Look at the handlers/main.yml in this role for a description of the tasks stated below.
  when: edx_platform_checkout.changed
  tags:
  - lms
  - cms
  - install
  - deploy

# Ruby plays that need to be run after platform updates.
- name: gem | gem install bundler
  shell: >
    RBENV_ROOT={{ rbenv_root }} GEM_HOME={{ gem_home }} {{ rbenv_root }}/shims/gem install bundle 
      chdir={{ edx_platform_code_dir }}
  tags:
  - ruby
  - deploy
  - install

- name: bundle | bundle install
  shell: >
    RBENV_ROOT={{ rbenv_root }} GEM_HOME={{ gem_home }} {{ gem_home }}/bin/bundle install --binstubs 
      chdir={{ edx_platform_code_dir }}
  tags:
  - ruby
  - deploy
  - install

# Node play that need to be run after platform updates.
- name: Install edx-platform npm dependencies
  shell: npm install chdir={{ edx_platform_code_dir }}
  tags:
  - npm
  - update
  - deploy

# Python plays that need to be run after platform updates.

# Substitute github mirror in all requirements files
#
- name: Updating requirement files for git mirror
  command: |
    /bin/sed -i -e 's/github\.com/{{ GIT_MIRROR }}/g' {{ item }}
  with_items:
    - "{{ pre_requirements_file }}"
    - "{{ post_requirements_file }}"
    - "{{ repo_requirements_file }}"
    - "{{ github_requirements_file }}"
    - "{{ local_requirements_file }}"
    - "{{ sandbox_base_requirements }}"
    - "{{ sandbox_local_requirements }}"
    - "{{ sandbox_post_requirements }}"
  tags:
    - lms
    - cms
    - install
    - deploy

# Install the python pre requirements into {{ venv_dir }}
- name : install python pre-requirements
  pip: >
    requirements="{{pre_requirements_file}}" 
    virtualenv="{{venv_dir}}" 
{'fraction_non_alphanumeric': 0.10783475783475784, 'fraction_numerical': 0.0008547008547008547, 'mean_word_length': 3.4212846347607053, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 8, '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': '1199867', 'n_tokens_mistral': 2398, 'n_tokens_neox': 2381, 'n_words': 679}