dragoon 0.0.6 → 0.0.7
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/TODO +2 -1
- data/lib/dragoon.rb +11 -4
- data/lib/dragoon/color.rb +5 -2
- data/lib/dragoon/version.rb +1 -1
- metadata +4 -4
data/TODO
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
TODO
|
|
2
2
|
----------
|
|
3
|
+
- [ ] provide SSL connection support
|
|
3
4
|
- [x] config.yml.example
|
|
4
5
|
- [x] network: irc.freenode.net
|
|
5
6
|
- [x] channels: #ubuntu, #ruby, #ffmpeg
|
|
@@ -9,7 +10,7 @@ TODO
|
|
|
9
10
|
- [x] login
|
|
10
11
|
- [x] join channels
|
|
11
12
|
- [x] - normal channels
|
|
12
|
-
- [
|
|
13
|
+
- [x] - channels that need you to be identified with nickserv
|
|
13
14
|
- [ ] - more than 50 channels
|
|
14
15
|
- [x] Event Parsing
|
|
15
16
|
- [x] during msg events (PRIVMSG)
|
data/lib/dragoon.rb
CHANGED
|
@@ -124,19 +124,26 @@ module Dragoon
|
|
|
124
124
|
end
|
|
125
125
|
|
|
126
126
|
def run
|
|
127
|
-
trap("INT") { stop}
|
|
128
127
|
@socket = connect
|
|
129
128
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
129
|
+
begin
|
|
130
|
+
while line = @socket.gets
|
|
131
|
+
@event = Event.parse(line)
|
|
132
|
+
dispatch(@event)
|
|
133
|
+
end
|
|
134
|
+
rescue Interrupt
|
|
135
|
+
stop
|
|
133
136
|
end
|
|
137
|
+
|
|
134
138
|
end
|
|
135
139
|
|
|
136
140
|
def connect
|
|
137
141
|
puts "*** Connecting to #{@network} on port #{@port}"
|
|
138
142
|
puts "*** Press Ctrl + c to stop the program"
|
|
139
143
|
TCPSocket.new(@network, @port)
|
|
144
|
+
rescue Errno::EADDRNOTAVAIL => e
|
|
145
|
+
puts "#{e.class} Cannot connect to #{@network} at port #{@port}".red
|
|
146
|
+
exit
|
|
140
147
|
end
|
|
141
148
|
|
|
142
149
|
def stop
|
data/lib/dragoon/color.rb
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
module Dragoon
|
|
2
2
|
module Color
|
|
3
3
|
|
|
4
|
+
# Term::ANSIColors is included in String class to simplify text coloring
|
|
5
|
+
# ie. "word".green => "\e[32mword\e[0m"
|
|
6
|
+
|
|
4
7
|
# borrowed from Term::ANSIColors
|
|
5
8
|
COLORED_REGEXP = /\e\[(?:(?:[349]|10)[0-7]|[0-9])?m/
|
|
6
|
-
|
|
9
|
+
COLOR_LIST = [:red, :green, :blue, :magenta, :cyan, :white]
|
|
7
10
|
|
|
8
11
|
# assign a permanent color to a text
|
|
9
12
|
def colorize(text)
|
|
@@ -13,7 +16,7 @@ module Dragoon
|
|
|
13
16
|
end
|
|
14
17
|
|
|
15
18
|
def next_color
|
|
16
|
-
|
|
19
|
+
COLOR_LIST.push(COLOR_LIST.shift).first
|
|
17
20
|
end
|
|
18
21
|
|
|
19
22
|
def highlight_keywords(text,keywords)
|
data/lib/dragoon/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dragoon
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 17
|
|
5
5
|
prerelease:
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 0
|
|
9
|
-
-
|
|
10
|
-
version: 0.0.
|
|
9
|
+
- 7
|
|
10
|
+
version: 0.0.7
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Reginald Tan
|
|
@@ -15,7 +15,7 @@ autorequire:
|
|
|
15
15
|
bindir: bin
|
|
16
16
|
cert_chain: []
|
|
17
17
|
|
|
18
|
-
date: 2012-02-
|
|
18
|
+
date: 2012-02-08 00:00:00 Z
|
|
19
19
|
dependencies:
|
|
20
20
|
- !ruby/object:Gem::Dependency
|
|
21
21
|
name: rspec
|