Exemplo n.º 1
0
def install(version=_VERSION):
    target = '/usr/local/ruby-%s' % version
    priority = _convert_version_to_string(version) 
    placeholder = {'target': target, 'priority': priority}
    
    ruby_build.ensure()
    sudo('ruby-build %s %s' % (version, target))

    update_alternatives_cmd = """sudo update-alternatives \
--install /usr/bin/ruby   ruby   %(target)s/bin/ruby %(priority)s \
--slave   /usr/bin/erb    erb    %(target)s/bin/erb \
--slave   /usr/bin/gem    gem    %(target)s/bin/gem \
--slave   /usr/bin/irb    irb    %(target)s/bin/irb \
--slave   /usr/bin/rake   rake   %(target)s/bin/rake \
--slave   /usr/bin/rdoc   rdoc   %(target)s/bin/rdoc \
--slave   /usr/bin/ri     ri     %(target)s/bin/ri \
--slave   /usr/bin/testrb testrb %(target)s/bin/testrb \
--slave   /usr/share/man/man1/erb.1  erb.1  %(target)s/share/man/man1/erb.1 \
--slave   /usr/share/man/man1/irb.1  irb.1  %(target)s/share/man/man1/irb.1 \
--slave   /usr/share/man/man1/rake.1 rake.1 %(target)s/share/man/man1/rake.1 \
--slave   /usr/share/man/man1/ri.1   ri.1   %(target)s/share/man/man1/ri.1 \
--slave   /usr/share/man/man1/ruby.1 ruby.1 %(target)s/share/man/man1/ruby.1 
"""
    sudo(update_alternatives_cmd % placeholder)
    sudo('update-alternatives --set ruby %(target)s/bin/ruby' % placeholder)
Exemplo n.º 2
0
def install(version, _update=True):
    ruby_rbenv.ensure()
    ruby_build.ensure()

    status = run("rbenv global %s; true" % version)
    if not status == "" or _update:
        run("rbenv install %s" % version)
        run("rbenv global %s" % version)

    run("rbenv rehash")
    run("gem install --no-ri --no-rdoc bundler")