rubypitaya 1.7.0 → 1.8.2

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: 9f720d0d81fffae4bb38fefce2c8048a948d5fb70b3b87f9b5c04cd0c167bfed
4
- data.tar.gz: 780f7133b9c2d5b48a287488b99c7acb6d24a9ef531711877e6c810b37528b21
3
+ metadata.gz: 98578f08422524b11b61a8501ece0db64a473dc3d421292dc4f96736c2b97227
4
+ data.tar.gz: ad35ec4d5ed83954a9fa0bca5c95d6fee579863b5826a63115c0f98b988bc4ea
5
5
  SHA512:
6
- metadata.gz: 1c824698bddeb7dacdc7097ffa3b7b1954c3276468b5dd7f28c727c209af0746b222101615da362bf3e5fb251f636a7d411ba1755694f52325a425f7522bb4df
7
- data.tar.gz: b38d3672dadf0f25ffae767e5e47ca025fa750b0f9820208216deaea5c9ea7d135696f3043ed384fbe52ae3903c932a60cc55aec4fc96e21b55926629de14a6d
6
+ metadata.gz: 18dc452f364538e9c9fd8c8fdd0b57b74c140fd7501fb6492f3bc954051803bb35e31c5f5f29a232438634eae9868aec710efc45133aeb3d3bd00203ed6d8223
7
+ data.tar.gz: 7dee2039fc3efa7db3a25b439edace0cbd60cf12d84f13e0170c946f6a3bca5105fe92d16ac22c6b8092b4412faa389d8e1cce7812bfbdf75956b0b0c0ca8eb0
@@ -1,6 +1,6 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- gem 'rubypitaya', '1.7.0'
3
+ gem 'rubypitaya', '1.8.2'
4
4
 
5
5
  group :development do
6
6
  gem 'pry', '0.12.2'
@@ -62,7 +62,7 @@ GEM
62
62
  diff-lcs (>= 1.2.0, < 2.0)
63
63
  rspec-support (~> 3.8.0)
64
64
  rspec-support (3.8.3)
65
- rubypitaya (1.7.0)
65
+ rubypitaya (1.8.2)
66
66
  activerecord (= 6.0.2)
67
67
  etcdv3 (= 0.10.2)
68
68
  eventmachine (= 1.2.7)
@@ -85,7 +85,7 @@ DEPENDENCIES
85
85
  pry (= 0.12.2)
86
86
  rake (= 10.0)
87
87
  rspec (= 3.8.0)
88
- rubypitaya (= 1.7.0)
88
+ rubypitaya (= 1.8.2)
89
89
 
90
90
  BUNDLED WITH
91
91
  1.17.2
@@ -30,6 +30,10 @@ db-create:
30
30
  db-migrate:
31
31
  @docker-compose run --service-ports --rm rubypitaya bundle exec rake db:migrate
32
32
 
33
+ ## Rollback migrations STEP=1
34
+ db-rollback:
35
+ @docker-compose run --service-ports --rm -e STEP="$(STEP)" rubypitaya bundle exec rake db:rollback
36
+
33
37
  ## Drop database
34
38
  db-drop:
35
39
  @docker-compose run --service-ports --rm rubypitaya bundle exec rake db:drop
@@ -33,6 +33,28 @@ namespace :db do
33
33
  puts 'Database migrated.'
34
34
  end
35
35
 
36
+ desc 'Rollback migrations'
37
+ task :rollback do
38
+ environment_name = ENV.fetch("RUBYPITAYA_ENV") { 'development' }
39
+ database_config = RubyPitaya::DatabaseConfig.new(environment_name, RubyPitaya::Path::DATABASE_CONFIG_PATH)
40
+ connection_data = database_config.connection_data
41
+
42
+ step = ENV["STEP"] ? ENV["STEP"].to_i : 1
43
+
44
+ if step == 0
45
+ puts ''
46
+ puts 'Error: No rollback to STEP=0'
47
+ puts ''
48
+ return
49
+ end
50
+
51
+ ActiveRecord::Base.establish_connection(connection_data)
52
+ ActiveRecord::Base.connection.migration_context.rollback(step)
53
+ ActiveRecord::Base.connection.close
54
+
55
+ puts 'Rollback done.'
56
+ end
57
+
36
58
  desc 'Drop the database'
