rubypitaya 2.19.1 → 2.23.0

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 (39) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rubypitaya.rb +8 -1
  3. data/lib/rubypitaya/app-template/Gemfile +1 -1
  4. data/lib/rubypitaya/app-template/Gemfile.lock +15 -12
  5. data/lib/rubypitaya/app-template/Makefile +2 -2
  6. data/lib/rubypitaya/app-template/Rakefile +5 -10
  7. data/lib/rubypitaya/app-template/app/app_initializer.rb +3 -0
  8. data/lib/rubypitaya/app-template/app/bll/player_bll.rb +1 -1
  9. data/lib/rubypitaya/app-template/app/config/initial_player.json +4 -1
  10. data/lib/rubypitaya/app-template/app/handlers/player_handler.rb +4 -0
  11. data/lib/rubypitaya/app-template/{db/migration → app/migrations}/1606736477_create_player_migration.rb +0 -0
  12. data/lib/rubypitaya/app-template/app/setup/rubypitaya.yml +33 -0
  13. data/lib/rubypitaya/app-template/bin/console +3 -4
  14. data/lib/rubypitaya/app-template/docker-compose.yml +24 -15
  15. data/lib/rubypitaya/app-template/docker/dev/Dockerfile +1 -0
  16. data/lib/rubypitaya/app-template/docker/entrypoint.sh +4 -1
  17. data/lib/rubypitaya/app-template/features/player.feature +1 -1
  18. data/lib/rubypitaya/app-template/helm/templates/deployments/rubypitaya.yaml +17 -21
  19. data/lib/rubypitaya/app-template/helm/values.yaml +7 -3
  20. data/lib/rubypitaya/app-template/kubernetes/deployment-rubypitaya.yaml +10 -14
  21. data/lib/rubypitaya/app-template/spec/player_handler_spec.rb +4 -3
  22. data/lib/rubypitaya/core/{db/migration → app/migrations}/0000000001_create_user_migration.rb +0 -0
  23. data/lib/rubypitaya/core/application_files_importer.rb +3 -1
  24. data/lib/rubypitaya/core/config.rb +9 -0
  25. data/lib/rubypitaya/core/database_config.rb +15 -10
  26. data/lib/rubypitaya/core/handler_base.rb +2 -1
  27. data/lib/rubypitaya/core/handler_router.rb +4 -4
  28. data/lib/rubypitaya/core/helpers/setup_helper.rb +3 -4
  29. data/lib/rubypitaya/core/http_routes.rb +9 -8
  30. data/lib/rubypitaya/core/initializer_content.rb +3 -2
  31. data/lib/rubypitaya/core/main.rb +27 -12
  32. data/lib/rubypitaya/core/mongo_connector.rb +25 -0
  33. data/lib/rubypitaya/core/path.rb +3 -5
  34. data/lib/rubypitaya/core/setup.rb +10 -0
  35. data/lib/rubypitaya/core/spec-helpers/handler_spec_helper.rb +24 -2
  36. data/lib/rubypitaya/version.rb +1 -1
  37. metadata +20 -6
  38. data/lib/rubypitaya/app-template/app/setup/initial_player.yml +0 -2
  39. data/lib/rubypitaya/app-template/config/database.yml +0 -20
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 63a4b9efb72dc065c543c844c34f18109ecd16c6a037595dcaee92269600294a
4
- data.tar.gz: 825ffcf632ca4152c92f859cc73075b7b25d47bdc0b82dcc047833cc8f2f5744
3
+ metadata.gz: 3622a8779af46681d3a25d677021ef477a968e2a538d3dc7712c54a3bb5cd01d
4
+ data.tar.gz: d3357dc303db00fc1d29c208557547d60def38e432558a8286313dce4a9776df
5
5
  SHA512:
6
- metadata.gz: 88f7e8a0224d7e119a1f1660a82a57fa71a419a8d33ad190136f2b3796b03176ee6eb198d2528985fe30461dfde33f28e47f049f6df4ade56740c6bbf881cb9b
7
- data.tar.gz: 5cc1afdaf5c20cb7ebcf809a833b6243cc3d064bfb47443ec8ba116678fb19bb385698bbb567f94e76d22d3b4185d2707593ef6df8cd4dffce1dd538bcf4a97a
6
+ metadata.gz: 7f253dd21e9999acbe8ca3e6f64795f5c434a392cc7ad58749d5d0ac964fd1261e1440ef28a676489ce545bc406f39d5e1547242cee04575b666acfbe9dac4cb
7
+ data.tar.gz: 8ea11f029554fbb21abecb2f12dd69f6a40f6bff2dcb326e1bb28812be9261318bb650f8ff783b010fd68f5ac430de311263338d725b44e9715da914cc4ed2d6
data/lib/rubypitaya.rb CHANGED
@@ -49,7 +49,14 @@ module RubyPitaya
49
49
  `git -C #{Path::PLUGINS_FOLDER_PATH} clone #{plugin_git_link}`
50
50
  FileUtils.rm_rf(plugin_git_path)
51
51
 
52
- plugin_migrations_path = File.join(plugin_folder_path, 'db/migration/')
52
+ Dir.entries(plugin_folder_path).each do |entry|
53
+ entry_path = File.join(plugin_folder_path, entry)
54
+ FileUtils.rm_rf(entry_path) unless entry == 'app' ||
55
+ entry == '.' ||
56
+ entry == '..'
57
+ end
58
+
59
+ plugin_migrations_path = File.join(plugin_folder_path, 'app/migrations/')
53
60
  plugin_migrations_files = Dir[File.join(plugin_migrations_path, '*')]
54
61
  base_migration_timestamp = Time.now.utc.to_i
55
62
 
@@ -1,6 +1,6 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- gem 'rubypitaya', '2.19.1'
3
+ gem 'rubypitaya', '2.23.0'
4
4
 
5
5
  group :development do
6
6
  gem 'pry', '0.14.0'
@@ -12,9 +12,10 @@ GEM
12
12
  minitest (>= 5.1)
13
13
  tzinfo (~> 2.0)
14
14
  zeitwerk (~> 2.3)
15
+ bson (4.12.1)
15
16
  builder (3.2.4)
16
17
  coderay (1.1.3)
17
- concurrent-ruby (1.1.8)
18
+ concurrent-ruby (1.1.9)
18
19
  cucumber (5.3.0)
19
20
  builder (~> 3.2, >= 3.2.4)
20
21
  cucumber-core (~> 8.0, >= 8.0.1)
@@ -50,14 +51,14 @@ GEM
50
51
  etcdv3 (0.10.2)
51
52
  grpc (~> 1.17)
52
53
  eventmachine (1.2.7)
