Class: EtnaApp

Inherits:
Object
  • Object
show all
Includes:
Etna::Application
Defined in:
lib/etna.rb,
lib/commands.rb

Defined Under Namespace

Classes: Config, Console, CreateTemplate, Janus, Magma, Metis, Polyphemus

Instance Attribute Summary

Attributes included from Etna::Application

#logger

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Etna::Application

#config, #configure, #controller_tags, #dev_route, #env_config, find, #find_descendents, #id, included, #initialize, instance, #load_config_from_env_path, register, #run_command, #setup_logger, #setup_yabeda, #sign, #test?, #write_job_metrics

Class Method Details

.config_file_pathObject



10
11
12
# File 'lib/commands.rb', line 10

def self.config_file_path
  File.join(Dir.home, 'etna.yml')
end

Instance Method Details

#dispatch_to_subcommand(cmd = 'help', *args, environment: nil, **kwds) ⇒ Object



16
17
18
19
# File 'lib/commands.rb', line 16

def dispatch_to_subcommand(cmd = 'help', *args, environment: nil, **kwds)
  set_environment(environment)
  super(cmd, *args, **kwds)
end

#environmentObject



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/commands.rb', line 21

def environment
  if @environment
    @environment
  elsif @config && @config.is_a?(Hash) && @config.keys.length == 1
    @config.keys.last.to_sym
  elsif @config && @config.is_a?(Hash) && @config.keys.length > 1
    :many
  else
    :none
  end
end

#set_environment(env) ⇒ Object



33
34
35
# File 'lib/commands.rb', line 33

def set_environment(env)
  @environment = env.nil? ? nil : env.to_sym
end