rus-admin
Set of helpers for system administration with IRB
How to install
gem install rus-admin
Open IRB shell with:
rus-admin
Find helper
# When search #in_file - result is Struct object of param and line numbers
# When search #in_dir - result is Struct object of param and found file-names
# Last result is available in Find#info
# Find#new or alias Find#reset clear params array
# Find#reset! clear params and info
How to use:
# check for name equal to .gemspec
Find['.gemspec'].in_dir Dir.pwd
=> #<struct Find::Result params=[".gemspec"], path="/home/alx/Alpha/rus-admin", result={}>
# check if name include .gemspec
Find.in_dir Dir.pwd, :include
pp search.result if search.result.any?
=> {".gemspec"=>["rus-admin.gemspec"]}
# reset params to nil
Find.new
# add to params
Find['password']
# add more to params
Find['another_password', 'password_another']
# search in file for params
Find.in_file 'path_to_file.txt'
pp Find.info.result if Find.info.result.any?
Randpass helper
# Create random password with SecureRandom#base64
# Add random characters, and shuffle it
# Last password is saved in attribute :pass
How to use:
Randompass[20]
=> "0!ZNiAUZCbjo!#hHeX+XX$eAC=!p"
Override
Override method capitalize!, make it work without downcase of other characters.
Available in classes: String, Symbol, Array. If used in array, hashes and integers are skipped.
# override method #capitalize!
Rus::Admin.override!
#check if classes are overriden
Rus::Admin.override?