53
- ffi (1.15.0)
54
- google-protobuf (3.15.5)
55
- googleapis-common-protos-types (1.0.6)
56
- google-protobuf (~> 3.14)
57
- grpc (1.36.0)
54
+ ffi (1.15.3)
55
+ google-protobuf (3.17.3)
56
+ googleapis-common-protos-types (1.1.0)
58
57
  google-protobuf (~> 3.14)
58
+ grpc (1.38.0)
59
+ google-protobuf (~> 3.15)
59
60
  googleapis-common-protos-types (~> 1.0)
60
- i18n (1.8.9)
61
+ i18n (1.8.10)
61
62
  concurrent-ruby (~> 1.0)
62
63
  listen (3.4.1)
63
64
  rb-fsevent (~> 0.10, >= 0.10.3)
@@ -65,6 +66,8 @@ GEM
65
66
  method_source (1.0.0)
66
67
  middleware (0.1.0)
67
68
  minitest (5.14.4)
69
+ mongo (2.15.0)
70
+ bson (>= 4.8.2, < 5.0.0)
68
71
  multi_json (1.15.0)
69
72
  multi_test (0.1.2)
70
73
  mustermann (1.1.1)
@@ -90,7 +93,7 @@ GEM
90
93
  rack-protection (2.1.0)
91
94
  rack
92
95
  rake (13.0.3)
93
- rb-fsevent (0.10.4)
96
+ rb-fsevent (0.11.0)
94
97
  rb-inotify (0.10.1)
95
98
  ffi (~> 1.0)
96
99
  redis (4.2.5)
@@ -107,11 +110,11 @@ GEM
107
110
  diff-lcs (>= 1.2.0, < 2.0)
108
111
  rspec-support (~> 3.10.0)
109
112
  rspec-support (3.10.2)
110
- ruby2_keywords (0.0.4)
111
- rubypitaya (2.19.1)
113
+ ruby2_keywords (0.0.5)
114
+ rubypitaya (2.23.0)
112
115
  activerecord (= 6.1.3)
113
116
  etcdv3 (= 0.10.2)
114
- eventmachine (= 1.2.7)
117
+ mongo (= 2.15.0)
115
118
  nats (= 0.11.0)
116
119
  ostruct (= 0.3.3)
117
120
  pg (= 1.2.3)
@@ -149,7 +152,7 @@ DEPENDENCIES
149
152
  listen (= 3.4.1)
150
153
  pry (= 0.14.0)
151
154
  rspec (= 3.10.0)
152
- rubypitaya (= 2.19.1)
155
+ rubypitaya (= 2.23.0)
153
156
 
154
157
  BUNDLED WITH
155
158
  2.1.4
@@ -41,7 +41,7 @@ test-cucumber:
41
41
  ## Update gems dependencies on Gemfile.lock
42
42
  update-dependencies:
43
43
  @rm -f Gemfile.lock
44
- @docker run --rm -v "$(PWD)":/usr/src/app -w /usr/src/app ruby:2.7.2-slim bundle install
44
+ @docker run --rm -v "$(PWD)":/usr/src/app -w /usr/src/app ruby:2.7.2 bundle install
45
45
 
46
46
  ## + Improve metagame
47
47
 
@@ -49,7 +49,7 @@ update-dependencies:
49
49
  create-migration:
50
50
  @docker-compose run --service-ports --rm rubypitaya-commands bundle exec rubypitaya create-migration $(NAME)
51
51
 
52
- ## Add or update a plugim. GIT=[plugin-git-link]
52
+ ## Add or update a plugin. GIT=[plugin-http-git-link]
53
53
  add-plugin:
54
54
  @docker-compose run --service-ports --rm rubypitaya-commands bundle exec rubypitaya add-plugin $(GIT)
55
55
 
@@ -8,8 +8,7 @@ namespace :db do
8
8
 
9
9
  desc 'Create the database'
10
10
  task :create do
11
- environment_name = ENV.fetch("RUBYPITAYA_ENV") { 'development' }
12
- database_config = RubyPitaya::DatabaseConfig.new(environment_name, RubyPitaya::Path::DATABASE_CONFIG_PATH)
11
+ database_config = RubyPitaya::DatabaseConfig.new
13
12
  connection_data = database_config.connection_data_without_database
14
13
 
15
14
  ActiveRecord::Base.establish_connection(connection_data)
@@ -21,8 +20,7 @@ namespace :db do
21
20
 
22
21
  desc 'Migrate the database'
23
22
  task :migrate do
24
- environment_name = ENV.fetch("RUBYPITAYA_ENV") { 'development' }
25
- database_config = RubyPitaya::DatabaseConfig.new(environment_name, RubyPitaya::Path::DATABASE_CONFIG_PATH)
23
+ database_config = RubyPitaya::DatabaseConfig.new
26
24
  connection_data = database_config.connection_data
27
25
  migrations_paths = [RubyPitaya::Path::Core::MIGRATIONS_FOLDER_PATH]
28
26
  migrations_paths += RubyPitaya::Path::Plugins::MIGRATIONS_FOLDER_PATHS
@@ -38,8 +36,7 @@ namespace :db do
38
36
 
39
37
  desc 'Rollback migrations'
40
38
  task :rollback do
41
- environment_name = ENV.fetch("RUBYPITAYA_ENV") { 'development' }
42
- database_config = RubyPitaya::DatabaseConfig.new(environment_name, RubyPitaya::Path::DATABASE_CONFIG_PATH)
39
+ database_config = RubyPitaya::DatabaseConfig.new
43
40
  connection_data = database_config.connection_data
44
41
  migrations_paths = [RubyPitaya::Path::Core::MIGRATIONS_FOLDER_PATH]
45
42
  migrations_paths += RubyPitaya::Path::Plugins::MIGRATIONS_FOLDER_PATHS
@@ -64,8 +61,7 @@ namespace :db do
64
61
 
65
62
  desc 'Drop the database'
66
63
  task :drop do
67
- environment_name = ENV.fetch("RUBYPITAYA_ENV") { 'development' }
68
- database_config = RubyPitaya::DatabaseConfig.new(environment_name, RubyPitaya::Path::DATABASE_CONFIG_PATH)
64
+ database_config = RubyPitaya::DatabaseConfig.new
69
65
  connection_data = database_config.connection_data_without_database
70
66
 
71
67
  ActiveRecord::Base.establish_connection(connection_data)
@@ -78,8 +74,7 @@ namespace :db do
78
74
 
79
75
  desc 'migration status'
80
76
  task :status do
81
- environment_name = ENV.fetch("RUBYPITAYA_ENV") { 'development' }
82
- database_config = RubyPitaya::DatabaseConfig.new(environment_name, RubyPitaya::Path::DATABASE_CONFIG_PATH)
77
+ database_config = RubyPitaya::DatabaseConfig.new
83
78
  connection_data = database_config.connection_data
84
79
  migrations_paths = [RubyPitaya::Path::Core::MIGRATIONS_FOLDER_PATH]
