Compare commits
10 commits
5571ab8f3b
...
f891c58c77
Author | SHA1 | Date | |
---|---|---|---|
f891c58c77 | |||
292c63b93e | |||
17b8231196 | |||
6ef5e4caac | |||
569a0987e2 | |||
1312cff63c | |||
bcc36ed2c6 | |||
d36dc75e9a | |||
316c6c1f1e | |||
aea59dc9bc |
10 changed files with 41 additions and 39 deletions
|
@ -34,3 +34,5 @@ Layout/EmptyLineBetweenDefs:
|
|||
Enabled: false
|
||||
Style/TrivialAccessors:
|
||||
Enabled: false
|
||||
Style/MultilineIfModifier:
|
||||
Enabled: false
|
||||
|
|
|
@ -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
|
||||
|
|
12
README.md
12
README.md
|
@ -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)
|
||||
|
||||
|
|
|
@ -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 .
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <ruby.h>
|
||||
#include <libhbsdcontrol.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include "glue.h"
|
||||
#include "context.h"
|
||||
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
|
||||
module BSD
|
||||
module Control
|
||||
VERSION = "0.2.0"
|
||||
VERSION = "0.2.1"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_relative "bsd/control"
|
||||
|
|
|
@ -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
|
26
test/unprivileged/readme_examples_test.rb
Normal file
26
test/unprivileged/readme_examples_test.rb
Normal 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
|
Loading…
Reference in a new issue