Class: PolyglotCli::Command::Setup
- Inherits:
-
Object
- Object
- PolyglotCli::Command::Setup
- Includes:
- Helper::General, Helper::Terminal
- Defined in:
- lib/polyglot_cli/commands/setup.rb
Instance Attribute Summary collapse
-
#subdomain ⇒ Object
readonly
override subdomain for the setup, use the cached value (from prompt) instead of reading it from the config file (which does not exist yet during the setup).
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(options = Commander::Command::Options.new) ⇒ Setup
constructor
A new instance of Setup.
Methods included from Helper::General
#config, #languages, #project, #project_id, #remote_translations, #select_languages, #server_changed?, #token, #update_config
Methods included from Helper::Terminal
Constructor Details
#initialize(options = Commander::Command::Options.new) ⇒ Setup
Returns a new instance of Setup.
14 15 16 |
# File 'lib/polyglot_cli/commands/setup.rb', line 14 def initialize( = Commander::Command::Options.new) @options = end |
Instance Attribute Details
#subdomain ⇒ Object (readonly)
override subdomain for the setup, use the cached value (from prompt) instead of reading it from the config file (which does not exist yet during the setup)
34 35 36 |
# File 'lib/polyglot_cli/commands/setup.rb', line 34 def subdomain @subdomain end |
Class Method Details
.init(options) ⇒ Object
10 11 12 |
# File 'lib/polyglot_cli/commands/setup.rb', line 10 def self.init() new().call end |
Instance Method Details
#call ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/polyglot_cli/commands/setup.rb', line 18 def call @config = { subdomain: subdomain_prompt, project_id: project_id_prompt, locale_path: locale_path_prompt } PolyglotCli::IO::Config.write(@config.merge(locale_mapping: locale_mapping)) success rescue TTY::Prompt::ConfigurationError prompt.error('Could not find any projects. Please try a new search.') end |