85
80
  migrations_paths += RubyPitaya::Path::Plugins::MIGRATIONS_FOLDER_PATHS
@@ -13,6 +13,9 @@ class AppInitializer < RubyPitaya::InitializerBase
13
13
  # - get instance by key
14
14
  # - redis
15
15
  # - link: https://github.com/redis/redis-rb/
16
+ # - mongo
17
+ # - class: Mongo::Client
18
+ # - link: https://docs.mongodb.com/ruby-driver/current/tutorials/quick-start/
16
19
  # - config
17
20
  # - class: RubyPitaya::Config
18
21
  # - link: https://gitlab.com/LucianoPC/ruby-pitaya/-/blob/master/lib/rubypitaya/core/config.rb
@@ -2,7 +2,7 @@ class PlayerBLL
2
2
 
3
3
  def create_new_player(setup, config)
4
4
  name = config['initial_player'][:name]
5
- gold = setup['initial_player.wallet.gold']
5
+ gold = config['initial_player'][:wallet][:gold]
6
6
 
7
7
  player = Player.new(name: name, gold: gold, user: User.new)
8
8
  player.save!
@@ -1,3 +1,6 @@
1
1
  {
2
- "name": "Guest"
2
+ "name": "Guest",
3
+ "wallet": {
4
+ "gold": 10
5
+ }
3
6
  }
@@ -11,6 +11,10 @@ class PlayerHandler < RubyPitaya::HandlerBase
11
11
  # - @redis
12
12
  # - link: https://github.com/redis/redis-rb/
13
13
  #
14
+ # - @mongo
15
+ # - class: Mongo::Client
16
+ # - link: https://docs.mongodb.com/ruby-driver/current/tutorials/quick-start/
17
+ #
14
18
  # - @config
15
19
  # - info: Hash with config json files inside of 'app/config'
16
20
  # - example:
@@ -0,0 +1,33 @@
1
+ server:
2
+ name: 'rubypitaya'
3
+ environment: development
4
+
5
+ nats:
6
+ url: 'nats://nats:4222'
7
+
8
+ etcd:
9
+ url: 'http://etcd:2379'
10
+ prefix: 'rubypitaya/'
11
+ leaseSeconds: '60'
12
+
13
+ redis:
14
+ url: 'redis://redis:6379'
15
+
16
+ database:
17
+ host: 'db'
18
+ port: 5432
19
+ user: 'postgres'
20
+ password: 'postgres'
21
+ name: 'ruby_pitaya'
22
+
23
+ mongo:
24
+ url: mongo:27017
25
+ user: 'user'
26
+ pass: 'password'
27
+ database: admin
28
+
29
+ http:
30
+ auth:
31
+ user: 'user'
32
+ pass: 'pass'
33
+ enabled: 'false'
@@ -7,8 +7,7 @@ require 'rubypitaya'
7
7
  require 'rubypitaya/core/database_config'
8
8
 
9
9
  # Database connection
10
- environment_name = ENV.fetch("RUBYPITAYA_ENV") { 'development' }
11
- database_config = RubyPitaya::DatabaseConfig.new(environment_name, RubyPitaya::Path::DATABASE_CONFIG_PATH)
10
+ database_config = RubyPitaya::DatabaseConfig.new
12
11
  ActiveRecord::Base.establish_connection(database_config.connection_data)
13
12
  ActiveRecord::Base.logger = ActiveSupport::Logger.new(STDOUT)
14
13
  ActiveSupport::LogSubscriber.colorize_logging = true
@@ -16,7 +15,7 @@ ActiveSupport::LogSubscriber.colorize_logging = true
16
15
  # Loading core files
17
16
  Gem.find_files('rubypitaya/**/*.rb').each do |path|
18
17
  require path unless path.end_with?('spec.rb') ||
19
- path.include?('db/migration') ||
18
+ path.include?('app/migrations') ||
20
19
  path.include?('core/templates') ||
21
20
  path.include?('core/spec-helpers') ||
22
21
  path.include?('app-template')
@@ -29,7 +28,7 @@ app_folder_paths.each do |app_folder_path|
29
28
 
30
29
  Dir[app_files_path].each do |path|
31
30
  require path unless path.end_with?('spec.rb') ||
32
- path.include?('db/migration') ||
31
+ path.include?('app/migrations') ||
33
32
  path.include?('spec_helper.rb')
34
33
  end
35
34
  end
@@ -26,6 +26,28 @@ services:
26
26
  ports:
27
27
  - '9100:5432'
28
28
 
29
+ mongo:
30
+ image: mongo:5.0.0
31
+ restart: always
32
+ ports:
33
+ - 27017:27017
34
+ environment:
35
+ MONGO_INITDB_ROOT_USERNAME: user
36
+ MONGO_INITDB_ROOT_PASSWORD: password
37
+
38
+ mongo-express:
39
+ depends_on:
40
+ - 'mongo'
41
+ image: mongo-express:0.54.0
42
+ restart: always
43
+ ports:
44
+ - 8081:8081
45
+ environment:
46
+ ME_CONFIG_MONGODB_ADMINUSERNAME: user
47
+ ME_CONFIG_MONGODB_ADMINPASSWORD: password
48
+ ME_CONFIG_MONGODB_SERVER: 'mongo'
49
+ ME_CONFIG_MONGODB_PORT: '27017'
50
+
29
51
  connector:
30
52
  image: 'registry.gitlab.com/lucianopc/pitaya-connector:0.1.0'
31
53
  depends_on:
@@ -49,6 +71,8 @@ services:
49
71
  - 'nats'
50
72
  - 'etcd'
51
73
  - 'redis'
74
+ - 'mongo'
75
+ - 'mongo-express'
52
76
  - 'connector'
53
77
  build:
54
78
  context: '.'
@@ -60,22 +84,7 @@ services:
60
84
  ports:
61
85
  - '80:4567'
62
86
  environment:
63
- SERVER_NAME: 'rubypitaya'
64
- RUBYPITAYA_ENV: 'development'
65
87
  HISTFILE: '/app/rubypitaya/.bash-history'
66
- NATS_URL: 'nats://nats:4222'
67
- ETCD_URL: 'http://etcd:2379'
68
- ETCD_PREFIX: 'rubypitaya/'
69
- ETCD_LEASE_SECONDS: '60'
70
- REDIS_URL: 'redis://redis:6379'
71
- DATABASE_HOST: 'db'
72
- DATABASE_PORT: 5432
73
- DATABASE_USER: 'postgres'
74
- DATABASE_PASSWORD: 'postgres'
75
- DATABASE_NAME: 'ruby_pitaya'
76
- HTTP_AUTH_ENABLED: 'false'
77
- HTTP_AUTH_USER: 'user'
78
- HTTP_AUTH_PASS: 'pass'
79
88
 
