Created
July 6, 2016 07:56
-
-
Save nna774/ce0cfd761263cc52ceda05e62b0282b8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/ruby | |
# -*- encoding: utf-8 -*- | |
require 'json' | |
require "net/https" | |
WH_URI = "https://hooks.slack.com/services/~~~~~~~~~~~~~~~~~~" | |
hashO = { | |
"text" => "また git com を実行しました。", | |
"icon_emoji" => ":sadpanda:", | |
"username" => "git com", | |
"channel" => "#nona-kanshi", | |
} | |
hash = "payload=" + hashO.to_json | |
uri = URI.parse(WH_URI) | |
https = Net::HTTP.new(uri.host, uri.port) | |
https.use_ssl = true | |
req = Net::HTTP::Post.new(uri.request_uri) | |
req.body = hash | |
res = https.request(req) | |
puts "this \`com\` is reported to Slack" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
[alias]
com = !/home/nona/.dotfiles/bin/com.rb