Coder Social home page Coder Social logo

obs-service-bundle_gems's Introduction

bundle_gems (OBS source service)

Build Status

This service is useful for Rails and similar applications using a Bundler Gemfile.

Configured correctly it will:

  • Read your source code and figure out dependent gems
  • Add those gems to the rpm .spec file

Usage

spec strategy (default)

  • You need a Gemfile and Gemfile.lock among your sources. If you have a tarball, consider using the extract_file service to extract them.

  • If your tarball is created from a git repository using the tar_scm source service, use the following parameters to tar_scm to extract the files:

  <param name="extract">Gemfile</param>
  <param name="extract">Gemfile.lock</param>
  • You need to mark the spec file with a special comment block, after the last sources.
Source2: somefile.tar.gz
# From here populated by obs-service-bundle_gems
### GEMS START
### GEMS END
  • Once there is a tarball, you configure the bundle_gems service.
<service name="bundle_gems"/>
  • As after the bundle_gems service, the gems will be listed in the rpm spec as a URL, you can configure the download_files gem to retrieve them.
# From here populated by obs-service-bundle_gems
### GEMS START
Source100: https://rubygems.org/downloads/actioncable-5.1.4.gem
Source101: https://rubygems.org/downloads/actionmailer-5.1.4.gem
Source102: https://rubygems.org/downloads/actionpack-5.1.4.gem
Source103: https://rubygems.org/downloads/actionview-5.1.4.gem
Source104: https://rubygems.org/downloads/activejob-5.1.4.gem
Source105: https://rubygems.org/downloads/activemodel-5.1.4.gem
...

Configure a service to retrieve those files:

  <service name="download_files"/>
  • The resulting _service file would look like:
<services>
  <service name="tar_scm">
    <param name="versionformat">15.0.git%cd.%h</param>
    <param name="url">git://github.com/openSUSE/software-o-o.git</param>
    <param name="scm">git</param>
    <param name="extract">Gemfile</param>
    <param name="extract">Gemfile.lock</param>
  </service>
  <service name="bundle_gems"/>
  <service name="download_files"/>
  <service name="recompress">
    <param name="compression">gz</param>
    <param name="file">*.tar</param>
  </service>
  <service name="set_version">
  </service>
</services>
  • Include Ruby and Bundler as requirement:
BuildRequires: rubygem(%{rb_default_ruby_abi}:bundler)
  • Install the gems in the vendor/cache in order to run tasks needed during build:
mkdir -p vendor/cache
cp %{_sourcedir}/*.gem vendor/cache

%build
gem="gem.%{rb_default_ruby_suffix}"
bundle="bundle.%{rb_default_ruby_suffix}"
export GEM_HOME=$PWD/vendor GEM_PATH=$PWD/vendor PATH=$PWD/vendor/bin:$PATH
$gem install vendor/cache/bundle*.gem
$bundle config build.nokogiri --use-system-libraries
$bundle --local --deployment --with production

cpio mode

Compared to the default spec strategy mode, the cpio strategy mode makes use of bundler to create a vendor.obscpio file. This has the advantage that you can also use gems from sources other than rubygems.org and nothing gets written to your spec file (you don't need the # GEMS START marker). Most of the description from the spec strategy mode (default) applies as well in this mode. However, you need to explictly set the strategy to cpio in your service file with:

<service name="bundle_gems">
  <param name="strategy">cpio</param>
</service>

The vendor obscpio gets automatically unpacked during build. The gems are located under rpmbuild/SOURCES/vendor/cache in your build environment.

Authors

License

The code is licensed under the GPLv2 or later.

obs-service-bundle_gems's People

Contributors

dmacvicar avatar chrisbr avatar ana06 avatar jordimassaguerpla avatar vpereira avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.