Class: Commands::Configs

Inherits:
Object
  • Object
show all
Defined in:
lib/commands/configs.rb

Instance Method Summary collapse

Instance Method Details

#optionsObject

holds the options that were passed you can set any initial defaults here



13
14
15
16
# File 'lib/commands/configs.rb', line 13

def options
  @options ||= {
  }
end

#register(opts, global_options) ⇒ Object



24
25
26
27
# File 'lib/commands/configs.rb', line 24

def register(opts, global_options)
  opts.banner = "Usage: configs"
  opts.description = "List all configurations."
end

#required_optionsObject

required options



19
20
21
22
# File 'lib/commands/configs.rb', line 19

def required_options
  @required_options ||= Set.new [
  ]
end

#run(global_options) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/commands/configs.rb', line 30

def run(global_options)
  # show contents of configs directory for files with .config extension
  # try to make sure the repo is available
  EbmSharedLib.prepare_config_repo

  config_path = "#{EbmSharedLib::CONFIG_PATH}/configs"
  config_names = Pathname.glob("#{config_path}/*.config").map { |file_info|
    if file_info.directory? == false
      name = file_info.basename.to_s
      name.slice!("#{EbmSharedLib::CONFIG_SUFFIX}")
      name
    else
      nil
    end
  }
  puts "\nCurrent configurations:"
  config_names.each do |name|
    puts name unless name.nil?
  end

end