80
89
  rubypitaya-console:
81
90
  <<: *rubypitaya
@@ -5,6 +5,7 @@ ENV LC_ALL=C.UTF-8
5
5
 
6
6
  RUN apt update && \
7
7
  apt install -y --no-install-recommends \
8
+ git \
8
9
  netcat \
9
10
  libpq-dev \
10
11
  build-essential \
@@ -4,7 +4,10 @@ cmd="$@"
4
4
 
5
5
  echo "=> Waiting for postgres"
6
6
 
7
- ./docker/wait_for.sh $DATABASE_HOST:$DATABASE_PORT
7
+ RUBYPITAYA_DATABASE_HOST=${RUBYPITAYA_DATABASE_HOST:-'db'}
8
+ RUBYPITAYA_DATABASE_PORT=${RUBYPITAYA_DATABASE_PORT:-5432}
9
+
10
+ ./docker/wait_for.sh $RUBYPITAYA_DATABASE_HOST:$RUBYPITAYA_DATABASE_PORT
8
11
 
9
12
  echo "=> Postgres is ready"
10
13
 
@@ -3,7 +3,7 @@ Feature: Player
3
3
  As a game player I want to have a player on database
4
4
 
5
5
  Scenario: Create new player
6
- Given setup key 'initial_player.wallet.gold' is '10'
6
+ Given config key 'initial_player.wallet.gold' is '10'
7
7
  And config key 'initial_player.name' is 'Guest'
8
8
  When client call route 'rubypitaya.playerHandler.authenticate'
9
9
  Then server should response 'code' as 'RP-200'
@@ -25,34 +25,30 @@ spec:
25
25
  - containerPort: 4567
26
26
  name: rubypitaya
27
27
  env:
28
- - name: SERVER_NAME
29
- value: "rubypitaya"
30
- - name: RUBYPITAYA_ENV
31
- value: "production"
32
- - name: NATS_URL
28
+ - name: RUBYPITAYA_SERVER_ENVIRONMENT
29
+ value: {{ .Values.rubypitaya.server.environment | quote }}
30
+ - name: RUBYPITAYA_NATS_URL
33
31
  value: "nats://nats.{{ .Values.namespace }}.svc.cluster.local:4222"
34
- - name: ETCD_URL
32
+ - name: RUBYPITAYA_ETCD_URL
35
33
  value: "http://etcd.{{ .Values.namespace }}.svc.cluster.local:2379"
36
- - name: ETCD_PREFIX
37
- value: "rubypitaya/"
38
- - name: ETCD_LEASE_SECONDS
39
- value: "60"
40
- - name: REDIS_URL
34
+ - name: RUBYPITAYA_REDIS_URL
41
35
  value: "redis://redis.{{ .Values.namespace }}.svc.cluster.local:6379"
42
- - name: DATABASE_NAME
36
+ - name: RUBYPITAYA_DATABASE_NAME
43
37
  value: {{ .Values.database.name | quote }}
44
- - name: DATABASE_HOST
38
+ - name: RUBYPITAYA_DATABASE_HOST
45
39
  value: {{ .Values.database.host | quote }}
46
- - name: DATABASE_USER
40
+ - name: RUBYPITAYA_DATABASE_USER
47
41
  value: {{ .Values.database.user | quote }}
48
- - name: DATABASE_PASSWORD
42
+ - name: RUBYPITAYA_DATABASE_PORT
43
+ value: {{ .Values.database.port | quote }}
44
+ - name: RUBYPITAYA_DATABASE_PASSWORD
49
45
  value: {{ .Values.database.password | quote }}
50
- - name: HTTP_AUTH_ENABLED
51
- value: {{ .Values.http.enabled | quote }}
52
- - name: HTTP_AUTH_USER
53
- value: {{ .Values.http.user | quote }}
54
- - name: HTTP_AUTH_PASS
55
- value: {{ .Values.http.password | quote }}
46
+ - name: RUBYPITAYA_HTTP_AUTH_ENABLED
47
+ value: {{ .Values.http.auth.enabled | quote }}
48
+ - name: RUBYPITAYA_HTTP_AUTH_USER
49
+ value: {{ .Values.http.auth.user | quote }}
50
+ - name: RUBYPITAYA_HTTP_AUTH_PASS
51
+ value: {{ .Values.http.auth.password | quote }}
56
52
  - name: MATCHMAKING_CURRENTROOMBLL
57
53
  value: kubernetes
58
54
  - name: MATCHMAKING_ROOMBLL_KUBERNETES_NAMESPACE
@@ -7,6 +7,8 @@ connector:
7
7
  tag: 0.2.0
8
8
 
9
9
  rubypitaya:
10
+ server:
11
+ environment: production
10
12
  image:
11
13
  repository: [metagame-repository-link]
12
14
  tag: latest
@@ -15,12 +17,14 @@ database:
15
17
  name: [database-name]
16
18
  host: [database-host]
17
19
  user: [database-user]
20
+ port: [database-port]
18
21
  password: [database-password]
19
22
 
20
23
  http:
21
- enabled: false
22
- user: user
23
- password: pass
24
+ auth:
25
+ user: 'user'
26
+ pass: 'pass'
27
+ enabled: 'false'
24
28
 
25
29
  gameserver:
26
30
  image:
@@ -22,27 +22,23 @@ spec:
22
22
  - containerPort: 4567
23
23
  name: rubypitaya
24
24
  env:
25
- - name: SERVER_NAME
26
- value: "rubypitaya"
27
- - name: RUBYPITAYA_ENV
25
+ - name: RUBYPITAYA_SERVER_ENVIRONMENT
28
26
  value: "production"
29
- - name: NATS_URL
27
+ - name: RUBYPITAYA_NATS_URL
30
28
  value: "nats://nats.default.svc.cluster.local:4222"
31
- - name: ETCD_URL
29
+ - name: RUBYPITAYA_ETCD_URL
32
30
  value: "http://etcd.default.svc.cluster.local:2379"
33
- - name: ETCD_PREFIX
34
- value: "rubypitaya/"
35
- - name: ETCD_LEASE_SECONDS
36
- value: "60"
37
- - name: REDIS_URL
31
+ - name: RUBYPITAYA_REDIS_URL
38
32
  value: "redis://redis.default.svc.cluster.local:6379"
39
- - name: DATABASE_HOST
33
+ - name: RUBYPITAYA_DATABASE_HOST
40
34
  value: "postgres.default.svc.cluster.local"
41
- - name: DATABASE_USER
35
+ - name: RUBYPITAYA_DATABASE_USER
42
36
  value: "postgres"
43
- - name: DATABASE_PASSWORD
37
+ - name: RUBYPITAYA_DATABASE_PORT
38
+ value: "5432"
39
+ - name: RUBYPITAYA_DATABASE_PASSWORD
44
40
  value: "postgres"
