Class: DPL::Provider::AzureWebApps

Inherits:
DPL::Provider show all
Defined in:
lib/dpl/provider/azure_webapps.rb

Instance Attribute Summary

Attributes inherited from DPL::Provider

#context, #options

Instance Method Summary collapse

Methods inherited from DPL::Provider

apt_get, #cleanup, #commit_msg, context, #create_key, #default_text_charset, #default_text_charset?, #deploy, #detect_encoding?, #encoding_for, #error, experimental, #initialize, #log, new, npm_g, #option, pip, requires, #run, #setup_git_credentials, #setup_git_ssh, #sha, shell, #uncleanup, #user_agent, #warn

Constructor Details

This class inherits a constructor from DPL::Provider

Instance Method Details

#check_appObject



21
22
# File 'lib/dpl/provider/azure_webapps.rb', line 21

def check_app
end

#check_authObject



24
25
26
27
28
# File 'lib/dpl/provider/azure_webapps.rb', line 24

def check_auth
  error "missing Azure Git Deployment username" unless config['username']
  error "missing Azure Git Deployment password" unless config['password']
  error "missing Azure Web App name" unless config['site']
end

#configObject



4
5
6
7
8
9
10
11
# File 'lib/dpl/provider/azure_webapps.rb', line 4

def config
  {
    "username"     => options[:username] || context.env['AZURE_WA_USERNAME'],
    "password"     => options[:password] || context.env['AZURE_WA_PASSWORD'],
    "site"         => options[:site] || context.env['AZURE_WA_SITE'],
    "slot"         => options[:slot] || context.env['AZURE_WA_SLOT']
  }
end

#git_targetObject



13
14
15
# File 'lib/dpl/provider/azure_webapps.rb', line 13

def git_target
  "https://#{config['username']}:#{config['password']}@#{config['slot'] || config['site']}.scm.azurewebsites.net:443/#{config['site']}.git"
end

#needs_key?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/dpl/provider/azure_webapps.rb', line 17

def needs_key?
  false
end

#push_appObject



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/dpl/provider/azure_webapps.rb', line 30

def push_app
  log "Deploying to Azure Web App '#{config['slot'] || config['site']}'"

  if !!options[:skip_cleanup]
    log "Skipping Cleanup"
    context.shell "git checkout HEAD"
    context.shell "git add . --all --force"
    context.shell "git commit -m \"Skip Cleanup Commit\""
  end

  if !!options[:verbose]
    context.shell "git push --force --quiet #{git_target} HEAD:master"
  else
    context.shell "git push --force --quiet #{git_target} HEAD:master > /dev/null 2>&1"
  end
end