dm-keeper-adapter

A DataMapper adapter for features.opensuse.org

Usage

This adapter allows easy access to the openSUSE feature database using DataMapper. It supports features, relationtrees, productlines, and products.

features.opensuse.org is the web frontend, the database server provides an xquery API at keeper.novell.com/sxkeeper, which is used by this adapter - hence the name.

Install

Install it with

gem install dm-keeper-adapter

Code

require 'rubygems'
require 'dm-core'
require 'dm-keeper-adapter'

DataMapper::Logger.new($stdout, :debug)

# Retrieves credentials from ~/.oscrc if exists
# Otherwise add user:pass@ before keeper.novell.com 
keeper = DataMapper.setup(:default, :adapter => 'keeper', :url  => 'https://keeper.novell.com/sxkeeper')

require 'keeper/feature'
DataMapper.finalize

# Get feature by ID
f = Feature.get(311545)

# Finding features (see http://datamapper.org/docs/find.html)

# Get feature by title (assuming there's only one)
f = Feature.first(:title => "Feature title")

# Get all features matching a title string
features = Feature.all(:title.like => "foobar")

TODO

Real DataMapper queries mapped to XPath

License

MIT

Author

Klaus Kämpf <[email protected]>