Class: Analytics::Command::Init

Inherits:
Object
  • Object
show all
Includes:
Helpers::Terminal
Defined in:
lib/ios_analytics_cli/commands/init.rb

Overview

A class called from CLI’s ‘init’ argument, which generates the project’s configuration file depending on the user’s input.

Instance Method Summary collapse

Methods included from Helpers::Terminal

#prompt

Instance Method Details

#performObject

Entry point of this class - the only public method in it.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/ios_analytics_cli/commands/init.rb', line 12

def perform
  lang = lang_selection
  analytics_path = analytics_path_selection
  src_path = src_path_selection

  config = {
    language: lang,
    analyticsFilesPath: analytics_path,
    sourcePath: src_path
  }
  Analytics::IO::Config.write(config)

  prompt.ok('Configuration file is properly created. You\'re good to go!')
end