rubypitaya 2.7.5 → 2.8.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 78c0e17a12d24e8681424de7febeb3c496362c9efb6ddba566e2cb5a94a8e076
4
- data.tar.gz: c01c5cdc3bd4adf77d1fae5479418d1f09f693e157b1bb28bc458260841198ee
3
+ metadata.gz: 29b7ecc7e113e398e9295133b97a79f04af607848ba185db0005027af86b70c9
4
+ data.tar.gz: 6ae5d8f4b78041e30bf8d362f443ce18a22bdc3fd1f909afb037622b9b4201b1
5
5
  SHA512:
6
- metadata.gz: 2e54976ad166dfef5c686cbd75cabb7c15e2dbb991aa7946b43a120213e26d1fa46b414212d9c1d18a970b17a6689ac89c38c8bedc075670d0ed4ea9a1050253
7
- data.tar.gz: d510fcd44c66d24be9b7f07de8184f8fbff14d24308abd7955f9d156a2d056bc7417b47cf9c50da0ad9b17e307f7471949b50883b542118a029376c6f35f36f2
6
+ metadata.gz: 0a4209c6106cca1ecd8f88cb7dc6db0615c4bb3e1455d5b4319a986cb76c96a9359edd2f1189292724e64b2f8e4b38f5156854f2ba42476fa1fda9d4ae68c1b1
7
+ data.tar.gz: 4fee00de34828c2810b64f4af518987c48963e5a9b48dd2e25b46accd31413b852e5f41ebcd55f989c467a342212c3f9888c07114147fee98371e18772497986
@@ -1,6 +1,6 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- gem 'rubypitaya', '2.7.5'
3
+ gem 'rubypitaya', '2.8.0'
4
4
 
5
5
  group :development do
6
6
  gem 'pry', '0.12.2'
@@ -69,7 +69,7 @@ GEM
69
69
  rspec-support (~> 3.8.0)
70
70
  rspec-support (3.8.3)
71
71
  ruby2_keywords (0.0.2)
72
- rubypitaya (2.7.5)
72
+ rubypitaya (2.8.0)
73
73
  activerecord (= 6.0.2)
74
74
  etcdv3 (= 0.10.2)
75
75
  eventmachine (= 1.2.7)
@@ -106,7 +106,7 @@ DEPENDENCIES
106
106
  listen (= 3.2.1)
107
107
  pry (= 0.12.2)
108
108
  rspec (= 3.8.0)
109
- rubypitaya (= 2.7.5)
109
+ rubypitaya (= 2.8.0)
110
110
 
111
111
  BUNDLED WITH
112
112
  1.17.2
@@ -2,6 +2,7 @@ IMAGE_TAG ?= latest
2
2
  IMAGE_REGISTRY ?= [put-your-registry-here]
3
3
  KUBE_NAMESPACE ?= [put-your-namespace-here]
4
4
  KUBE_DEPLOYMENT_SERVER ?= rubypitaya
5
+ KUBECONTEXT ?= ''
5
6
 
6
7
  ## Run ruby pitaya metagame project
7
8
  run:
@@ -35,6 +36,10 @@ db-create:
35
36
  db-migrate:
36
37
  @docker-compose run --service-ports --rm rubypitaya bundle exec rake db:migrate
37
38
 
39
+ ## Show migrations status on database
40
+ db-migrate-status:
41
+ @docker-compose run --service-ports --rm rubypitaya bundle exec rake db:status
42
+
38
43
  ## Rollback migrations STEP=1
39
44
  db-rollback:
40
45
  @docker-compose run --service-ports --rm -e STEP="$(STEP)" rubypitaya bundle exec rake db:rollback
@@ -75,6 +75,25 @@ namespace :db do
75
75
  puts 'Database deleted.'
76
76
  end
77
77
 
