marvin 0.8.0.2 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +9 -0
- data/examples/example_dsl.rb +54 -0
- data/lib/marvin.rb +1 -1
- data/lib/marvin/abstract_client.rb +2 -4
- data/lib/marvin/irc/client.rb +3 -2
- metadata +47 -21
data/README.markdown
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
Marvin - an evented ruby IRC library
|
2
|
+
------------------------------------
|
3
|
+
|
4
|
+
Welcome to the home of Marvin - a ruby library (usable as a framework) for working with IRC
|
5
|
+
in an evented fashion. This app is currently undergoing major changes and master is used to
|
6
|
+
reflect ongoing development. If you'd like to play with an older version, checkout the
|
7
|
+
_v0.4.0_ tag or the _legacy_ branch. Thanks!
|
8
|
+
|
9
|
+
-- Darcy
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'marvin'
|
2
|
+
Marvin::DSL.run do
|
3
|
+
|
4
|
+
configure do |c|
|
5
|
+
c.real_name = "Marvin Bot of Doom"
|
6
|
+
c.user_name = "MarvinBot"
|
7
|
+
c.nicks = "Marvin", "Marvin_", "Marvin__"
|
8
|
+
end
|
9
|
+
|
10
|
+
logging do
|
11
|
+
|
12
|
+
setup do
|
13
|
+
@file = File.open(Marvin::Settings.root.join("logs", "irc.log"), "w+")
|
14
|
+
end
|
15
|
+
|
16
|
+
incoming do |server, nick, target, message|
|
17
|
+
@file.puts "<< #{Time.now} <#{target}:#{server}> #{nick}: #{message}"
|
18
|
+
end
|
19
|
+
|
20
|
+
outgoing do |server, nick, target, message|
|
21
|
+
@file.puts ">> #{Time.now} <#{target}:#{server}> #{nick}: #{message}"
|
22
|
+
end
|
23
|
+
|
24
|
+
teardown do
|
25
|
+
@file.close if @file
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
handler do
|
31
|
+
|
32
|
+
on :incoming_action do
|
33
|
+
reply "Hey! Are we related?" if from.include?(client.nickname)
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
commands do
|
39
|
+
|
40
|
+
prefix_is "!"
|
41
|
+
|
42
|
+
command :awesome, "Tells you how awesome you are" do
|
43
|
+
reply "You are #{25 + rand(75)}% awesome!"
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
server "irc.freenode.net" do
|
49
|
+
|
50
|
+
join "#marvin-testing", "#relayrelay"
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
data/lib/marvin.rb
CHANGED
@@ -34,8 +34,6 @@ module Marvin
|
|
34
34
|
logger.info "Initializing the current instance"
|
35
35
|
@channels = []
|
36
36
|
connections << self
|
37
|
-
logger.info "Setting the client for each handler"
|
38
|
-
setup_handlers
|
39
37
|
logger.info "Dispatching the default :client_connected event"
|
40
38
|
dispatch :client_connected
|
41
39
|
end
|
@@ -60,9 +58,9 @@ module Marvin
|
|
60
58
|
Marvin::Reloading.reload! if @@development
|
61
59
|
end
|
62
60
|
|
63
|
-
def
|
61
|
+
def pre_dispatching
|
64
62
|
process_development
|
65
|
-
|
63
|
+
setup_handlers
|
66
64
|
end
|
67
65
|
|
68
66
|
# Sets the current class-wide settings of this IRC Client
|
data/lib/marvin/irc/client.rb
CHANGED
@@ -52,7 +52,7 @@ module Marvin::IRC
|
|
52
52
|
def receive_line(line)
|
53
53
|
return unless @connected
|
54
54
|
line = line.strip
|
55
|
-
logger.debug "<< #{line}"
|
55
|
+
logger.debug "[#{host_with_port}] << #{line}"
|
56
56
|
@client.receive_line(line)
|
57
57
|
rescue Exception => e
|
58
58
|
logger.warn "Uncaught exception raised; Likely in Marvin"
|
@@ -62,7 +62,7 @@ module Marvin::IRC
|
|
62
62
|
def send_line(*lines)
|
63
63
|
return unless @connected
|
64
64
|
lines.each do |line|
|
65
|
-
logger.debug ">> #{line.strip}"
|
65
|
+
logger.debug "[#{host_with_port}] >> #{line.strip}"
|
66
66
|
send_data line
|
67
67
|
end
|
68
68
|
end
|
@@ -105,6 +105,7 @@ module Marvin::IRC
|
|
105
105
|
EventMachine.run do
|
106
106
|
unless connections.data == false
|
107
107
|
connections.each_pair do |server, configuration|
|
108
|
+
configuration ||= Marvin::Nash.new
|
108
109
|
connect(configuration.merge(:server => server.to_s))
|
109
110
|
end
|
110
111
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: marvin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Darcy Laycock
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-10-05 00:00:00 +08:00
|
13
13
|
default_executable: marvin
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 1.0.
|
23
|
+
version: 1.0.1
|
24
24
|
version:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: eventmachine
|
@@ -42,6 +42,26 @@ dependencies:
|
|
42
42
|
- !ruby/object:Gem::Version
|
43
43
|
version: "0"
|
44
44
|
version:
|
45
|
+
- !ruby/object:Gem::Dependency
|
46
|
+
name: thoughtbot-shoulda
|
47
|
+
type: :development
|
48
|
+
version_requirement:
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: "0"
|
54
|
+
version:
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: yard
|
57
|
+
type: :development
|
58
|
+
version_requirement:
|
59
|
+
version_requirements: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: "0"
|
64
|
+
version:
|
45
65
|
description: |-
|
46
66
|
Marvin is a library (also usable in framework / application form) that
|
47
67
|
makes it simple and fast to build applications around IRC. With an emphasis
|
@@ -54,10 +74,16 @@ executables:
|
|
54
74
|
- marvin
|
55
75
|
extensions: []
|
56
76
|
|
57
|
-
extra_rdoc_files:
|
58
|
-
|
77
|
+
extra_rdoc_files:
|
78
|
+
- README.markdown
|
59
79
|
files:
|
60
80
|
- bin/marvin
|
81
|
+
- handlers/debug_handler.rb
|
82
|
+
- handlers/hello_world.rb
|
83
|
+
- handlers/keiki_thwopper.rb
|
84
|
+
- handlers/simple_logger.rb
|
85
|
+
- handlers/tweet_tweet.rb
|
86
|
+
- lib/marvin.rb
|
61
87
|
- lib/marvin/abstract_client.rb
|
62
88
|
- lib/marvin/abstract_parser.rb
|
63
89
|
- lib/marvin/base.rb
|
@@ -66,32 +92,31 @@ files:
|
|
66
92
|
- lib/marvin/command_handler.rb
|
67
93
|
- lib/marvin/console.rb
|
68
94
|
- lib/marvin/core_commands.rb
|
95
|
+
- lib/marvin/distributed.rb
|
69
96
|
- lib/marvin/distributed/client.rb
|
70
97
|
- lib/marvin/distributed/handler.rb
|
71
98
|
- lib/marvin/distributed/protocol.rb
|
72
99
|
- lib/marvin/distributed/server.rb
|
73
|
-
- lib/marvin/distributed.rb
|
74
100
|
- lib/marvin/dsl.rb
|
75
101
|
- lib/marvin/exception_tracker.rb
|
76
102
|
- lib/marvin/exceptions.rb
|
103
|
+
- lib/marvin/irc.rb
|
77
104
|
- lib/marvin/irc/client.rb
|
78
105
|
- lib/marvin/irc/event.rb
|
79
106
|
- lib/marvin/irc/replies.rb
|
80
|
-
- lib/marvin/irc.rb
|
81
107
|
- lib/marvin/logging_handler.rb
|
82
108
|
- lib/marvin/middle_man.rb
|
109
|
+
- lib/marvin/parsers.rb
|
83
110
|
- lib/marvin/parsers/command.rb
|
111
|
+
- lib/marvin/parsers/prefixes.rb
|
84
112
|
- lib/marvin/parsers/prefixes/host_mask.rb
|
85
113
|
- lib/marvin/parsers/prefixes/server.rb
|
86
|
-
- lib/marvin/parsers/prefixes.rb
|
87
114
|
- lib/marvin/parsers/ragel_parser.rb
|
88
115
|
- lib/marvin/parsers/ragel_parser.rl
|
89
116
|
- lib/marvin/parsers/simple_parser.rb
|
90
|
-
- lib/marvin/parsers.rb
|
91
117
|
- lib/marvin/settings.rb
|
92
118
|
- lib/marvin/test_client.rb
|
93
119
|
- lib/marvin/util.rb
|
94
|
-
- lib/marvin.rb
|
95
120
|
- templates/boot.erb
|
96
121
|
- templates/connections.yml.erb
|
97
122
|
- templates/debug_handler.erb
|
@@ -105,18 +130,14 @@ files:
|
|
105
130
|
- test/parser_test.rb
|
106
131
|
- test/test_helper.rb
|
107
132
|
- test/util_test.rb
|
108
|
-
-
|
109
|
-
|
110
|
-
- handlers/keiki_thwopper.rb
|
111
|
-
- handlers/simple_logger.rb
|
112
|
-
- handlers/tweet_tweet.rb
|
113
|
-
has_rdoc: false
|
133
|
+
- README.markdown
|
134
|
+
has_rdoc: true
|
114
135
|
homepage: http://sutto.net/
|
115
136
|
licenses: []
|
116
137
|
|
117
138
|
post_install_message:
|
118
|
-
rdoc_options:
|
119
|
-
|
139
|
+
rdoc_options:
|
140
|
+
- --charset=UTF-8
|
120
141
|
require_paths:
|
121
142
|
- lib
|
122
143
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -134,9 +155,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
155
|
requirements: []
|
135
156
|
|
136
157
|
rubyforge_project:
|
137
|
-
rubygems_version: 1.3.
|
158
|
+
rubygems_version: 1.3.5
|
138
159
|
signing_key:
|
139
160
|
specification_version: 3
|
140
161
|
summary: Evented IRC Library for Ruby, built on EventMachine and Perennial.
|
141
|
-
test_files:
|
142
|
-
|
162
|
+
test_files:
|
163
|
+
- test/abstract_client_test.rb
|
164
|
+
- test/parser_comparison.rb
|
165
|
+
- test/parser_test.rb
|
166
|
+
- test/test_helper.rb
|
167
|
+
- test/util_test.rb
|
168
|
+
- examples/example_dsl.rb
|