Module: ThinService::Command::Commands::ServiceValidation

Included in:
Remove
Defined in:
lib/thin_service/command.rb

Instance Method Summary collapse

Instance Method Details

#configureObject



307
308
309
310
311
# File 'lib/thin_service/command.rb', line 307

def configure
  options [
    ['-N', '--name SVC_NAME', "Required name for the service to be registered/installed.", :@svc_name, nil],
  ]
end

#validateObject



313
314
315
316
317
318
319
320
321
322
323
324
325
# File 'lib/thin_service/command.rb', line 313

def validate
  valid? @svc_name != nil, "A service name is mandatory."

  # Validate that the service exists
  valid? ServiceManager.exist?(@svc_name), "There is no service with that name, cannot proceed."
  if @valid then
    ServiceManager.open(@svc_name) do |svc|
      valid? svc.binary_path_name.include?("thin_service"), "The service specified isn't a Thin service."
    end
  end

  return @valid
end