å®è¡æéã®é·ãã³ãã³ãã®çµäºãGrowlãã¡ã¼ã«éç¥ããRubyã¹ã¯ãªãã
ããã«ã¡ã¯ãæ ªå¼ä¼ç¤¾CFlatã§ãã
ãã«ããªã©ã®å¦çæéãé·ãã³ãã³ããå®è¡ãããã¨ã£ã¦ãã©ããå¾
ã¤ããããªãã¯ã¦ãã§ãè¦ããã¨ãyoutubeã§ãè¦ããã¨ãªã£ã¦ã大æµæ°ãã¤ããã¨ãã«ã¯ã³ãã³ããã¨ã£ãã«çµãã£ã¦ããã¨ãããã¨ã«ãªããã¡ã§ãã
ãã¨ãã£ã¦ããããçµãã£ãããªããï¼çµãã£ã¦ããããï¼ããç¹°ãè¿ãã®ã大å¤ã¹ãã¬ã¹ããã¾ãã¾ãããããã£ããã¨ã«ãªããã«ã³ãã³ãã®å¾
ã¡æéãæå¹ã«ä½¿ãããã«ã¯ãã¯ãçµäºãéç¥ããã®ãè³¢ãã§ãããã
æ¹æ³ã¯ããããããã¨æãã¾ããããæ軽ã«Rubyã§æ¸ãã¦ã¿ããã¨æãã¾ãã
ã¡ãªã¿ã«ãéç¥ã欲ããã¨ãã¯2ãã¿ã¼ã³ããã¨æã£ã¦ãã¾ãã
- Macããã¯é¢ããã«ãã©ã¦ã¶ã§éãã ããã¦ããå ´åã
- Macããé¢ãã¦ä½ããããå ´åï¼ex å¾ ã¡æéã«é¨å±ã®çä»ãã§ããã¨ãããï¼
åè ã¯Growlã®éç¥ãå¾è ã¯ã¡ã¼ã«ã§ã®éç¥ãã¡ããã©ããããªã¨èãã¾ããã
使ãæ¹
ãããã£ã¦ä½¿ãã¾ããRubyã¹ã¯ãªããã«å®è¡ãããã³ãã³ãã渡ãã¾ãã
# growl
$ growlnotifier [command] --option1 --option2
# mail
$ mailnotifier [command] --option1 --option2
ã½ã¼ã¹
Growléç¥
#!/usr/bin/env ruby commands = ARGV.join ' ' system "#{commands}" system "growlnotify -s -t 'bash' -m 'finished commands - [#{commands}]'"
Growléç¥ã®ããã«ã¯ãGrowlï¼ææï¼ã¨GrowlNotifyãå¿
è¦ã§ãã
Growlã¯MacAppStoreãããGrowlNotifyã¯ãã¡ãããâhttp://growl.info/downloads#generaldownloads
ã¡ã¼ã«éç¥
#!/usr/bin/env ruby require "mail" commands = ARGV.join ' ' system "#{commands}" mail = Mail.new do from "[email protected]" to "your_email" body "[#{commands}] finished" end mail.delivery_method :smtp, { address: "smtp.gmail.com", domain: "gmail.com", port: 587, user_name: "youraccount", password: "yourpassword" authentication: :plain } mail.deliver!