Class: Dude::Commands::Install

Inherits:
Dry::CLI::Command
  • Object
show all
Defined in:
lib/dude/commands/install.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object (private)



43
44
45
46
47
48
# File 'lib/dude/commands/install.rb', line 43

def method_missing(method, *args, &block)
  return super unless method.start_with?('setup_')

  const_name = method.to_s.split('setup_').last
  Object.const_get("Dude::Setup::#{const_name.capitalize}").new(prompt).call(settings: current_settings)
end

Instance Method Details

#callObject



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/dude/commands/install.rb', line 17

def call
  @prompt = TTY::Prompt.new

  create_file_if_not_exists

  @current_settings = Dude::Config.configure_with('.duderc.yml')
  @current_settings[:project_management_tool] = setup_project_management_tool # jira, trello
  @current_settings = send("setup_#{current_settings[:project_management_tool]}")
  setup_features.each { send("setup_#{_1}") } # toggl, github

  save
end