Class: Bixby::Provision::Base
- Inherits:
-
Object
- Object
- Bixby::Provision::Base
- Extended by:
- Log
- Includes:
- Log, Util::File, ScriptUtil
- Defined in:
- lib/bixby/provision/dsl/base.rb
Direct Known Subclasses
Bundler, Config, DirDSL, FileDSL, Inventory, Meteor, NPM, NTP, NodeJS, Packager::PackagerBase, Ruby, RunControl, SCM, SCM::SCMBase, Service, Services::ServiceBase, System, Variable
Constant Summary collapse
- PATH =
"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
Instance Attribute Summary collapse
-
#manifest ⇒ Object
Returns the value of attribute manifest.
-
#proxy ⇒ Object
Returns the value of attribute proxy.
Instance Method Summary collapse
- #get_gid(group) ⇒ Object
- #get_group(gid) ⇒ Object
- #get_uid(user) ⇒ Object
- #get_user(uid) ⇒ Object
-
#initialize(obj = nil) ⇒ Base
constructor
A new instance of Base.
- #tap(&block) ⇒ Object
Methods included from Util::File
#chmod, #chown, #sha256sum, #which
Constructor Details
Instance Attribute Details
#manifest ⇒ Object
Returns the value of attribute manifest.
16 17 18 |
# File 'lib/bixby/provision/dsl/base.rb', line 16 def manifest @manifest end |
#proxy ⇒ Object
Returns the value of attribute proxy.
16 17 18 |
# File 'lib/bixby/provision/dsl/base.rb', line 16 def proxy @proxy end |
Instance Method Details
#get_gid(group) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/bixby/provision/dsl/base.rb', line 51 def get_gid(group) return group if group.nil? or group.kind_of? Fixnum return group.to_i if group =~ /^[0-9]+$/ # convert to int, e.g. "500" begin return Etc.getgrnam(group).gid rescue ArgumentError => ex # TODO raise logger.warn("Group '#{group}' was invalid: #{ex.}") end nil end |
#get_group(gid) ⇒ Object
63 64 65 66 67 68 69 70 71 |
# File 'lib/bixby/provision/dsl/base.rb', line 63 def get_group(gid) begin return Etc.getgrgid(gid).name rescue ArgumentError => ex # TODO raise logger.warn("Group '#{group}' was invalid: #{ex.}") end nil end |
#get_uid(user) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/bixby/provision/dsl/base.rb', line 29 def get_uid(user) return user if user.nil? or user.kind_of? Fixnum return user.to_i if user =~ /^[0-9]+$/ # convert to int, e.g. "500" begin return Etc.getpwnam(user).uid rescue ArgumentError => ex # TODO raise logger.warn("Username '#{user}' was invalid: #{ex.}") end nil end |
#get_user(uid) ⇒ Object
41 42 43 44 45 46 47 48 49 |
# File 'lib/bixby/provision/dsl/base.rb', line 41 def get_user(uid) begin return Etc.getpwuid(uid).name rescue ArgumentError => ex # TODO raise logger.warn("Username '#{user}' was invalid: #{ex.}") end nil end |
#tap(&block) ⇒ Object
25 26 27 |
# File 'lib/bixby/provision/dsl/base.rb', line 25 def tap(&block) self.instance_eval(&block) end |