Skip to content

Commit 8a9b380

Browse files
feat(macos): support for homebrew
1 parent 1b12b49 commit 8a9b380

File tree

3 files changed

+34
-12
lines changed

3 files changed

+34
-12
lines changed

golang/map.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
{%- do golang.environ.append('export PATH=${PATH}:%s/go/bin'|format(golang.pkg.archive.name)) %}
6868
{%- endif %}
6969

70-
{#- Depreciated parameter 'golang.dir' %}
70+
{#- Depreciated parameter 'golang.dir' #}
7171
{%- if 'dir' in golang and golang.dir and golang.kernel == 'linux' %}
7272
{%- do golang.linux.update({'dir': golang.dir}) %}
7373
{%- endif %}

golang/package/clean.sls

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,31 @@
11
# -*- coding: utf-8 -*-
22
# vim: ft=sls
33

4-
{#- Get the `tplroot` from `tpldir` #}
54
{%- set tplroot = tpldir.split('/')[0] %}
65
{%- set sls_config_clean = tplroot ~ '.config.clean' %}
6+
{%- set sls_repo_clean = '.repo.clean' %}
77
{%- from tplroot ~ "/map.jinja" import golang with context %}
88
99
include:
1010
- {{ sls_config_clean }}
11+
{%- if grains.kernel|lower == 'linux' %}
12+
- {{ sls_repo_clean }}
1113
12-
{%- if golang.pkg.use_upstream_repo %}
13-
include:
14-
- .repo.clean
15-
{%- endif %}
16-
17-
golang-package-clean-pkg-removed:
14+
golang-package-clean-pkg-cleaned:
1815
pkg.removed:
1916
- name: {{ golang.pkg.name }}
2017
- require:
2118
- sls: {{ sls_config_clean }}
19+
- sls: {{ sls_repo_clean }}
20+
21+
{%- elif grains.os_family == 'MacOS' %}
22+
23+
golang-package-clean-cmd-run-brew:
24+
cmd.run:
25+
- name: brew uninstall --force {{ golang.pkg.name }}
26+
- runas: {{ golang.rootuser }}
27+
- onlyif: test -x /usr/local/bin/brew
28+
- require:
29+
- sls: {{ sls_config_clean }}
30+
31+
{%- endif %}

golang/package/install.sls

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,27 @@
11
# -*- coding: utf-8 -*-
22
# vim: ft=sls
33

4-
{#- Get the `tplroot` from `tpldir` #}
54
{%- set tplroot = tpldir.split('/')[0] %}
5+
{%- set sls_repo_install = '.repo' %}
66
{%- from tplroot ~ "/map.jinja" import golang with context %}
77
8-
{%- if golang.pkg.use_upstream_repo %}
8+
{%- if grains.kernel|lower == 'linux' %}
99
include:
10-
- .repo
11-
{%- endif %}
10+
- {{ sls_repo_install }}
1211
1312
golang-package-install-pkg-installed:
1413
pkg.installed:
1514
- name: {{ golang.pkg.name }}
15+
- reload_modules: true
16+
- require:
17+
- sls: {{ sls_repo_install }}
18+
19+
{%- elif grains.os_family == 'MacOS' %}
20+
21+
golang-package-install-cmd-run-brew:
22+
cmd.run:
23+
- name: brew install {{ golang.pkg.name }}
24+
- runas: {{ golang.rootuser }}
25+
- onlyif: test -x /usr/local/bin/brew
26+
27+
{%- endif %}

0 commit comments

Comments
 (0)