<commit_before>{% from "bulkeats/map.jinja" import bulkeats with context %}

{% set bulkeats_venv = salt['pillar.get']('bulkeats:venv') %}
{% set bulkeats_proj = salt['pillar.get']('bulkeats:proj') %}
{% set bulkeats_user = salt['pillar.get']('bulkeats:user') %}
{% set bulkeats_theme = salt['pillar.get']('bulkeats:theme') %}

include:
  - git
  - nginx
  - python.pip
  - python.virtualenv

{{ bulkeats_user }}:
  user.present:
    - name: {{ bulkeats_user }}
    - shell: /bin/bash
    - home: /home/{{ bulkeats_user }}
    - uid: 2150
    - gid: 2150
    - groups:
      - {{ bulkeats.group }}
    - require:
      - group: {{ bulkeats_user }}
  group.present:
    - gid: 2150

bulkeats_venv:
  virtualenv.managed:
    - name: {{ bulkeats_venv }}
    - user: {{ bulkeats_user }}
    - pip_upgrade: True
    - require:
      - pkg: install_python_virtualenv
      - user: {{ bulkeats_user }}

bulkeats_git:
  git.latest:
    - name: https://github.com/gravyboat/bulkeats.git
    - target: {{ bulkeats_proj }}
    - user: {{ bulkeats_user }}
    - force_reset: True
    - force_clone: True
    - force_checkout: True
    - require:
      - pkg: install_git
      - virtualenv: bulkeats_venv
    - watch_in:
      - service: nginx_service

bulkeats_themes_dir:
  file.directory:
    - name: {{ bulkeats_proj }}/themes
    - user: {{ bulkeats_user }}
    - group: {{ bulkeats_user }}
    - mode: 755

bulkeats_theme:
  git.latest:
    - name: https://github.com/gravyboat/pelican-themes.git
    - target: {{ bulkeats_theme }}
    - user: {{ bulkeats_user }}
    - force_reset: True
    - force_clone: True
    - force_checkout: True
    - require:
      - virtualenv: bulkeats_venv
      - git: bulkeats_git
    - watch_in:
      - service: nginx_service

bulkeats_pkgs:
  pip.installed:
    - bin_env: {{ bulkeats_venv }}
    - requirements: {{ bulkeats_proj }}/requirements.txt
    - user: {{ bulkeats_user }}
    - require:
      - git: bulkeats_git
      - pkg: install_python_pip
      - virtualenv: bulkeats_venv

refresh_pelican:
  cmd.run:
    - runas: {{ bulkeats_user }}
    - name: {{ bulkeats_venv }}/bin/pelican -s {{bulkeats_proj}}/pelicanconf.py
    - require:
      - virtualenv: bulkeats_venv
    - watch:
      - git: bulkeats_git

bulkeats_copy_images:
  cmd.run:
    - name: cp -r {{ bulkeats_proj }}/content/images/ {{ bulkeats_proj }}/output/
    - runas: {{ bulkeats_user }}
    - require:
      - cmd: refresh_pelican


bulkeats_nginx_conf:
  file.managed:
    - name: /etc/nginx/conf.d/bulkeats.conf
    - source: salt://bulkeats/files/bulkeats.conf
    - template: jinja
    - user: root
    - group: root
    - mode: 644
    - require:
      - git: bulkeats_git
      - pkg: install_nginx
    - watch_in:
      - service: nginx_service

site_favicon:
  file.managed:
    - name: {{ salt['pillar.get']('bulkeats:root') }}/favicon.ico
    - source: salt://bulkeats/files/favicon.ico
    - template: jinja
    - user: {{ bulkeats_user }}
    - group: {{ bulkeats_user }}
    - mode: 644
    - require:
      - git: bulkeats_git
      - pkg: install_nginx
    - watch_in:
      - service: nginx_service

remove_default_sites_enabled:
  file.absent:
    - name: /etc/nginx/sites-enabled/default
    - watch_in:
      - service: nginx_service<commit_msg>Fix some conflicting IDs<commit_after>{% from "bulkeats/map.jinja" import bulkeats with context %}

