Module: Service::ServiceValidation

Included in:
Remove
Defined in:
lib/mongrel_service/init.rb

Instance Method Summary collapse

Instance Method Details

#configureObject



156
157
158
159
160
# File 'lib/mongrel_service/init.rb', line 156

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

#validateObject



162
163
164
165
166
167
168
169
170
171
172
173
174
# File 'lib/mongrel_service/init.rb', line 162

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?("mongrel_service"), "The service specified isn't a Mongrel service."
    end
  end

  return @valid
end