45
- - name: DATABASE_NAME
41
+ - name: RUBYPITAYA_DATABASE_NAME
46
42
  value: "ruby_pitaya"
47
43
  imagePullSecrets:
48
44
  - name: gitlab-registry
@@ -3,10 +3,11 @@ require 'spec_helper'
3
3
  RSpec.describe 'PlayerHandler', type: :request do
4
4
  context 'authenticate' do
5
5
  it 'create_new_user' do
6
- setup = {'initial_player' => {'wallet' => {'gold' => 10}}}
7
- config = {'initial_player' => {'name' => 'Guest'}}
6
+ config = {'initial_player' => {
7
+ 'name' => 'Guest',
8
+ 'wallet' => {'gold' => 10},
9
+ }}
8
10
 
9
- set_setup(setup)
10
11
  set_config(config)
11
12
 
12
13
  params = {}
@@ -10,7 +10,9 @@ module RubyPitaya
10
10
  app_folder_paths.each do |app_folder_path|
11
11
  app_files_path = "#{app_folder_path}/**/*.rb"
12
12
 
13
- Gem.find_files(app_files_path).each { |path| require path }
13
+ Gem.find_files(app_files_path).each do |path|
14
+ require path unless path.include?('app/migrations')
15
+ end
14
16
  end
15
17
  end
16
18
 
@@ -9,6 +9,7 @@ module RubyPitaya
9
9
  @config_core_override = nil
10
10
  @has_config_core_override = false
11
11
 
12
+ @empty_hash = {}
12
13
  @result_cache = {}
13
14
  end
14
15
 
@@ -18,6 +19,7 @@ module RubyPitaya
18
19
 
19
20
  if @has_config_core_override
20
21
  result = @config_core_override[key]
22
+ result = @config_core[key] if result.nil?
21
23
  else
22
24
  result = @config_core[key]
23
25
  end
@@ -27,6 +29,13 @@ module RubyPitaya
27
29
  result
28
30
  end
29
31
 
32
+ def fetch(*args)
33
+ result = self[args[0]]
34
+ return result unless result.nil?
35
+
36
+ @empty_hash.fetch(*args)
37
+ end
38
+
30
39
  def auto_reload
31
40
  @config_core.auto_reload
32
41
  @config_core_override.auto_reload unless @config_core_override.nil?
@@ -1,21 +1,30 @@
1
1
  require 'erb'
2
2
  require 'yaml'
3
3
 
4
- require 'rubypitaya/core/path'
4
+ require 'rubypitaya/core/setup'
5
5
 
6
6
  module RubyPitaya
7
7
 
8
8
  class DatabaseConfig
9
9
 
10
- def initialize(environment_name, database_config_path)
11
- @environment_name = environment_name
10
+ def initialize()
11
+ @setup = Setup.new
12
+
13
+ @config = {
14
+ 'adapter' => 'postgresql',
15
+ 'encoding' => 'unicode',
16
+ 'pool' => @setup.fetch('rubypitaya.database.pool', 5),
17
+ 'host' => @setup['rubypitaya.database.host'],
18
+ 'user' => @setup['rubypitaya.database.user'],
19
+ 'password' => @setup['rubypitaya.database.password'],
20
+ 'database' => @setup['rubypitaya.database.name'],
21
+ }
12
22
 
13
- yaml_contents = File.open(database_config_path).read
14
- @config = YAML.load( ERB.new(yaml_contents).result )
23
+ @config['database'] = "#{@config['database']}_test" if @environment_name == 'test'
15
24
  end
16
25
 
17
26
  def config
18
- @config[@environment_name]
27
+ @config
19
28
  end
20
29
 
21
30
  def connection_data
@@ -44,9 +53,5 @@ module RubyPitaya
44
53
  def database_name
45
54
  config['database']
46
55
  end
47
-
48
- def migrations_path
49
- @migrations_path
50
- end
51
56
  end
52
57
  end
@@ -17,10 +17,11 @@ module RubyPitaya
17
17
  @postman = nil
18
18
  end
19
19
 
20
- def set_attributes(bll, log, redis, setup, config, params, session, postman)
20
+ def set_attributes(bll, log, redis, mongo, setup, config, params, session, postman)
21
21
  @bll = bll
22
22
  @log = log
23
23
  @redis = redis
24
+ @mongo = mongo
24
25
  @setup = setup
25
26
  @config = config
26
27
  @params = params
@@ -54,8 +54,8 @@ module RubyPitaya
54
54
  @handler_name_map = @handler_name_map.to_h
55
55
  end
56
56
 
57
- def call(handler_name, action_name, session, postman, redis, setup, config,
58
- bll, log, params)
57
+ def call(handler_name, action_name, session, postman, redis, mongo, setup,
58
+ config, bll, log, params)
59
59
  unless @handler_name_map.include?(handler_name)
