Compare commits

...

10 commits

Author SHA1 Message Date
f891c58c77 Update docs 2024-06-22 23:43:02 -03:00
292c63b93e Update docs 2024-06-20 23:11:00 -03:00
17b8231196 Update docs 2024-06-20 23:09:33 -03:00
6ef5e4caac v0.2.1 2024-05-14 20:57:20 -03:00
569a0987e2 Add errno.h include directive to glue.c 2024-05-14 20:56:37 -03:00
1312cff63c Update .rubocop.yml 2024-05-13 16:05:08 -03:00
bcc36ed2c6 Update test/ 2024-05-13 16:02:17 -03:00
d36dc75e9a Update test-cmd.rb 2024-05-13 11:26:29 -03:00
316c6c1f1e Rewrite test with BSD::Control::Test 2024-05-12 22:50:19 -03:00
aea59dc9bc Move readme_examples_test.rb 2024-05-12 22:49:15 -03:00
10 changed files with 41 additions and 39 deletions

View file

@ -34,3 +34,5 @@ Layout/EmptyLineBetweenDefs:
Enabled: false
Style/TrivialAccessors:
Enabled: false
Style/MultilineIfModifier:
Enabled: false

View file

@ -1,7 +1,7 @@
PATH
remote: .
specs:
bsdcontrol.rb (0.2.0)
bsdcontrol.rb (0.2.1)
GEM
remote: https://rubygems.org/
@ -51,7 +51,7 @@ GEM
standard-performance (1.3.1)
lint_roller (~> 1.1)
rubocop-performance (~> 1.20.2)
test-cmd.rb (0.8.0)
test-cmd.rb (0.12.0)
test-unit (3.6.2)
power_assert
unicode-display_width (2.5.0)
@ -64,7 +64,7 @@ DEPENDENCIES
bsdcontrol.rb!
rake-compiler (~> 1.2)
standard (~> 1.35)
test-cmd.rb (~> 0.8)
test-cmd.rb (~> 0.12)
test-unit (~> 3.6)
BUNDLED WITH

View file

@ -1,7 +1,7 @@
## About
bsdcontrol.rb provides Ruby bindings for libhbsdcontrol from the
[HardenedBSD](https://HardenedBSD.org) project.
bsdcontrol.rb provides Ruby bindings for
[libhbsdcontrol](https://git.hardenedbsd.org/hardenedbsd/HardenedBSD/-/tree/hardened/current/master/lib/libhbsdcontrol/).
## Examples
@ -57,12 +57,10 @@ BSD::Control
## Documentation
A complete API reference is available at
[0x1eef.github.io/x/bsdcontrol.rb](https://0x1eef.github.io/x/bsdcontrol.rb).
[0x1eef.github.io/x/bsdcontrol.rb](https://0x1eef.github.io/x/bsdcontrol.rb)
## Install
**Rubygems.org**
bsdcontrol.rb can be installed via rubygems.org:
gem install bsdcontrol.rb
@ -75,7 +73,7 @@ bsdcontrol.rb can be installed via rubygems.org:
## License
[BSD Zero Clause](https://choosealicense.com/licenses/0bsd/).
[BSD Zero Clause](https://choosealicense.com/licenses/0bsd/)
<br>
See [LICENSE](./LICENSE).
See [LICENSE](./LICENSE)

View file

@ -17,7 +17,7 @@ run_test()
# main
if [ "$(id -u)" != "0" ]; then
rake clean clobber compile
for file in test/readme_examples_test.rb test/unprivileged/*_test.rb; do
for file in test/unprivileged/*_test.rb; do
logfile=".runner.log_$(basename ${file})"
if run_test "${file}" "${logfile}"; then
echo -n .

View file

@ -22,6 +22,6 @@ Gem::Specification.new do |gem|
gem.description = gem.summary
gem.add_development_dependency 'rake-compiler', '~> 1.2'
gem.add_development_dependency 'standard', '~> 1.35'
gem.add_development_dependency 'test-cmd.rb', '~> 0.8'
gem.add_development_dependency 'test-cmd.rb', '~> 0.12'
gem.add_development_dependency 'test-unit', '~> 3.6'
end

View file

@ -1,6 +1,7 @@
#include <ruby.h>
#include <libhbsdcontrol.h>
#include <fcntl.h>
#include <errno.h>
#include "glue.h"
#include "context.h"

View file

@ -2,6 +2,6 @@
module BSD
module Control
VERSION = "0.2.0"
VERSION = "0.2.1"
end
end

View file

@ -1,2 +1,3 @@
# frozen_string_literal: true
require_relative "bsd/control"

View file

@ -1,26 +0,0 @@
# frozen_string_literal: true
require_relative "setup"
class ReadmeExamplesTest < Test::Unit::TestCase
require "rbconfig"
require "test/cmd"
def test_available_features_success
assert_equal true,
cmd(RbConfig.ruby, readme_example("1_available_features.rb"))
.status.success?
end
def test_available_features_stdout
cmd(RbConfig.ruby, readme_example("1_available_features.rb"))
.stdout
.each_line { assert_match %r{The [a-zA-Z0-9_]+ feature is available}, _1 }
end
private
def readme_example(name)
File.join(Dir.getwd, "share", "bsdcontrol.rb", "examples", name)
end
end

View file

@ -0,0 +1,26 @@
# frozen_string_literal: true
require_relative "../setup"
module BSD::Control
class ReadmeExamplesTest < BSD::Control::Test
require "test/cmd"
def test_available_features_success
assert_equal true,
cmd("ruby", readme_example("1_available_features.rb")).success?
end
def test_available_features_stdout
assert_match %r|\A(The [a-zA-Z0-9_]+ feature is available\n){9}\z|,
cmd("ruby", readme_example("1_available_features.rb")).stdout
end
private
def readme_example(path)
dir = File.join(Dir.getwd, "share", "bsdcontrol.rb", "examples")
File.join(dir, path)
end
end
end