Added rbenv wrapper

Change-Id: Iefab7b71b96998789a66b3e1ea03f28fbfc38391
This commit is contained in:
Eli Klein 2014-01-03 22:53:42 -07:00
parent 604d39305b
commit efa6f231ee
8 changed files with 163 additions and 0 deletions

View File

@ -237,6 +237,92 @@ def rvm_env(parser, xml_parent, data):
'ruby-class': 'String'}).text = "rvm"
def rbenv(parser, xml_parent, data):
"""yaml: rbenv
Set the rbenv implementation.
Requires the Jenkins `rbenv plugin.
<https://wiki.jenkins-ci.org/display/JENKINS/rbenv+plugin>`_
All parameters are optional.
:arg str ruby-version: Version of Ruby to use (default: 1.9.3-p484)
:arg bool ignore-local-version: If true, ignore local Ruby
version (defined in the ".ruby-version" file in workspace) even if it
has been defined (default: false)
:arg str preinstall-gem-list: List of gems to install
(default: 'bundler,rake')
:arg str rbenv-root: RBENV_ROOT (default: $HOME/.rbenv)
:arg str rbenv-repo: Which repo to clone rbenv from
(default: https://github.com/sstephenson/rbenv.git)
:arg str rbenv-branch: Which branch to clone rbenv from (default: master)
:arg str ruby-build-repo: Which repo to clone ruby-build from
(default: https://github.com/sstephenson/ruby-build.git)
:arg str ruby-build-branch: Which branch to clone ruby-build from
(default: master)
Example:
.. literalinclude:: /../../tests/wrappers/fixtures/rbenv003.yaml
"""
mapping = [
# option, xml name, default value (text), attributes (hard coded)
("preinstall-gem-list", 'gem__list', 'bundler,rake'),
("rbenv-root", 'rbenv__root', '$HOME/.rbenv'),
("rbenv-repo", 'rbenv__repository',
'https://github.com/sstephenson/rbenv.git'),
("rbenv-branch", 'rbenv__revision', 'master'),
("ruby-build-repo", 'ruby__build__repository',
'https://github.com/sstephenson/ruby-build.git'),
("ruby-build-branch", 'ruby__build__revision', 'master'),
("ruby-version", 'version', '1.9.3-p484'),
]
rpo = XML.SubElement(xml_parent,
'ruby-proxy-object')
ro_class = "Jenkins::Tasks::BuildWrapperProxy"
ro = XML.SubElement(rpo,
'ruby-object',
{'ruby-class': ro_class,
'pluginid': 'rbenv'})
XML.SubElement(ro,
'pluginid',
{'pluginid': "rbenv",
'ruby-class': "String"}).text = "rbenv"
o = XML.SubElement(ro,
'object',
{'ruby-class': 'RbenvWrapper',
'pluginid': 'rbenv'})
for elem in mapping:
(optname, xmlname, val) = elem[:3]
xe = XML.SubElement(o,
xmlname,
{'ruby-class': "String",
'pluginid': "rbenv"})
if optname and optname in data:
val = data[optname]
if type(val) == bool:
xe.text = str(val).lower()
else:
xe.text = val
ignore_local_class = 'FalseClass'
if 'ignore-local-version' in data:
ignore_local_string = str(data['ignore-local-version']).lower()
if ignore_local_string == 'true':
ignore_local_class = 'TrueClass'
XML.SubElement(o,
'ignore__local__version',
{'ruby-class': ignore_local_class,
'pluginid': 'rbenv'})
def build_name(parser, xml_parent, data):
"""yaml: build-name
Set the name of the build

View File

@ -204,6 +204,7 @@ setuptools.setup(
'port-allocator=jenkins_jobs.modules.wrappers:port_allocator',
('pre-scm-buildstep='
'jenkins_jobs.modules.wrappers:pre_scm_buildstep'),
'rbenv=jenkins_jobs.modules.wrappers:rbenv',
'release=jenkins_jobs.modules.wrappers:release',
'rvm-env=jenkins_jobs.modules.wrappers:rvm_env',
'sauce-ondemand=jenkins_jobs.modules.wrappers:sauce_ondemand',

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<buildWrappers>
<ruby-proxy-object>
<ruby-object pluginid="rbenv" ruby-class="Jenkins::Tasks::BuildWrapperProxy">
<pluginid pluginid="rbenv" ruby-class="String">rbenv</pluginid>
<object pluginid="rbenv" ruby-class="RbenvWrapper">
<gem__list pluginid="rbenv" ruby-class="String">bundler,rake</gem__list>
<rbenv__root pluginid="rbenv" ruby-class="String">$HOME/.rbenv</rbenv__root>
<rbenv__repository pluginid="rbenv" ruby-class="String">https://github.com/sstephenson/rbenv.git</rbenv__repository>
<rbenv__revision pluginid="rbenv" ruby-class="String">master</rbenv__revision>
<ruby__build__repository pluginid="rbenv" ruby-class="String">https://github.com/sstephenson/ruby-build.git</ruby__build__repository>
<ruby__build__revision pluginid="rbenv" ruby-class="String">master</ruby__build__revision>
<version pluginid="rbenv" ruby-class="String">1.9.3-p484</version>
<ignore__local__version pluginid="rbenv" ruby-class="FalseClass"/>
</object>
</ruby-object>
</ruby-proxy-object>
</buildWrappers>
</project>

View File

@ -0,0 +1,2 @@
wrappers:
- rbenv

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<buildWrappers>
<ruby-proxy-object>
<ruby-object pluginid="rbenv" ruby-class="Jenkins::Tasks::BuildWrapperProxy">
<pluginid pluginid="rbenv" ruby-class="String">rbenv</pluginid>
<object pluginid="rbenv" ruby-class="RbenvWrapper">
<gem__list pluginid="rbenv" ruby-class="String">bundler,rake</gem__list>
<rbenv__root pluginid="rbenv" ruby-class="String">$HOME/.rbenv</rbenv__root>
<rbenv__repository pluginid="rbenv" ruby-class="String">https://github.com/sstephenson/rbenv.git</rbenv__repository>
<rbenv__revision pluginid="rbenv" ruby-class="String">master</rbenv__revision>
<ruby__build__repository pluginid="rbenv" ruby-class="String">https://github.com/sstephenson/ruby-build.git</ruby__build__repository>
<ruby__build__revision pluginid="rbenv" ruby-class="String">master</ruby__build__revision>
<version pluginid="rbenv" ruby-class="String">2.0.0-p353</version>
<ignore__local__version pluginid="rbenv" ruby-class="TrueClass"/>
</object>
</ruby-object>
</ruby-proxy-object>
</buildWrappers>
</project>

View File

@ -0,0 +1,4 @@
wrappers:
- rbenv:
ruby-version: 2.0.0-p353
ignore-local-version: true

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<buildWrappers>
<ruby-proxy-object>
<ruby-object pluginid="rbenv" ruby-class="Jenkins::Tasks::BuildWrapperProxy">
<pluginid pluginid="rbenv" ruby-class="String">rbenv</pluginid>
<object pluginid="rbenv" ruby-class="RbenvWrapper">
<gem__list pluginid="rbenv" ruby-class="String">bundler,rake</gem__list>
<rbenv__root pluginid="rbenv" ruby-class="String">$HOME/.rbenv</rbenv__root>
<rbenv__repository pluginid="rbenv" ruby-class="String">https://github.com/sstephenson/rbenv.git</rbenv__repository>
<rbenv__revision pluginid="rbenv" ruby-class="String">master</rbenv__revision>
<ruby__build__repository pluginid="rbenv" ruby-class="String">https://github.com/sstephenson/ruby-build.git</ruby__build__repository>
<ruby__build__revision pluginid="rbenv" ruby-class="String">master</ruby__build__revision>
<version pluginid="rbenv" ruby-class="String">2.0.0-p353</version>
<ignore__local__version pluginid="rbenv" ruby-class="FalseClass"/>
</object>
</ruby-object>
</ruby-proxy-object>
</buildWrappers>
</project>

View File

@ -0,0 +1,10 @@
wrappers:
- rbenv:
ruby-version: 2.0.0-p353
ignore-local-version: false
preinstall-gem-list: "bundler,rake"
rbenv-root: "$HOME/.rbenv"
rbenv-repo: "https://github.com/sstephenson/rbenv.git"
rbenv-branch: "master"
ruby-build-repo: "https://github.com/sstephenson/ruby-build.git"
ruby-build-branch: "master"