60
60
  return {
61
61
  code: StatusCodes::CODE_HANDLER_NOT_FOUND,
@@ -72,11 +72,11 @@ module RubyPitaya
72
72
  handler = @handler_name_map[handler_name]
73
73
 
74
74
  if !handler.class.authenticated_action_name?(action_name)
75
- handler.set_attributes(bll, log, redis, setup, config, params, session, postman)
75
+ handler.set_attributes(bll, log, redis, mongo, setup, config, params, session, postman)
76
76
  handler.send(action_name)
77
77
  else
78
78
  if session.authenticated?
79
- handler.set_attributes(bll, log, redis, setup, config, params, session, postman)
79
+ handler.set_attributes(bll, log, redis, mongo, setup, config, params, session, postman)
80
80
  handler.send(action_name)
81
81
  else
82
82
  return {
@@ -3,8 +3,7 @@ require 'active_record'
3
3
  require 'rubypitaya/core/database_config'
4
4
 
5
5
  # Database connection
6
- environment_name = ENV.fetch("RUBYPITAYA_ENV") { 'development' }
7
- database_config = RubyPitaya::DatabaseConfig.new(environment_name, RubyPitaya::Path::DATABASE_CONFIG_PATH)
6
+ database_config = RubyPitaya::DatabaseConfig.new
8
7
  ActiveRecord::Base.establish_connection(database_config.connection_data)
9
8
  # ActiveRecord::Base.logger = ActiveSupport::Logger.new(STDOUT)
10
9
  # ActiveSupport::LogSubscriber.colorize_logging = true
@@ -19,7 +18,7 @@ ActiveRecord::Migration.maintain_test_schema!
19
18
  # Loading core files
20
19
  Gem.find_files('rubypitaya/**/*.rb').each do |path|
21
20
  require path unless path.end_with?('spec.rb') ||
22
- path.include?('db/migration') ||
21
+ path.include?('app/migrations') ||
23
22
  path.include?('core/templates') ||
24
23
  path.include?('core/spec-helpers') ||
25
24
  path.include?('app-template')
@@ -32,6 +31,6 @@ app_folder_paths.each do |app_folder_path|
32
31
 
33
32
  Dir[app_files_path].each do |path|
34
33
  require path unless path.end_with?('spec.rb') ||
35
- path.include?('db/migration')
34
+ path.include?('app/migrations')
36
35
  end
37
36
  end
@@ -1,13 +1,13 @@
1
1
  require 'sinatra/base'
2
- require 'sinatra/reloader' if ENV['RUBYPITAYA_ENV'] == 'development'
3
2
  require 'rubypitaya/core/parameters'
4
3
 
5
4
  module RubyPitaya
6
5
 
7
6
  class HttpRoutes < Sinatra::Base
8
7
 
9
- if ENV['RUBYPITAYA_ENV'] == 'development'
10
- register Sinatra::Reloader
8
+ def self.auto_reload
9
+ require 'sinatra/reloader'
10
+ register ::Sinatra::Reloader
11
11
  end
12
12
 
13
13
  helpers do
@@ -19,12 +19,13 @@ module RubyPitaya
19
19
  before do
20
20
  content_type :json
21
21
 
22
- return error_unauthorized unless authorized?(request)
23
-
24
22
  @bll = settings.bll
23
+ @mongo = settings.mongo
25
24
  @setup = settings.setup
26
25
  @config = settings.config
27
26
 
27
+ return error_unauthorized unless authorized?(request)
28
+
28
29
  @config.clear_cache
29
30
 
30
31
  if request.content_type == 'application/json'
@@ -49,12 +50,12 @@ module RubyPitaya
49
50
  end
50
51
 
51
52
  def http_auth_enabled?
52
- return ENV.fetch("HTTP_AUTH_ENABLED") { 'false' } == 'true'
53
+ return @setup.fetch('rubypitaya.http.auth.enabled') { 'false' } == 'true'
53
54
  end
54
55
 
55
56
  def get_http_auth
56
- user = ENV.fetch("HTTP_AUTH_USER") { '' }
57
- pass = ENV.fetch("HTTP_AUTH_PASS") { '' }
57
+ user = @setup.fetch('rubypitaya.http.auth.user') { '' }
58
+ pass = @setup.fetch('rubypitaya.http.auth.pass') { '' }
58
59
 
59
60
  auth_token = ::Base64.strict_encode64("#{user}:#{pass}")
60
61
 
@@ -2,11 +2,12 @@ module RubyPitaya
2
2
 
3
3
  class InitializerContent
4
4
 
5
- attr_reader :bll, :log, :redis, :setup, :config
5
+ attr_reader :bll, :log, :redis, :mongo, :setup, :config
6
6
 
7
- def initialize(bll, log, redis, setup, config)
7
+ def initialize(bll, log, redis, mongo, setup, config)
8
8
  @bll = bll
9
9
  @log = log
10
+ @mongo = mongo
10
11
  @redis = redis
11
12
  @setup = setup
12
13
  @config = config
@@ -16,8 +16,9 @@ require 'rubypitaya/core/handler_router'
16
16
  require 'rubypitaya/core/etcd_connector'
17
17
  require 'rubypitaya/core/nats_connector'
18
18
  require 'rubypitaya/core/database_config'
19
- require 'rubypitaya/core/redis_connector'
20
19
  require 'rubypitaya/core/instance_holder'
20
+ require 'rubypitaya/core/mongo_connector'
21
+ require 'rubypitaya/core/redis_connector'
21
22
  require 'rubypitaya/core/database_connector'
22
23
  require 'rubypitaya/core/initializer_content'
23
24
  require 'rubypitaya/core/initializer_broadcast'
@@ -30,8 +31,10 @@ module RubyPitaya
30
31
  attr_reader :redis_connector, :config, :bll
31
32
 
32
33
  def initialize
33
- @environment_name = ENV.fetch("RUBYPITAYA_ENV") { 'development' }
34
+ @setup = Setup.new
35
+ @environment_name = @setup.fetch('rubypitaya.server.environment', 'development')
34
36
  @is_development_environment = @environment_name == 'development'
37
+ @setup.auto_reload if @is_development_environment
35
38
 
36
39
  @log = Logger.new('/proc/self/fd/1')
37
40
  @log.level = Logger::INFO
@@ -43,13 +46,13 @@ module RubyPitaya
43
46
  @application_files_importer.import
44
47
  @application_files_importer.auto_reload if @is_development_environment
45
48
 
46
- @server_name = ENV['SERVER_NAME']
49
+ @server_name = @setup['rubypitaya.server.name']
47
50
  @service_uuid = SecureRandom.uuid
48
51
  @desktop_name = Socket.gethostname
49
52
 
50
- @etcd_prefix = ENV['ETCD_PREFIX']
51
- @etcd_address = ENV['ETCD_URL']
52
- @etcd_lease_seconds = ENV['ETCD_LEASE_SECONDS'].to_i
53
+ @etcd_prefix = @setup['rubypitaya.etcd.prefix']
54
+ @etcd_address = @setup['rubypitaya.etcd.url']
55
+ @etcd_lease_seconds = @setup['rubypitaya.etcd.leaseSeconds'].to_i
53
56
  @allow_reconnect = false
54
57
  @etcd_connector = EtcdConnector.new(@service_uuid, @desktop_name,
55
58
  @server_name, @etcd_prefix,
@@ -57,30 +60,37 @@ module RubyPitaya
57
60
  @etcd_lease_seconds)
58
61
  @etcd_connector.connect
59
62
 
60
- @nats_address = ENV['NATS_URL']
63
+ @nats_address = @setup['rubypitaya.nats.url']
61
64
  @nats_connector = NatsConnector.new(@nats_address, @service_uuid,
62
65
  @server_name)
63
66
 
64
- @redis_address = ENV['REDIS_URL']
67
+ @redis_address = @setup['rubypitaya.redis.url']
65
68
  @redis_connector = RedisConnector.new(@redis_address)
66
69
  @redis_connector.connect
67
70
 
68
- @database_config = DatabaseConfig.new(@environment_name, Path::DATABASE_CONFIG_PATH)
71
+ @database_config = DatabaseConfig.new
69
72
  @database_connector = DatabaseConnector.new(@database_config)
70
73
  @database_connector.connect
71
74
 
75
+ @mongo_address = @setup['rubypitaya.mongo.url']
76
+ @mongo_user = @setup['rubypitaya.mongo.user']
77
+ @mongo_password = @setup['rubypitaya.mongo.pass']
78
+ @mongo_database_name = @setup['rubypitaya.mongo.database']
79
+ @mongo_connector = MongoConnector.new(@mongo_address, @mongo_user,
80
+ @mongo_password, @mongo_database_name)
81
+ @mongo_connector.connect
82
+
72
83
  @session = Session.new
73
84
  @postman = Postman.new(@nats_connector)
74
85
  @config = Config.new
75
86
  @config.auto_reload if @is_development_environment
76
- @setup = Setup.new
77
- @setup.auto_reload if @is_development_environment
78
87
 
79
88
  @bll = InstanceHolder.new
80
89
 
81
90
  @initializer_content = InitializerContent.new(@bll,
82
91
  @log,
83
92
  @redis_connector.redis,
93
+ @mongo_connector.mongo,
84
94
  @setup,
85
95
  @config)
86
96
  @initializer_broadcast = InitializerBroadcast.new
@@ -97,10 +107,14 @@ module RubyPitaya
97
107
  def run_http
98
108
  HttpRoutes.set :bll, @bll
99
109
  HttpRoutes.set :log, @log
110
+ HttpRoutes.set :redis, @redis_connector.redis
111
+ HttpRoutes.set :mongo, @mongo_connector.mongo
100
112
  HttpRoutes.set :setup, @setup
101
113
  HttpRoutes.set :config, @config
102
114
  HttpRoutes.set :views, [Path::HTTP_VIEWS_PATH] + Path::Plugins::HTTP_VIEWS_PATHS
103
115
 
116
+ HttpRoutes.auto_reload if @is_development_environment
117
+
104
118
  Thread.new do
105
119
  HttpRoutes.bind = '0.0.0.0'
106
120
  HttpRoutes.port = '4567'
@@ -170,7 +184,8 @@ module RubyPitaya
170
184
 
171
185
  response = @handler_router.call(handler_name, action_name, @session,
172
186
  @postman, @redis_connector.redis,
173
- @setup, @config, @bll, @log, params)
187
+ @mongo_connector.mongo, @setup, @config,
188
+ @bll, @log, params)
174
189
 
175
190
  delta_time_seconds = ((Time.now.to_f - start_time_seconds) * 1000).round(2)
176
191
 
@@ -0,0 +1,25 @@
1
+ require 'mongo'
2
+
3
+ module RubyPitaya
4
+
5
+ class MongoConnector
6
+
7
+ def initialize(mongo_address, mongo_user, mongo_password, mongo_database_name)
8
+ @mongo_address = mongo_address
9
+ @mongo_user = mongo_user
10
+ @mongo_password = mongo_password
11
+ @mongo_database_name = mongo_database_name
12
+ end
13
+
14
+ def connect
15
+ @mongo_client = Mongo::Client.new([@mongo_address],
16
+ user: @mongo_user,
17
+ password: @mongo_password,
18
+ database: @mongo_database_name)
19
+ end
20
+
21
+ def mongo
22
+ @mongo_client
23
+ end
24
+ end
25
+ end
@@ -4,13 +4,11 @@ module RubyPitaya
4
4
  APP_TEMPLATE_FOLDER_PATH = File.join(__dir__, '../app-template/')
5
5
  MIGRATION_TEMPLATE_PATH = File.join(__dir__, 'templates/template_migration.rb.erb')
6
6
 
7
- DATABASE_CONFIG_PATH = File.join(Dir.pwd, 'config/database.yml')
8
-
9
7
  APP_FOLDER_PATH = File.join(Dir.pwd, 'app/')
10
8
  HANDLERS_FOLDER_PATH = File.join(Dir.pwd, 'app/handlers/')
11
9
  APP_CONFIG_FOLDER_PATH = File.join(Dir.pwd, 'app/config/')
12
10
  APP_SETUP_FOLDER_PATH = File.join(Dir.pwd, 'app/setup/')
13
- MIGRATIONS_FOLDER_PATH = File.join(Dir.pwd, 'db/migration/')
11
+ MIGRATIONS_FOLDER_PATH = File.join(Dir.pwd, 'app/migrations/')
14
12
  PLUGINS_FOLDER_PATH = File.join(Dir.pwd, 'plugins/')
15
13
 
16
14
  ROUTES_FILE_PATH = File.join(Dir.pwd, 'config/routes.rb')
@@ -20,7 +18,7 @@ module RubyPitaya
20
18
 
21
19
  class Core
22
20
  APP_FOLDER_PATH = File.join(__dir__, 'app/')
23
- MIGRATIONS_FOLDER_PATH = File.join(__dir__, 'db/migration/')
21
+ MIGRATIONS_FOLDER_PATH = File.join(__dir__, 'app/migrations/')
24
22
  end
25
23
 
26
24
  class Plugins
@@ -28,7 +26,7 @@ module RubyPitaya
28
26
  HANDLERS_FOLDER_PATHS = Dir.glob(File.join(Dir.pwd, 'plugins/*/app/handlers'))
29
27
  APP_CONFIG_FOLDER_PATHS = Dir.glob(File.join(Dir.pwd, 'plugins/*/app/config/'))
30
28
  APP_SETUP_FOLDER_PATHS = Dir.glob(File.join(Dir.pwd, 'plugins/*/app/setup/'))
31
- MIGRATIONS_FOLDER_PATHS = Dir.glob(File.join(Dir.pwd, 'plugins/*/db/migration'))
29
+ MIGRATIONS_FOLDER_PATHS = Dir.glob(File.join(Dir.pwd, 'plugins/*/app/migrations/'))
32
30
  HTTP_VIEWS_PATHS = Dir.glob(File.join(Dir.pwd, 'plugins/*/app/http/views'))
33
31
  end
34
32
  end
@@ -1,9 +1,12 @@
1
+ require 'rubypitaya/core/path'
2
+
1
3
  module RubyPitaya
2
4
 
3
5
  class Setup
4
6
 
5
7
  def initialize()
6
8
  @config = {}
9
+ @empty_hash = {}
7
10
  configs_folder_paths = Path::Plugins::APP_SETUP_FOLDER_PATHS + [Path::APP_SETUP_FOLDER_PATH]
8
11
 
9
12
  configs_folder_paths.each do |configs_folder_path|
@@ -24,6 +27,13 @@ module RubyPitaya
24
27
  @config.dig(*split_key)
25
28
  end
26
29
 
30
+ def fetch(*args)
31
+ result = self[args[0]]
32
+ return result unless result.nil?
33
+
34
+ @empty_hash.fetch(*args)
35
+ end
36
+
27
37
  def auto_reload
28
38
  require 'listen'
29
39
 
@@ -1,3 +1,4 @@
1
+ require 'rubypitaya/core/setup'
1
2
  require 'rubypitaya/core/handler_router'
2
3
  require 'rubypitaya/core/redis_connector'
3
4
  require 'rubypitaya/core/spec-helpers/setup_spec_helper'
@@ -21,6 +22,7 @@ module RubyPitaya
21
22
  @@response = {}
22
23
 
23
24
  initialize_redis
25
+ initialize_mongo
24
26
 
25
27
  @@handler_router ||= HandlerRouter.new()
26
28
 
@@ -28,6 +30,7 @@ module RubyPitaya
28
30
  @@initializer_content = InitializerContent.new(@@bll,
29
31
  @@log,
30
32
  @@redis_connector.redis,
33
+ @@mongo_connector.mongo,
31
34
  @@setup,
32
35
  @@config)
33
36
  @@initializer_broadcast = InitializerBroadcast.new
@@ -39,7 +42,8 @@ module RubyPitaya
39
42
 
40
43
  @@response = @@handler_router.call(handler_name, action_name, @@session,
41
44
  @@postman, @@redis_connector.redis,
42
- @@setup, @@config, @@bll, @@log, params)
45
+ @@mongo_connector.mongo, @@setup,
46
+ @@config, @@bll, @@log, params)
43
47
  end
