Difference between revisions of "Ruby Gem package guidelines"

From ArchWiki
Jump to: navigation, search
m (Prevent leading spaces when copy-pasting the example)
(Undo revision 187856 by Intgr (talk) leading spaces are used to format text in this Wiki)
Line 9: Line 9:
  
 
==Example PKGBUILD==
 
==Example PKGBUILD==
<pre>
+
  # Contributor: YourName <YourEmail AT example DOT com>
# Contributor: YourName <YourEmail AT example DOT com>
+
  pkgname=ruby-GEMNAME # All lowercase
pkgname=ruby-GEMNAME # All lowercase
+
  pkgver=GEMVERSION
pkgver=GEMVERSION
+
  pkgrel=1
pkgrel=1
+
  pkgdesc="Ruby gem FooBar which implements BazQuux"
pkgdesc="Ruby gem FooBar which implements BazQuux"
+
  arch=(any)
arch=(any)
+
  url=""
url=""
+
  license=()
license=()
+
  depends=(ruby) # Gem may depend on other gems as well (you can get dependency information from the yaml specification)
depends=(ruby) # Gem may depend on other gems as well (you can get dependency information from the yaml specification)
+
  makedepends=(rubygems)
makedepends=(rubygems)
+
  source=(http://rubygems.org/downloads/GEMNAME-$pkgver.gem)
source=(http://rubygems.org/downloads/GEMNAME-$pkgver.gem)
+
  noextract=(GEMNAME-$pkgver.gem)
noextract=(GEMNAME-$pkgver.gem)
+
  md5sums=()
md5sums=()
+
 
 
+
  build() {
build() {
+
    cd $srcdir
  cd $srcdir
+
    # _gemdir is defined inside build() because if ruby[gems] is not installed on the system
  # _gemdir is defined inside build() because if ruby[gems] is not installed on the system
+
    #  makepkg will barf when sourcing the PKGBUILD
  #  makepkg will barf when sourcing the PKGBUILD
+
    local _gemdir="$(ruby -rubygems -e'puts Gem.default_dir')"
  local _gemdir="$(ruby -rubygems -e'puts Gem.default_dir')"
+
    
 
+
    gem install --no-user-install --ignore-dependencies --verbose -i "$pkgdir$_gemdir" -n "$pkgdir"/usr/bin GEMNAME-$pkgver.gem
   gem install --no-user-install --ignore-dependencies --verbose -i "$pkgdir$_gemdir" -n "$pkgdir"/usr/bin GEMNAME-$pkgver.gem
+
  }
}
+
 
 
+
  # vim:set ts=2 sw=2 et:
# vim:set ts=2 sw=2 et:
+
</pre>
+
  
 
==Automation==
 
==Automation==

Revision as of 21:53, 5 March 2012

This template has only maintenance purposes. For linking to local translations please use interlanguage links, see Help:i18n#Interlanguage links.


Local languages: Català – Dansk – English – Español – Esperanto – Hrvatski – Indonesia – Italiano – Lietuviškai – Magyar – Nederlands – Norsk Bokmål – Polski – Português – Slovenský – Česky – Ελληνικά – Български – Русский – Српски – Українська – עברית – العربية – ไทย – 日本語 – 正體中文 – 简体中文 – 한국어


External languages (all articles in these languages should be moved to the external wiki): Deutsch – Français – Română – Suomi – Svenska – Tiếng Việt – Türkçe – فارسی

Package Naming

For libraries, use "ruby-gemname". For applications, use the program name. In either case, the pkgname should be entirely lowercase

Examples

For examples, please see github-gem ruby-json_pure ruby-hpricot

Example PKGBUILD

 # Contributor: YourName <YourEmail AT example DOT com>
 pkgname=ruby-GEMNAME # All lowercase
 pkgver=GEMVERSION
 pkgrel=1
 pkgdesc="Ruby gem FooBar which implements BazQuux"
 arch=(any)
 url=""
 license=()
 depends=(ruby) # Gem may depend on other gems as well (you can get dependency information from the yaml specification)
 makedepends=(rubygems)
 source=(http://rubygems.org/downloads/GEMNAME-$pkgver.gem)
 noextract=(GEMNAME-$pkgver.gem)
 md5sums=()
 
 build() {
   cd $srcdir
   # _gemdir is defined inside build() because if ruby[gems] is not installed on the system
   #  makepkg will barf when sourcing the PKGBUILD
   local _gemdir="$(ruby -rubygems -e'puts Gem.default_dir')"
 
   gem install --no-user-install --ignore-dependencies --verbose -i "$pkgdir$_gemdir" -n "$pkgdir"/usr/bin GEMNAME-$pkgver.gem
 }
 
 # vim:set ts=2 sw=2 et:

Automation

Abhishek Dasgupta wrote gem2arch to aid in automating the process of creating a ruby gem PKGBUILD. Make sure to manually check the PKGBUILD after generation. There are multiple versions of this tool in AUR (Search for gem2arch).

The gem installation can also be automated completely with the tool pacgem which creates a temporary PKGBUILD, calls makepkg and namcap. The resulting package is then installed with sudo pacman.