Sha256: b54defb72d67df307ae3b5442a047b1556364bfaa2ec28d39b2881fcfb65571c
Contents?: true
Size: 1.78 KB
Versions: 2
Compression:
Stored size: 1.78 KB
Contents
require 'commander/blank' require 'commander/command' module Analytics module Command # A class called from CLI's 'init' argument, # which generates the project's configuration file depending on the user's input. class Init include Helpers::Terminal # Entry point of this class - the only public method in it. 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 ## The following methods are used to retrieve project information, ## in order to create analytitcs.yml configuration file. private # Prompts a user to select a programming language. def lang_selection languages = { 'Swift' => 'swift', 'Objective-C' => 'objc', 'Both' => 'swift-objc' } prompt.select('Select lang:', languages) end # Prompts a user to select a path to which the generated # analytics files will be saved. def analytics_path_selection prompt.ask('Where would You like to store analytics files? (Press enter to use default path)', default: './Common/Analytics/') end # Prompts a user to select a path in which he'll hold a source json file, # from which the analytics files will be generated. def src_path_selection prompt.ask('Where would You like to store json file from which analytics files will be generated? (Press enter to use default path)', default: 'analytics-source.json') end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ios_analytics_cli-1.1.0 | lib/ios_analytics_cli/commands/init.rb |
ios_analytics_cli-1.0.0 | lib/ios_analytics_cli/commands/init.rb |