Skip to content

Commit

Permalink
feat: Support for installing official HS Spoons.
Browse files Browse the repository at this point in the history
  • Loading branch information
TechDufus committed Sep 12, 2024
1 parent d9c7f54 commit 2fe50fb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
7 changes: 7 additions & 0 deletions roles/hammerspoon/tasks/MacOSX.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,10 @@
src: "config/"
dest: "{{ ansible_user_dir }}/.hammerspoon"
mode: "0644"

- name: "Hammerspoon | Install Hammerspoon Spoons"
ansible.builtin.include_tasks: spoons.yml
loop:
- "ReloadConfiguration"
loop_control:
loop_var: current_spoon
23 changes: 11 additions & 12 deletions roles/hammerspoon/tasks/spoons.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
---
- name: "Hammerspoon | MacOSX | Ensure ~/.hammerspoon exists"
ansible.builtin.file:
name: "{{ ansible_user_dir }}/.hammerspoon"
state: directory

- name: "Hammerspoon | MacOSX | Ensure ~/.hammerspoon/Spoons exists"
ansible.builtin.file:
name: "{{ ansible_user_dir }}/.hammerspoon/Spoons"
state: directory
mode: "0755"

- name: "Hammerspoon | MacOSX | {{ current_spoon }} | Detect local instance of {{ current_spoon }}"
ansible.builtin.stat:
name: "{{ ansible_user_dir }}/.hammerspoon/Spoons/{{ current_spoon }}"
Expand All @@ -23,4 +12,14 @@
url: "https://github.com/Hammerspoon/Spoons/blob/master/Spoons/{{ current_spoon }}.spoon.zip"
dest: "{{ ansible_user_dir }}/.hammerspoon/Spoons"
return_content: true
notify: "Hammerspoon | MacOSX | {{ current_spoon }} | Cleanup latest {{ current_spoon }} zip"

- name: "Hammerspoon | MacOSX | {{ current_spoon }} | Unzip latest {{ current_spoon }}"
ansible.builtin.unarchive:
src: "{{ ansible_user_dir }}/.hammerspoon/Spoons/{{ current_spoon }}.spoon.zip"
dest: "{{ ansible_user_dir }}/.hammerspoon/Spoons/"
creates: "{{ ansible_user_dir }}/.hammerspoon/Spoons/{{ current_spoon }}.spoon"

- name: "Hammerspoon | MacOSX | {{ current_spoon }} | Cleanup latest {{ current_spoon }} zip"
ansible.builtin.file:
name: "{{ ansible_user_dir }}/.hammerspoon/Spoons/{{ current_spoon }}.spoon.zip"
state: absent

0 comments on commit 2fe50fb

Please sign in to comment.