Skip to content

Instantly share code, notes, and snippets.

@nna774
Created July 6, 2016 07:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nna774/ce0cfd761263cc52ceda05e62b0282b8 to your computer and use it in GitHub Desktop.
Save nna774/ce0cfd761263cc52ceda05e62b0282b8 to your computer and use it in GitHub Desktop.
#! /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"
@nna774
Copy link
Author

nna774 commented Jul 6, 2016

[alias]
com = !/home/nona/.dotfiles/bin/com.rb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment