bwrap 1.0.0.pre.alpha5 → 1.0.0.pre.beta1

Sign up to get free protection for your applications and to get access to all the features.
data/lib/bwrap.rb CHANGED
@@ -1,81 +1,28 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "optimist"
4
-
5
- #require "deep-cover" if ENV["DEEP_COVER"]
6
-
7
- require "bwrap/version"
8
- require "bwrap/args/construct"
9
- require "bwrap/config"
10
- require "bwrap/execution"
11
-
12
- # Executes bwrap command using given configuration.
13
- class Bwrap::Bwrap
14
- include Bwrap::Execution
15
-
16
- def initialize config
17
- @config = config
18
- end
19
-
20
- # Parses command line arguments given to caller script.
21
- def parse_command_line_arguments
22
- options = parse_options
23
-
24
- Bwrap::Output.handle_output_options options
25
- end
26
-
27
- # Runs given command inside bwrap.
28
- #
29
- # @param command [String, Array] Command, with necessary arguments, to be executed inside bwrap
30
- def run command
31
- construct = Bwrap::Args::Construct.new
32
- construct.command = command
33
- construct.config = @config
34
- bwrap_args = construct.construct_bwrap_args
35
-
36
- exec_command = [ "bwrap" ]
37
- exec_command += bwrap_args
38
- exec_command.append command
39
- exec_command += @cli_args if @cli_args
40
-
41
- execute exec_command
42
-
43
- construct.cleanup
44
- end
45
-
46
- # Parses global bwrap flags using Optimist.
47
- #
48
- # Sets instance variable `@cli_args`.
49
- #
50
- # @return [Hash] options parsed by {Optimist.options}
51
- private def parse_options
52
- options = Optimist.options do
53
- version ::Bwrap::VERSION
54
-
55
- banner "Usage:"
56
- banner " #{$PROGRAM_NAME} [global options]\n \n"
57
- banner "Global options:"
58
- opt :verbose,
59
- "Show verbose output",
60
- short: "v"
61
- opt :debug,
62
- "Show debug output (useful when debugging a problem)",
63
- short: "d"
64
- opt :trace,
65
- "Show trace output (noisiest, probably not useful for most of time)",
66
- short: :none
67
- opt :version,
68
- "Print version and exit",
69
- short: "V"
70
- opt :help,
71
- "Show help message",
72
- short: "h"
73
-
74
- educate_on_error
75
- end
76
-
77
- @cli_args = ARGV.dup
78
-
79
- options
80
- end
3
+ require "bwrap/bwrap"
4
+
5
+ # ruby-bwrap provides easy-to-use interface to run complex programs in sandboxes created with
6
+ # {https://github.com/containers/bubblewrap bubblewrap}.
7
+ #
8
+ # To run a program inside bubblewrap, a wrapper executable can be created. For example:
9
+ #
10
+ # require "bwrap"
11
+ #
12
+ # config = Bwrap::Config.new
13
+ # config.user = "dummy_user"
14
+ # config.full_system_mounts = true
15
+ # config.binaries_from = %w{
16
+ # /bin
17
+ # /usr/bin
18
+ # }
19
+ #
20
+ # bwrap = Bwrap::Bwrap.new config
21
+ # bwrap.parse_command_line_arguments
22
+ # bwrap.run "/bin/true"
23
+ #
24
+ # There also are few generic utilities, {Bwrap::Output} for handling output of scripts and
25
+ # {Bwrap::Execution} to run executables.
26
+ module Bwrap
27
+ # Empty module.
81
28
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bwrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre.alpha5
4
+ version: 1.0.0.pre.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samu Voutilainen
@@ -34,22 +34,8 @@ cert_chain:
34
34
  X4ioQwEn1/9tHs19VO1CLF58451HgEo1BXd7eWLmV1V5cqw0YWok1ly4L/Su/Phf
35
35
  MRxVMHiVAqY=
36
36
  -----END CERTIFICATE-----
37
- date: 2021-11-29 00:00:00.000000000 Z
37
+ date: 2021-12-12 00:00:00.000000000 Z
38
38
  dependencies:
39
- - !ruby/object:Gem::Dependency
40
- name: optimist
41
- requirement: !ruby/object:Gem::Requirement
42
- requirements:
43
- - - "~>"
44
- - !ruby/object:Gem::Version
45
- version: '3.0'
46
- type: :runtime
47
- prerelease: false
48
- version_requirements: !ruby/object:Gem::Requirement
49
- requirements:
50
- - - "~>"
51
- - !ruby/object:Gem::Version
52
- version: '3.0'
53
39
  - !ruby/object:Gem::Dependency
54
40
  name: bundler
55
41
  requirement: !ruby/object:Gem::Requirement
@@ -134,14 +120,19 @@ files:
134
120
  - lib/bwrap.rb
135
121
  - lib/bwrap/args/args.rb
136
122
  - lib/bwrap/args/bind.rb
123
+ - lib/bwrap/args/bind/library.rb
124
+ - lib/bwrap/args/bind/mime.rb
137
125
  - lib/bwrap/args/construct.rb
138
126
  - lib/bwrap/args/environment.rb
139
127
  - lib/bwrap/args/features.rb
140
128
  - lib/bwrap/args/library.rb
141
129
  - lib/bwrap/args/machine_id.rb
142
130
  - lib/bwrap/args/mount.rb
131
+ - lib/bwrap/bwrap.rb
143
132
  - lib/bwrap/config.rb
133
+ - lib/bwrap/config/features.rb
144
134
  - lib/bwrap/execution.rb
135
+ - lib/bwrap/execution/exceptions.rb
145
136
  - lib/bwrap/execution/execute.rb
146
137
  - lib/bwrap/execution/execution.rb
147
138
  - lib/bwrap/execution/labels.rb
@@ -150,7 +141,7 @@ files:
150
141
  - lib/bwrap/output/colors.rb
151
142
  - lib/bwrap/output/levels.rb
152
143
  - lib/bwrap/output/log.rb
153
- - lib/bwrap/output/output.rb
144
+ - lib/bwrap/output/output_impl.rb
154
145
  - lib/bwrap/version.rb
155
146
  homepage: https://git.sr.ht/~smar/ruby-bwrap
156
147
  licenses:
metadata.gz.sig CHANGED
Binary file
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "bwrap/version"
4
-
5
- # Outputting utilities.
6
- module Bwrap::Output
7
- # Nya.
8
- end