44
48
 
45
49
  def response
@@ -96,12 +100,30 @@ module RubyPitaya
96
100
  @@redis_connector ||= nil
97
101
 
98
102
  if @@redis_connector.nil?
99
- redis_address = ENV['REDIS_URL']
103
+ @@core_setup ||= Setup.new
104
+ redis_address = @@core_setup['rubypitaya.redis.url']
100
105
  @@redis_connector = RedisConnector.new(redis_address)
101
106
  @@redis_connector.connect
102
107
  end
103
108
 
104
109
  @@redis_connector.redis.flushall
105
110
  end
111
+
112
+ def initialize_mongo
113
+ @@mongo_connector ||= nil
114
+
115
+ if @@mongo_connector.nil?
116
+ @@core_setup ||= Setup.new
117
+ mongo_address = @@core_setup['rubypitaya.mongo.url']
118
+ mongo_user = @@core_setup['rubypitaya.mongo.user']
119
+ mongo_password = @@core_setup['rubypitaya.mongo.pass']
120
+ mongo_database_name = @@core_setup['rubypitaya.mongo.database']
121
+ @@mongo_connector = MongoConnector.new(mongo_address, mongo_user,
122
+ mongo_password, mongo_database_name)
123
+ @@mongo_connector.connect
124
+ end
125
+
126
+ @@mongo_connector.mongo.collections.map(&:drop)
127
+ end
106
128
  end
