-
Notifications
You must be signed in to change notification settings - Fork 0
/
dashbot.rb
executable file
·32 lines (27 loc) · 1.33 KB
/
dashbot.rb
1
2
3
4
5
6
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
#! /home/tolik/.rvm/rubies/ruby-2.1.2/bin/ruby
require 'active_support'
require 'slack-ruby-client'
Slack.configure do |config|
config.token = 'xoxb-66876465587-t278i97dYremj7P2wxyqoMxQ'
end
client = Slack::RealTime::Client.new
client.on :message do |data|
case data.text
when 'dashbot hi' then
client.web_client.chat_postMessage channel: data.channel, text: "Hi <@#{data.user}>!"
when 'dashbot -purpose' then
client.web_client.chat_postMessage channel: data.channel, text: "Hi <@#{data.user}>! I will do calabash automation tests for you. Run 'dashbot -help' to get help on my commands"
when 'dashbot -help' then
client.web_client.chat_postMessage channel: data.channel, text: "Hi <@#{data.user}>! This is what I can do for you: \n
\t'dashbot update build' - will download latest build from alpha and update test environment.
\t'dashbot test' - to start all available tests "
when 'dashbot test' then
client.web_client.chat_postMessage channel: data.channel, text: "<@#{data.user}> Starting test!"
file_name = "TestResults"+Time.now.to_s.gsub(' ','-')+'.txt'
result = system "/home/tolik/calabash-test-android/start_test.sh > #{file_name}"
status = "Failed"
result ? status = "Passed" : "Failed"
client.web_client.chat_postMessage channel: data.channel, text: status
end
end
client.start!