This is the development version of Kanrisuru. Since this is still a pre-1.0 release, we don't recommend using this in system-critical production environments.

Kanrisuru

realpath

Get the full canonicalised version of a path (absolute path) in ruby.
linux manual

Basic Usage

require 'kanrisuru'
host = Kanrisuru::Remote::Host.new(host: '127.0.1.1', username: 'ubuntu', keys: ['~/.ssh/id_rsa'])

result = host.realpath('/etc/os-release')
result.success? 
true

result.path
'/usr/lib/os-release'

Parameters

Field Type Description
path string
Required name of program to get full path of
strip boolean
Only strip . and .., components, but do not resolve symbolic links

Result

Returns a FilePath struct.

FilePath Fields

Field Type Description
path string Symbolic or absolute file path

Return Example

host.realpath('/etc/os-release').data
#<Struct:Kanrisuru::Core::Path::FilePath:0x00000690
  path = "/usr/lib/os-release"
>

Exit Status

Code Description
0 Success
1 Failure

Tested On

  • Ubuntu, Debian, Centos, Fedora, Redhat, OpenSuse, SLES