Skip to content

Commit

Permalink
Add cask installation capabilities
Browse files Browse the repository at this point in the history
  • Loading branch information
rricard committed Sep 6, 2014
1 parent 1c58252 commit 5fa201f
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Ensure that homebrew is installed on your mac
| `installation_method` | The way to install homebrew, `script` or `clone` | `script` |
| `clone_dir` | The path where homebrew will be cloned | `~/src/github.com/Homebrew/homebrew` |
| `install_dir` | The path where homebrew will be installed | `/usr/local` |
| `install_cask` | Defines if you want to install Homebrew Cask too | `yes` |

## Dependencies

Expand Down
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
installation_method: script
clone_dir: "/Users/{{ ansible_user_id}}/src/github.com/Homebrew/homebrew"
install_dir: "/usr/local"
install_cask: yes
19 changes: 19 additions & 0 deletions tasks/cask.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
- name: assert cask presence
stat: path={{ install_dir }}/bin/brew-cask.rb
register: cask_installed

- name: tap the cask repository
homebrew_tap: tap=caskroom/cask state=present
when: cask_installed.stat.exists == false

- name: install brew-cask
homebrew: name=brew-cask state=latest update_homebrew=yes
when: cask_installed.stat.exists == false

- name: add new cask opts to common env
lineinfile: dest=/Users/{{ affected_users }}/.common_env
regexp='^export HOMEBREW_CASK_OPTS'
line='export HOMEBREW_CASK_OPTS="--appdir=/Applications"'
state=present
when: cask_installed.stat.exists == false
3 changes: 3 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@

- name: Update Homebrew
homebrew: update_homebrew=yes

- include: cask.yml
when: install_cask == yes
1 change: 1 addition & 0 deletions test_vars.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
clone_dir: "/Users/{{ ansible_user_id}}/src/github.com/Homebrew/homebrew"
install_dir: "/Users/{{ ansible_user_id}}/brew"
install_cask: yes

0 comments on commit 5fa201f

Please sign in to comment.