Module: Gith::Slack

Included in:
Deliver, Deploy
Defined in:
lib/gith/adapters/slack.rb

Instance Method Summary collapse

Instance Method Details

#deploy_env(env, branch) ⇒ Object



34
35
36
37
# File 'lib/gith/adapters/slack.rb', line 34

def deploy_env(env, branch)
  notify "Deploying to #{env}"
  post_message "deploy #{branch} to #{env}"
end

#lock_and_deploy(env, story, branch) ⇒ Object



23
24
25
26
27
# File 'lib/gith/adapters/slack.rb', line 23

def lock_and_deploy(env, story, branch)
  lock_env    env, story
  sleep 2
  deploy_env  env, branch
end

#lock_env(env, story) ⇒ Object



29
30
31
32
# File 'lib/gith/adapters/slack.rb', line 29

def lock_env(env, story)
  notify "Locking #{env}"
  post_message "lock #{env} #{story}"
end

#post_message(msg) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/gith/adapters/slack.rb', line 14

def post_message(msg)
  msg = ".#{msg}" unless dev?

  slack.start_rtm
  slack.client.send channel: $channel, type: 'message', text: msg
  slack.client.init
  slack.client.single_send
end

#slackObject

$channel loaded in init.rb



10
11
12
# File 'lib/gith/adapters/slack.rb', line 10

def slack
  @slack ||= SlackRTM.new token: config[:slack_token]
end