Class: Thor::Actions::CreateLink

Inherits:
Object
  • Object
show all
Defined in:
lib/thor-ssh/actions/create_link.rb

Instance Method Summary collapse

Instance Method Details

#identical?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/thor-ssh/actions/create_link.rb', line 6

def identical?
  exists? && base.destination_files.identical?(render, destination)
end

#invoke!Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/thor-ssh/actions/create_link.rb', line 10

def invoke!
  invoke_with_conflict_check do
    base.destination_files.mkdir_p(File.dirname(destination))
    # Create a symlink by default
    config[:symbolic] = true if config[:symbolic].nil?
    base.destination_files.unlink(destination) if exists?
    if config[:symbolic]
      base.destination_files.symlink(render, destination)
    else
      base.destination_files.link(render, destination)
    end
  end
  given_destination
end