]> git.immae.eu Git - perso/Immae/Config/Ansible.git/blobdiff - roles/contexts/fretlink/tasks/main.yml
Add zeal docsets
[perso/Immae/Config/Ansible.git] / roles / contexts / fretlink / tasks / main.yml
index b1b163a5912f911a980424f7a9bc36d1d4f57257..78f733a43cc12805047cca1f6f6721561af09c6a 100644 (file)
@@ -7,12 +7,46 @@
     - programming/haskell
     - programming/nodejs
 - name: Config files
-  synchronize:
-    recursive: yes
-    archive: no
-    checksum: yes
-    src: config_files/
-    dest: /$XDG_CONFIG_HOME/
+  copy:
+    src: "config_files/{{ item }}"
+    dest: "$XDG_CONFIG_HOME/{{ item }}"
+  loop:
+    - "autostart/zeal.desktop"
+- name: zeal configuration
+  ini_file:
+    path: "$XDG_CONFIG_HOME/Zeal/Zeal.conf"
+    section: "{{ item.0 }}"
+    option: "{{ item.1 }}"
+    value: "{{ item.2 }}"
+    no_extra_spaces: true
+  loop:
+    - [ "General", "check_for_update", "true" ]
+    - [ "General", "hide_on_close", "true" ]
+    - [ "General", "minimize_to_systray", "true" ]
+    - [ "General", "show_systray_icon", "true" ]
+    - [ "General", "start_minimized", "true" ]
+    - [ "docsets", "path", "{{ lookup('env', 'XDG_DATA_HOME') }}/Zeal/Zeal/docsets" ]
+    - [ "search", "fuzzy_search_enabled", "false" ]
+    - [ "tabs", "open_new_tab_after_active", "false" ]
+- name: Zeal docsets
+  block:
+    - name: Check missing Zeal docsets
+      register: zeal_missing_docsets
+      shell: "for i in {{ zeal_roles | join(' ') }}; do [ -d $XDG_DATA_HOME/Zeal/Zeal/docsets/$i.docset ] || echo $i; done"
+      changed_when: zeal_missing_docsets.stdout != ""
+      check_mode: no
+    - name: Ask for Zeal docsets
+      when: zeal_missing_docsets.stdout != ""
+      pause:
+        prompt: "install Zeal docsets ? [y/N]"
+      register: zeal_install_docsets
+      check_mode: no
+    - name: Zeal docsets
+      when: zeal_missing_docsets.stdout != "" and zeal_install_docsets.user_input.startswith("y")
+      shell: "dasht-docsets-install {{ item }}"
+      args:
+        creates: "$XDG_DATA_HOME/Zeal/Zeal/docsets/{{ item }}.docset"
+      loop: "{{ zeal_missing_docsets.stdout.split('\n') }}"
 - name: Create pm2 config dir
   file:
     path: $XDG_CONFIG_HOME/pm2
 - name: workdir
   block:
     - name: workdir scripts
-      synchronize:
-        recursive: yes
-        archive: no
-        checksum: yes
-        src: workdir/
-        dest: /$HOME/workdir/
-    - name: chmod workdir script
-      file:
-        path: $HOME/workdir/start
+      copy:
         mode: 0755
+        src: "workdir/{{ item }}"
+        dest: "$HOME/workdir/{{ item }}"
+      loop:
+        - start
     - name: environment variables file
       block:
         - name: extract environment