{% set bulkeats_venv = salt['pillar.get']('bulkeats:venv') %}
{% set bulkeats_proj = salt['pillar.get']('bulkeats:proj') %}
{% set bulkeats_user = salt['pillar.get']('bulkeats:user') %}
{% set bulkeats_theme = salt['pillar.get']('bulkeats:theme') %}

include:
  - git
  - nginx
  - python.pip
  - python.virtualenv

{{ bulkeats_user }}:
  user.present:
    - name: {{ bulkeats_user }}
    - shell: /bin/bash
    - home: /home/{{ bulkeats_user }}
    - uid: 2150
    - gid: 2150
    - groups:
      - {{ bulkeats.group }}
    - require:
      - group: {{ bulkeats_user }}
  group.present:
    - gid: 2150

bulkeats_venv:
  virtualenv.managed:
    - name: {{ bulkeats_venv }}
    - user: {{ bulkeats_user }}
    - pip_upgrade: True
    - require:
      - pkg: install_python_virtualenv
      - user: {{ bulkeats_user }}

bulkeats_git:
  git.latest:
    - name: https://github.com/gravyboat/bulkeats.git
    - target: {{ bulkeats_proj }}
    - user: {{ bulkeats_user }}
    - force_reset: True
    - force_clone: True
    - force_checkout: True
    - require:
      - pkg: install_git
      - virtualenv: bulkeats_venv
    - watch_in:
      - service: nginx_service

bulkeats_themes_dir:
  file.directory:
    - name: {{ bulkeats_proj }}/themes
    - user: {{ bulkeats_user }}
    - group: {{ bulkeats_user }}
    - mode: 755

bulkeats_theme:
  git.latest:
    - name: https://github.com/gravyboat/pelican-themes.git
    - target: {{ bulkeats_theme }}
    - user: {{ bulkeats_user }}
    - force_reset: True
    - force_clone: True
    - force_checkout: True
    - require:
      - virtualenv: bulkeats_venv
      - git: bulkeats_git
    - watch_in:
      - service: nginx_service

bulkeats_pkgs:
  pip.installed:
    - bin_env: {{ bulkeats_venv }}
    - requirements: {{ bulkeats_proj }}/requirements.txt
    - user: {{ bulkeats_user }}
    - require:
      - git: bulkeats_git
      - pkg: install_python_pip
      - virtualenv: bulkeats_venv

bulkeats_refresh_pelican:
  cmd.run:
    - runas: {{ bulkeats_user }}
    - name: {{ bulkeats_venv }}/bin/pelican -s {{bulkeats_proj}}/pelicanconf.py
    - require:
      - virtualenv: bulkeats_venv
    - watch:
      - git: bulkeats_git

bulkeats_copy_images:
  cmd.run:
    - name: cp -r {{ bulkeats_proj }}/content/images/ {{ bulkeats_proj }}/output/
    - runas: {{ bulkeats_user }}
    - require:
      - cmd: bulkeats_refresh_pelican


bulkeats_nginx_conf:
  file.managed:
    - name: /etc/nginx/conf.d/bulkeats.conf
    - source: salt://bulkeats/files/bulkeats.conf
    - template: jinja
    - user: root
    - group: root
    - mode: 644
    - require:
      - git: bulkeats_git
      - pkg: install_nginx
    - watch_in:
      - service: nginx_service

bulkeats_site_favicon:
  file.managed:
    - name: {{ salt['pillar.get']('bulkeats:root') }}/favicon.ico
    - source: salt://bulkeats/files/favicon.ico
    - template: jinja
    - user: {{ bulkeats_user }}
    - group: {{ bulkeats_user }}
    - mode: 644
    - require:
      - git: bulkeats_git
      - pkg: install_nginx
    - watch_in:
      - service: nginx_service
{'fraction_non_alphanumeric': 0.13953488372093023, 'fraction_numerical': 0.0065116279069767444, 'mean_word_length': 2.4645542427497316, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, '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': '2843510', 'n_tokens_mistral': 2532, 'n_tokens_neox': 2410, 'n_words': 415}