-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
38 lines (32 loc) · 1.27 KB
/
Rakefile
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
33
34
35
36
37
38
require "yaml"
require "immosquare-slack"
namespace :immosquare_slack do
desc "Slack tasks"
namespace :sample do
##=============================================================##
## Load config keys from config_dev.yml
##=============================================================##
def load_config
path = "#{File.dirname(__FILE__)}/config_dev.yml"
abort("Error: config_dev.yml not found") if !File.exist?(path)
##=============================================================##
## Load config keys from config_dev.yml
##=============================================================##
dev_config = YAML.load_file(path)
abort("Error config_dev.yml is empty") if dev_config.nil?
ImmosquareSlack.config do |config|
config.slack_api_token_bot = dev_config["slack_api_token_bot"]
end
end
##=============================================================##
## rake immosquare_slack:sample:post_message
##=============================================================##
desc "Send Message to Sack Channel"
task :post_message do
load_config
ImmosquareSlack::Channel.post_message("test", "Je suis un test",
:notify => "channel",
:bot_name => "MyBot")
end
end
end