Module: Bsdkrun

Defined in:
lib/bsdkrun.rb,
lib/bsdkrun/args.rb,
lib/bsdkrun/types.rb,
lib/bsdkrun/binary.rb,
lib/bsdkrun/errors.rb,
lib/bsdkrun/images.rb,
lib/bsdkrun/system.rb,
lib/bsdkrun/process.rb,
lib/bsdkrun/sandbox.rb,
lib/bsdkrun/version.rb,
lib/bsdkrun/volumes.rb,
lib/bsdkrun/networks.rb

Overview

bsdkrun — a Ruby SDK for bsdkrun, a Firecracker-style microVM launcher for BSD and Linux guests. A thin wrapper around the bsdkrun CLI: it builds argv, shells out, and parses JSON output.

Examples:

require "bsdkrun"

box = Bsdkrun::Sandbox.create(os: "linux", image: "alpine")
puts box.exec(["uname", "-a"]).text
box.stop

Defined Under Namespace

Modules: Args, Binary, Images, Networks, Process, System, Volumes Classes: BinaryNotFound, CommandFailed, Error, ImageInfo, NetworkInfo, Result, Sandbox, SandboxInfo, SandboxNotFound, VolumeInfo

Constant Summary collapse

VERSION =

The bsdkrun Ruby SDK version.

"0.1.0"

Class Method Summary collapse

Class Method Details

.binary_pathString

Returns the resolved bsdkrun binary path.

Returns:

  • (String)

    the resolved bsdkrun binary path.

Raises:



36
37
38
# File 'lib/bsdkrun.rb', line 36

def binary_path
  Binary.resolve
end

.binary_path=(path) ⇒ void

This method returns an undefined value.

Force the SDK to use a specific bsdkrun binary, bypassing discovery.

Parameters:

  • path (String, nil)


30
31
32
# File 'lib/bsdkrun.rb', line 30

def binary_path=(path)
  Binary.override = path
end

.create(opts = {}, **kwargs) ⇒ Sandbox

Convenience alias for Bsdkrun::Sandbox.create.

Returns:



48
49
50
# File 'lib/bsdkrun.rb', line 48

def create(opts = {}, **kwargs)
  Sandbox.create(opts, **kwargs)
end

.get(id) ⇒ Sandbox

Convenience alias for Bsdkrun::Sandbox.get.

Returns:



54
55
56
# File 'lib/bsdkrun.rb', line 54

def get(id)
  Sandbox.get(id)
end

.imagesModule

The Images namespace.

Returns:

  • (Module)


66
67
68
# File 'lib/bsdkrun.rb', line 66

def images
  Images
end

.list(all: false) ⇒ Array<SandboxInfo>

Convenience alias for Bsdkrun::Sandbox.list.

Returns:



60
61
62
# File 'lib/bsdkrun.rb', line 60

def list(all: false)
  Sandbox.list(all: all)
end

.networksModule

The Networks namespace.

Returns:

  • (Module)


78
79
80
# File 'lib/bsdkrun.rb', line 78

def networks
  Networks
end

.reset_binary!void

This method returns an undefined value.

Reset cached binary discovery state (mainly for tests).



42
43
44
# File 'lib/bsdkrun.rb', line 42

def reset_binary!
  Binary.reset!
end

.systemModule

The System namespace.

Returns:

  • (Module)


84
85
86
# File 'lib/bsdkrun.rb', line 84

def system
  System
end

.volumesModule

The Volumes namespace.

Returns:

  • (Module)


72
73
74
# File 'lib/bsdkrun.rb', line 72

def volumes
  Volumes
end