post2irc 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +4 -0
- data/Gemfile.lock +26 -0
- data/Rakefile +1 -0
- data/bin/post2irc +20 -0
- data/lib/post2irc/ircbot.rb +30 -0
- data/lib/post2irc/sinatra_listener.rb +16 -0
- data/lib/post2irc/version.rb +3 -0
- data/lib/post2irc.rb +9 -0
- data/pkg/post2irc-0.0.1.gem +0 -0
- data/post2irc.gemspec +27 -0
- metadata +90 -0
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
post2irc (0.0.1)
|
5
|
+
cinch
|
6
|
+
cinch
|
7
|
+
sinatra
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: http://rubygems.org/
|
11
|
+
specs:
|
12
|
+
cinch (2.0.3)
|
13
|
+
rack (1.4.1)
|
14
|
+
rack-protection (1.2.0)
|
15
|
+
rack
|
16
|
+
sinatra (1.3.2)
|
17
|
+
rack (~> 1.3, >= 1.3.6)
|
18
|
+
rack-protection (~> 1.2)
|
19
|
+
tilt (~> 1.3, >= 1.3.3)
|
20
|
+
tilt (1.3.3)
|
21
|
+
|
22
|
+
PLATFORMS
|
23
|
+
ruby
|
24
|
+
|
25
|
+
DEPENDENCIES
|
26
|
+
post2irc!
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/post2irc
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'cinch'
|
5
|
+
require 'sinatra'
|
6
|
+
require 'post2irc'
|
7
|
+
rescue LoadError => e
|
8
|
+
require 'rubygems'
|
9
|
+
path = File.expand_path '../../lib', __FILE__
|
10
|
+
$:.unshift(path) if File.directory?(path) && !$:.include?(path)
|
11
|
+
require 'cinch'
|
12
|
+
require 'sinatra'
|
13
|
+
require 'post2irc'
|
14
|
+
end
|
15
|
+
|
16
|
+
irc_server, irc_port, irc_channels, irc_nickname, sinatra_bind, sinatra_port = ARGV
|
17
|
+
|
18
|
+
Ircbot.start irc_server, irc_port, irc_channels, irc_nickname
|
19
|
+
SinatraListener.start sinatra_bind, sinatra_port
|
20
|
+
|
@@ -0,0 +1,30 @@
|
|
1
|
+
class Ircbot
|
2
|
+
def self.start(server, port, channels, nickname)
|
3
|
+
puts "XXX start"
|
4
|
+
puts server
|
5
|
+
puts port
|
6
|
+
puts channels
|
7
|
+
puts nickname
|
8
|
+
@@channels = channels.split(',')
|
9
|
+
@@bot = Cinch::Bot.new do
|
10
|
+
configure do |c|
|
11
|
+
c.nick = 'aspbot'
|
12
|
+
c.user = "aspbot"
|
13
|
+
c.realname = "aspbot"
|
14
|
+
c.server = 'irc.freenode.net'
|
15
|
+
c.port = 6667
|
16
|
+
c.channels = @@channels
|
17
|
+
end
|
18
|
+
end
|
19
|
+
Thread.new do
|
20
|
+
@@bot.start
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.report(message)
|
25
|
+
@@channels.each do |cname|
|
26
|
+
@@bot.Channel(cname).send "#{message}"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
|
2
|
+
class SinatraListener < Sinatra::Base
|
3
|
+
def self.start(bind='0.0.0.0',port='4567')
|
4
|
+
configure :production, :development do
|
5
|
+
enable :logging
|
6
|
+
set :port, port
|
7
|
+
set :bind, bind
|
8
|
+
end
|
9
|
+
self.run!
|
10
|
+
end
|
11
|
+
|
12
|
+
get "/" do
|
13
|
+
Ircbot.report params[:q]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
data/lib/post2irc.rb
ADDED
Binary file
|
data/post2irc.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "post2irc/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "post2irc"
|
7
|
+
s.version = Post2irc::VERSION
|
8
|
+
s.authors = ["javier ramirez"]
|
9
|
+
s.email = ["javier@formatinternet.com"]
|
10
|
+
s.homepage = "http://javier-ramirez.com"
|
11
|
+
s.summary = %q{Post to irc by sending a regular http post to a URL}
|
12
|
+
s.description = %q{This gem will start a sinatra script that will listen to posts and will publish the contents to an irc channel. No authentication is provided.}
|
13
|
+
|
14
|
+
s.rubyforge_project = "post2irc"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
# specify any dependencies here; for example:
|
22
|
+
s.add_dependency "sinatra"
|
23
|
+
s.add_dependency "cinch"
|
24
|
+
s.add_runtime_dependency "cinch"
|
25
|
+
s.required_ruby_version = '>= 1.9.1'
|
26
|
+
end
|
27
|
+
|
metadata
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: post2irc
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- javier ramirez
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-08-02 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: sinatra
|
16
|
+
requirement: &71413130 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *71413130
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: cinch
|
27
|
+
requirement: &71412030 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *71412030
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: cinch
|
38
|
+
requirement: &71411020 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *71411020
|
47
|
+
description: This gem will start a sinatra script that will listen to posts and will
|
48
|
+
publish the contents to an irc channel. No authentication is provided.
|
49
|
+
email:
|
50
|
+
- javier@formatinternet.com
|
51
|
+
executables:
|
52
|
+
- post2irc
|
53
|
+
extensions: []
|
54
|
+
extra_rdoc_files: []
|
55
|
+
files:
|
56
|
+
- Gemfile
|
57
|
+
- Gemfile.lock
|
58
|
+
- Rakefile
|
59
|
+
- bin/post2irc
|
60
|
+
- lib/post2irc.rb
|
61
|
+
- lib/post2irc/ircbot.rb
|
62
|
+
- lib/post2irc/sinatra_listener.rb
|
63
|
+
- lib/post2irc/version.rb
|
64
|
+
- pkg/post2irc-0.0.1.gem
|
65
|
+
- post2irc.gemspec
|
66
|
+
homepage: http://javier-ramirez.com
|
67
|
+
licenses: []
|
68
|
+
post_install_message:
|
69
|
+
rdoc_options: []
|
70
|
+
require_paths:
|
71
|
+
- lib
|
72
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 1.9.1
|
78
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
+
none: false
|
80
|
+
requirements:
|
81
|
+
- - ! '>='
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
requirements: []
|
85
|
+
rubyforge_project: post2irc
|
86
|
+
rubygems_version: 1.8.10
|
87
|
+
signing_key:
|
88
|
+
specification_version: 3
|
89
|
+
summary: Post to irc by sending a regular http post to a URL
|
90
|
+
test_files: []
|