Class: Slugforge::Commands::Config

Inherits:
SubCommand show all
Defined in:
lib/slugforge/commands/config.rb

Instance Method Summary collapse

Methods inherited from SubCommand

banner

Methods inherited from Slugforge::Command

#initialize, start

Methods included from Helper

included

Constructor Details

This class inherits a constructor from Slugforge::Command

Instance Method Details

#showObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/slugforge/commands/config.rb', line 5

def show
  if json?
    logger.say_json config.values
  else
    logger.say "The following configuration options are in use:"
    rows = config.values.map { |name, value| [name, value] }
    print_table(rows, :indent => 4)

    unless config.slugins.empty?
      logger.say "Slugins detected:"
      rows = config.slugins.map do |(name, slugin)|
        [name, slugin.spec.version, slugin.enabled ? 'enabled' : 'disabled']
      end
      print_table(rows, :indent => 4)
    end
  end
end