File: README.rdoc

package info (click to toggle)
ruby-augeas 1%3A0.5.0%2Bgem-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 188 kB
  • sloc: ruby: 309; ansic: 304; makefile: 4
file content (34 lines) | stat: -rw-r--r-- 1,048 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
= Ruby bindings for augeas

The class Augeas provides bindings to augeas [http://augeas.net] library.

== Usage: Setting Data
    Augeas::open do |aug|
      aug.set("/files/etc/sysconfig/firstboot/RUN_FIRSTBOOT", "YES")
      unless aug.save
        raise IOError, "Failed to save changes"
      end
    end

== Usage: Accessing Data
    firstboot = Augeas::open { |aug| aug.get("/files/etc/sysconfig/firstboot/RUN_FIRSTBOOT") }

== Usage: Removing Data
    Augeas::open do |aug|
      aug.rm("/files/etc/sysconfig/firstboot/RUN_FIRSTBOOT")
      unless aug.save
        raise IOError, "Failed to save changes"
      end
    end

== Usage: Minimal Setup with a Custom Root

By passing +NO_MODL_AUTOLOAD+, no files are read on startup; that allows
setting up a custom transform.

  Augeas::open("/var/tmp/augeas-root", "/usr/local/share/mylenses",
                Augeas::NO_MODL_AUTOLOAD) do |aug|
    aug.transform(:lens => "Aliases.lns", :incl => "/etc/aliases")
    aug.load
    aug.get("/files/etc/aliases/*[name = 'postmaster']/value")
  end