Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
rubygemsrecipe
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Xavier Thompson
rubygemsrecipe
Commits
a5b62f3d
Commit
a5b62f3d
authored
Jan 25, 2014
by
sirex
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated documentation and did small refactoring to increase code readability.
parent
c66433ea
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
14 deletions
+41
-14
CHANGES.rst
CHANGES.rst
+7
-0
README.rst
README.rst
+14
-0
rubygems.py
rubygems.py
+20
-14
No files found.
CHANGES.rst
View file @
a5b62f3d
Change History
Change History
**************
**************
0.1.8 (2014-01-25)
==================
- Feature: added 'gem-options' and 'environment' options.
- Fix: add quotes to values of environment variables.
0.1.7 (2012-05-24)
0.1.7 (2012-05-24)
==================
==================
...
...
README.rst
View file @
a5b62f3d
...
@@ -39,3 +39,17 @@ version
...
@@ -39,3 +39,17 @@ version
ruby-executable
ruby-executable
A path to a Ruby executable. Gems will be installed using this executable.
A path to a Ruby executable. Gems will be installed using this executable.
gem-options
Extra options, that will be passed to gem executable. Example::
gem-options =
--with-icu-lib=${icu:location}/lib/
--with-icu-dir=${icu:location}/
environment
Possibility to add or override environment variables. Example::
environment =
LDFLAGS = -L${icu:location}/lib -Wl,-rpath=${icu:location}/lib
CFLAGS = -I${icu:location}/include
rubygems.py
View file @
a5b62f3d
...
@@ -9,6 +9,8 @@ import subprocess
...
@@ -9,6 +9,8 @@ import subprocess
import
urllib
import
urllib
import
zc.buildout
import
zc.buildout
from
string
import
strip
class
Recipe
(
object
):
class
Recipe
(
object
):
"""zc.buildout recipe for compiling and installing software"""
"""zc.buildout recipe for compiling and installing software"""
...
@@ -59,6 +61,15 @@ class Recipe(object):
...
@@ -59,6 +61,15 @@ class Recipe(object):
def
_join_paths
(
self
,
*
paths
):
def
_join_paths
(
self
,
*
paths
):
return
':'
.
join
(
filter
(
None
,
paths
))
return
':'
.
join
(
filter
(
None
,
paths
))
def
_get_env_override
(
self
,
env
):
env
=
filter
(
None
,
map
(
strip
,
env
.
splitlines
()))
try
:
env
=
[
map
(
strip
,
line
.
split
(
'='
,
1
))
for
line
in
env
]
except
ValueError
:
# Unpacking impossible
self
.
log
.
error
(
"Every environment line should contain a '=' sign"
)
zc
.
buildout
.
UserError
(
'Configuration error'
)
return
env
def
_get_env
(
self
):
def
_get_env
(
self
):
s
=
{
s
=
{
'PATH'
:
os
.
environ
.
get
(
'PATH'
,
''
),
'PATH'
:
os
.
environ
.
get
(
'PATH'
,
''
),
...
@@ -78,16 +89,9 @@ class Recipe(object):
...
@@ -78,16 +89,9 @@ class Recipe(object):
'%(PREFIX)s/bin'
,
'%(PREFIX)s/bin'
,
)
%
s
,
)
%
s
,
}
}
try
:
env_override
=
self
.
options
.
get
(
'environment'
,
''
)
env_override
=
self
.
options
.
get
(
'environment'
,
''
)
env
=
{
k
:
v
%
env
env_override
=
self
.
_get_env_override
(
env_override
)
for
k
,
v
in
[[
i
.
strip
()
for
i
in
line
.
split
(
'='
,
1
)]
env
=
{
k
:
v
%
env
for
k
,
v
in
env_override
}
for
line
in
env_override
.
split
(
'
\
n
'
)
if
line
.
strip
()]
}
except
ValueError
:
# Unpacking impossible
self
.
log
.
error
(
"Every environment line should contain a '=' sign"
)
zc
.
buildout
.
UserError
(
'Configuration error'
)
return
env
return
env
def
_get_latest_rubygems
(
self
):
def
_get_latest_rubygems
(
self
):
...
@@ -176,6 +180,8 @@ class Recipe(object):
...
@@ -176,6 +180,8 @@ class Recipe(object):
gem_executable
=
self
.
get_gem_executable
(
bindir
)
gem_executable
=
self
.
get_gem_executable
(
bindir
)
for
gemname
in
self
.
gems
:
for
gemname
in
self
.
gems
:
extra
=
self
.
options
.
get
(
'gem-options'
,
''
)
extra
=
' '
.
join
(
filter
(
None
,
map
(
strip
,
extra
.
splitlines
())))
s
=
{
s
=
{
'GEM'
:
gem_executable
,
'GEM'
:
gem_executable
,
'OPTIONS'
:
' '
.
join
([
'OPTIONS'
:
' '
.
join
([
...
@@ -183,12 +189,12 @@ class Recipe(object):
...
@@ -183,12 +189,12 @@ class Recipe(object):
'--no-ri'
,
'--no-ri'
,
'--bindir=%s'
%
bindir
,
'--bindir=%s'
%
bindir
,
]),
]),
'EXTRA'
:
self
.
options
.
get
(
'gem-options'
,
''
)
,
'EXTRA'
:
extra
,
}
}
if
'=='
in
gemname
:
if
'=='
in
gemname
:
gemname
,
version
=
gemname
.
split
(
'=='
,
1
)
gemname
,
version
=
map
(
strip
,
gemname
.
split
(
'=='
,
1
)
)
s
[
'GEMNAME'
]
=
gemname
.
strip
()
s
[
'GEMNAME'
]
=
gemname
s
[
'OPTIONS'
]
+=
' --version %s'
%
version
.
strip
()
s
[
'OPTIONS'
]
+=
' --version %s'
%
version
else
:
else
:
s
[
'GEMNAME'
]
=
gemname
s
[
'GEMNAME'
]
=
gemname
self
.
run
(
'%(GEM)s install %(OPTIONS)s %(GEMNAME)s -- %(EXTRA)s'
%
s
,
self
.
run
(
'%(GEM)s install %(OPTIONS)s %(GEMNAME)s -- %(EXTRA)s'
%
s
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment