Class: ConfigmonkeyCli::Application::ManifestAction::Rtfm

Inherits:
Base
  • Object
show all
Defined in:
lib/configmonkey_cli/application/manifest_actions/rtfm.rb

Instance Attribute Summary

Attributes inherited from Base

#app, #args, #manifest, #opts, #thor

Instance Method Summary collapse

Methods inherited from Base

#args_and_opts, #exists?, #expand_dst, #expand_src, #initialize, #rel, #to_s

Constructor Details

This class inherits a constructor from ConfigmonkeyCli::Application::ManifestAction::Base

Instance Method Details

#destructiveObject



26
27
28
# File 'lib/configmonkey_cli/application/manifest_actions/rtfm.rb', line 26

def destructive
  thor.create_link(@link, manifest.directory)
end

#init(directory, opts = {}) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/configmonkey_cli/application/manifest_actions/rtfm.rb', line 5

def init directory, opts = {}
  @directory = directory
  @opts = opts.reverse_merge({
    name: "__THIS_IS_A_GIT_BASED_CONFIG__",
    symbolic: true,
  })
end

#prepareObject



13
14
15
16
# File 'lib/configmonkey_cli/application/manifest_actions/rtfm.rb', line 13

def prepare
  @actual_directory = expand_dst(@directory)
  @link = File.join(@actual_directory, @opts[:name])
end

#simulateObject



18
19
20
21
22
23
24
# File 'lib/configmonkey_cli/application/manifest_actions/rtfm.rb', line 18

def simulate
  if thor.options[:pretend]
    destructive
  else
    status :fake, :black, rel(@link)
  end
end