ruby-augeas 0.4.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/COPYING +38 -46
- data/NEWS +26 -1
- data/README.md +86 -0
- data/Rakefile +12 -8
- data/ext/augeas/_augeas.c +238 -30
- data/ext/augeas/_augeas.h +48 -0
- data/ext/augeas/extconf.rb +4 -0
- data/lib/augeas/facade.rb +326 -0
- data/lib/augeas.rb +94 -0
- data/tests/tc_augeas.rb +85 -2
- data/tests/tc_facade.rb +554 -0
- metadata +32 -53
- data/README.rdoc +0 -34
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 516d7f0b53e2ef92757c400168ab4fd4ac8f1fe121ba3378f89293d181d1a8ad
|
4
|
+
data.tar.gz: 7e2511ae0787aa55a441a311218caf78fe954e02f863b73cc00a6f2419834cb0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a390e7d3add28bfdc4624ebcb6b6e4887b8f613751c1507fb30f72ce2b04e36e5c2b33a51712c72a0200c9218528ab9bb02b5d15761116a8e6375d7e7d8afe01
|
7
|
+
data.tar.gz: c7700610c5447a52673685a4a414fb2cef0ea3bc6214a8e9ac751812e23cdd39088b80bbc62765ade52a48d7cc7aece836dcc6a9412cd3e5f8542ed9b5d8663f
|
data/COPYING
CHANGED
@@ -1,9 +1,8 @@
|
|
1
|
-
|
2
1
|
GNU LESSER GENERAL PUBLIC LICENSE
|
3
2
|
Version 2.1, February 1999
|
4
3
|
|
5
4
|
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
6
|
-
|
5
|
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
7
6
|
Everyone is permitted to copy and distribute verbatim copies
|
8
7
|
of this license document, but changing it is not allowed.
|
9
8
|
|
@@ -23,8 +22,7 @@ specially designated software packages--typically libraries--of the
|
|
23
22
|
Free Software Foundation and other authors who decide to use it. You
|
24
23
|
can use it too, but we suggest you first think carefully about whether
|
25
24
|
this license or the ordinary General Public License is the better
|
26
|
-
strategy to use in any particular case, based on the explanations
|
27
|
-
below.
|
25
|
+
strategy to use in any particular case, based on the explanations below.
|
28
26
|
|
29
27
|
When we speak of free software, we are referring to freedom of use,
|
30
28
|
not price. Our General Public Licenses are designed to make sure that
|
@@ -57,7 +55,7 @@ modified by someone else and passed on, the recipients should know
|
|
57
55
|
that what they have is not the original version, so that the original
|
58
56
|
author's reputation will not be affected by problems that might be
|
59
57
|
introduced by others.
|
60
|
-
|
58
|
+
|
61
59
|
Finally, software patents pose a constant threat to the existence of
|
62
60
|
any free program. We wish to make sure that a company cannot
|
63
61
|
effectively restrict the users of a free program by obtaining a
|
@@ -89,9 +87,9 @@ libraries. However, the Lesser license provides advantages in certain
|
|
89
87
|
special circumstances.
|
90
88
|
|
91
89
|
For example, on rare occasions, there may be a special need to
|
92
|
-
encourage the widest possible use of a certain library, so that it
|
93
|
-
|
94
|
-
|
90
|
+
encourage the widest possible use of a certain library, so that it becomes
|
91
|
+
a de-facto standard. To achieve this, non-free programs must be
|
92
|
+
allowed to use the library. A more frequent case is that a free
|
95
93
|
library does the same job as widely used non-free libraries. In this
|
96
94
|
case, there is little to gain by limiting the free library to free
|
97
95
|
software only, so we use the Lesser General Public License.
|
@@ -113,7 +111,7 @@ modification follow. Pay close attention to the difference between a
|
|
113
111
|
"work based on the library" and a "work that uses the library". The
|
114
112
|
former contains code derived from the library, whereas the latter must
|
115
113
|
be combined with the library in order to run.
|
116
|
-
|
114
|
+
|
117
115
|
GNU LESSER GENERAL PUBLIC LICENSE
|
118
116
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
119
117
|
|
@@ -138,8 +136,8 @@ included without limitation in the term "modification".)
|
|
138
136
|
"Source code" for a work means the preferred form of the work for
|
139
137
|
making modifications to it. For a library, complete source code means
|
140
138
|
all the source code for all modules it contains, plus any associated
|
141
|
-
interface definition files, plus the scripts used to control
|
142
|
-
|
139
|
+
interface definition files, plus the scripts used to control compilation
|
140
|
+
and installation of the library.
|
143
141
|
|
144
142
|
Activities other than copying, distribution and modification are not
|
145
143
|
covered by this License; they are outside its scope. The act of
|
@@ -218,7 +216,7 @@ instead of to this License. (If a newer version than version 2 of the
|
|
218
216
|
ordinary GNU General Public License has appeared, then you can specify
|
219
217
|
that version instead if you wish.) Do not make any other change in
|
220
218
|
these notices.
|
221
|
-
|
219
|
+
|
222
220
|
Once this change is made in a given copy, it is irreversible for
|
223
221
|
that copy, so the ordinary GNU General Public License applies to all
|
224
222
|
subsequent copies and derivative works made from that copy.
|
@@ -269,7 +267,7 @@ Library will still fall under Section 6.)
|
|
269
267
|
distribute the object code for the work under the terms of Section 6.
|
270
268
|
Any executables containing that work also fall under Section 6,
|
271
269
|
whether or not they are linked directly with the Library itself.
|
272
|
-
|
270
|
+
|
273
271
|
6. As an exception to the Sections above, you may also combine or
|
274
272
|
link a "work that uses the Library" with the Library to produce a
|
275
273
|
work containing portions of the Library, and distribute that work
|
@@ -305,10 +303,10 @@ of these things:
|
|
305
303
|
the user installs one, as long as the modified version is
|
306
304
|
interface-compatible with the version that the work was made with.
|
307
305
|
|
308
|
-
c) Accompany the work with a written offer, valid for at
|
309
|
-
three years, to give the same user the materials
|
310
|
-
Subsection 6a, above, for a charge no more
|
311
|
-
performing this distribution.
|
306
|
+
c) Accompany the work with a written offer, valid for at
|
307
|
+
least three years, to give the same user the materials
|
308
|
+
specified in Subsection 6a, above, for a charge no more
|
309
|
+
than the cost of performing this distribution.
|
312
310
|
|
313
311
|
d) If distribution of the work is made by offering access to copy
|
314
312
|
from a designated place, offer equivalent access to copy the above
|
@@ -331,7 +329,7 @@ restrictions of other proprietary libraries that do not normally
|
|
331
329
|
accompany the operating system. Such a contradiction means you cannot
|
332
330
|
use both them and the Library together in an executable that you
|
333
331
|
distribute.
|
334
|
-
|
332
|
+
|
335
333
|
7. You may place library facilities that are a work based on the
|
336
334
|
Library side-by-side in a single library together with other library
|
337
335
|
facilities not covered by this License, and distribute such a combined
|
@@ -372,7 +370,7 @@ subject to these terms and conditions. You may not impose any further
|
|
372
370
|
restrictions on the recipients' exercise of the rights granted herein.
|
373
371
|
You are not responsible for enforcing compliance by third parties with
|
374
372
|
this License.
|
375
|
-
|
373
|
+
|
376
374
|
11. If, as a consequence of a court judgment or allegation of patent
|
377
375
|
infringement or for any other reason (not limited to patent issues),
|
378
376
|
conditions are imposed on you (whether by court order, agreement or
|
@@ -386,10 +384,9 @@ all those who receive copies directly or indirectly through you, then
|
|
386
384
|
the only way you could satisfy both it and this License would be to
|
387
385
|
refrain entirely from distribution of the Library.
|
388
386
|
|
389
|
-
If any portion of this section is held invalid or unenforceable under
|
390
|
-
|
391
|
-
|
392
|
-
circumstances.
|
387
|
+
If any portion of this section is held invalid or unenforceable under any
|
388
|
+
particular circumstance, the balance of the section is intended to apply,
|
389
|
+
and the section as a whole is intended to apply in other circumstances.
|
393
390
|
|
394
391
|
It is not the purpose of this section to induce you to infringe any
|
395
392
|
patents or other property right claims or to contest validity of any
|
@@ -407,11 +404,11 @@ be a consequence of the rest of this License.
|
|
407
404
|
|
408
405
|
12. If the distribution and/or use of the Library is restricted in
|
409
406
|
certain countries either by patents or by copyrighted interfaces, the
|
410
|
-
original copyright holder who places the Library under this License
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
407
|
+
original copyright holder who places the Library under this License may add
|
408
|
+
an explicit geographical distribution limitation excluding those countries,
|
409
|
+
so that distribution is permitted only in or among countries not thus
|
410
|
+
excluded. In such case, this License incorporates the limitation as if
|
411
|
+
written in the body of this License.
|
415
412
|
|
416
413
|
13. The Free Software Foundation may publish revised and/or new
|
417
414
|
versions of the Lesser General Public License from time to time.
|
@@ -425,7 +422,7 @@ conditions either of that version or of any later version published by
|
|
425
422
|
the Free Software Foundation. If the Library does not specify a
|
426
423
|
license version number, you may choose any version ever published by
|
427
424
|
the Free Software Foundation.
|
428
|
-
|
425
|
+
|
429
426
|
14. If you wish to incorporate parts of the Library into other free
|
430
427
|
programs whose distribution conditions are incompatible with these,
|
431
428
|
write to the author to ask for permission. For software which is
|
@@ -459,21 +456,19 @@ SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
|
459
456
|
DAMAGES.
|
460
457
|
|
461
458
|
END OF TERMS AND CONDITIONS
|
462
|
-
|
459
|
+
|
463
460
|
How to Apply These Terms to Your New Libraries
|
464
461
|
|
465
462
|
If you develop a new library, and you want it to be of the greatest
|
466
463
|
possible use to the public, we recommend making it free software that
|
467
464
|
everyone can redistribute and change. You can do so by permitting
|
468
|
-
redistribution under these terms (or, alternatively, under the terms
|
469
|
-
|
470
|
-
|
471
|
-
To apply these terms, attach the following notices to the library.
|
472
|
-
It is safest to attach them to the start of each source file to most
|
473
|
-
effectively convey the exclusion of warranty; and each file should
|
474
|
-
have at least the "copyright" line and a pointer to where the full
|
475
|
-
notice is found.
|
465
|
+
redistribution under these terms (or, alternatively, under the terms of the
|
466
|
+
ordinary General Public License).
|
476
467
|
|
468
|
+
To apply these terms, attach the following notices to the library. It is
|
469
|
+
safest to attach them to the start of each source file to most effectively
|
470
|
+
convey the exclusion of warranty; and each file should have at least the
|
471
|
+
"copyright" line and a pointer to where the full notice is found.
|
477
472
|
|
478
473
|
<one line to give the library's name and a brief idea of what it does.>
|
479
474
|
Copyright (C) <year> <name of author>
|
@@ -490,21 +485,18 @@ notice is found.
|
|
490
485
|
|
491
486
|
You should have received a copy of the GNU Lesser General Public
|
492
487
|
License along with this library; if not, write to the Free Software
|
493
|
-
Foundation, Inc.,
|
488
|
+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
494
489
|
|
495
490
|
Also add information on how to contact you by electronic and paper mail.
|
496
491
|
|
497
|
-
You should also get your employer (if you work as a programmer) or
|
498
|
-
|
499
|
-
|
492
|
+
You should also get your employer (if you work as a programmer) or your
|
493
|
+
school, if any, to sign a "copyright disclaimer" for the library, if
|
494
|
+
necessary. Here is a sample; alter the names:
|
500
495
|
|
501
496
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
502
|
-
library `Frob' (a library for tweaking knobs) written by James
|
503
|
-
Random Hacker.
|
497
|
+
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
504
498
|
|
505
499
|
<signature of Ty Coon>, 1 April 1990
|
506
500
|
Ty Coon, President of Vice
|
507
501
|
|
508
502
|
That's all there is to it!
|
509
|
-
|
510
|
-
|
data/NEWS
CHANGED
@@ -1,3 +1,28 @@
|
|
1
|
+
0.6.0 - 2024-08-07
|
2
|
+
- Updated ruby bindings that behave more Ruby-ish
|
3
|
+
- Fix errors and warnings during build process
|
4
|
+
- Minor updates to README.md
|
5
|
+
- Update ruby-augeas.spec from current Fedora 39 spec file
|
6
|
+
|
7
|
+
0.5.0 - 2013-03-12
|
8
|
+
- add libxml2 headers and library to Makefile
|
9
|
+
- add libxml2-devel build req to rpm spec
|
10
|
+
- split out header, add memstream utils from Augeas
|
11
|
+
- integrate with Travis CI
|
12
|
+
- Takefile: add gem authors metadata
|
13
|
+
- Augeas::transform: add .lns suffix if a module name is passed
|
14
|
+
to match aug_transform behaviour
|
15
|
+
- add Augeas::clearm
|
16
|
+
- add Augeas::context and Augeas::context=
|
17
|
+
- add Augeas::label
|
18
|
+
- add Augeas::rename
|
19
|
+
- add Augeas::srun
|
20
|
+
- add Augeas::text_retrieve
|
21
|
+
- add Augeas::text_store
|
22
|
+
|
23
|
+
0.4.1 - 2011-03-29
|
24
|
+
- remove object files from release tarball
|
25
|
+
|
1
26
|
0.4.0 - 2011-03-25
|
2
27
|
- set can now set multiple elements at once
|
3
28
|
- expose aug_setm as Augeas#setm
|
@@ -15,4 +40,4 @@
|
|
15
40
|
|
16
41
|
0.2.0 - 2008-08-26
|
17
42
|
Details for this and earlier releases need to be extracted from the
|
18
|
-
history of the git repo
|
43
|
+
history of the git repo
|
data/README.md
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
![ruby-augeas ci build status](../../actions/workflows/ci.yml/badge.svg)
|
2
|
+
|
3
|
+
# Ruby bindings for augeas
|
4
|
+
|
5
|
+
The class Augeas provides bindings to [Augeas](https://augeas.net) library.
|
6
|
+
|
7
|
+
|
8
|
+
## Building
|
9
|
+
|
10
|
+
To build the bindings, which unfortunately includes installing them from a
|
11
|
+
gem, you need to have Augeas and its header file installed as well as
|
12
|
+
`pkg-config`.
|
13
|
+
|
14
|
+
On Fedora, you can do that simply by running
|
15
|
+
```
|
16
|
+
dnf install augeas-devel pkgconfig
|
17
|
+
```
|
18
|
+
|
19
|
+
On MacOS (OSX), you need to set up [Homebrew](https://brew.sh/) and then run
|
20
|
+
```
|
21
|
+
brew install augeas pkg-config
|
22
|
+
```
|
23
|
+
|
24
|
+
Build the ruby gem by running
|
25
|
+
```
|
26
|
+
rake build
|
27
|
+
rake test
|
28
|
+
rake gem
|
29
|
+
```
|
30
|
+
The output is pkg/ruby-augeas-VERSION.gem
|
31
|
+
|
32
|
+
Build the rpm package (optional) in the pkg/ subdirectory
|
33
|
+
```
|
34
|
+
rake rpm
|
35
|
+
```
|
36
|
+
The output is pkg/ruby-augeas-VERSION-1.DIST.src.rpm with binary packages in pkg/$(uname -m)
|
37
|
+
|
38
|
+
Create html documentation using rdoc
|
39
|
+
|
40
|
+
```
|
41
|
+
rake rdoc
|
42
|
+
```
|
43
|
+
|
44
|
+
The output is in doc/site/api/
|
45
|
+
The starting document is doc/site/api/index.html
|
46
|
+
|
47
|
+
## Usage
|
48
|
+
|
49
|
+
### Setting Data
|
50
|
+
```ruby
|
51
|
+
Augeas::open do |aug|
|
52
|
+
aug.set("/files/etc/sysconfig/firstboot/RUN_FIRSTBOOT", "YES")
|
53
|
+
unless aug.save
|
54
|
+
raise IOError, "Failed to save changes"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
```
|
58
|
+
|
59
|
+
### Accessing Data
|
60
|
+
```ruby
|
61
|
+
firstboot = Augeas::open { |aug| aug.get("/files/etc/sysconfig/firstboot/RUN_FIRSTBOOT") }
|
62
|
+
```
|
63
|
+
|
64
|
+
### Removing Data
|
65
|
+
```ruby
|
66
|
+
Augeas::open do |aug|
|
67
|
+
aug.rm("/files/etc/sysconfig/firstboot/RUN_FIRSTBOOT")
|
68
|
+
unless aug.save
|
69
|
+
raise IOError, "Failed to save changes"
|
70
|
+
end
|
71
|
+
end
|
72
|
+
```
|
73
|
+
|
74
|
+
### Minimal Setup with a Custom Root
|
75
|
+
|
76
|
+
By passing `NO_MODL_AUTOLOAD`, no files are read on startup; that allows
|
77
|
+
setting up a custom transform.
|
78
|
+
|
79
|
+
```ruby
|
80
|
+
Augeas::open("/var/tmp/augeas-root", "/usr/local/share/mylenses",
|
81
|
+
Augeas::NO_MODL_AUTOLOAD) do |aug|
|
82
|
+
aug.transform(:lens => "Aliases.lns", :incl => "/etc/aliases")
|
83
|
+
aug.load
|
84
|
+
aug.get("/files/etc/aliases/*[name = 'postmaster']/value")
|
85
|
+
end
|
86
|
+
```
|
data/Rakefile
CHANGED
@@ -9,13 +9,13 @@
|
|
9
9
|
# Bryan Kearney <bkearney@redhat.com>
|
10
10
|
|
11
11
|
require 'rake/clean'
|
12
|
-
require '
|
12
|
+
require 'rdoc/task'
|
13
13
|
require 'rake/testtask'
|
14
|
-
require '
|
14
|
+
require 'rubygems/package_task'
|
15
15
|
|
16
16
|
PKG_NAME='ruby-augeas'
|
17
17
|
GEM_NAME=PKG_NAME # we'd like 'augeas' but that makes RPM fail
|
18
|
-
PKG_VERSION='0.
|
18
|
+
PKG_VERSION='0.6.0'
|
19
19
|
EXT_CONF='ext/augeas/extconf.rb'
|
20
20
|
MAKEFILE="ext/augeas/Makefile"
|
21
21
|
AUGEAS_MODULE="ext/augeas/_augeas.so"
|
@@ -65,17 +65,17 @@ task :test => :build
|
|
65
65
|
#
|
66
66
|
# Generate the documentation
|
67
67
|
#
|
68
|
-
|
69
|
-
rd.main = "README.
|
68
|
+
RDoc::Task.new do |rd|
|
69
|
+
rd.main = "README.md"
|
70
70
|
rd.rdoc_dir = "doc/site/api"
|
71
|
-
rd.rdoc_files.include("README.
|
71
|
+
rd.rdoc_files.include("README.md", "ext/**/*.[ch]","lib/**/*.rb")
|
72
72
|
end
|
73
73
|
|
74
74
|
#
|
75
75
|
# Packaging
|
76
76
|
#
|
77
77
|
PKG_FILES = FileList[
|
78
|
-
"Rakefile", "COPYING","README.
|
78
|
+
"Rakefile", "COPYING","README.md", "NEWS",
|
79
79
|
"ext/**/*.[ch]", "lib/**/*.rb", "ext/**/MANIFEST", "ext/**/extconf.rb",
|
80
80
|
"tests/**/*",
|
81
81
|
"spec/**/*"
|
@@ -91,14 +91,16 @@ SPEC = Gem::Specification.new do |s|
|
|
91
91
|
s.email = "augeas-devel@redhat.com"
|
92
92
|
s.homepage = "http://augeas.net/"
|
93
93
|
s.summary = "Ruby bindings for augeas"
|
94
|
+
s.authors = [ "Bryan Kearney", "David Lutterkort" ]
|
94
95
|
s.files = PKG_FILES
|
96
|
+
s.licenses = ['LGPL-2.1+']
|
95
97
|
s.autorequire = "augeas"
|
96
98
|
s.required_ruby_version = '>= 1.8.1'
|
97
99
|
s.extensions = "ext/augeas/extconf.rb"
|
98
100
|
s.description = "Provides bindings for augeas."
|
99
101
|
end
|
100
102
|
|
101
|
-
|
103
|
+
Gem::PackageTask.new(SPEC) do |pkg|
|
102
104
|
pkg.need_tar = true
|
103
105
|
pkg.need_zip = true
|
104
106
|
end
|
@@ -130,3 +132,5 @@ end
|
|
130
132
|
task :sync do |t|
|
131
133
|
system "rsync -rav doc/site/ et:/var/www/sites/augeas.et.redhat.com/docs/ruby/"
|
132
134
|
end
|
135
|
+
|
136
|
+
task :default => [:build, :test]
|