Class: Commands::Configs
- Inherits:
-
Object
- Object
- Commands::Configs
- Defined in:
- lib/commands/configs.rb
Instance Method Summary collapse
-
#options ⇒ Object
holds the options that were passed you can set any initial defaults here.
- #register(opts, global_options) ⇒ Object
-
#required_options ⇒ Object
required options.
- #run(global_options) ⇒ Object
Instance Method Details
#options ⇒ Object
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 ||= { } end |
#register(opts, global_options) ⇒ Object
24 25 26 27 |
# File 'lib/commands/configs.rb', line 24 def register(opts, ) opts. = "Usage: configs" opts.description = "List all configurations." end |
#required_options ⇒ Object
required options
19 20 21 22 |
# File 'lib/commands/configs.rb', line 19 def ||= 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() # 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 |