natives

List native packages required by ruby gems on your machine.

What it does:

Install

gem install natives

Use

natives list capybara-webkit sqlite3

Have a gemfile?

natives list  # looks for Gemfile in current directory
natives list --gemfile Gemfile.special
natives list --gemfile /path/to/Gemfile.special

How to install native packages?

Output from natives list can be used together with your package manager e.g. brew, apt-get. If you need a package manager wrapper, try pacapt.

brew install $(natives list capybara-webkit sqlite3)
apt-get install $(natives list capybara-webkit sqlite3)
pacapt -S $(natives list capybara-webkit sqlite3)

Switch catalog

It uses ‘rubygems’ catalog by default. To use a different catalog:

natives list --catalog npm sqlite3

Custom (project-specific) catalog

It also looks for natives-catalogs/ in current directory. If exists, it loads all catalog files in the directory.

$ cd rails_app1
$ cat natives-catalogs/catalog1.yaml
rubygems:
  my_gem:
    homebrew:
      mac_os_x:
        - package1
    apt:
      default:
        - package2

$ natives list my_gem   # runs on mac os x
package1

Catalog

Supported catalogs

Catalog load paths

It loads YAML files (.yaml, .yml) from the following paths in this order:

  1. catalogs/ in this gem.

  2. natives-catalogs/ in current working directory, if any.

When there are multiple YAML files in a path, they are sorted by filename and loaded in that order.

Catalog YAML format

A catalog file is written in YAML, based on this format:

catalog_name:
  entry_name:
    package_provider:
      platform:
        platform_version:
          - package_name

For example,

rubygems:
  capybara-webkit:
    homebrew:
      mac_os_x:
        10.7.5:
          - libqtwebkit-dev

Use default when apply to all platforms

rubygems:
  curb:
    apt:
      default:
        - libcurl4-openssl-dev

Use default when apply to all platform versions

rubygems:
  capybara-webkit:
    homebrew:
      mac_os_x:
        default:
          - libqtwebkit-dev

Use array to group platform versions

rubygems:
  capybara-webkit:
    apt:
      ubuntu:
        [10.04, 10.04.1, 10.04.2, 10.04.3, 10.04.4]:
          - libqt4-dev
        default:
          - libqtwebkit-dev

Supported values for platforms and package providers

Not in the list? No worry, submit a PR to patch {host_detection/package_provider.rb}.

Package providers
aix
yum
packman
apt
feebsd
portage
homebrew
macports
solaris
ips
zypper
smartos
Platforms
aix
amazon
arch
centos
debian
fedora
freebsd
gcel
gentoo
linaro
linuxmint
mac_os_x
mac_os_x_server
nexentacore
omnios
openindiana
opensolaris
opensuse
oracle
raspbian
redhat
scientific
smartos
solaris2
suse
ubuntu
xcp
xenserver

Related work

Contributing to natives

Copyright © 2013 Huiming Teo. See LICENSE.txt for further details.