---
- name: Clone rbenv
  git: >
    repo=git://github.com/sstephenson/rbenv.git
    dest=~/.rbenv
  tags: update

- name: Clone rbenv plugins
  git: >
    repo=git://github.com/{{ item }}.git
    dest=~/.rbenv/plugins/{{ item | basename }}
  with_items:
    - sstephenson/rbenv-default-gems
    - sstephenson/ruby-build
    - tpope/rbenv-ctags
    - tpope/rbenv-readline
  tags: update

- name: Install Rubies
  shell: 'rbenv install --skip-existing {{ item }}'
  with_items: dotfiles.ruby.versions
  changed_when: no

- name: Set default Ruby version
  shell: 'rbenv global {{ dotfiles.ruby.default_version }}'

- name: Link dotfiles
  file: src={{ item }} dest=~/.{{ item | basename }} state=link
  with_fileglob:
    - ./*

- name: Link default gems
  template: src=default-gems dest=~/.rbenv/default-gems

---
- name: Clone rbenv
  git: >
    repo=git://github.com/sstephenson/rbenv.git
    dest=~/.rbenv
  tags: update

- name: Clone rbenv plugins
  git: >
    repo=git://github.com/{{ item }}.git
    dest=~/.rbenv/plugins/{{ item | basename }}
  with_items:
    - sstephenson/rbenv-default-gems
    - sstephenson/ruby-build
    - tpope/rbenv-ctags
    - tpope/rbenv-readline
  tags: update

- name: Install Rubies
  shell: 'rbenv install --skip-existing {{ item }}'
  with_items: dotfiles.ruby.versions
  changed_when: no

- name: Set default Ruby version
  shell: 'rbenv global {{ dotfiles.ruby.default_version }}'

- name: Link dotfiles
  file: src={{ item }} dest=~/.{{ item | basename }} state=link
  with_fileglob:
    - ./*

- name: Create ~/.rbenv/default-gems
  template: src=default-gems dest=~/.rbenv/default-gems

Rename Ruby default gems task
Rename Ruby default gems task
