logs_tf 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/Gemfile.lock +35 -29
- data/lib/logs_tf/upload.rb +21 -0
- data/lib/logs_tf/version.rb +1 -1
- data/logs_tf.gemspec +3 -3
- data/spec/logs_tf/upload_spec.rb +42 -4
- metadata +39 -52
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZTNlZDhiOWIwY2I2Y2Y0ZjBlOTlhODBhYTA3ODU4ODcxMzIzZDZlYQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
NWQ5Y2RlMmJjNmIzNjczMGRkM2Y3NmE0NDJlYTc2ZWRiNjAwOGM2ZQ==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
OWMxMGUxOTNhYTQyOWU3NzYwOTI0ZTM4YmFkMGQ2NmNhNmUwODQ1NzM5MDcx
|
10
|
+
NDU3MDEwMGJmYWUyYTcxYzQ1YWNlZjgwM2I4Y2VmNzA5YWU4NWYwODUzNzcx
|
11
|
+
MTdiZjJlZjM3OGRkNWI1MTFjMzliODMwODNlNjYwMjZhMDNjODg=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZTczZDVhMzAzMWY0Mzk1NjhkNWI3MjYwOTJlMjVhMWRhODg0NjRkMjIwNzI3
|
14
|
+
NDJlODY5ZjM1ZWFlMGMxN2M0ZWRkY2U4MWRkY2FkNWY1MzM4MTk0NWY4MzFm
|
15
|
+
ZGRlNjI4YjEwMTc4NTMyNTUwYTY2MTIzNDFmZWJmNDBkNjg1MmQ=
|
data/Gemfile.lock
CHANGED
@@ -1,51 +1,57 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
logs_tf (0.0.
|
4
|
+
logs_tf (0.0.3)
|
5
5
|
faraday (~> 0.8.0)
|
6
6
|
multipart-post (~> 1.2.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
coderay (1.0
|
12
|
-
|
13
|
-
coveralls (0.6.4)
|
14
|
-
colorize
|
11
|
+
coderay (1.1.0)
|
12
|
+
coveralls (0.7.0)
|
15
13
|
multi_json (~> 1.3)
|
16
14
|
rest-client
|
17
15
|
simplecov (>= 0.7)
|
16
|
+
term-ansicolor
|
18
17
|
thor
|
19
|
-
diff-lcs (1.2.
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
18
|
+
diff-lcs (1.2.5)
|
19
|
+
docile (1.1.0)
|
20
|
+
faraday (0.8.8)
|
21
|
+
multipart-post (~> 1.2.0)
|
22
|
+
lockfile (2.1.0)
|
23
|
+
method_source (0.8.2)
|
24
|
+
mime-types (2.0)
|
25
|
+
multi_json (1.8.2)
|
25
26
|
multipart-post (1.2.0)
|
26
|
-
pry (0.9.12)
|
27
|
-
coderay (~> 1.0
|
27
|
+
pry (0.9.12.3)
|
28
|
+
coderay (~> 1.0)
|
28
29
|
method_source (~> 0.8)
|
29
30
|
slop (~> 3.4)
|
30
31
|
pry-nav (0.2.3)
|
31
32
|
pry (~> 0.9.10)
|
32
33
|
rest-client (1.6.7)
|
33
34
|
mime-types (>= 1.16)
|
34
|
-
rspec (2.
|
35
|
-
rspec-core (~> 2.
|
36
|
-
rspec-expectations (~> 2.
|
37
|
-
rspec-mocks (~> 2.
|
38
|
-
rspec-core (2.
|
39
|
-
rspec-expectations (2.
|
35
|
+
rspec (2.14.1)
|
36
|
+
rspec-core (~> 2.14.0)
|
37
|
+
rspec-expectations (~> 2.14.0)
|
38
|
+
rspec-mocks (~> 2.14.0)
|
39
|
+
rspec-core (2.14.7)
|
40
|
+
rspec-expectations (2.14.4)
|
40
41
|
diff-lcs (>= 1.1.3, < 2.0)
|
41
|
-
rspec-mocks (2.
|
42
|
-
simplecov (0.
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
42
|
+
rspec-mocks (2.14.4)
|
43
|
+
simplecov (0.8.1)
|
44
|
+
docile (~> 1.1.0)
|
45
|
+
lockfile (>= 2.1.0)
|
46
|
+
multi_json
|
47
|
+
simplecov-html (~> 0.8.0)
|
48
|
+
simplecov-html (0.8.0)
|
49
|
+
slop (3.4.6)
|
50
|
+
term-ansicolor (1.2.2)
|
51
|
+
tins (~> 0.8)
|
47
52
|
thor (0.18.1)
|
48
|
-
|
53
|
+
tins (0.13.1)
|
54
|
+
vcr (2.7.0)
|
49
55
|
|
50
56
|
PLATFORMS
|
51
57
|
ruby
|
@@ -53,6 +59,6 @@ PLATFORMS
|
|
53
59
|
DEPENDENCIES
|
54
60
|
coveralls
|
55
61
|
logs_tf!
|
56
|
-
pry-nav
|
57
|
-
rspec
|
58
|
-
vcr
|
62
|
+
pry-nav
|
63
|
+
rspec
|
64
|
+
vcr
|
data/lib/logs_tf/upload.rb
CHANGED
@@ -37,6 +37,20 @@ module LogsTF
|
|
37
37
|
NotAuthenticatedError
|
38
38
|
when "Invalid API key"
|
39
39
|
InvalidAPIKeyError
|
40
|
+
when "Log has no valid rounds (at least one needed)"
|
41
|
+
NoValidRoundsError
|
42
|
+
when "Not enough players (2 needed)"
|
43
|
+
NotEnoughPlayersError
|
44
|
+
when "Log is empty"
|
45
|
+
LogIsEmptyError
|
46
|
+
when /^Parsing failed in line \d+$/
|
47
|
+
ParsingFailedError
|
48
|
+
when "Missing API key or login"
|
49
|
+
MissingAPIKeyOrLoginError
|
50
|
+
when "Guru Meditation"
|
51
|
+
GuruMeditationError
|
52
|
+
else
|
53
|
+
UnknownLogsTfError
|
40
54
|
end
|
41
55
|
|
42
56
|
raise error_class, response_body["error"]
|
@@ -97,6 +111,13 @@ module LogsTF
|
|
97
111
|
class MissingLogError < Error; end
|
98
112
|
class NotAuthenticatedError < Error; end
|
99
113
|
class InvalidAPIKeyError < Error; end
|
114
|
+
class NoValidRoundsError < Error; end
|
115
|
+
class NotEnoughPlayersError < Error; end
|
116
|
+
class LogIsEmptyError < Error; end
|
117
|
+
class ParsingFailedError < Error; end
|
118
|
+
class MissingAPIKeyOrLoginError < Error; end
|
119
|
+
class GuruMeditationError < Error; end
|
120
|
+
class UnknownLogsTfError < Error; end
|
100
121
|
|
101
122
|
end
|
102
123
|
|
data/lib/logs_tf/version.rb
CHANGED
data/logs_tf.gemspec
CHANGED
@@ -17,8 +17,8 @@ Gem::Specification.new do |gem|
|
|
17
17
|
gem.add_dependency "faraday", "~> 0.8.0"
|
18
18
|
gem.add_dependency "multipart-post", "~> 1.2.0"
|
19
19
|
|
20
|
-
gem.add_development_dependency "vcr"
|
20
|
+
gem.add_development_dependency "vcr"
|
21
21
|
gem.add_development_dependency 'coveralls'
|
22
|
-
gem.add_development_dependency "pry-nav"
|
23
|
-
gem.add_development_dependency "rspec"
|
22
|
+
gem.add_development_dependency "pry-nav"
|
23
|
+
gem.add_development_dependency "rspec"
|
24
24
|
end
|
data/spec/logs_tf/upload_spec.rb
CHANGED
@@ -31,7 +31,7 @@ module LogsTF
|
|
31
31
|
end
|
32
32
|
|
33
33
|
it "raises the appropriate error when upload was unsuccessful" do
|
34
|
-
upload.stub(:connection =>
|
34
|
+
upload.stub(:connection => double(:connection).as_null_object)
|
35
35
|
upload.stub(:request_success? => true)
|
36
36
|
upload.stub(:upload_success? => false)
|
37
37
|
upload.should_receive(:raise_logs_tf_error)
|
@@ -39,7 +39,7 @@ module LogsTF
|
|
39
39
|
end
|
40
40
|
|
41
41
|
it "raises an error when the response status is not 200" do
|
42
|
-
upload.stub(:connection =>
|
42
|
+
upload.stub(:connection => double(:connection).as_null_object)
|
43
43
|
upload.stub(:request_success? => false)
|
44
44
|
expect{upload.send}.to raise_error Upload::RequestError
|
45
45
|
end
|
@@ -47,7 +47,7 @@ module LogsTF
|
|
47
47
|
end
|
48
48
|
|
49
49
|
describe '#error' do
|
50
|
-
before { upload.stub(:response =>
|
50
|
+
before { upload.stub(:response => double(:body => '{ "error": "foobar" }')) }
|
51
51
|
|
52
52
|
it "parses the JSON respone from logs.tf for the error message" do
|
53
53
|
upload.error.should == 'foobar'
|
@@ -57,7 +57,7 @@ module LogsTF
|
|
57
57
|
|
58
58
|
describe '#raise_logs_tf_error' do
|
59
59
|
|
60
|
-
before { upload.stub(:response =>
|
60
|
+
before { upload.stub(:response => double(:body => '{ "error": "foobar" }')) }
|
61
61
|
|
62
62
|
it "raises InvalidLogError" do
|
63
63
|
upload.stub(:error => "Invalid log file")
|
@@ -79,6 +79,44 @@ module LogsTF
|
|
79
79
|
expect{upload.raise_logs_tf_error}.to raise_error Upload::InvalidAPIKeyError
|
80
80
|
end
|
81
81
|
|
82
|
+
it "raises NoValidRoundsError" do
|
83
|
+
upload.stub(:error => "Log has no valid rounds (at least one needed)")
|
84
|
+
expect{upload.raise_logs_tf_error}.to raise_error Upload::NoValidRoundsError
|
85
|
+
end
|
86
|
+
|
87
|
+
it "raises NotEnoughPlayersError" do
|
88
|
+
upload.stub(:error => "Not enough players (2 needed)")
|
89
|
+
expect{upload.raise_logs_tf_error}.to raise_error Upload::NotEnoughPlayersError
|
90
|
+
end
|
91
|
+
|
92
|
+
it "raises LogIsEmptyError" do
|
93
|
+
upload.stub(:error => "Log is empty")
|
94
|
+
expect{upload.raise_logs_tf_error}.to raise_error Upload::LogIsEmptyError
|
95
|
+
end
|
96
|
+
|
97
|
+
it "raises ParsingFailedError" do
|
98
|
+
upload.stub(:error => "Parsing failed in line 123")
|
99
|
+
expect{upload.raise_logs_tf_error}.to raise_error Upload::ParsingFailedError
|
100
|
+
|
101
|
+
upload.stub(:error => "Parsing failed in line 456")
|
102
|
+
expect{upload.raise_logs_tf_error}.to raise_error Upload::ParsingFailedError
|
103
|
+
end
|
104
|
+
|
105
|
+
it "raises MissingAPIKeyOrLoginError" do
|
106
|
+
upload.stub(:error => "Missing API key or login")
|
107
|
+
expect{upload.raise_logs_tf_error}.to raise_error Upload::MissingAPIKeyOrLoginError
|
108
|
+
end
|
109
|
+
|
110
|
+
it "raises GuruMeditationError" do
|
111
|
+
upload.stub(:error => "Guru Meditation")
|
112
|
+
expect{upload.raise_logs_tf_error}.to raise_error Upload::GuruMeditationError
|
113
|
+
end
|
114
|
+
|
115
|
+
it "raises UnknownLogsTFError" do
|
116
|
+
upload.stub(:error => "Foobar")
|
117
|
+
expect{upload.raise_logs_tf_error}.to raise_error Upload::UnknownLogsTfError
|
118
|
+
end
|
119
|
+
|
82
120
|
end
|
83
121
|
|
84
122
|
end
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logs_tf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
version: 0.0.2
|
4
|
+
version: 0.0.3
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Arie
|
@@ -12,101 +11,89 @@ cert_chain: []
|
|
12
11
|
date: 2013-02-10 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
|
-
prerelease: false
|
16
|
-
type: :runtime
|
17
14
|
name: faraday
|
18
|
-
version_requirements: !ruby/object:Gem::Requirement
|
19
|
-
none: false
|
20
|
-
requirements:
|
21
|
-
- - ~>
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 0.8.0
|
24
15
|
requirement: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
16
|
requirements:
|
27
17
|
- - ~>
|
28
18
|
- !ruby/object:Gem::Version
|
29
19
|
version: 0.8.0
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
prerelease: false
|
32
20
|
type: :runtime
|
33
|
-
|
21
|
+
prerelease: false
|
34
22
|
version_requirements: !ruby/object:Gem::Requirement
|
35
|
-
none: false
|
36
23
|
requirements:
|
37
24
|
- - ~>
|
38
25
|
- !ruby/object:Gem::Version
|
39
|
-
version:
|
26
|
+
version: 0.8.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: multipart-post
|
40
29
|
requirement: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
30
|
requirements:
|
43
31
|
- - ~>
|
44
32
|
- !ruby/object:Gem::Version
|
45
33
|
version: 1.2.0
|
46
|
-
|
34
|
+
type: :runtime
|
47
35
|
prerelease: false
|
48
|
-
type: :development
|
49
|
-
name: vcr
|
50
36
|
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
none: false
|
52
37
|
requirements:
|
53
38
|
- - ~>
|
54
39
|
- !ruby/object:Gem::Version
|
55
|
-
version: 2.
|
40
|
+
version: 1.2.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: vcr
|
56
43
|
requirement: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
44
|
requirements:
|
59
|
-
- -
|
45
|
+
- - ! '>='
|
60
46
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
|
-
prerelease: false
|
47
|
+
version: '0'
|
64
48
|
type: :development
|
65
|
-
|
49
|
+
prerelease: false
|
66
50
|
version_requirements: !ruby/object:Gem::Requirement
|
67
|
-
none: false
|
68
51
|
requirements:
|
69
52
|
- - ! '>='
|
70
53
|
- !ruby/object:Gem::Version
|
71
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: coveralls
|
72
57
|
requirement: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
58
|
requirements:
|
75
59
|
- - ! '>='
|
76
60
|
- !ruby/object:Gem::Version
|
77
61
|
version: '0'
|
78
|
-
- !ruby/object:Gem::Dependency
|
79
|
-
prerelease: false
|
80
62
|
type: :development
|
81
|
-
|
63
|
+
prerelease: false
|
82
64
|
version_requirements: !ruby/object:Gem::Requirement
|
83
|
-
none: false
|
84
65
|
requirements:
|
85
|
-
- -
|
66
|
+
- - ! '>='
|
86
67
|
- !ruby/object:Gem::Version
|
87
|
-
version: 0
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry-nav
|
88
71
|
requirement: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
72
|
requirements:
|
91
|
-
- -
|
73
|
+
- - ! '>='
|
92
74
|
- !ruby/object:Gem::Version
|
93
|
-
version: 0
|
94
|
-
- !ruby/object:Gem::Dependency
|
95
|
-
prerelease: false
|
75
|
+
version: '0'
|
96
76
|
type: :development
|
97
|
-
|
77
|
+
prerelease: false
|
98
78
|
version_requirements: !ruby/object:Gem::Requirement
|
99
|
-
none: false
|
100
79
|
requirements:
|
101
|
-
- -
|
80
|
+
- - ! '>='
|
102
81
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
104
85
|
requirement: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
86
|
requirements:
|
107
|
-
- -
|
87
|
+
- - ! '>='
|
108
88
|
- !ruby/object:Gem::Version
|
109
|
-
version:
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ! '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
110
97
|
description: A gem to interface with the logs.tf API
|
111
98
|
email: rubygems@ariekanarie.nl
|
112
99
|
executables: []
|
@@ -135,27 +122,26 @@ files:
|
|
135
122
|
- spec/spec_helper.rb
|
136
123
|
homepage: http://github.com/Arie/logs_tf
|
137
124
|
licenses: []
|
125
|
+
metadata: {}
|
138
126
|
post_install_message:
|
139
127
|
rdoc_options: []
|
140
128
|
require_paths:
|
141
129
|
- lib
|
142
130
|
required_ruby_version: !ruby/object:Gem::Requirement
|
143
|
-
none: false
|
144
131
|
requirements:
|
145
132
|
- - ! '>='
|
146
133
|
- !ruby/object:Gem::Version
|
147
134
|
version: '0'
|
148
135
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
149
|
-
none: false
|
150
136
|
requirements:
|
151
137
|
- - ! '>='
|
152
138
|
- !ruby/object:Gem::Version
|
153
139
|
version: '0'
|
154
140
|
requirements: []
|
155
141
|
rubyforge_project:
|
156
|
-
rubygems_version: 1.
|
142
|
+
rubygems_version: 2.1.9
|
157
143
|
signing_key:
|
158
|
-
specification_version:
|
144
|
+
specification_version: 4
|
159
145
|
summary: Logs.tf
|
160
146
|
test_files:
|
161
147
|
- spec/fixtures/logs/broder_vs_epsilon.log
|
@@ -163,3 +149,4 @@ test_files:
|
|
163
149
|
- spec/fixtures/vcr/upload.yml
|
164
150
|
- spec/logs_tf/upload_spec.rb
|
165
151
|
- spec/spec_helper.rb
|
152
|
+
has_rdoc:
|