rubypitaya 2.6.2 → 2.7.3

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.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rubypitaya/app-template/Gemfile +1 -1
  3. data/lib/rubypitaya/app-template/Gemfile.lock +2 -2
  4. data/lib/rubypitaya/app-template/Makefile +8 -6
  5. data/lib/rubypitaya/app-template/app/app_initializer.rb +34 -31
  6. data/lib/rubypitaya/app-template/app/bll/player_bll.rb +10 -7
  7. data/lib/rubypitaya/app-template/app/constants/status_codes.rb +22 -19
  8. data/lib/rubypitaya/app-template/app/handlers/hello_world_handler.rb +1 -0
  9. data/lib/rubypitaya/app-template/app/handlers/player_handler.rb +69 -66
  10. data/lib/rubypitaya/app-template/app/models/player.rb +13 -10
  11. data/lib/rubypitaya/app-template/config/routes.rb +1 -1
  12. data/lib/rubypitaya/app-template/db/migration/{0000000002_create_player_migration.rb → 1606736477_create_player_migration.rb} +0 -0
  13. data/lib/rubypitaya/app-template/docker/prod/Dockerfile +5 -1
  14. data/lib/rubypitaya/app-template/kubernetes/README.md +22 -2
  15. data/lib/rubypitaya/app-template/kubernetes/gameplay/deployment-nginx.yaml +130 -0
  16. data/lib/rubypitaya/app-template/kubernetes/gameplay/gameplay-template.yaml +29 -0
  17. data/lib/rubypitaya/app-template/kubernetes/gameplay/nginx.conf +13 -0
  18. data/lib/rubypitaya/app-template/kubernetes/gameplay/service-nginx.yaml +928 -0
  19. data/lib/rubypitaya/app-template/kubernetes/role-rubypitaya.yaml +31 -0
  20. data/lib/rubypitaya/app-template/kubernetes/rolebinding-rubypitaya.yaml +13 -0
  21. data/lib/rubypitaya/app-template/kubernetes/service-etcd.yaml +1 -1
  22. data/lib/rubypitaya/app-template/kubernetes/service-nats.yaml +1 -1
  23. data/lib/rubypitaya/app-template/kubernetes/service-postgres.yaml +1 -1
  24. data/lib/rubypitaya/app-template/kubernetes/service-redis.yaml +1 -1
  25. data/lib/rubypitaya/core/http_routes.rb +10 -2
  26. data/lib/rubypitaya/core/main.rb +2 -1
  27. data/lib/rubypitaya/version.rb +1 -1
  28. metadata +9 -4
  29. data/lib/rubypitaya/app-template/docker/prod/Makefile +0 -67
@@ -0,0 +1,31 @@
1
+ kind: Role
2
+ apiVersion: apps/v1
3
+ metadata:
4
+ namespace: default
5
+ name: namespace
6
+ rules:
7
+ - apiGroups:
8
+ - ""
9
+ resources:
10
+ - services
11
+ - pods
12
+ verbs:
13
+ - get
14
+ - list
15
+ - watch
16
+ - create
17
+ - update
18
+ - patch
19
+ - delete
20
+ - apiGroups:
21
+ - apps
22
+ resources:
23
+ - deployments
24
+ verbs:
25
+ - get
26
+ - list
27
+ - watch
28
+ - create
29
+ - update
30
+ - patch
31
+ - delete
@@ -0,0 +1,13 @@
1
+ kind: RoleBinding
2
+ apiVersion: apps/v1
3
+ metadata:
4
+ name: rubypitaya
5
+ namespace: default
6
+ subjects:
7
+ - kind: ServiceAccount
8
+ name: rubypitaya
9
+ namespace: default
10
+ roleRef:
11
+ apiGroup: apps
12
+ kind: Role
13
+ name: rubypitaya
@@ -14,4 +14,4 @@ spec:
14
14
  port: 2380
15
15
  targetPort: 2380
16
16
  name: etcd-2380
17
- type: LoadBalancer
17
+ type: ClusterIP
@@ -9,4 +9,4 @@ spec:
9
9
  - protocol: TCP
10
10
  port: 4222
11
11
  targetPort: 4222
12
- type: LoadBalancer
12
+ type: ClusterIP
@@ -9,4 +9,4 @@ spec:
9
9
  - protocol: TCP
10
10
  port: 5432
11
11
  targetPort: 5432
12
- type: LoadBalancer
12
+ type: ClusterIP
@@ -10,4 +10,4 @@ spec:
10
10
  port: 6379
11
11
  targetPort: 6379
12
12
  name: redis
13
- type: LoadBalancer
13
+ type: ClusterIP
@@ -10,6 +10,12 @@ module RubyPitaya
10
10
  register Sinatra::Reloader
11
11
  end
12
12
 
13
+ helpers do
14
+ def find_template(views, name, engine, &block)
15
+ views.each { |v| super(v, name, engine, &block) }
16
+ end
17
+ end
18
+
13
19
  before do
14
20
  content_type :json
15
21
 
@@ -17,8 +23,10 @@ module RubyPitaya
17
23
  @setup = settings.setup
18
24
  @config = settings.config
19
25
 
20
- request_body = request.body.read
21
- @params.merge!(JSON.parse(request_body)) if !request_body.blank?
26
+ if request.content_type == 'application/json'
27
+ request_body = request.body.read
28
+ @params.merge!(JSON.parse(request_body)) if !request_body.blank?
29
+ end
22
30
 
23
31
  @params = Parameters.new(@params)
24
32
  end
@@ -8,6 +8,7 @@ require 'rubypitaya/core/config'
8
8
  require 'rubypitaya/core/session'
9
9
  require 'rubypitaya/core/postman'
10
10
  require 'rubypitaya/core/parameters'
