Class: Conjur::CLI

Inherits:
Object
  • Object
show all
Extended by:
GLI::App
Defined in:
lib/conjur/cli.rb

Class Method Summary collapse

Class Method Details

.apply_configObject



57
58
59
# File 'lib/conjur/cli.rb', line 57

def apply_config
  Conjur::Config.apply
end

.init!Object

This makes our generate-commands script a little bit cleaner. We can call this from that script to ensure that commands for all plugins are loaded.



88
89
90
91
92
93
94
# File 'lib/conjur/cli.rb', line 88

def init!
  subcommand_option_handling :normal
  load_config
  apply_config
  load_plugins
  commands_from 'conjur/command'
end

.load_configObject



53
54
55
# File 'lib/conjur/cli.rb', line 53

def load_config
  Conjur::Config.load
end

.load_pluginsObject



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/conjur/cli.rb', line 70

def load_plugins
  # These used to be plugins but now they are in the core CLI
  plugins = Conjur::Config.plugins - %w(layer pubkeys)
  
  plugins.each do |plugin|
    begin
      filename = "conjur-asset-#{plugin}"
      require filename
    rescue LoadError => err
      warn "WARNING: #{err.message}\n" \
        "Could not load plugin '#{plugin}' specified in your config file.\n"\
        "Make sure you have the #{filename} gem installed."
    end
  end
end

.run(args) ⇒ Object

Horible hack! We want to support legacy commands like host:list, but we don’t want to do too much effort, and GLIs support for aliasing doesn’t work out so well with subcommands.



65
66
67
68
# File 'lib/conjur/cli.rb', line 65

def run args
 args = args.shift.split(':') + args unless args.empty?
  super args
end