camper_van 0.0.14 → 0.0.15
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 +0 -1
- data/camper_van.gemspec +1 -0
- data/lib/camper_van/channel.rb +3 -9
- data/lib/camper_van/version.rb +1 -1
- data/spec/camper_van/channel_spec.rb +34 -3
- metadata +5 -4
data/Gemfile
CHANGED
data/camper_van.gemspec
CHANGED
@@ -10,6 +10,7 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.homepage = "https://github.com/zerowidth/camper_van"
|
11
11
|
s.summary = %q{An IRC to Campfire bridge}
|
12
12
|
s.description = %q{An IRC to Campfire bridge for IRC-based access to campfire chatrooms}
|
13
|
+
s.license = "MIT"
|
13
14
|
|
14
15
|
s.rubyforge_project = "camper_van"
|
15
16
|
|
data/lib/camper_van/channel.rb
CHANGED
@@ -78,19 +78,13 @@ module CamperVan
|
|
78
78
|
|
79
79
|
# Public: "leaves" a campfire room, per the PART irc command.
|
80
80
|
# Confirms with the connected client to PART the channel.
|
81
|
-
#
|
82
|
-
# Does not actually leave the campfire room, just closes out the campfire
|
83
|
-
# connections, so the server can idle the connection out. This behavior
|
84
|
-
# was chosen so periodic joins/parts wouldn't spam the campfire rooms
|
85
|
-
# unnecessarily, and also to reflect how Propane et. al. treat open
|
86
|
-
# connections: allowing them to time out rather than leaving explicitly.
|
87
81
|
def part
|
88
82
|
client.user_reply :part, channel
|
89
83
|
if stream
|
90
|
-
stream.close if stream.respond_to?(
|
91
|
-
stream.close_connection if stream.respond_to?(
|
84
|
+
stream.close if stream.respond_to?(:close) # EM/em-http-request gem is installed and uses .close
|
85
|
+
stream.close_connection if stream.respond_to?(:close_connection)
|
92
86
|
end
|
93
|
-
|
87
|
+
room.leave
|
94
88
|
end
|
95
89
|
|
96
90
|
# Public: replies to a WHO command with a list of users for a campfire room,
|
data/lib/camper_van/version.rb
CHANGED
@@ -22,6 +22,7 @@ describe CamperVan::Channel do
|
|
22
22
|
attr_reader :locked, :full, :topic, :membership_limit
|
23
23
|
attr_reader :sent
|
24
24
|
attr_reader :stream_count
|
25
|
+
attr_reader :left
|
25
26
|
|
26
27
|
attr_writer :users, :topic, :locked, :full, :open_to_guests
|
27
28
|
attr_writer :stream
|
@@ -52,6 +53,10 @@ describe CamperVan::Channel do
|
|
52
53
|
yield
|
53
54
|
end
|
54
55
|
|
56
|
+
def leave
|
57
|
+
@left = true
|
58
|
+
end
|
59
|
+
|
55
60
|
def users
|
56
61
|
yield @users if block_given?
|
57
62
|
@users
|
@@ -144,12 +149,38 @@ describe CamperVan::Channel do
|
|
144
149
|
end
|
145
150
|
|
146
151
|
it "closes the connection on the stream" do
|
147
|
-
|
148
|
-
|
152
|
+
stream = Class.new do
|
153
|
+
attr_reader :closed
|
154
|
+
def close_connection
|
155
|
+
@closed = true
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
@room.stream = stream.new
|
160
|
+
@channel.stream_campfire_to_channel # sets up stream
|
161
|
+
@channel.part
|
162
|
+
|
163
|
+
assert @room.stream.closed
|
164
|
+
end
|
165
|
+
|
166
|
+
it "closes the em-http connection if present" do
|
167
|
+
stream = Class.new do
|
168
|
+
attr_reader :closed
|
169
|
+
def close # em-http defines this
|
170
|
+
@closed = true
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
@room.stream = stream.new
|
149
175
|
@channel.stream_campfire_to_channel # sets up stream
|
150
176
|
@channel.part
|
151
177
|
|
152
|
-
@room.stream.
|
178
|
+
assert @room.stream.closed
|
179
|
+
end
|
180
|
+
|
181
|
+
it "leaves the channel" do
|
182
|
+
@channel.part
|
183
|
+
assert @room.left
|
153
184
|
end
|
154
185
|
end
|
155
186
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: camper_van
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.15
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-10-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: eventmachine
|
@@ -131,7 +131,8 @@ files:
|
|
131
131
|
- spec/camper_van/user_spec.rb
|
132
132
|
- spec/spec_helper.rb
|
133
133
|
homepage: https://github.com/zerowidth/camper_van
|
134
|
-
licenses:
|
134
|
+
licenses:
|
135
|
+
- MIT
|
135
136
|
post_install_message:
|
136
137
|
rdoc_options: []
|
137
138
|
require_paths:
|
@@ -150,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
150
151
|
version: '0'
|
151
152
|
segments:
|
152
153
|
- 0
|
153
|
-
hash:
|
154
|
+
hash: 2139526513697469635
|
154
155
|
requirements: []
|
155
156
|
rubyforge_project: camper_van
|
156
157
|
rubygems_version: 1.8.23
|