Class: GitWit::Actions::Dscl::Base

Inherits:
Thor::Actions::EmptyDirectory
  • Object
show all
Defined in:
lib/git_wit/actions/dscl/base.rb

Direct Known Subclasses

Group, GroupMembership, User

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base, type, name, config = {}) ⇒ Base

Returns a new instance of Base.



6
7
8
9
# File 'lib/git_wit/actions/dscl/base.rb', line 6

def initialize(base, type, name, config = {})
  @base, @type, @name = base, type, name
  @config = {verbose: true}.merge config
end

Instance Attribute Details

#baseObject (readonly)

Returns the value of attribute base.



4
5
6
# File 'lib/git_wit/actions/dscl/base.rb', line 4

def base
  @base
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/git_wit/actions/dscl/base.rb', line 4

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



4
5
6
# File 'lib/git_wit/actions/dscl/base.rb', line 4

def type
  @type
end

Instance Method Details

#exists?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/git_wit/actions/dscl/base.rb', line 22

def exists?
  dscl_exists?
end

#invoke!Object



11
12
13
14
15
# File 'lib/git_wit/actions/dscl/base.rb', line 11

def invoke!
  invoke_with_conflict_check do
    create
  end
end

#revoke!Object



17
18
19
20
# File 'lib/git_wit/actions/dscl/base.rb', line 17

def revoke!
  say_status :remove, :red
  destroy if !pretend? && exists?
end