fluke/devops-service/app/client/devops-client.rb

34 lines
679 B
Ruby
Raw Normal View History

2014-05-08 15:34:26 +04:00
require 'sinatra/base'
class Client < Sinatra::Base
2015-06-25 11:13:46 +03:00
def initialize
2014-05-08 15:34:26 +04:00
super()
2015-06-25 11:13:46 +03:00
@@config = DevopsConfig.config
2014-05-08 15:34:26 +04:00
end
# Route to download devops client
get "/devops-client.gem" do
begin
send_file @@config[:client_file]
rescue
msg = "No file '#{@@config[:client_file]}' found"
logger.error msg
return [404, msg]
end
end
# Route to get client documentation
get "/ru/index.html" do
file = File.join(@@config[:public_dir], "ru_index.html")
if File.exist? file
File.read(file)
else
logger.error "File '#{file}' does not exist"
return [404, "File '/ru/index.html' does not exist"]
end
end
end
2015-06-25 11:13:46 +03:00