Add new RubyPackage build system base class (#18199)

* Add new RubyPackage build system base class

* Ruby: add spack external find support

* Add build tests for RubyPackage
This commit is contained in:
Adam J. Stewart 2020-09-02 18:26:36 -05:00 committed by GitHub
parent e22a0ca5cf
commit 443407cda5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 513 additions and 112 deletions

View file

@ -18,6 +18,7 @@ on:
- '!var/spack/repos/builtin/packages/py-setuptools/**'
- '!var/spack/repos/builtin/packages/openjpeg/**'
- '!var/spack/repos/builtin/packages/r-rcpp/**'
- '!var/spack/repos/builtin/packages/ruby-rake/**'
# Don't run if we only modified documentation
- 'lib/spack/docs/**'
@ -26,7 +27,14 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
package: [lz4, mpich, tut, py-setuptools, openjpeg, r-rcpp]
package:
- lz4 # MakefilePackage
- mpich # AutotoolsPackage
- tut # WafPackage
- py-setuptools # PythonPackage
- openjpeg # CMakePackage
- r-rcpp # RPackage
- ruby-rake # RubyPackage
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
@ -41,9 +49,10 @@ jobs:
- name: Install System Packages
run: |
sudo apt-get update
sudo apt-get -yqq install ccache gfortran perl perl-base r-base r-base-core r-base-dev findutils openssl libssl-dev libpciaccess-dev
sudo apt-get -yqq install ccache gfortran perl perl-base r-base r-base-core r-base-dev ruby findutils openssl libssl-dev libpciaccess-dev
R --version
perl --version
ruby --version
- name: Copy Configuration
run: |
ccache -M 300M && ccache -z

View file

@ -12,5 +12,173 @@ RubyPackage
Like Perl, Python, and R, Ruby has its own build system for
installing Ruby gems.
This build system is a work-in-progress. See
https://github.com/spack/spack/pull/3127 for more information.
^^^^^^
Phases
^^^^^^
The ``RubyPackage`` base class provides the following phases that
can be overridden:
#. ``build`` - build everything needed to install
#. ``install`` - install everything from build directory
For packages that come with a ``*.gemspec`` file, these phases run:
.. code-block:: console
$ gem build *.gemspec
$ gem install *.gem
For packages that come with a ``Rakefile`` file, these phases run:
.. code-block:: console
$ rake package
$ gem install *.gem
For packages that come pre-packaged as a ``*.gem`` file, the build
phase is skipped and the install phase runs:
.. code-block:: console
$ gem install *.gem
These are all standard ``gem`` commands and can be found by running:
.. code-block:: console
$ gem help commands
For packages that only distribute ``*.gem`` files, these files can be
downloaded with the ``expand=False`` option in the ``version`` directive.
The build phase will be automatically skipped.
^^^^^^^^^^^^^^^
Important files
^^^^^^^^^^^^^^^
When building from source, Ruby packages can be identified by the
presence of any of the following files:
* ``*.gemspec``
* ``Rakefile``
* ``setup.rb`` (not yet supported)
However, not all Ruby packages are released as source code. Some are only
released as ``*.gem`` files. These files can be extracted using:
.. code-block:: console
$ gem unpack *.gem
^^^^^^^^^^^
Description
^^^^^^^^^^^
The ``*.gemspec`` file may contain something like:
.. code-block:: ruby
summary = 'An implementation of the AsciiDoc text processor and publishing toolchain'
description = 'A fast, open source text processor and publishing toolchain for converting AsciiDoc content to HTML 5, DocBook 5, and other formats.'
Either of these can be used for the description of the Spack package.
^^^^^^^^
Homepage
^^^^^^^^
The ``*.gemspec`` file may contain something like:
.. code-block:: ruby
homepage = 'https://asciidoctor.org'
This should be used as the official homepage of the Spack package.
^^^^^^^^^^^^^^^^^^^^^^^^^
Build system dependencies
^^^^^^^^^^^^^^^^^^^^^^^^^
All Ruby packages require Ruby at build and run-time. For this reason,
the base class contains:
.. code-block:: python
extends('ruby')
depends_on('ruby', type=('build', 'run'))
The ``*.gemspec`` file may contain something like:
.. code-block:: ruby
required_ruby_version = '>= 2.3.0'
This can be added to the Spack package using:
.. code-block:: python
depends_on('ruby@2.3.0:', type=('build', 'run'))
^^^^^^^^^^^^^^^^^
Ruby dependencies
^^^^^^^^^^^^^^^^^
When you install a package with ``gem``, it reads the ``*.gemspec``
file in order to determine the dependencies of the package.
If the dependencies are not yet installed, ``gem`` downloads them
and installs them for you. This may sound convenient, but Spack
cannot rely on this behavior for two reasons:
#. Spack needs to be able to install packages on air-gapped networks.
If there is no internet connection, ``gem`` can't download the
package dependencies. By explicitly listing every dependency in
the ``package.py``, Spack knows what to download ahead of time.
#. Duplicate installations of the same dependency may occur.
Spack supports *activation* of Ruby extensions, which involves
symlinking the package installation prefix to the Ruby installation
prefix. If your package is missing a dependency, that dependency
will be installed to the installation directory of the same package.
If you try to activate the package + dependency, it may cause a
problem if that package has already been activated.
For these reasons, you must always explicitly list all dependencies.
Although the documentation may list the package's dependencies,
often the developers assume people will use ``gem`` and won't have to
worry about it. Always check the ``*.gemspec`` file to find the true
dependencies.
Check for the following clues in the ``*.gemspec`` file:
* ``add_runtime_dependency``
These packages are required for installation.
* ``add_dependency``
This is an alias for ``add_runtime_dependency``
* ``add_development_dependency``
These packages are optional dependencies used for development.
They should not be added as dependencies of the package.
^^^^^^^^^^^^^^^^^^^^^^
External documentation
^^^^^^^^^^^^^^^^^^^^^^
For more information on Ruby packaging, see:
https://guides.rubygems.org/

View file

@ -0,0 +1,59 @@
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import glob
import inspect
from spack.directives import depends_on, extends
from spack.package import PackageBase, run_after
class RubyPackage(PackageBase):
"""Specialized class for building Ruby gems.
This class provides two phases that can be overridden if required:
#. :py:meth:`~.RubyPackage.build`
#. :py:meth:`~.RubyPackage.install`
"""
#: Phases of a Ruby package
phases = ['build', 'install']
#: This attribute is used in UI queries that need to know the build
#: system base class
build_system_class = 'RubyPackage'
extends('ruby')
depends_on('ruby', type=('build', 'run'))
def build(self, spec, prefix):
"""Build a Ruby gem."""
# ruby-rake provides both rake.gemspec and Rakefile, but only
# rake.gemspec can be built without an existing rake installation
gemspecs = glob.glob('*.gemspec')
rakefiles = glob.glob('Rakefile')
if gemspecs:
inspect.getmodule(self).gem('build', '--norc', gemspecs[0])
elif rakefiles:
jobs = inspect.getmodule(self).make_jobs
inspect.getmodule(self).rake('package', '-j{0}'.format(jobs))
else:
# Some Ruby packages only ship `*.gem` files, so nothing to build
pass
def install(self, spec, prefix):
"""Install a Ruby gem.
The ruby package sets ``GEM_HOME`` to tell gem where to install to."""
gems = glob.glob('*.gem')
if gems:
inspect.getmodule(self).gem(
'install', '--norc', '--ignore-dependencies', gems[0])
# Check that self.prefix is there after installation
run_after('install')(PackageBase.sanity_check_prefix)

View file

@ -352,6 +352,34 @@ def __init__(self, name, *args, **kwargs):
super(OctavePackageTemplate, self).__init__(name, *args, **kwargs)
class RubyPackageTemplate(PackageTemplate):
"""Provides appropriate overrides for Ruby packages"""
base_class_name = 'RubyPackage'
dependencies = """\
# FIXME: Add dependencies if required. Only add the ruby dependency
# if you need specific versions. A generic ruby dependency is
# added implicity by the RubyPackage class.
# depends_on('ruby@X.Y.Z:', type=('build', 'run'))
# depends_on('ruby-foo', type=('build', 'run'))"""
body_def = """\
def build(self, spec, prefix):
# FIXME: If not needed delete this function
pass"""
def __init__(self, name, *args, **kwargs):
# If the user provided `--name ruby-numpy`, don't rename it
# ruby-ruby-numpy
if not name.startswith('ruby-'):
# Make it more obvious that we are renaming the package
tty.msg("Changing package name from {0} to ruby-{0}".format(name))
name = 'ruby-{0}'.format(name)
super(RubyPackageTemplate, self).__init__(name, *args, **kwargs)
class MakefilePackageTemplate(PackageTemplate):
"""Provides appropriate overrides for Makefile packages"""
@ -410,6 +438,7 @@ def __init__(self, name, *args, **kwargs):
'perlmake': PerlmakePackageTemplate,
'perlbuild': PerlbuildPackageTemplate,
'octave': OctavePackageTemplate,
'ruby': RubyPackageTemplate,
'makefile': MakefilePackageTemplate,
'intel': IntelPackageTemplate,
'meson': MesonPackageTemplate,
@ -464,12 +493,16 @@ def __call__(self, stage, url):
"""Try to guess the type of build system used by a project based on
the contents of its archive or the URL it was downloaded from."""
# Most octave extensions are hosted on Octave-Forge:
# https://octave.sourceforge.net/index.html
# They all have the same base URL.
if url is not None and 'downloads.sourceforge.net/octave/' in url:
self.build_system = 'octave'
return
if url is not None:
# Most octave extensions are hosted on Octave-Forge:
# https://octave.sourceforge.net/index.html
# They all have the same base URL.
if 'downloads.sourceforge.net/octave/' in url:
self.build_system = 'octave'
return
if url.endswith('.gem'):
self.build_system = 'ruby'
return
# A list of clues that give us an idea of the build system a package
# uses. If the regular expression matches a file contained in the
@ -488,6 +521,9 @@ def __call__(self, stage, url):
(r'/WORKSPACE$', 'bazel'),
(r'/Build\.PL$', 'perlbuild'),
(r'/Makefile\.PL$', 'perlmake'),
(r'/.*\.gemspec$', 'ruby'),
(r'/Rakefile$', 'ruby'),
(r'/setup\.rb$', 'ruby'),
(r'/.*\.pro$', 'qmake'),
(r'/(GNU)?[Mm]akefile$', 'makefile'),
(r'/DESCRIPTION$', 'octave'),

View file

@ -27,6 +27,7 @@
from spack.build_systems.python import PythonPackage
from spack.build_systems.r import RPackage
from spack.build_systems.perl import PerlPackage
from spack.build_systems.ruby import RubyPackage
from spack.build_systems.intel import IntelPackage
from spack.build_systems.meson import MesonPackage
from spack.build_systems.sip import SIPPackage

View file

@ -23,6 +23,9 @@
('WORKSPACE', 'bazel'),
('Makefile.PL', 'perlmake'),
('Build.PL', 'perlbuild'),
('foo.gemspec', 'ruby'),
('Rakefile', 'ruby'),
('setup.rb', 'ruby'),
('GNUmakefile', 'makefile'),
('makefile', 'makefile'),
('Makefile', 'makefile'),

View file

@ -29,4 +29,8 @@ packages:
externals:
- spec: libpciaccess@0.13.5
prefix: /usr
ruby:
buildable: False
externals:
- spec: ruby@2.5.1
prefix: /usr

View file

@ -1,20 +0,0 @@
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Asciidoctor(Package):
"""Modern asciidoc tool based on ruby"""
homepage = "https://asciidoctor.org/"
url = "https://rubygems.org/downloads/asciidoctor-1.5.8.gem"
version('1.5.8', sha256='9deaa93eacadda48671e18395b992eafba35d08f25ddbe28d25bb275831a8d62', expand=False)
extends('ruby')
def install(self, spec, prefix):
gem('install', 'asciidoctor-{0}.gem'.format(self.version))

View file

@ -0,0 +1,16 @@
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
class RubyAsciidoctor(RubyPackage):
"""A fast, open source text processor and publishing toolchain for
converting AsciiDoc content to HTML 5, DocBook 5, and other formats."""
homepage = "https://asciidoctor.org/"
url = "https://github.com/asciidoctor/asciidoctor/archive/v2.0.10.tar.gz"
version('2.0.10', sha256='afca74837e6d4b339535e8ba0b79f2ad00bd1eef78bf391cc36995ca2e31630a')
depends_on('ruby@2.3.0:', type=('build', 'run'))

View file

@ -0,0 +1,19 @@
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
class RubyErubis(RubyPackage):
"""Erubis is a fast, secure, and very extensible implementation of eRuby.
"""
homepage = "http://www.kuwata-lab.com/erubis/"
git = "https://github.com/kwatch/erubis.git"
version('master', branch='master')
version('2.7.0', commit='14d3eab57fbc361312c8f3af350cbf9a5bafce17')
def patch(self):
filter_file('$Release$', str(self.version),
'erubis.gemspec', string=True)

View file

@ -3,20 +3,16 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RubyGnuplot(Package):
class RubyGnuplot(RubyPackage):
"""Utility library to aid in interacting with gnuplot from ruby"""
homepage = "https://rubygems.org/gems/gnuplot/versions/2.6.2"
homepage = "https://github.com/rdp/ruby_gnuplot"
url = "https://rubygems.org/downloads/gnuplot-2.6.2.gem"
# Source code is available at https://github.com/rdp/ruby_gnuplot
# but release tarballs are not available, download gem instead
version('2.6.2', sha256='d2c28d4a55867ef6f0a5725ce157581917b4d27417bc3767c7c643a828416bb3', expand=False)
depends_on('gnuplot+X')
extends('ruby')
def install(self, spec, prefix):
gem('install', 'gnuplot-{0}.gem'.format(self.version))

View file

@ -0,0 +1,16 @@
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
class RubyHpricot(RubyPackage):
"""A swift, liberal HTML parser with a fantastic library.
NOTE: ruby-hpricot is no longer maintained, consider ruby-nokogiri instead.
"""
homepage = "https://github.com/hpricot/hpricot"
url = "https://github.com/hpricot/hpricot/archive/0.8.6.tar.gz"
version('0.8.6', sha256='792f63cebe2f2b02058974755b4c8a3aef52e5daf37f779a34885d5ff2876017')

View file

@ -0,0 +1,16 @@
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
class RubyMustache(RubyPackage):
"""Inspired by ctemplate and et, Mustache is a framework-agnostic way to
render logic-free views."""
homepage = "https://github.com/mustache/mustache"
url = "https://github.com/mustache/mustache/archive/v1.1.1.tar.gz"
version('1.1.1', sha256='9ab4a9842a37d5278789ba26152b0b78f649e3020266809ec33610a89f7e65ea')
depends_on('ruby@2.0:', type=('build', 'run'))

View file

@ -3,21 +3,15 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RubyNarray(Package):
class RubyNarray(RubyPackage):
"""Numo::NArray is an Numerical N-dimensional Array class for fast
processing and easy manipulation of multi-dimensional numerical data,
similar to numpy.ndaray."""
homepage = "https://rubygems.org/gems/narray"
git = "https://github.com/ruby-numo/narray.git"
homepage = "https://masa16.github.io/narray/"
url = "https://github.com/ruby-numo/numo-narray/archive/v0.9.1.8.tar.gz"
version('0.9.0.9', commit='9cadbbccf1e01b6d1bc143c19d598cad1c420869')
version('0.9.1.8', sha256='48814c6ebf2c4846fcf6cfd2705a15a97a608960c1676cb6c7b5c9254b0dd51b')
extends('ruby')
def install(self, spec, prefix):
gem('build', 'numo-narray.gemspec')
gem('install', 'numo-narray-{0}.gem'.format(self.version))
depends_on('ruby@2.2:2.999', type=('build', 'run'))

View file

@ -0,0 +1,15 @@
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
class RubyRake(RubyPackage):
"""Rake is a Make-like program implemented in Ruby."""
homepage = "https://github.com/ruby/rake"
url = "https://github.com/ruby/rake/archive/v13.0.1.tar.gz"
version('13.0.1', sha256='d865329b5e0c38bd9d11ce70bd1ad6e0d5676c4eee74fd818671c55ec49d92fd')
depends_on('ruby@2.2:', type=('build', 'run'))

View file

@ -0,0 +1,15 @@
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
class RubyRdiscount(RubyPackage):
"""Fast Implementation of Gruber's Markdown in C."""
homepage = "https://dafoster.net/projects/rdiscount/"
url = "https://github.com/davidfstr/rdiscount/archive/2.2.0.2.tar.gz"
version('2.2.0.2', sha256='a6956059fc61365c242373b03c5012582d7342842eae38fe59ebc1bc169744db')
depends_on('ruby@1.9.3:', type=('build', 'run'))

View file

@ -3,21 +3,17 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RubyRonn(Package):
class RubyRonn(RubyPackage):
"""Ronn builds manuals. It converts simple, human readable textfiles to
roff for terminal display, and also to HTML for the web."""
homepage = "https://rubygems.org/gems/ronn"
homepage = "https://rtomayko.github.io/ronn/"
url = "https://github.com/rtomayko/ronn/archive/0.7.3.tar.gz"
version('0.7.3', sha256='808aa6668f636ce03abba99c53c2005cef559a5099f6b40bf2c7aad8e273acb4')
version('0.7.0', sha256='ea14337093de8707aa8a67b97357332fa8a03b0df722bdbf4f027fbe4379b185')
extends('ruby')
def install(self, spec, prefix):
gem('build', 'ronn.gemspec')
gem('install', 'ronn-{0}.gem'.format(self.version))
depends_on('ruby-hpricot@0.8.2:', type=('build', 'run'))
depends_on('ruby-rdiscount@1.5.8:', type=('build', 'run'))
depends_on('ruby-mustache@0.7.0:', type=('build', 'run'))

View file

@ -3,18 +3,16 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RubyRubyinline(Package):
class RubyRubyinline(RubyPackage):
"""Inline allows you to write foreign code within your ruby code."""
homepage = "https://rubygems.org/gems/RubyInline"
url = "https://rubygems.org/downloads/RubyInline-3.12.4.gem"
homepage = "https://www.zenspider.com/projects/rubyinline.html"
url = "https://rubygems.org/downloads/RubyInline-3.12.5.gem"
version('3.12.4', sha256='205bbc14c02d3d55e1b497241ede832ab87f3d981f92f3bda98b75e8144103e0', expand=False)
# Source code available at https://github.com/seattlerb/rubyinline
# but I had trouble getting the Rakefile to build
extends('ruby')
version('3.12.5', sha256='d4559cb86b7fedd2e9b4b0a3bd99a1955186dbc09f1269920a0dd5c67639c156', expand=False)
def install(self, spec, prefix):
gem('install', 'RubyInline-{0}.gem'.format(self.version))
depends_on('ruby-zentest@4.3:4.999', type=('build', 'run'))

View file

@ -3,10 +3,8 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RubySvn2git(Package):
class RubySvn2git(RubyPackage):
"""svn2git is a tiny utility for migrating projects from Subversion to Git
while keeping the trunk, branches and tags where they should be. It uses
git-svn to clone an svn repository and does some clean-up to make sure
@ -21,9 +19,3 @@ class RubySvn2git(Package):
depends_on('git')
depends_on('subversion+perl')
extends('ruby')
def install(self, spec, prefix):
gem('build', 'svn2git.gemspec')
gem('install', 'svn2git-{0}.gem'.format(self.version))

View file

@ -3,18 +3,13 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RubyTerminalTable(Package):
class RubyTerminalTable(RubyPackage):
"""Simple, feature rich ascii table generation library"""
homepage = "https://rubygems.org/gems/terminal-table"
url = "https://rubygems.org/downloads/terminal-table-1.8.0.gem"
homepage = "https://github.com/tj/terminal-table"
url = "https://github.com/tj/terminal-table/archive/v1.8.0.tar.gz"
version('1.8.0', sha256='13371f069af18e9baa4e44d404a4ada9301899ce0530c237ac1a96c19f652294', expand=False)
version('1.8.0', sha256='69b8e157f5dc3f056b5242923ab3e729a16c6f893b3a5d540e71135a973e5fbe')
extends('ruby')
def install(self, spec, prefix):
gem('install', 'terminal-table-{0}.gem'.format(self.version))
depends_on('ruby-unicode-display-width@1.1.1:1.999', type=('build', 'run'))

View file

@ -0,0 +1,15 @@
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
class RubyThor(RubyPackage):
"""Thor is a toolkit for building powerful command-line interfaces."""
homepage = "http://whatisthor.com/"
url = "https://github.com/erikhuda/thor/archive/v1.0.1.tar.gz"
version('1.0.1', sha256='e6b902764e237ce296cf9e339c93f8ca83bec5b59be0bf8bacd7ffddc6684d07')
depends_on('ruby@2.0.0:', type=('build', 'run'))

View file

@ -0,0 +1,18 @@
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
class RubyTmuxinator(RubyPackage):
"""Create and manage complex tmux sessions easily."""
homepage = "https://github.com/tmuxinator/tmuxinator"
url = "https://github.com/tmuxinator/tmuxinator/archive/v2.0.1.tar.gz"
version('2.0.1', sha256='a2c8428d239a6e869da516cecee3ac64db47ba1f1932317eb397b1afd698ee09')
depends_on('ruby@2.5.8:', type=('build', 'run'))
depends_on('ruby-erubis@2.6:2.999', type=('build', 'run'))
depends_on('ruby-thor@1.0:1.999', type=('build', 'run'))
depends_on('ruby-xdg@2.2.5:2.999', type=('build', 'run'))

View file

@ -0,0 +1,15 @@
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
class RubyUnicodeDisplayWidth(RubyPackage):
"""Determines the monospace display width of a string in Ruby."""
homepage = "https://github.com/janlelis/unicode-display_width"
url = "https://github.com/janlelis/unicode-display_width/archive/v1.7.0.tar.gz"
version('1.7.0', sha256='2dd6faa95e022a9f52841d29be6c622c58fff9fb0b84fb2cb30d4f0e13fa8a73')
depends_on('ruby@1.9.3:', type=('build', 'run'))

View file

@ -0,0 +1,18 @@
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
class RubyXdg(RubyPackage):
"""Provides a Ruby implementation of the XDG Base Directory Specification.
"""
homepage = "https://www.alchemists.io/projects/xdg/"
url = "https://rubygems.org/downloads/xdg-2.2.5.gem"
# Source code can be found at https://github.com/bkuhlmann/xdg and
# https://github.com/rubyworks/xdg but I was unable to get it to build
# from source
version('2.2.5', sha256='f3a5f799363852695e457bb7379ac6c4e3e8cb3a51ce6b449ab47fbb1523b913', expand=False)

View file

@ -0,0 +1,19 @@
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
class RubyZentest(RubyPackage):
"""ZenTest provides 4 different tools: zentest, unit_diff, autotest, and
multiruby."""
homepage = "https://github.com/seattlerb/zentest"
url = "https://rubygems.org/downloads/ZenTest-4.12.0.gem"
# Source code available at https://github.com/seattlerb/zentest
# but I had trouble getting the Rakefile to build
version('4.12.0', sha256='5301757c3ab29dd2222795c1b076dd348f4d92fe0426e97a13ae56fea47a786e', expand=False)
depends_on('ruby@1.8:2.999', type=('build', 'run'))

View file

@ -3,7 +3,7 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
import re
class Ruby(AutotoolsPackage):
@ -54,6 +54,14 @@ class Ruby(AutotoolsPackage):
expand=False
)
executables = ['^ruby$']
@classmethod
def determine_version(cls, exe):
output = Executable(exe)('--version', output=str, error=str)
match = re.search(r'ruby ([\d.]+)', output)
return match.group(1) if match else None
def url_for_version(self, version):
url = "http://cache.ruby-lang.org/pub/ruby/{0}/ruby-{1}.tar.gz"
return url.format(version.up_to(2), version)
@ -92,8 +100,9 @@ def setup_dependent_package(self, module, dependent_spec):
gem('install', '<gem-name>.gem')
"""
# Ruby extension builds have global ruby and gem functions
module.ruby = Executable(join_path(self.spec.prefix.bin, 'ruby'))
module.gem = Executable(join_path(self.spec.prefix.bin, 'gem'))
module.ruby = Executable(self.prefix.bin.ruby)
module.gem = Executable(self.prefix.bin.gem)
module.rake = Executable(self.prefix.bin.rake)
@run_after('install')
def post_install(self):

View file

@ -1,21 +0,0 @@
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Tmuxinator(Package):
"""A session configuration creator and manager for tmux"""
homepage = "https://github.com/tmuxinator/tmuxinator"
git = "https://github.com/tmuxinator/tmuxinator.git"
version('0.6.11', tag='v0.6.11')
extends('ruby')
def install(self, spec, prefix):
gem('build', 'tmuxinator.gemspec')
gem('install', 'tmuxinator-{0}.gem'.format(self.version))