--- # tasks file for nrser.rbenv_gem - name: parse rbenv_gem_rubies into rbenv_gem_rubies_list vars.rb: namespace: rbenv_gem vars: rubies: "{{ rbenv_gem_rubies }}" src: | exe = "/usr/bin/env rbenv" all = `#{ exe } versions --bare`.strip.split + ['system'] global = `#{ exe } global`.strip current = `#{ exe } version-name`.strip list = rubies.split(',').map {|s| s.strip }.map {|version| case version when 'global' global when 'current' current when 'all' all else version end }.flatten.uniq unless (list - all).empty? raise "versions #{ (list - all).join(', ') } are not installed" end {'rubies_list' => list} # - debug: # msg: "{{ rbenv_gem_rubies_list }}" # this will clone the repo, build the .gem and point rbenv_gem_source to it - include: clone-repo.yml when: rbenv_gem_repo is defined - include: manage-source.yml when: rbenv_gem_source is defined - include: manage-version.yml when: rbenv_gem_source is not defined