rubypitaya 1.6.2 → 1.8.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2b3d4094709845f5536e4bcf58a3ff876cfb85121447f314324ddb7ae807c5d4
4
- data.tar.gz: c47979ed6c7f11a3a2ee47092da775961e423b9504aeb9bde3332f9d4df1352e
3
+ metadata.gz: f6af52a60b6ae4d3e721706cba8b7a888182d648f0e4eef7c91be38fc41e9c08
4
+ data.tar.gz: 7e224b942b81b4e5d3a759c08e468c643eca5b5a895cd08d233dc77741c9cbd7
5
5
  SHA512:
6
- metadata.gz: 28e1d0fcd1d9cf3d061390f0a476717a7e672b46530759f3aa68099b740c9da850ea18d255d69c3c25919c19c98cb8a1f36a7fa62e5c10ae4d16b22b19682fb5
7
- data.tar.gz: 755177ffdfc191e5f0d7c6adc6038ddf4fbd8656118003617883e6a46af98a491999783119b08f3d002c038e9e9c08a11e8e4283c80ab4a3f2da4b250d7729f6
6
+ metadata.gz: e897b6cac313dc5ba1bfbd81367b3d952cdca06245b1bf045c908ad23276aef4b6c570366e63014d0098ea1548d57d4e4ee7052209742f92c2511aa9b743fc84
7
+ data.tar.gz: 0ec9970b1fdaa694bf8523cb19462426fcf68594aa491415ee00ac6dca8ef5853159ba3d3a4f89409d579a345ae269f64d3de100198c6e2937dc2d99ff4c7a97
@@ -1,6 +1,6 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- gem 'rubypitaya', '1.6.2'
3
+ gem 'rubypitaya', '1.8.1'
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.6.2)
65
+ rubypitaya (1.8.1)
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.6.2)
88
+ rubypitaya (= 1.8.0)
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
@@ -12,7 +12,7 @@ services:
12
12
  - '2380:2380'
13
13
 
14
14
  redis:
15
- image: 'redis:3.2.5-alpine'
15
+ image: 'redis:6.0.5-alpine'
16
16
  ports:
17
17
  - '9001:6379'
18
18
 
@@ -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:
@@ -17,7 +17,7 @@ spec:
17
17
  spec:
18
18
  containers:
19
19
  - name: redis
20
- image: redis:3.2.5-alpine
20
+ image: redis:6.0.5-alpine
21
21
  ports:
22
22
  - containerPort: 6379
23
23
  name: redis
@@ -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.6.2"
2
+ VERSION = "1.8.1"
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.6.2
4
+ version: 1.8.1
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-20 00:00:00.000000000 Z
11
+ date: 2020-09-08 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