Parent

Stella

Public Class Methods

canonical_host(host) click to toggle source

blamestella.com/ => blamestella.com blamestella.com/ => blamestella.com:443

# File lib/stella.rb, line 161
def canonical_host(host)
  return nil if host.nil?
  if host.kind_of?(URI)
    uri = host
  else
    host &&= host.to_s
    host.strip!
    host = host.to_s unless String === host
    host = "http://#{host}" unless host.match(/^https?:\/\//)
    uri = URI.parse(host)
  end
  str = "#{uri.host}".downcase 
  #str << ":#{uri.port}" if uri.port && uri.port != 80 
  str
end
canonical_uri(uri) click to toggle source
# File lib/stella.rb, line 177
def canonical_uri(uri)
  return nil if uri.nil?
  if uri.kind_of?(URI)
    uri = Addressable::URI.parse uri.to_s
  elsif uri.kind_of?(String)
    uri &&= uri.to_s
    uri.strip! unless uri.frozen?
    uri = "http://#{uri}" unless uri.match(/^https?:\/\//)
    uri = Addressable::URI.parse(uri)
  end
  uri.scheme ||= 'http'
  uri.path = '/' if uri.path.to_s.empty?
  uri
end
checkup(uri, opts={}) click to toggle source
# File lib/stella.rb, line 150
def checkup(uri, opts={})
  plan = Stella::Testplan.new uri
  run = Stella::Testrun.new plan, :checkup, opts
  Stella::Engine.run run
  run
end
debug?() click to toggle source
# File lib/stella.rb, line 129
def debug?()        @debug == true  end
get(uri, opts={}) click to toggle source
# File lib/stella.rb, line 139
def get(uri, opts={})
  opts[:concurrency] ||= 1
  opts[:repetitions] ||= 1
  run = checkup uri, opts
  report = run.report
  if report.processed? && report.content && report.statuses.success?
    report.content.response_body 
  else
    nil
  end
end
ld(*msg) click to toggle source
# File lib/stella.rb, line 133
def ld(*msg)
  return unless Stella.debug?
  prefix = "D(#{Thread.current.object_id}):  "
  li("#{prefix}#{msg.join("#{$/}#{prefix}")}")
end
le(*msg) click to toggle source
# File lib/stella.rb, line 132
def le(*msg); li "  " << msg.join("#{$/}  ") end
li(*msg) click to toggle source
# File lib/stella.rb, line 131
def li(*msg) STDERR.puts *msg unless quiet? end
new(*args) click to toggle source
# File lib/stella.rb, line 110
def initialize *args
  @plan = Stella::TP === args.first ? 
    args.first.clone : Stella::TP.new(args.first)
  #@plan.freeze
  @runner
end
now() click to toggle source
# File lib/stella.rb, line 156
def now
  Time.now.utc.to_f
end
quiet?() click to toggle source
# File lib/stella.rb, line 130
def quiet?()        @quiet == true  end
rescue(&blk) click to toggle source
# File lib/stella.rb, line 192
def rescue(&blk)
  blk.call
rescue StellaError => ex
  Stella.le ex.message
  Stella.ld ex.backtrace
#rescue => ex
#  Stella.le ex.message
#  Stella.le ex.backtrace
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.