capng_c 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 88da08aa05f1a6e84b2b57fb2fca90a1d0c0d4dde8585dbad9e2f848e286cef6
4
- data.tar.gz: 28a4762a3f921fbe0b06d1913d151d907b12a4558d1941fd7b9fed2440974eb6
3
+ metadata.gz: 31b53b59b57445d79f742beb25910e6bb62270673d6c171ffea029938d5f35ee
4
+ data.tar.gz: 62c157b61e3cc5e1bfd144effb8370a3de756e63a7cfccfb3012d236ceecd2d9
5
5
  SHA512:
6
- metadata.gz: d6880731ae31f78a4b8ff1734b8638c1eddb86ec0bf519f9a6a13fe1b3410d7f1488103548954ba17fd5fa6e834eacd94275c46bdb650cf70f15ab901ab8ac84
7
- data.tar.gz: 381f2a5abde2165d4f31513d3ae9086ae7d183747f53993ff492b7e255fbcfa9bbefdf9da8035027cc6cf0e330c9cf6efea69b260e329d685e4d95f81a25f988
6
+ metadata.gz: a3b0b2deda2fb0c46fcce53f54097659a4d7fddd34e1bc4ce01fd27dea02a220263cf668deb048542009dc92b885753938f753af37e7a87500b806111330e552
7
+ data.tar.gz: b2968668551f8b397d7f5da73d38004215cef706e2d8e2ecf09453a6ca4ef14ed4b8e550296767a5f38dba9e87edcb669b4edaf2cf8433e3f92c7c9a27591c0a
@@ -0,0 +1,30 @@
1
+ name: Linux testing
2
+ on:
3
+ - push
4
+ - pull_request
5
+ jobs:
6
+ build:
7
+ runs-on: ${{ matrix.os }}
8
+ strategy:
9
+ fail-fast: false
10
+ matrix:
11
+ ruby: [ '2.4', '2.5', '2.6' , '2.7' ]
12
+ os:
13
+ - ubuntu-latest
14
+ name: Ruby ${{ matrix.ruby }} unit testing on ${{ matrix.os }}
15
+ steps:
16
+ - uses: actions/checkout@v2
17
+ - name: Install dependencies
18
+ run: |
19
+ sudo apt update
20
+ sudo apt -V install libcap-ng-dev
21
+ - uses: ruby/setup-ruby@v1
22
+ with:
23
+ ruby-version: ${{ matrix.ruby }}
24
+ - name: unit testing
25
+ env:
26
+ CI: true
27
+ run: |
28
+ gem install bundler rake
29
+ bundle install --jobs 4 --retry 3
30
+ bundle exec rake
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Capng_c
2
2
 
3
+ ![Linux testing](https://github.com/cosmo0920/capng_c/workflows/Linux%20testing/badge.svg?branch=main)
4
+
3
5
  libcap-ng bindings for Ruby.
4
6
 
5
7
  ## Installation
@@ -162,7 +162,7 @@ rb_capng_change_id(VALUE self, VALUE rb_uid, VALUE rb_gid, VALUE rb_flags)
162
162
  if (result == 0)
163
163
  return Qtrue;
164
164
  else
165
- return Qfalse;
165
+ rb_raise(rb_eRuntimeError, "Calling capng_change_id is failed with: (exitcode: %d)\n", result);
166
166
  }
167
167
 
168
168
  static VALUE
@@ -20,7 +20,7 @@ includedir = RbConfig::CONFIG["includedir"]
20
20
 
21
21
  dir_config("capng", includedir, libdir)
22
22
 
23
- $LDFLAGS << " -lcap-ng "
23
+ pkg_config("libcap-ng")
24
24
  $CFLAGS << " -Wall -std=c99 -fPIC "
25
25
  # $CFLAGS << " -g -O0"
26
26
 
@@ -67,7 +67,7 @@ rb_capng_print_caps_text(VALUE self, VALUE rb_where, VALUE rb_select_set)
67
67
  if (result)
68
68
  return rb_str_new2(result);
69
69
  else
70
- return rb_str_new2("(NULL)");
70
+ return rb_str_new2("none");
71
71
  }
72
72
 
73
73
  static VALUE
@@ -86,7 +86,7 @@ rb_capng_print_caps_numeric(VALUE self, VALUE rb_where, VALUE rb_select_set)
86
86
  if (result)
87
87
  return rb_str_new2(result);
88
88
  else
89
- return rb_str_new2("(NULL)");
89
+ return rb_str_new2("none");
90
90
  }
91
91
 
92
92
  void Init_capng_print(VALUE rb_cCapNG)
@@ -6,6 +6,7 @@ class CapNG
6
6
 
7
7
  alias_method :caps_file_raw, :caps_file
8
8
  alias_method :apply_caps_file_raw, :apply_caps_file
9
+ alias_method :update_raw, :update
9
10
 
10
11
  def caps_file(file_or_string_path)
11
12
  if file_or_string_path.is_a?(String) && File.exist?(file_or_string_path)
@@ -30,4 +31,14 @@ class CapNG
30
31
  raise ArgumentError, "#{file_or_string_path} should be File class or String class instance."
31
32
  end
32
33
  end
34
+
35
+ def update(action, type, capability_or_capability_array)
36
+ if capability_or_capability_array.is_a?(Array) && !capability_or_capability_array.empty?
37
+ capability_or_capability_array.each do |capability|
38
+ update_raw(action, type, capability)
39
+ end
40
+ else
41
+ update_raw(action, type, capability_or_capability_array)
42
+ end
43
+ end
33
44
  end
@@ -1,3 +1,3 @@
1
1
  class CapNG
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capng_c
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiroshi Hatake
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-10-26 00:00:00.000000000 Z
11
+ date: 2020-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -80,6 +80,7 @@ extensions:
80
80
  - ext/capng/extconf.rb
81
81
  extra_rdoc_files: []
82
82
  files:
83
+ - ".github/workflows/linux.yml"
83
84
  - ".gitignore"
84
85
  - Gemfile
85
86
  - LICENSE