37
59
  task :drop do
38
60
  environment_name = ENV.fetch("RUBYPITAYA_ENV") { 'development' }
@@ -1,15 +1,22 @@
1
1
  class StatusCodes
2
- # Success codes
3
- CODE_OK = 'RP-200'
4
2
 
5
- # Error codes
6
- CODE_UNKNOWN = 'RP-000'
7
- CODE_HANDLER_NOT_FOUNDED = 'RP-001'
8
- CODE_ACTION_NOT_FOUNDED = 'RP-002'
9
- CODE_NOT_AUTHENTICATED = 'RP-003'
10
- CODE_AUTHENTICATION_ERROR = 'RP-004'
3
+ CODE_OK = RubyPitaya::StatusCodes::CODE_OK
11
4
 
12
- class Connector
13
- CODE_UNKNOWN = 'PIT-000'
14
- end
5
+ ################
6
+ ## Existent Codes
7
+ ################
8
+ ## Success codes
9
+ #
10
+ # RubyPitaya::StatusCodes::CODE_OK = 'RP-200'
11
+ #
12
+ #
13
+ ## Error codes
14
+ # RubyPitaya::StatusCodes::CODE_UNKNOWN = 'RP-000'
15
+ # RubyPitaya::StatusCodes::CODE_HANDLER_NOT_FOUNDED = 'RP-001'
16
+ # RubyPitaya::StatusCodes::CODE_ACTION_NOT_FOUNDED = 'RP-002'
17
+ # RubyPitaya::StatusCodes::CODE_NOT_AUTHENTICATED = 'RP-003'
18
+ # RubyPitaya::StatusCodes::CODE_AUTHENTICATION_ERROR = 'RP-004'
19
+ #
20
+ # RubyPitaya::StatusCodes::Connector::CODE_UNKNOWN = 'PIT-000'
21
+ ################
15
22
  end
@@ -22,7 +22,7 @@ services:
22
22
  - 'postgres:/var/lib/postgresql/data'
23
23
  environment:
24
24
  POSTGRES_USER: 'postgres'
25
- POSTGRES_HOST_AUTH_METHOD: 'trust'
25
+ POSTGRES_PASSWORD: 'postgres'
26
26
  ports:
27
27
  - '9100:5432'
28
28
 
@@ -67,7 +67,7 @@ services:
67
67
  REDIS_URL: 'redis://redis:6379'
68
68
  DATABASE_HOST: 'db'
69
69
  DATABASE_USER: 'postgres'
70
- DATABASE_PASSWORD: ''
70
+ DATABASE_PASSWORD: 'postgres'
71
71
  DATABASE_NAME: 'ruby_pitaya'
72
72
 
73
73
  volumes:
@@ -41,7 +41,7 @@ spec:
41
41
  - name: DATABASE_USER
42
42
  value: "postgres"
43
43
  - name: DATABASE_PASSWORD
44
- value: ""
44
+ value: "postgres"
45
45
  - name: DATABASE_NAME
46
46
  value: "ruby_pitaya"
47
47
  imagePullSecrets:
@@ -19,8 +19,10 @@ spec:
19
19
  - name: postgres
20
20
  image: postgres:9.6.17
21
21
  env:
22
- - name: POSTGRES_HOST_AUTH_METHOD
23
- value: "trust"
22
+ - name: POSTGRES_USER
23
+ value: "postgres"
24
+ - name: POSTGRES_PASSWORD
25
+ value: "postgres"
24
26
  - name: PGDATA
25
27
  value: "/var/lib/postgresql/data/pgdata"
26
28
  ports:
@@ -75,7 +75,7 @@ module RubyPitaya
75
75
  if is_last_index
76
76
  config[key] = value
77
77
  else
