steam-condenser 1.3.1 → 1.3.2
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.lock +2 -2
- data/README.md +20 -5
- data/lib/steam-condenser/version.rb +1 -1
- data/lib/steam/servers/source_server.rb +11 -11
- data/lib/steam/sockets/rcon_socket.rb +2 -6
- data/test/steam/sockets/test_rcon_socket.rb +3 -3
- metadata +3 -3
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
steam-condenser (1.3.
|
|
4
|
+
steam-condenser (1.3.2)
|
|
5
5
|
bzip2-ruby (~> 0.2.7)
|
|
6
6
|
multi_json (~> 1.5.0)
|
|
7
7
|
multi_xml (~> 0.5.1)
|
|
@@ -14,7 +14,7 @@ GEM
|
|
|
14
14
|
mocha (0.13.1)
|
|
15
15
|
metaclass (~> 0.0.1)
|
|
16
16
|
multi_json (1.5.0)
|
|
17
|
-
multi_xml (0.5.
|
|
17
|
+
multi_xml (0.5.2)
|
|
18
18
|
rake (10.0.3)
|
|
19
19
|
shoulda-context (1.0.2)
|
|
20
20
|
yard (0.8.3)
|
data/README.md
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
Steam Condenser
|
|
1
|
+
Steam Condenser
|
|
2
2
|
===============
|
|
3
3
|
|
|
4
|
+
[](http://travis-ci.org/koraktor/steam-condenser-ruby)
|
|
5
|
+
|
|
6
|
+
[](https://codeclimate.com/github/koraktor/steam-condenser-ruby)
|
|
7
|
+
|
|
4
8
|
The Steam Condenser is a multi-language library for querying the Steam
|
|
5
9
|
Community, Source and GoldSrc game servers as well as the Steam master servers.
|
|
6
10
|
Currently it is implemented in Java, PHP and Ruby.
|
|
7
11
|
|
|
8
12
|
## Requirements
|
|
9
13
|
|
|
10
|
-
*
|
|
11
|
-
*
|
|
14
|
+
* Ruby 1.8.7 or newer (and compatible Ruby VMs)
|
|
15
|
+
* Any operating system able to run such a VM
|
|
12
16
|
|
|
13
17
|
The following gems are required:
|
|
14
18
|
|
|
@@ -20,13 +24,24 @@ The following gems are required:
|
|
|
20
24
|
|
|
21
25
|
To install Steam Condenser as a Ruby gem use the following command:
|
|
22
26
|
|
|
23
|
-
|
|
27
|
+
```bash
|
|
28
|
+
$ gem install steam-condenser
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
If you're projet dependencies are managed by [Bundler](http://gembundler.com)
|
|
32
|
+
add this to your `Gemfile`:
|
|
33
|
+
|
|
34
|
+
```ruby
|
|
35
|
+
gem 'steam-condenser'
|
|
36
|
+
```
|
|
24
37
|
|
|
25
38
|
## Usage
|
|
26
39
|
|
|
27
40
|
To start using Steam Condenser requiring the base file is usually enough:
|
|
28
41
|
|
|
29
|
-
|
|
42
|
+
```ruby
|
|
43
|
+
require 'steam-condenser'
|
|
44
|
+
```
|
|
30
45
|
|
|
31
46
|
## License
|
|
32
47
|
|
|
@@ -71,11 +71,15 @@ class SourceServer
|
|
|
71
71
|
def rcon_auth(password)
|
|
72
72
|
@rcon_request_id = rand 2**16
|
|
73
73
|
|
|
74
|
-
@rcon_socket.send RCONAuthRequest.new
|
|
75
|
-
@rcon_socket.reply
|
|
76
|
-
reply = @rcon_socket.reply
|
|
74
|
+
@rcon_socket.send RCONAuthRequest.new @rcon_request_id, password
|
|
77
75
|
|
|
78
|
-
|
|
76
|
+
begin
|
|
77
|
+
@rcon_socket.reply
|
|
78
|
+
reply = @rcon_socket.reply
|
|
79
|
+
@rcon_authenticated = reply.request_id == @rcon_request_id
|
|
80
|
+
rescue Errno::ECONNRESET
|
|
81
|
+
raise RCONBanError
|
|
82
|
+
end
|
|
79
83
|
end
|
|
80
84
|
|
|
81
85
|
# Remotely executes a command on the server via RCON
|
|
@@ -100,13 +104,9 @@ class SourceServer
|
|
|
100
104
|
@rcon_authenticated = false
|
|
101
105
|
raise RCONNoAuthError
|
|
102
106
|
end
|
|
103
|
-
rescue
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
raise RCONNoAuthError
|
|
107
|
-
end
|
|
108
|
-
|
|
109
|
-
raise $!
|
|
107
|
+
rescue Errno::ECONNRESET
|
|
108
|
+
@rcon_authenticated = false
|
|
109
|
+
raise RCONNoAuthError
|
|
110
110
|
end
|
|
111
111
|
response << response_packet.response
|
|
112
112
|
end while response.size < 3 || response_packet.response.size > 0
|
|
@@ -79,12 +79,8 @@ class RCONSocket
|
|
|
79
79
|
# dropped by the server
|
|
80
80
|
# @return [RCONPacket] The packet replied from the server
|
|
81
81
|
def reply
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
@socket.close
|
|
85
|
-
raise RCONNoAuthError
|
|
86
|
-
end
|
|
87
|
-
rescue Errno::ECONNRESET
|
|
82
|
+
if receive_packet(4) == 0
|
|
83
|
+
@socket.close
|
|
88
84
|
raise RCONBanError
|
|
89
85
|
end
|
|
90
86
|
|
|
@@ -96,10 +96,10 @@ class TestRCONSocket < Test::Unit::TestCase
|
|
|
96
96
|
@socket.reply
|
|
97
97
|
end
|
|
98
98
|
|
|
99
|
-
should 'raise an
|
|
99
|
+
should 'raise an ECONNRESET if the client has been banned' do
|
|
100
100
|
@socket.expects(:receive_packet).with(4).raises Errno::ECONNRESET
|
|
101
101
|
|
|
102
|
-
assert_raise
|
|
102
|
+
assert_raise Errno::ECONNRESET do
|
|
103
103
|
assert_nil @socket.reply
|
|
104
104
|
end
|
|
105
105
|
end
|
|
@@ -108,7 +108,7 @@ class TestRCONSocket < Test::Unit::TestCase
|
|
|
108
108
|
@socket.expects(:receive_packet).with(4).returns 0
|
|
109
109
|
@tcp_socket.expects :close
|
|
110
110
|
|
|
111
|
-
assert_raise
|
|
111
|
+
assert_raise RCONBanError do
|
|
112
112
|
assert_nil @socket.reply
|
|
113
113
|
end
|
|
114
114
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: steam-condenser
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.3.
|
|
4
|
+
version: 1.3.2
|
|
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-02-06 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: bzip2-ruby
|
|
@@ -282,7 +282,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
282
282
|
version: '0'
|
|
283
283
|
requirements: []
|
|
284
284
|
rubyforge_project:
|
|
285
|
-
rubygems_version: 1.8.
|
|
285
|
+
rubygems_version: 1.8.23
|
|
286
286
|
signing_key:
|
|
287
287
|
specification_version: 3
|
|
288
288
|
summary: Steam Condenser - A Steam query library
|