Determine system and binary capabilities at runtime.
Add the line below to your build_config.rb:
MRuby::Build.newdo |conf|
# ... (snip) ...conf.gem'mruby-os'endOr add this line to your aplication's mrbgem.rake:
MRuby::Gem::Specification.new('your-mrbgem')do |spec|
# ... (snip) ...spec.add_dependency'mruby-logger'endTo get the machine architecture:
OS.machine# i686 or x86_64To get the max "word size" of the machine:
OS.bits# 32 or 64# orOS.bits:machineTo get the used "word size" by the binary:
OS.bits:binaryTo get the kernel name:
OS.sysname# Darwin, Linux or Windows_NTTo execute code per platform:
ifOS.posix?# The normal wayelse# WindowsendSee also linux?, mac?, macos?, osx?, x?.
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
- Sebastián Katzer, Fa. appPlant GmbH
The gem is available as open source under the terms of the MIT License.
Made with 😋 in Leipzig
© 2017 appPlant GmbH