78
+ desc 'migration status'
79
+ task :status do
80
+ environment_name = ENV.fetch("RUBYPITAYA_ENV") { 'development' }
81
+ database_config = RubyPitaya::DatabaseConfig.new(environment_name, RubyPitaya::Path::DATABASE_CONFIG_PATH)
82
+ connection_data = database_config.connection_data
83
+ migrations_paths = [RubyPitaya::Path::Core::MIGRATIONS_FOLDER_PATH]
84
+ migrations_paths += RubyPitaya::Path::Plugins::MIGRATIONS_FOLDER_PATHS
85
+ migrations_paths += [RubyPitaya::Path::MIGRATIONS_FOLDER_PATH]
86
+
87
+ ActiveRecord::Base.establish_connection(connection_data)
88
+ ActiveRecord::Migrator.migrations_paths = migrations_paths
89
+ ActiveRecord::Base.connection.migration_context.migrations_status.each do |status, version, name|
90
+ puts "#{status.center(8)} #{version.ljust(14)} #{name}"
91
+ end
92
+ ActiveRecord::Base.connection.close
93
+
94
+ puts 'Rollback done.'
95
+ end
96
+
78
97
  desc 'Reset the database'
79
98
  task :reset do
80
99
  Rake::Task['db:drop'].invoke
@@ -34,7 +34,6 @@ module MyApp
34
34
  # - info
35
35
  # - log information
36
36
 
37
-
38
37
  def run(initializer_content)
39
38
  bll = initializer_content.bll
40
39
 
@@ -42,5 +41,9 @@ module MyApp
42
41
 
43
42
  bll.add_instance(:player, playerBll)
44
43
  end
44
+
45
+ def self.path
46
+ __FILE__
47
+ end
45
48
  end
46
49
  end
@@ -18,10 +18,14 @@ Gem.find_files('rubypitaya/**/*.rb').each do |path|
18
18
  path.include?('app-template')
19
19
  end
20
20
 
21
- app_files_path = File.join(RubyPitaya::Path::APP_FOLDER_PATH, '**/*.rb')
22
- Dir[app_files_path].each do |path|
23
- require path unless path.end_with?('spec.rb') ||
24
- path.include?('db/migration')
21
+ app_folder_paths = RubyPitaya::Path::Plugins::APP_FOLDER_PATHS + [RubyPitaya::Path::APP_FOLDER_PATH]
22
+ app_folder_paths.each do |app_folder_path|
23
+ app_files_path = File.join(app_folder_path, '**/*.rb')
24
+
25
+ Dir[app_files_path].each do |path|
26
+ require path unless path.end_with?('spec.rb') ||
27
+ path.include?('db/migration')
28
+ end
25
29
  end
26
30
 
27
31
  require 'irb'
@@ -16,7 +16,7 @@ spec:
16
16
  spec:
17
17
  containers:
18
18
  - name: rubypitaya
19
- image: git.topfreegames.com:4567/prestes/tech-prototype/rubypitaya:latest
19
+ image: registry.gitlab.com/lucianopc/ruby-pitaya:latest
20
20
  command: ["bundle", "exec", "rubypitaya", "run"]
21
21
  ports:
22
22
  - containerPort: 4567
@@ -45,4 +45,4 @@ spec:
45
45
  - name: DATABASE_NAME
46
46
  value: "ruby_pitaya"
47
47
  imagePullSecrets:
48
- - name: gitlab-registry
48
+ - name: gitlab-registry
@@ -2,6 +2,10 @@ module RubyPitaya
2
2
 
3
3
  class InitializerBase
4
4
 
5
+ def self.path
6
+ __FILE__
7
+ end
8
+
5
9
  def run(main)
6
10
  end
7
11
  end
@@ -6,7 +6,25 @@ module RubyPitaya
6
6
  class InitializerBroadcast
7
7
 
8
8
  def run(initializer_content)
9
+ app_classes = []
10
+ plugin_classes = []
11
+
9
12
  ObjectSpace.each_object(InitializerBase.singleton_class) do |klass|
13
+ is_plugin_class = klass.path.include?('plugins')
14
+
15
+ if is_plugin_class
16
+ plugin_classes << klass
17
+ else
18
+ app_classes << klass
19
+ end
20
+ end
21
+
22
+ plugin_classes.each do |klass|
23
+ instance = klass.new
24
+ instance.run(initializer_content)
25
+ end
26
+
27
+ app_classes.each do |klass|
10
28
  instance = klass.new
11
29
  instance.run(initializer_content)
12
30
  end
@@ -1,3 +1,3 @@
1
1
  module RubyPitaya
2
- VERSION = '2.7.5'
2
+ VERSION = '2.8.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.7.5
4
+ version: 2.8.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: 2020-12-02 00:00:00.000000000 Z
11
+ date: 2020-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg