Class: Mammoth::Commands::ValidateCommand

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

Overview

Validates a Mammoth configuration through a provider.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(provider, output: $stdout) ⇒ ValidateCommand

Returns a new instance of ValidateCommand.

Parameters:

  • provider (#load)

    configuration provider

  • output (#puts) (defaults to: $stdout)

    output stream



11
12
13
14
# File 'lib/mammoth/commands/validate_command.rb', line 11

def initialize(provider, output: $stdout)
  @provider = provider
  @output = output
end

Instance Attribute Details

#outputObject (readonly)

Returns the value of attribute output.



7
8
9
# File 'lib/mammoth/commands/validate_command.rb', line 7

def output
  @output
end

#providerObject (readonly)

Returns the value of attribute provider.



7
8
9
# File 'lib/mammoth/commands/validate_command.rb', line 7

def provider
  @provider
end

Instance Method Details

#callInteger

Returns process-style status code.

Returns:

  • (Integer)

    process-style status code



17
18
19
20
21
# File 'lib/mammoth/commands/validate_command.rb', line 17

def call
  config = provider.load
  output.puts "Configuration OK: #{config.path}"
  0
end