gamekey 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.idea/.rakeTasks +1 -1
- data/.idea/workspace.xml +24 -25
- data/README.md +7 -1
- data/bin/gamekey +1 -1
- data/lib/gamekey.rb +6 -0
- data/lib/gamekey/version.rb +1 -1
- data/lib/reference.rb +14 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9021ba8301abd0b2212bac379f30853727da957
|
4
|
+
data.tar.gz: 65f3202b5b2a8b46da58317ce73634670f3a2931
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9d54d1d3e9c58bfbf10356956cce144916709fbb55c7ec11db49905304d8443281a1f1866ff11aa195a74f2649dfaf7f0dd653399e82d6316c04a1e9cf816ce
|
7
|
+
data.tar.gz: 50f9540a370b0e27dc43de89e81c9c9e9b6c059e5aa3b58bf966e6f433c2f46b4c185e5a379568c34d1029aba6843e810f017e1db7fc6e1bb5e0492a54663f5a
|
data/.gitignore
CHANGED
data/.idea/.rakeTasks
CHANGED
@@ -4,4 +4,4 @@ You are allowed to:
|
|
4
4
|
1. Remove rake task
|
5
5
|
2. Add existing rake tasks
|
6
6
|
To add existing rake tasks automatically delete this file and reload the project.
|
7
|
-
--><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build gamekey-0.0.
|
7
|
+
--><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build gamekey-0.0.2.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Build and install gamekey-0.0.2.gem into system gems" fullCmd="install" taksId="install" /><RakeGroup description="" fullCmd="" taksId="install"><RakeTask description="Build and install gamekey-0.0.2.gem into system gems without network access" fullCmd="install:local" taksId="local" /></RakeGroup><RakeTask description="Create tag v0.0.2 and build and push gamekey-0.0.2.gem to Rubygems" fullCmd="release" taksId="release" /><RakeGroup description="" fullCmd="" taksId="release"><RakeTask description="" fullCmd="release:guard_clean" taksId="guard_clean" /><RakeTask description="" fullCmd="release:rubygem_push" taksId="rubygem_push" /><RakeTask description="" fullCmd="release:source_control_push" taksId="source_control_push" /></RakeGroup></RakeGroup></Settings>
|
data/.idea/workspace.xml
CHANGED
@@ -4,7 +4,6 @@
|
|
4
4
|
<list default="true" id="e21dde69-0bf9-477c-a2f0-85752ecf88a0" name="Default" comment="">
|
5
5
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/gamekey.iml" afterPath="$PROJECT_DIR$/.idea/gamekey.iml" />
|
6
6
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
|
7
|
-
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/gamekey.gemspec" afterPath="$PROJECT_DIR$/gamekey.gemspec" />
|
8
7
|
</list>
|
9
8
|
<ignored path="gamekey.iws" />
|
10
9
|
<ignored path=".idea/workspace.xml" />
|
@@ -20,7 +19,7 @@
|
|
20
19
|
<component name="CoverageDataManager">
|
21
20
|
<SUITE FILE_PATH="coverage/gamekey@build__gamekey.coverage" NAME="build: gamekey Coverage Results" MODIFIED="1452602112965" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="gamekey" />
|
22
21
|
<SUITE FILE_PATH="coverage/gamekey@gamekey.coverage" NAME="gamekey Coverage Results" MODIFIED="1449768901945" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/bin" MODULE_NAME="gamekey" />
|
23
|
-
<SUITE FILE_PATH="coverage/gamekey@install__gamekey.coverage" NAME="install: gamekey Coverage Results" MODIFIED="
|
22
|
+
<SUITE FILE_PATH="coverage/gamekey@install__gamekey.coverage" NAME="install: gamekey Coverage Results" MODIFIED="1456236998595" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="gamekey" />
|
24
23
|
</component>
|
25
24
|
<component name="CreatePatchCommitExecutor">
|
26
25
|
<option name="PATCH_PATH" value="" />
|
@@ -63,9 +62,6 @@
|
|
63
62
|
</file>
|
64
63
|
<file leaf-file-name="README.md" pinned="false" current-in-tab="false">
|
65
64
|
<entry file="file://$PROJECT_DIR$/README.md">
|
66
|
-
<provider editor-type-id="MultiMarkdownFxPreviewEditor">
|
67
|
-
<state />
|
68
|
-
</provider>
|
69
65
|
<provider selected="true" editor-type-id="split-provider[text-editor;MultiMarkdownPreviewEditor]">
|
70
66
|
<state split_layout="FIRST">
|
71
67
|
<first_editor vertical-scroll-proportion="0.0">
|
@@ -75,6 +71,9 @@
|
|
75
71
|
<second_editor />
|
76
72
|
</state>
|
77
73
|
</provider>
|
74
|
+
<provider editor-type-id="MultiMarkdownFxPreviewEditor">
|
75
|
+
<state />
|
76
|
+
</provider>
|
78
77
|
</entry>
|
79
78
|
</file>
|
80
79
|
<file leaf-file-name="Gemfile" pinned="false" current-in-tab="false">
|
@@ -110,7 +109,7 @@
|
|
110
109
|
<file leaf-file-name="gamekey.gemspec" pinned="false" current-in-tab="true">
|
111
110
|
<entry file="file://$PROJECT_DIR$/gamekey.gemspec">
|
112
111
|
<provider selected="true" editor-type-id="text-editor">
|
113
|
-
<state vertical-scroll-proportion="0.
|
112
|
+
<state vertical-scroll-proportion="0.0">
|
114
113
|
<caret line="9" column="51" selection-start-line="9" selection-start-column="51" selection-end-line="9" selection-end-column="51" />
|
115
114
|
<folding />
|
116
115
|
</state>
|
@@ -464,8 +463,8 @@
|
|
464
463
|
</list>
|
465
464
|
<recent_temporary>
|
466
465
|
<list size="3">
|
467
|
-
<item index="0" class="java.lang.String" itemvalue="Rake.
|
468
|
-
<item index="1" class="java.lang.String" itemvalue="Rake.
|
466
|
+
<item index="0" class="java.lang.String" itemvalue="Rake.build: gamekey" />
|
467
|
+
<item index="1" class="java.lang.String" itemvalue="Rake.install: gamekey" />
|
469
468
|
<item index="2" class="java.lang.String" itemvalue="Ruby.gamekey" />
|
470
469
|
</list>
|
471
470
|
</recent_temporary>
|
@@ -487,23 +486,23 @@
|
|
487
486
|
<frame x="439" y="53" width="1598" height="1213" extended-state="0" />
|
488
487
|
<editor active="false" />
|
489
488
|
<layout>
|
490
|
-
<window_info id="Project" active="
|
489
|
+
<window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.30684754" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
491
490
|
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
|
492
|
-
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.
|
493
|
-
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
491
|
+
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.35069767" sideWeight="0.5523256" order="7" side_tool="true" content_ui="tabs" />
|
494
492
|
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
|
495
|
-
<window_info id="Run" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.34879407" sideWeight="0.4502584" order="2" side_tool="false" content_ui="tabs" />
|
496
493
|
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.24921136" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
497
494
|
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
|
498
495
|
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
|
499
|
-
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
500
496
|
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
|
501
497
|
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
502
498
|
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
503
499
|
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
|
500
|
+
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.34879407" sideWeight="0.44767442" order="2" side_tool="false" content_ui="tabs" />
|
504
501
|
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
|
505
502
|
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32905984" sideWeight="0.4919564" order="1" side_tool="false" content_ui="tabs" />
|
503
|
+
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
506
504
|
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
505
|
+
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
507
506
|
</layout>
|
508
507
|
</component>
|
509
508
|
<component name="Vcs.Log.UiProperties">
|
@@ -866,14 +865,6 @@
|
|
866
865
|
</state>
|
867
866
|
</provider>
|
868
867
|
</entry>
|
869
|
-
<entry file="file://$PROJECT_DIR$/lib/auth.rb">
|
870
|
-
<provider selected="true" editor-type-id="text-editor">
|
871
|
-
<state vertical-scroll-proportion="0.0">
|
872
|
-
<caret line="7" column="5" selection-start-line="7" selection-start-column="5" selection-end-line="7" selection-end-column="5" />
|
873
|
-
<folding />
|
874
|
-
</state>
|
875
|
-
</provider>
|
876
|
-
</entry>
|
877
868
|
<entry file="file://$PROJECT_DIR$/lib/defaults.rb">
|
878
869
|
<provider selected="true" editor-type-id="text-editor">
|
879
870
|
<state vertical-scroll-proportion="0.0">
|
@@ -907,9 +898,6 @@
|
|
907
898
|
</provider>
|
908
899
|
</entry>
|
909
900
|
<entry file="file://$PROJECT_DIR$/README.md">
|
910
|
-
<provider editor-type-id="MultiMarkdownFxPreviewEditor">
|
911
|
-
<state />
|
912
|
-
</provider>
|
913
901
|
<provider editor-type-id="text-editor">
|
914
902
|
<state vertical-scroll-proportion="0.050974514">
|
915
903
|
<caret line="2" column="8" selection-start-line="2" selection-start-column="0" selection-end-line="3" selection-end-column="0" />
|
@@ -925,6 +913,9 @@
|
|
925
913
|
<second_editor />
|
926
914
|
</state>
|
927
915
|
</provider>
|
916
|
+
<provider editor-type-id="MultiMarkdownFxPreviewEditor">
|
917
|
+
<state />
|
918
|
+
</provider>
|
928
919
|
</entry>
|
929
920
|
<entry file="file://$PROJECT_DIR$/Gemfile">
|
930
921
|
<provider selected="true" editor-type-id="text-editor">
|
@@ -934,9 +925,17 @@
|
|
934
925
|
</state>
|
935
926
|
</provider>
|
936
927
|
</entry>
|
928
|
+
<entry file="file://$PROJECT_DIR$/lib/auth.rb">
|
929
|
+
<provider selected="true" editor-type-id="text-editor">
|
930
|
+
<state vertical-scroll-proportion="0.0">
|
931
|
+
<caret line="7" column="5" selection-start-line="7" selection-start-column="5" selection-end-line="7" selection-end-column="5" />
|
932
|
+
<folding />
|
933
|
+
</state>
|
934
|
+
</provider>
|
935
|
+
</entry>
|
937
936
|
<entry file="file://$PROJECT_DIR$/gamekey.gemspec">
|
938
937
|
<provider selected="true" editor-type-id="text-editor">
|
939
|
-
<state vertical-scroll-proportion="0.
|
938
|
+
<state vertical-scroll-proportion="0.0">
|
940
939
|
<caret line="9" column="51" selection-start-line="9" selection-start-column="51" selection-end-line="9" selection-end-column="51" />
|
941
940
|
<folding />
|
942
941
|
</state>
|
data/README.md
CHANGED
@@ -130,4 +130,10 @@ You get usage instructions via:
|
|
130
130
|
Gamekey is provided via Bitbucket as a public git repository.
|
131
131
|
So you can get all the sources via the following git command.
|
132
132
|
|
133
|
-
$ git clone https://nanekratzke@bitbucket.org/nanekratzke/gamekey.git
|
133
|
+
$ git clone https://nanekratzke@bitbucket.org/nanekratzke/gamekey.git
|
134
|
+
|
135
|
+
## Changelog
|
136
|
+
|
137
|
+
### Version 0.0.2
|
138
|
+
POST /game checks now that a secret is provided.
|
139
|
+
Thanks to Jan Lukas Deichmann figuring out this bug (WebTech SoSe 2016).
|
data/bin/gamekey
CHANGED
data/lib/gamekey.rb
CHANGED
@@ -309,6 +309,7 @@ class GamekeyService
|
|
309
309
|
# @return 200 OK, on successfull creation (response body includes JSON representation of game)
|
310
310
|
# @return 400, on invalid url (response body includes error message)
|
311
311
|
# @return 400, on invalid name (response body includes error message)
|
312
|
+
# @return 400, on missing secret (response body includes error message)
|
312
313
|
# @return 409, if a game with provided name already exists (response body includes error message)
|
313
314
|
#
|
314
315
|
post "/game" do
|
@@ -323,6 +324,11 @@ class GamekeyService
|
|
323
324
|
return "Bad Request: '#{name}' is not a valid name"
|
324
325
|
end
|
325
326
|
|
327
|
+
if (secret == nil || secret.empty?)
|
328
|
+
status 400
|
329
|
+
return "Bad Request: 'secret must be provided"
|
330
|
+
end
|
331
|
+
|
326
332
|
if (uri != nil && !url.empty?)
|
327
333
|
if !uri.absolute?
|
328
334
|
status 400
|
data/lib/gamekey/version.rb
CHANGED
data/lib/reference.rb
CHANGED
@@ -316,6 +316,16 @@ class GamekeyReferenceTests
|
|
316
316
|
uri = URI(@host)
|
317
317
|
http = Net::HTTP.new(uri.host, uri.port)
|
318
318
|
|
319
|
+
# Check that game can not be created if secret is not provided.
|
320
|
+
request = Net::HTTP::Post.new("/game")
|
321
|
+
request.set_form_data({
|
322
|
+
'name' => @game,
|
323
|
+
})
|
324
|
+
send = DateTime.now
|
325
|
+
res = http.request(request)
|
326
|
+
return "#{error('POST', '/game', "PG-0")} Could create game '#{game}' (should return HTTP code 400 due to missing secret)" if (res.code == "200")
|
327
|
+
|
328
|
+
# Check that game can be created
|
319
329
|
request = Net::HTTP::Post.new("/game")
|
320
330
|
request.set_form_data({
|
321
331
|
'name' => @game,
|
@@ -324,7 +334,6 @@ class GamekeyReferenceTests
|
|
324
334
|
|
325
335
|
send = DateTime.now
|
326
336
|
res = http.request(request)
|
327
|
-
|
328
337
|
return "#{error('POST', '/game', "PG-1")} Could not create game '#{@game}' (should return HTTP code 200, was #{res.code})\n #{res.body}".red unless (res.code == "200")
|
329
338
|
|
330
339
|
begin
|
@@ -520,7 +529,7 @@ class GamekeyReferenceTests
|
|
520
529
|
name = "A Cool Game, #{i}th Edition"
|
521
530
|
request.set_form_data({
|
522
531
|
"name" => name,
|
523
|
-
"
|
532
|
+
"secret" => "secret"
|
524
533
|
})
|
525
534
|
res = http.request(request)
|
526
535
|
return "#{error('POST', '/game', "SG-1")} Creating game with name '#{name}' failed while stress testing.\n#{res.body}".red unless res.code == "200"
|
@@ -530,15 +539,15 @@ class GamekeyReferenceTests
|
|
530
539
|
res = http.request(list_games);
|
531
540
|
games = JSON.parse(res.body)
|
532
541
|
|
533
|
-
return "#{error('GET', '/games', "SG-2")} Only #{games.count}
|
542
|
+
return "#{error('GET', '/games', "SG-2")} Only #{games.count} games have been created. Should be 1000.".red unless games.count == 1000
|
534
543
|
|
535
544
|
games.each do |game|
|
536
545
|
delete_game = Net::HTTP::Delete.new("/game/#{game['id']}")
|
537
546
|
delete_game.set_form_data({
|
538
|
-
"
|
547
|
+
"secret" => "secret"
|
539
548
|
})
|
540
549
|
res = http.request(delete_game)
|
541
|
-
return "#{error('DELETE', '/game/id', "SG-3")} Deleting
|
550
|
+
return "#{error('DELETE', '/game/id', "SG-3")} Deleting game with id '#{game['name']} (#{game['id']})' failed while stress testing.\n#{res.body}".red unless res.code == "200"
|
542
551
|
end
|
543
552
|
|
544
553
|
"Fine: Stress testing of game resources works".green
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gamekey
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nane Kratzke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|