Class: GitWit::Actions::Ssh::Sudoers
- Inherits:
-
Thor::Actions::EmptyDirectory
- Object
- Thor::Actions::EmptyDirectory
- GitWit::Actions::Ssh::Sudoers
- Defined in:
- lib/git_wit/actions/ssh/sudoers.rb
Instance Attribute Summary collapse
-
#base ⇒ Object
readonly
Returns the value of attribute base.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #exists? ⇒ Boolean
-
#initialize(base, name, config = {}) ⇒ Sudoers
constructor
A new instance of Sudoers.
- #invoke! ⇒ Object
- #revoke! ⇒ Object
Constructor Details
#initialize(base, name, config = {}) ⇒ Sudoers
Returns a new instance of Sudoers.
6 7 8 9 |
# File 'lib/git_wit/actions/ssh/sudoers.rb', line 6 def initialize(base, name, config = {}) @base, @name = base, name @config = {verbose: true}.merge config end |
Instance Attribute Details
#base ⇒ Object (readonly)
Returns the value of attribute base.
4 5 6 |
# File 'lib/git_wit/actions/ssh/sudoers.rb', line 4 def base @base end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/git_wit/actions/ssh/sudoers.rb', line 4 def name @name end |
Instance Method Details
#exists? ⇒ Boolean
22 23 24 25 |
# File 'lib/git_wit/actions/ssh/sudoers.rb', line 22 def exists? `sudo grep '#{sentinel}' /etc/sudoers 2>/dev/null` $?.success? end |
#invoke! ⇒ Object
11 12 13 14 15 |
# File 'lib/git_wit/actions/ssh/sudoers.rb', line 11 def invoke! invoke_with_conflict_check do create end end |
#revoke! ⇒ Object
17 18 19 20 |
# File 'lib/git_wit/actions/ssh/sudoers.rb', line 17 def revoke! say_status :remove, :red destroy if !pretend? && exists? end |