LoginSignup
0
2

More than 5 years have passed since last update.

ohai を使って色々取得

Posted at
all.rb
require "rubygems"
require "bundler/setup"
require 'ohai'

oh = Ohai::System.new
oh.all_plugins

YAML.dump(oh.data, File.open('all.yml', 'w'))
user.rb
require "rubygems"
require "bundler/setup"
require 'ohai'

oh = Ohai::System.new
a = oh.all_plugins("etc")

a[:etc][:passwd].each { | k, v |
  print "#{k},,#{v[:uid]},#{v[:gid]},,#{v[:shell]},#{v[:dir]}\n"
}
group.rb
require "rubygems"
require "bundler/setup"
require 'ohai'

oh = Ohai::System.new
a = oh.all_plugins("etc")

a[:etc][:group].each { | k, v |
  print "#{k},#{v[:gid]}\n"
}
0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2