11
+ require 'rubypitaya/core/http_routes'
11
12
  require 'rubypitaya/core/routes_base'
12
13
  require 'rubypitaya/core/status_codes'
13
14
  require 'rubypitaya/core/handler_router'
@@ -89,7 +90,7 @@ module RubyPitaya
89
90
  HttpRoutes.set :bll, @bll
90
91
  HttpRoutes.set :setup, @setup
91
92
  HttpRoutes.set :config, @config
92
- HttpRoutes.set :views, [Path::HTTP_VIEWS_PATH] + Path::Plugins::APP_CONFIG_FOLDER_PATHS;
93
+ HttpRoutes.set :views, [Path::HTTP_VIEWS_PATH] + Path::Plugins::HTTP_VIEWS_PATHS
93
94
 
94
95
  Thread.new do
95
96
  HttpRoutes.bind = '0.0.0.0'
@@ -1,3 +1,3 @@
1
1
  module RubyPitaya
2
- VERSION = '2.6.2'
2
+ VERSION = '2.7.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubypitaya
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.2
4
+ version: 2.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luciano Prestes Cavalcanti
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-28 00:00:00.000000000 Z
11
+ date: 2020-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg
@@ -235,16 +235,21 @@ files:
235
235
  - "./lib/rubypitaya/app-template/bin/console"
236
236
  - "./lib/rubypitaya/app-template/config/database.yml"
237
237
  - "./lib/rubypitaya/app-template/config/routes.rb"
238
- - "./lib/rubypitaya/app-template/db/migration/0000000002_create_player_migration.rb"
238
+ - "./lib/rubypitaya/app-template/db/migration/1606736477_create_player_migration.rb"
239
239
  - "./lib/rubypitaya/app-template/docker-compose.yml"
240
240
  - "./lib/rubypitaya/app-template/docker/dev/Dockerfile"
241
241
  - "./lib/rubypitaya/app-template/docker/entrypoint.sh"
242
242
  - "./lib/rubypitaya/app-template/docker/prod/Dockerfile"
243
- - "./lib/rubypitaya/app-template/docker/prod/Makefile"
244
243
  - "./lib/rubypitaya/app-template/kubernetes/README.md"
245
244
  - "./lib/rubypitaya/app-template/kubernetes/deployment-connector.yaml"
246
245
  - "./lib/rubypitaya/app-template/kubernetes/deployment-rubypitaya.yaml"
246
+ - "./lib/rubypitaya/app-template/kubernetes/gameplay/deployment-nginx.yaml"
247
+ - "./lib/rubypitaya/app-template/kubernetes/gameplay/gameplay-template.yaml"
248
+ - "./lib/rubypitaya/app-template/kubernetes/gameplay/nginx.conf"
249
+ - "./lib/rubypitaya/app-template/kubernetes/gameplay/service-nginx.yaml"
247
250
  - "./lib/rubypitaya/app-template/kubernetes/persistent-volume.yaml"
251
+ - "./lib/rubypitaya/app-template/kubernetes/role-rubypitaya.yaml"
252
+ - "./lib/rubypitaya/app-template/kubernetes/rolebinding-rubypitaya.yaml"
248
253
  - "./lib/rubypitaya/app-template/kubernetes/service-connector.yaml"
249
254
  - "./lib/rubypitaya/app-template/kubernetes/service-etcd.yaml"
250
255
  - "./lib/rubypitaya/app-template/kubernetes/service-nats.yaml"
@@ -1,67 +0,0 @@
1
- ## Run ruby pitaya metagame project
2
- run:
3
- @docker-compose run --service-ports --rm rubypitaya bundle exec rubypitaya
4
-
5
- ## Update docker images
6
- update:
7
- @docker-compose pull
8
-
9
- ## Create database
10
- db-create:
11
- @docker-compose run --service-ports --rm rubypitaya bundle exec rake db:create
12
-
13
- ## Run migrations to database
14
- db-migrate:
15
- @docker-compose run --service-ports --rm rubypitaya bundle exec rake db:migrate
16
-
17
- ## Drop database
18
- db-drop:
19
- @docker-compose run --service-ports --rm rubypitaya bundle exec rake db:drop
20
-
21
- ## Reset database
22
- db-reset:
23
- @docker-compose run --service-ports --rm rubypitaya bundle exec rake db:reset
24
-
25
- .DEFAULT_GOAL := show-help
26
-
27
- .PHONY: show-help
28
- show-help:
29
- @echo "$$(tput bold)Commands:$$(tput sgr0)"
30
- @echo
31
- @sed -n -e "/^## / { \
32
- h; \
33
- s/.*//; \
34
- :doc" \
35
- -e "H; \
36
- n; \
37
- s/^## //; \
38
- t doc" \
39
- -e "s/:.*//; \
40
- G; \
41
- s/\\n## /---/; \
42
- s/\\n/ /g; \
43
- p; \
44
- }" ${MAKEFILE_LIST} \
45
- | LC_ALL='C' sort --ignore-case \
46
- | awk -F '---' \
47
- -v ncol=$$(tput cols) \
48
- -v indent=19 \
49
- -v col_on="$$(tput setaf 6)" \
50
- -v col_off="$$(tput sgr0)" \
51
- '{ \
52
- printf "%s%*s%s ", col_on, -indent, $$1, col_off; \
53
- n = split($$2, words, " "); \
54
- line_length = ncol - indent; \
55
- for (i = 1; i <= n; i++) { \
56
- line_length -= length(words[i]) + 1; \
57
- if (line_length <= 0) { \
58
- line_length = ncol - indent - length(words[i]) - 1; \
59
- printf "\n%*s ", -indent, " "; \
60
- } \
61
- printf "%s ", words[i]; \
62
- } \
63
- printf "\n"; \
64
- }'
65
-
66
-
67
-