Class: GitWit::Actions::Ssh::Home
- Inherits:
-
Thor::Actions::EmptyDirectory
- Object
- Thor::Actions::EmptyDirectory
- GitWit::Actions::Ssh::Home
- Defined in:
- lib/git_wit/actions/ssh/home.rb
Instance Attribute Summary collapse
-
#base ⇒ Object
readonly
Returns the value of attribute base.
-
#home ⇒ Object
readonly
Returns the value of attribute home.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #exists? ⇒ Boolean
-
#initialize(base, user, home, config = {}) ⇒ Home
constructor
A new instance of Home.
- #invoke! ⇒ Object
- #revoke! ⇒ Object
Constructor Details
#initialize(base, user, home, config = {}) ⇒ Home
Returns a new instance of Home.
5 6 7 8 |
# File 'lib/git_wit/actions/ssh/home.rb', line 5 def initialize(base, user, home, config = {}) @base, @user, @home = base, user, File.(home) @config = {verbose: true}.merge config end |
Instance Attribute Details
#base ⇒ Object (readonly)
Returns the value of attribute base.
3 4 5 |
# File 'lib/git_wit/actions/ssh/home.rb', line 3 def base @base end |
#home ⇒ Object (readonly)
Returns the value of attribute home.
3 4 5 |
# File 'lib/git_wit/actions/ssh/home.rb', line 3 def home @home end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
3 4 5 |
# File 'lib/git_wit/actions/ssh/home.rb', line 3 def user @user end |
Instance Method Details
#exists? ⇒ Boolean
22 23 24 |
# File 'lib/git_wit/actions/ssh/home.rb', line 22 def exists? Dir.exists? home end |
#invoke! ⇒ Object
10 11 12 13 14 |
# File 'lib/git_wit/actions/ssh/home.rb', line 10 def invoke! invoke_with_conflict_check do create end end |
#revoke! ⇒ Object
16 17 18 19 20 |
# File 'lib/git_wit/actions/ssh/home.rb', line 16 def revoke! say_status :remove, :red destroy if !pretend? && exists? home end |