From afef2d18d6acb242053c9e7032f44d31730b8dec Mon Sep 17 00:00:00 2001 From: cronekorkn Date: Fri, 30 Dec 2022 14:58:30 +0100 Subject: [PATCH] rbenv --- bundles/rbenv/items.py | 40 +++++++++++++++++++++++++++++++++++++++ bundles/rbenv/metadata.py | 24 +++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 bundles/rbenv/items.py create mode 100644 bundles/rbenv/metadata.py diff --git a/bundles/rbenv/items.py b/bundles/rbenv/items.py new file mode 100644 index 0000000..420f6f0 --- /dev/null +++ b/bundles/rbenv/items.py @@ -0,0 +1,40 @@ +directories = { + '/opt/rbenv': {}, + '/opt/rbenv/plugins': { + 'needs': [ + 'git_deploy:/opt/rbenv', + ], + }, + '/opt/rbenv/plugins/ruby-build': { + 'needs': [ + 'git_deploy:/opt/rbenv', + ], + }, +} + +git_deploy = { + '/opt/rbenv': { + 'repo': 'https://github.com/sstephenson/rbenv.git', + 'rev': 'master', + }, + '/opt/rbenv/plugins/ruby-build': { + 'repo': 'https://github.com/sstephenson/ruby-build.git', + 'rev': 'master', + 'needs': [ + 'git_deploy:/opt/rbenv', + ], + }, +} + +for version in node.metadata.get('rbenv'): + actions[f'install_ruby_{version}'] = { + 'command': f'RBENV_ROOT=/opt/rbenv /opt/rbenv/bin/rbenv install {version}', + 'unless': f'RBENV_ROOT=/opt/rbenv /opt/rbenv/bin/rbenv versions | cut -c 3- | cut -d" " -f1 | grep -q ^{version}$', + 'needs': [ + 'git_deploy:/opt/rbenv', + 'git_deploy:/opt/rbenv/plugins/ruby-build', + 'pkg_apt:libyaml-dev', + ], + } + + diff --git a/bundles/rbenv/metadata.py b/bundles/rbenv/metadata.py new file mode 100644 index 0000000..636cfca --- /dev/null +++ b/bundles/rbenv/metadata.py @@ -0,0 +1,24 @@ +defaults = { + 'apt': { + # https://github.com/rbenv/ruby-build/wiki#ubuntudebianmint + 'packages': { + 'autoconf': {}, + 'bison': {}, + 'patch': {}, + 'build-essential': {}, + 'rustc': {}, + 'libssl-dev': {}, + 'libyaml-dev': {}, + 'libreadline-dev': {}, + 'zlib1g-dev': {}, + 'libgmp-dev': {}, + 'libncurses5-dev': {}, + 'libffi-dev': {}, + 'libgdbm6': {}, + 'libgdbm-dev': {}, + 'libdb-dev': {}, + 'uuid-dev': {}, + }, + }, + 'rbenv': set(), +}