107
129
  end
@@ -1,3 +1,3 @@
1
1
  module RubyPitaya
2
- VERSION = '2.19.1'
2
+ VERSION = '2.23.0'
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.19.1
4
+ version: 2.23.0
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: 2021-04-21 00:00:00.000000000 Z
11
+ date: 2021-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
54
  version: 0.11.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: mongo
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '='
60
+ - !ruby/object:Gem::Version
61
+ version: 2.15.0
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '='
67
+ - !ruby/object:Gem::Version
68
+ version: 2.15.0
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: redis
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -244,13 +258,12 @@ files:
244
258
  - "./lib/rubypitaya/app-template/app/handlers/player_handler.rb"
245
259
  - "./lib/rubypitaya/app-template/app/http/hello_world_http.rb"
246
260
  - "./lib/rubypitaya/app-template/app/http/views/hello_world.erb"
261
+ - "./lib/rubypitaya/app-template/app/migrations/1606736477_create_player_migration.rb"
247
262
  - "./lib/rubypitaya/app-template/app/models/player.rb"
248
263
  - "./lib/rubypitaya/app-template/app/models/user.rb"
249
- - "./lib/rubypitaya/app-template/app/setup/initial_player.yml"
264
+ - "./lib/rubypitaya/app-template/app/setup/rubypitaya.yml"
250
265
  - "./lib/rubypitaya/app-template/bin/console"
251
- - "./lib/rubypitaya/app-template/config/database.yml"
252
266
  - "./lib/rubypitaya/app-template/config/routes.rb"
253
- - "./lib/rubypitaya/app-template/db/migration/1606736477_create_player_migration.rb"
254
267
  - "./lib/rubypitaya/app-template/docker-compose.yml"
255
268
  - "./lib/rubypitaya/app-template/docker/dev/Dockerfile"
256
269
  - "./lib/rubypitaya/app-template/docker/entrypoint.sh"
@@ -303,13 +316,13 @@ files:
303
316
  - "./lib/rubypitaya/app-template/spec/hello_world_handler_spec.rb"
304
317
  - "./lib/rubypitaya/app-template/spec/player_handler_spec.rb"
305
318
  - "./lib/rubypitaya/app-template/spec/spec_helper.rb"
319
+ - "./lib/rubypitaya/core/app/migrations/0000000001_create_user_migration.rb"
306
320
  - "./lib/rubypitaya/core/app/models/user.rb"
307
321
  - "./lib/rubypitaya/core/application_files_importer.rb"
308
322
  - "./lib/rubypitaya/core/config.rb"
309
323
  - "./lib/rubypitaya/core/config_core.rb"
310
324
  - "./lib/rubypitaya/core/database_config.rb"
311
325
  - "./lib/rubypitaya/core/database_connector.rb"
312
- - "./lib/rubypitaya/core/db/migration/0000000001_create_user_migration.rb"
313
326
  - "./lib/rubypitaya/core/etcd_connector.rb"
314
327
  - "./lib/rubypitaya/core/handler_base.rb"
315
328
  - "./lib/rubypitaya/core/handler_router.rb"
@@ -320,6 +333,7 @@ files:
320
333
  - "./lib/rubypitaya/core/initializer_content.rb"
321
334
  - "./lib/rubypitaya/core/instance_holder.rb"
322
335
  - "./lib/rubypitaya/core/main.rb"
336
+ - "./lib/rubypitaya/core/mongo_connector.rb"
323
337
  - "./lib/rubypitaya/core/nats_connector.rb"
324
338
  - "./lib/rubypitaya/core/parameters.rb"
325
339
  - "./lib/rubypitaya/core/path.rb"
@@ -1,2 +0,0 @@
1
- wallet:
2
- gold: 10
@@ -1,20 +0,0 @@
1
- default: &default
2
- adapter: postgresql
3
- encoding: unicode
4
- pool: <%= ENV['RUBYPITAYA_MAX_THREADS'] { 5 } %>
5
- host: <%= ENV['DATABASE_HOST'] %>
6
- user: <%= ENV['DATABASE_USER'] %>
7
- password: <%= ENV['DATABASE_PASSWORD'] %>
8
-
9
- development:
10
- <<: *default
11
- database: <%= "#{ENV['DATABASE_NAME']}" %>
12
-
13
- test:
14
- <<: *default
15
- database: <%= "#{ENV['DATABASE_NAME']}_test" %>
16
-
17
- production:
18
- <<: *default
19
- database: <%= "#{ENV['DATABASE_NAME']}" %>
20
-