Skip to content

Determine system and binary capabilities at runtime

License

Notifications You must be signed in to change notification settings

katzer/mruby-os

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mruby-os
Build Status Build status

Determine system and binary capabilities at runtime.

Installation

Add the line below to your build_config.rb:

MRuby::Build.new do |conf|
  # ... (snip) ...
  conf.gem 'mruby-os'
end

Or add this line to your aplication's mrbgem.rake:

MRuby::Gem::Specification.new('your-mrbgem') do |spec|
  # ... (snip) ...
  spec.add_dependency 'mruby-logger'
end

Usage

To get the machine architecture:

OS.machine # i686 or x86_64

To get the max "word size" of the machine:

OS.bits # 32 or 64
# or
OS.bits :machine

To get the used "word size" by the binary:

OS.bits :binary

To get the kernel name:

OS.sysname # Darwin, Linux or Windows_NT

To execute code per platform:

if OS.posix?
  # The normal way
else
  # Windows
end

See also linux?, mac?, macos?, osx?, x?.

Development

Clone the repo:

$ git clone https://github.com/katzer/mruby-os.git && cd mruby-os/

Compile the source:

$ rake compile

Run the tests:

$ rake test

Authors

  • Sebastián Katzer, Fa. appPlant GmbH

License

The gem is available as open source under the terms of the MIT License.

Made with 😋 in Leipzig

© 2017 appPlant GmbH

About

Determine system and binary capabilities at runtime

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages