-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRunfile
More file actions
49 lines (42 loc) · 1.22 KB
/
Copy pathRunfile
File metadata and controls
49 lines (42 loc) · 1.22 KB
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
39
40
41
42
43
44
45
46
47
48
49
require 'byebug'
require 'lp'
require 'slacktail'
title "Slacktail Developer Toolbelt"
summary "Runfile tasks for building the Slacktail gem"
import_gem 'runfile-tasks/gem'
import 'demo'
import 'debug'
help "Test message rendering"
usage "render [YAMLFILE]"
action :render do |args|
file = args['YAMLFILE']
Slacktail::Client.default.start_async # in order to have channels and users list
message = file ? YAML.load_file("#{file}.yml") : message_mock
message = Slacktail::Message.new message
message.render
end
help "Generate changelog and append old changelog"
action :changelog do
system "git changelog --save"
# append older changelog (prior to switching to git-changelog)
system "cat .changelog.old.md >> CHANGELOG.md"
end
helpers do
# Mock for quick and dirty use with run render
def message_mock
OpenStruct.new({
text: "Hello tester",
# bot_id: 'some-bot-id',
user: "some-user-id",
attachments: [
OpenStruct.new({
text: "*Build SUCCESS*: `stage-shutdown` *#45*",
fields: [
OpenStruct.new({ title: "Build Number", value: "45" }),
OpenStruct.new({ title: "Env", value: "Production" }),
]
})
]
})
end
end