Skip to content

Instantly share code, notes, and snippets.

@gin0606
Created May 18, 2015 07:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gin0606/25f1b59e8a6602a758b9 to your computer and use it in GitHub Desktop.
Save gin0606/25f1b59e8a6602a758b9 to your computer and use it in GitHub Desktop.
- name: Command Line Toolsが入っているかの確認
stat: path=/usr/include
register: command_line_tools_dir
- name: Command Line Toolsが入っていなかったらインストールする
shell: |
PLACEHOLDER=/tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
touch $PLACEHOLDER
PROD=$(softwareupdate -l | grep "\*.*Command Line" | head -n 1 | awk -F"*" '{print $2}' | sed -e 's/^ *//' | tr -d '\n')
softwareupdate -i "${PROD}"
[[ -f $PLACEHOLDER ]] && rm $PLACEHOLDER
when: not command_line_tools_dir.stat.exists
- stat: path=~/.bash_profile
register: bash_profile
- file: path=~/.bash_profile state=touch
when: not bash_profile.stat.exists
- name: homebrewが入っているかの確認
stat: path=/usr/local/bin/brew
register: brew_command
- name: homebrewが入っていなかったらインストールする
shell: echo '\n' | ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
when: not brew_command.stat.exists
- shell: cp -r /vagrant/caches/homebrew/* /Library/Caches/Homebrew || true
- homebrew: update_homebrew=yes
- homebrew_tap: tap=caskroom/cask state=present
- homebrew: name=brew-cask
- homebrew_tap: tap={{ item }} state=present
with_items: homebrew.tap
- homebrew_cask: name={{ item }}
with_items: homebrew.cask
- homebrew: name={{ item }}
with_items: homebrew.formula
- name: rbenv関係のformulaをインストールする
homebrew: name={{ item }}
with_items:
- rbenv
- ruby-build
- rbenv-gem-rehash
- lineinfile: dest=~/.bash_profile line='if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi'
- lineinfile: dest=~/.bash_profile line='export PATH=$HOME/.rbenv/shims:$PATH'
- shell: /bin/bash -lc "rbenv install --skip-existing {{ rbenv.global }}"
- shell: /bin/bash -lc "rbenv global {{ rbenv.global }}"
- gem: name={{ item }}
with_items: ruby.gems
- shell: cp -r /Library/Caches/Homebrew/* /vagrant/caches/homebrew || true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment