From 82c375205f99f413f2a8239241e14533518922d7 Mon Sep 17 00:00:00 2001 From: Karl Hepworth Date: Mon, 3 Sep 2018 22:19:56 +1000 Subject: [PATCH 1/8] #11: Revoke support for homebrew in favour of downloading from source. --- README.md | 10 +++++++++- defaults/main.yml | 3 +++ meta/main.yml | 1 + tasks/main.yml | 7 ++++--- tests/test.yml | 1 - 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index e6ef60b..f452b5f 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,18 @@ Install [Dockutil](https://github.com/kcrawford/dockutil) and remove, add and an ## Requirements - - Homebrew +None. ## Role Variables +### Administration +````yaml +# The URL to the physical file where dockutil is available. +dockutil_url: https://raw.githubusercontent.com/kcrawford/dockutil/master/scripts/dockutil +# The installation path the above URL will be downloaded to. +dockutil_install_path: /usr/local/bin/dockutil +```` + ### Removal of dock items Dock items to remove: diff --git a/defaults/main.yml b/defaults/main.yml index 45354f4..e33eb38 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -6,6 +6,9 @@ # To manage dock items. # +dockutil_url: https://raw.githubusercontent.com/kcrawford/dockutil/master/scripts/dockutil +dockutil_install_path: /usr/local/bin/dockutil + dockitems_remove_all: false dockitems_disabled: diff --git a/meta/main.yml b/meta/main.yml index 4453f7c..2cc9d3e 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -11,6 +11,7 @@ galaxy_info: - 10.10 - 10.11 - 10.12 + - 10.13 - 10.7 - 10.8 - 10.9 diff --git a/tasks/main.yml b/tasks/main.yml index 1a24f5e..abb4c3a 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,9 +1,10 @@ --- - name: Dockutil | Ensure installed. - homebrew: - name: "dockutil" - state: installed + get_url: + url: "{{ dockutil_url }}" + dest: "{{ dockutil_install_path }}" + mode: 0755 - name: Dockutil | Get information on items to remove shell: "dockutil --find '{{ item }}'" diff --git a/tests/test.yml b/tests/test.yml index d3ba69f..ff44b48 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -4,5 +4,4 @@ vars: dockitems_enabled: [] roles: - - geerlingguy.homebrew - fubarhouse.macdock \ No newline at end of file From 1e12f06cc7bc07158ce2e1318bd841f9eea9e52b Mon Sep 17 00:00:00 2001 From: Karl Hepworth Date: Mon, 3 Sep 2018 22:25:57 +1000 Subject: [PATCH 2/8] #11: Remove homebrew test tasks --- .travis.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 41ac25d..d3e746f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,12 +4,6 @@ language: objective-c # 10.11 (see https://docs.travis-ci.com/user/osx-ci-environment/#OS-X-Version) osx_image: xcode7.3 -before_install: - # Uninstall existing brew installation. - - 'ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"' - - rm -rf /usr/local/Homebrew - - rm -rf /usr/local/Caskroom - - rm -rf /usr/local/bin/brew install: # Install pip. From 1584afc855c6eb42945c076585c2e471d54d1c67 Mon Sep 17 00:00:00 2001 From: Karl Hepworth Date: Mon, 3 Sep 2018 22:26:14 +1000 Subject: [PATCH 3/8] #11: Update xcode image --- .travis.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index d3e746f..6633998 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,8 @@ --- sudo: required language: objective-c -# 10.11 (see https://docs.travis-ci.com/user/osx-ci-environment/#OS-X-Version) -osx_image: xcode7.3 - +# 10.13 (see https://docs.travis-ci.com/user/osx-ci-environment/#OS-X-Version) +osx_image: xcode10 install: # Install pip. From 324bf97b8acf260cfb9ad7b953a92b07defff2e9 Mon Sep 17 00:00:00 2001 From: Karl Hepworth Date: Mon, 3 Sep 2018 22:27:18 +1000 Subject: [PATCH 4/8] #11: Removes pip --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6633998..6491306 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,8 +5,6 @@ language: objective-c osx_image: xcode10 install: - # Install pip. - - sudo easy_install pip # Install Ansible. - sudo pip install ansible From 50a86e26a6fbd36728b8b8c194d38ecc7cdd821b Mon Sep 17 00:00:00 2001 From: Karl Hepworth Date: Mon, 3 Sep 2018 22:30:53 +1000 Subject: [PATCH 5/8] #11: Removes homebrew from requirements --- tests/requirements.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/requirements.yml b/tests/requirements.yml index 48fd60a..dd8a39f 100644 --- a/tests/requirements.yml +++ b/tests/requirements.yml @@ -1,8 +1,5 @@ --- - - src: https://github.com/geerlingguy/ansible-role-homebrew - version: 2.1.0 - name: geerlingguy.homebrew - src: https://github.com/fubarhouse/ansible-role-macdock version: master name: fubarhouse.macdock \ No newline at end of file From abb22ad14b5cd4bc0c47c02a9f47ef9961c6bc0c Mon Sep 17 00:00:00 2001 From: Karl Hepworth Date: Tue, 4 Sep 2018 19:43:15 +1000 Subject: [PATCH 6/8] #11: Change all references to $PATH variant of binary to use the new installation path. --- tasks/main.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index abb4c3a..1e9494c 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -7,7 +7,7 @@ mode: 0755 - name: Dockutil | Get information on items to remove - shell: "dockutil --find '{{ item }}'" + shell: "{{ dockutil_install_path }} --find '{{ item }}'" register: dockutil_removeditems with_items: "{{ dockitems_disabled }}" changed_when: false @@ -16,12 +16,12 @@ when: dockitems_remove_all|bool == false - name: Dockutil | Remove all dock items - shell: "dockutil --remove all --no-restart" + shell: "{{ dockutil_install_path }} --remove all --no-restart" register: removed_items_task when: dockitems_remove_all|bool == true - name: Dockutil | Remove all unwanted dock items - shell: "dockutil --remove '{{ item.item }}' --no-restart" + shell: "{{ dockutil_install_path }} --remove '{{ item.item }}' --no-restart" with_items: "{{ dockutil_removeditems.results }}" loop_control: label: "{{item.item}}" @@ -31,7 +31,7 @@ notify: restart dock - name: Dockutil | Get information on configured setup - shell: "dockutil --find '{{ item.name }}'" + shell: "{{ dockutil_install_path }} --find '{{ item.name }}'" register: dockutil_newdata with_items: "{{ dockitems_enabled }}" changed_when: false @@ -39,7 +39,7 @@ check_mode: no - name: Dockutil | Adding items - shell: "dockutil --add '{{ item.item.path }}' --position {{ item.item.pos }} --no-restart" + shell: "{{ dockutil_install_path }} --add '{{ item.item.path }}' --position {{ item.item.pos }} --no-restart" with_items: "{{ dockutil_newdata.results }}" loop_control: label: "{{item.item}}" @@ -47,7 +47,7 @@ notify: restart dock - name: Dockutil | Get information on current setup - shell: "dockutil --find '{{ item.name }}'" + shell: "{{ dockutil_install_path }} --find '{{ item.name }}'" register: dockutil_currdata with_items: "{{ dockitems_enabled }}" changed_when: false @@ -55,7 +55,7 @@ check_mode: no - name: Dockutil | Moving items - shell: "dockutil --move '{{ item.item.name }}' --position {{ item.item.pos }} --no-restart" + shell: "{{ dockutil_install_path }} --move '{{ item.item.name }}' --position {{ item.item.pos }} --no-restart" with_items: "{{ dockutil_currdata.results }}" loop_control: label: "{{item.item}}" From ee07d69da13693b3934ba2d56bfb6be2fc9f543b Mon Sep 17 00:00:00 2001 From: Karl Hepworth Date: Tue, 4 Sep 2018 20:57:20 +1000 Subject: [PATCH 7/8] Add system to prevent reinstallation --- tasks/main.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tasks/main.yml b/tasks/main.yml index 1e9494c..54b806e 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,10 +1,16 @@ --- +- name: Dockutil | Detect installation + stat: + path: "{{ dockutil_install_path }}" + register: dockutil_stat + - name: Dockutil | Ensure installed. get_url: url: "{{ dockutil_url }}" dest: "{{ dockutil_install_path }}" mode: 0755 + when: not dockutil_stat.stat.exists - name: Dockutil | Get information on items to remove shell: "{{ dockutil_install_path }} --find '{{ item }}'" From c52e2c5faf2636dfdc7ddcc8ec93190e4e7c0375 Mon Sep 17 00:00:00 2001 From: Karl Hepworth Date: Tue, 4 Sep 2018 21:32:24 +1000 Subject: [PATCH 8/8] #14: Test the correct version --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 6491306..80a4ffd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,6 +21,9 @@ script: # Install roles - "ansible-galaxy install -r tests/requirements.yml" + # Copy this role into place + - cp -rf $TRAVIS_BUILD_DIR/* ../fubarhouse.macdock/ + # Check the role/playbook's syntax. - "ansible-playbook tests/test.yml --syntax-check"