Class: Lita::Handlers::GitHubDeploy

Inherits:
Handler
  • Object
show all
Defined in:
lib/lita/handlers/github_deploy.rb

Instance Method Summary collapse

Instance Method Details

#deploy(response) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/lita/handlers/github_deploy.rb', line 16

def deploy(response)
  app, _, env = response.args
  app, ref = app.split('#')
  app_config = config.apps[app]
  if app_config
    repo = app_config.fetch(:repo)
    ref ||= app_config.fetch(:default_ref, 'master')
    env ||= app_config.fetch(:default_env, 'production')
    create_deployment(repo, ref, env)
    response.reply("deploying #{repo}##{ref} to #{env}")
  else
    response.reply("#{app} not found")
  end
end