Created
January 11, 2012 08:34
-
-
Save nbqx/1593724 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
Earthquake.init do | |
command %r|^:create_shindanmaker_plugin\s+(.+)\s(.+)$|, :as => :create_shindanmaker_plugin do |m| | |
name = m[1] | |
url = m[2] | |
dir = File.dirname(__FILE__) | |
tmpl = <<TMPL | |
# -*- coding: utf-8 -*- | |
require 'httpclient' | |
Earthquake.init do | |
command :#{name} do |m| | |
url = "#{url}" | |
html = HTTPClient.new.post(url, { :u => m[1], :from => ""} ) | |
r = nil | |
html.body.split("\\n").detect{|e| r = e.match(/>\s+?(.+)\#\{url\}/)} | |
input(r[1]) if r | |
end | |
end | |
TMPL | |
if confirm "create #{name} plugin?" | |
open(dir+"/#{name}.rb","w") do |f| | |
f.print tmpl | |
end | |
puts "Created. You have to reboot earthquake.gem" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment