require "rubygems"
require "net/http"
require "uri"
if ARGV.length < 3
puts "cqversion.rb username password http://localhost:4502"
else
username = ARGV[0]
password = ARGV[1]
host = ARGV[2]
uri = URI.parse(host+"/libs/cq/core/content/welcome.html")
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Get.new(uri.request_uri)
request.basic_auth username, password
response = http.request(request)
if response.code == "200"
puts /Version [0-9\.a-zA-Z ]*/.match(response.body)
else
puts "failed to get version number - http error code: ", response.code
end
end
No comments:
Post a Comment
If you have any doubts or questions, please let us know.