Class: Publisher::Iis_deploy
- Inherits:
-
Object
- Object
- Publisher::Iis_deploy
- Defined in:
- lib/depengine/publisher/iis_deploy.rb
Instance Attribute Summary collapse
-
#http_read_timeout ⇒ Object
Returns the value of attribute http_read_timeout.
-
#iis_deploy_protocol ⇒ Object
Returns the value of attribute iis_deploy_protocol.
-
#iis_deploy_url ⇒ Object
Returns the value of attribute iis_deploy_url.
Instance Method Summary collapse
Instance Attribute Details
#http_read_timeout ⇒ Object
Returns the value of attribute http_read_timeout.
5 6 7 |
# File 'lib/depengine/publisher/iis_deploy.rb', line 5 def http_read_timeout @http_read_timeout end |
#iis_deploy_protocol ⇒ Object
Returns the value of attribute iis_deploy_protocol.
4 5 6 |
# File 'lib/depengine/publisher/iis_deploy.rb', line 4 def iis_deploy_protocol @iis_deploy_protocol end |
#iis_deploy_url ⇒ Object
Returns the value of attribute iis_deploy_url.
3 4 5 |
# File 'lib/depengine/publisher/iis_deploy.rb', line 3 def iis_deploy_url @iis_deploy_url end |
Instance Method Details
#deploy(version, iis_application_name, env) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/depengine/publisher/iis_deploy.rb', line 7 def deploy(version, iis_application_name, env) Helper.validates_presence_of iis_deploy_url, "IIS URL not set" Helper.validates_presence_of iis_deploy_protocol, "Protocol not set" iis_error = false begin uri = URI(iis_deploy_protocol + '://' + iis_deploy_url) Net::HTTP.start(uri.host, uri.port) do |http| http.read_timeout = http_read_timeout request = Net::HTTP::Post.new uri.request_uri request.set_form_data('version' => version, 'application_name' => iis_application_name, 'env' => env) request.content_type = 'application/x-www-form-urlencoded;charset=utf-8' http.request request do |response| response.read_body do |chunk| if chunk.include?("### Error while executing") $log.writer.error "Error executing deploy on IIS" iis_error = true end $log.writer.info "#{chunk}" end end end rescue Exception => e $log.writer.error "Error: while connecting to IIS Server" $log.writer.error "Request was: #{uri.to_s}" $log.writer.error e. exit 1 end if iis_error exit 1 end end |