Skip to content

Commit

Permalink
feat(macos): support for homebrew
Browse files Browse the repository at this point in the history
  • Loading branch information
noelmcloughlin committed May 7, 2020
1 parent 1b12b49 commit 8a9b380
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 12 deletions.
2 changes: 1 addition & 1 deletion golang/map.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
{%- do golang.environ.append('export PATH=${PATH}:%s/go/bin'|format(golang.pkg.archive.name)) %}
{%- endif %}

{#- Depreciated parameter 'golang.dir' %}
{#- Depreciated parameter 'golang.dir' #}
{%- if 'dir' in golang and golang.dir and golang.kernel == 'linux' %}
{%- do golang.linux.update({'dir': golang.dir}) %}
{%- endif %}
24 changes: 17 additions & 7 deletions golang/package/clean.sls
Original file line number Diff line number Diff line change
@@ -1,21 +1,31 @@
# -*- coding: utf-8 -*-
# vim: ft=sls

{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split('/')[0] %}
{%- set sls_config_clean = tplroot ~ '.config.clean' %}
{%- set sls_repo_clean = '.repo.clean' %}
{%- from tplroot ~ "/map.jinja" import golang with context %}
include:
- {{ sls_config_clean }}
{%- if grains.kernel|lower == 'linux' %}
- {{ sls_repo_clean }}
{%- if golang.pkg.use_upstream_repo %}
include:
- .repo.clean
{%- endif %}
golang-package-clean-pkg-removed:
golang-package-clean-pkg-cleaned:
pkg.removed:
- name: {{ golang.pkg.name }}
- require:
- sls: {{ sls_config_clean }}
- sls: {{ sls_repo_clean }}
{%- elif grains.os_family == 'MacOS' %}
golang-package-clean-cmd-run-brew:
cmd.run:
- name: brew uninstall --force {{ golang.pkg.name }}
- runas: {{ golang.rootuser }}
- onlyif: test -x /usr/local/bin/brew
- require:
- sls: {{ sls_config_clean }}
{%- endif %}
20 changes: 16 additions & 4 deletions golang/package/install.sls
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
# -*- coding: utf-8 -*-
# vim: ft=sls

{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split('/')[0] %}
{%- set sls_repo_install = '.repo' %}
{%- from tplroot ~ "/map.jinja" import golang with context %}
{%- if golang.pkg.use_upstream_repo %}
{%- if grains.kernel|lower == 'linux' %}
include:
- .repo
{%- endif %}
- {{ sls_repo_install }}
golang-package-install-pkg-installed:
pkg.installed:
- name: {{ golang.pkg.name }}
- reload_modules: true
- require:
- sls: {{ sls_repo_install }}
{%- elif grains.os_family == 'MacOS' %}
golang-package-install-cmd-run-brew:
cmd.run:
- name: brew install {{ golang.pkg.name }}
- runas: {{ golang.rootuser }}
- onlyif: test -x /usr/local/bin/brew
{%- endif %}

0 comments on commit 8a9b380

Please sign in to comment.