Class: GitWit::Actions::Ssh::Home

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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.expand_path(home)
  @config = {verbose: true}.merge config
end

Instance Attribute Details

#baseObject (readonly)

Returns the value of attribute base.



3
4
5
# File 'lib/git_wit/actions/ssh/home.rb', line 3

def base
  @base
end

#homeObject (readonly)

Returns the value of attribute home.



3
4
5
# File 'lib/git_wit/actions/ssh/home.rb', line 3

def home
  @home
end

#userObject (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

Returns:

  • (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