78
- config[key] = {}
78
+ config[key] = {} unless config.key?(key)
79
79
  config = config[key]
80
80
  end
81
81
  end
@@ -25,6 +25,7 @@ module RubyPitaya
25
25
  'pool': config['pool'],
26
26
  'host': config['host'],
27
27
  'user': config['user'],
28
+ 'password': config['password'],
28
29
  'database': config['database'],
29
30
  }
30
31
  end
@@ -36,6 +37,7 @@ module RubyPitaya
36
37
  'pool': config['pool'],
37
38
  'host': config['host'],
38
39
  'user': config['user'],
40
+ 'password': config['password'],
39
41
  }
40
42
  end
41
43
 
@@ -8,6 +8,7 @@ require 'rubypitaya/core/session'
8
8
  require 'rubypitaya/core/postman'
9
9
  require 'rubypitaya/core/parameters'
10
10
  require 'rubypitaya/core/routes_base'
11
+ require 'rubypitaya/core/status_codes'
11
12
  require 'rubypitaya/core/handler_router'
12
13
  require 'rubypitaya/core/etcd_connector'
13
14
  require 'rubypitaya/core/nats_connector'
@@ -12,15 +12,14 @@ module RubyPitaya
12
12
  end
13
13
 
14
14
  def connect
15
- @redis = Redis.new(url: @redis_address)
15
+ @redis = Redis.new(
16
+ url: @redis_address,
17
+ :reconnect_attempts => 10,
18
+ :reconnect_delay => 1.5,
19
+ :reconnect_delay_max => 2.0,
20
+ )
16
21
 
17
- test_connection
18
- end
19
-
20
- def test_connection
21
- @redis.set('tmp', 'value')
22
- @redis.get('tmp')
23
- @redis.del('tmp')
22
+ @redis.ping
24
23
  end
25
24
  end
26
25
  end
@@ -0,0 +1,18 @@
1
+ module RubyPitaya
2
+
3
+ class StatusCodes
4
+ # Success codes
5
+ CODE_OK = 'RP-200'
6
+
7
+ # Error codes
8
+ CODE_UNKNOWN = 'RP-000'
9
+ CODE_HANDLER_NOT_FOUNDED = 'RP-001'
10
+ CODE_ACTION_NOT_FOUNDED = 'RP-002'
11
+ CODE_NOT_AUTHENTICATED = 'RP-003'
12
+ CODE_AUTHENTICATION_ERROR = 'RP-004'
13
+
14
+ class Connector
15
+ CODE_UNKNOWN = 'PIT-000'
16
+ end
17
+ end
18
+ end
@@ -1,3 +1,3 @@
1
1
  module RubyPitaya
2
- VERSION = "1.7.0"
2
+ VERSION = "1.8.2"
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: 1.7.0
4
+ version: 1.8.2
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-06-22 00:00:00.000000000 Z
11
+ date: 2020-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg
@@ -201,7 +201,6 @@ files:
201
201
  - "./lib/rubypitaya/app-template/app/handlers/player_handler.rb"
202
202
  - "./lib/rubypitaya/app-template/app/models/player.rb"
203
203
  - "./lib/rubypitaya/app-template/app/models/user.rb"
204
- - "./lib/rubypitaya/app-template/apptemplate-0.1.0.gem"
205
204
  - "./lib/rubypitaya/app-template/bin/console"
206
205
  - "./lib/rubypitaya/app-template/config/database.yml"
207
206
  - "./lib/rubypitaya/app-template/config/routes.rb"
@@ -245,6 +244,7 @@ files:
245
244
  - "./lib/rubypitaya/core/redis_connector.rb"
246
245
  - "./lib/rubypitaya/core/routes_base.rb"
247
246
  - "./lib/rubypitaya/core/session.rb"
247
+ - "./lib/rubypitaya/core/status_codes.rb"
248
248
  - "./lib/rubypitaya/version.rb"
249
249
  - bin/rubypitaya
250
250
  homepage: https://gitlab.com/LucianoPC/ruby-pitaya