rubypitaya 3.7.0 → 3.9.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: 0d18288d711a487bc0b84dcd073c63ed0192ca0412fb99fcbc1e0305c587df97
4
- data.tar.gz: 1c5b6be9550df23b8d625806ae0b2a0f3a6b454e01a9ba32f27d890b5f169272
3
+ metadata.gz: ab294041796e0582cbaf00b126cd94640367f9efa9936951bb4d15e62189bc9d
4
+ data.tar.gz: 35717958fa3945457d8cf7cc1dd948d77c49fdbae65c1bef8b3ab314ae00e3f8
5
5
  SHA512:
6
- metadata.gz: 0326e18138b4eeae46b59d4d43df908446072b95838e724dcf9fd46125c937519bdf3781e177ba97c7e7db5d3aeabbc5a25675f0602d2aeaa4a640637bc1fc2e
7
- data.tar.gz: cfe3acbd44442ea99606bb6ba4e51b7103febecdad79551228a1bf2a2aaf5fda80b219d168fed4e8055eed6efc006aea0c0d582df6d0a15d6f7ab5e83769ee6c
6
+ metadata.gz: 575b508d8dee1160823a8694dfb4efa9ffc3f26a8d989e46519f6e26a14ed2a4ec7e75dbea0c13be84c33819f37a86beff67c28e48b6f302a1f80e2e1a9f91d2
7
+ data.tar.gz: df30b0b4f45cfbee21afca815a0c9b066324810475971e89022fe95a898f68b84a4dae8b868764ecc97986e88305bb0cb772324ff326c760229b5482d1ca4810
@@ -1,6 +1,6 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- gem 'rubypitaya', '3.7.0'
3
+ gem 'rubypitaya', '3.9.1'
4
4
 
5
5
  group :development do
6
6
  gem 'pry', '0.14.1'
@@ -99,7 +99,7 @@ GEM
99
99
  rspec-support (~> 3.11.0)
100
100
  rspec-support (3.11.0)
101
101
  ruby2_keywords (0.0.5)
102
- rubypitaya (3.7.0)
102
+ rubypitaya (3.9.1)
103
103
  activerecord (= 7.0.2)
104
104
  etcdv3 (= 0.11.5)
105
105
  google-protobuf (= 3.19.4)
@@ -138,7 +138,7 @@ DEPENDENCIES
138
138
  listen (= 3.7.1)
139
139
  pry (= 0.14.1)
140
140
  rspec (= 3.11.0)
141
- rubypitaya (= 3.7.0)
141
+ rubypitaya (= 3.9.1)
142
142
  sinatra-contrib (= 2.1.0)
143
143
 
144
144
  BUNDLED WITH
@@ -10,12 +10,17 @@ KUBECONTEXT ?= ''
10
10
  run:
11
11
  @docker-compose run --service-ports --rm rubypitaya bundle exec rubypitaya run
12
12
 
13
- ## Build project
13
+ ## Build project docker containers
14
14
  build:
15
15
  @docker-compose build
16
+ @docker-compose pull
16
17
  @echo "Copying vendor folder ..."
17
18
  @sh -c "FOLDER=$(notdir $(shell pwd)); CONTAINER="\$${FOLDER}_rubypitaya"; docker cp \$$(docker create \$${CONTAINER}):/app/rubypitaya/vendor ."
18
19
 
20
+ ## Setup project dependencies
21
+ setup: clear
22
+ @docker-compose run --service-ports --rm rubypitaya ./setup/development/main
23
+
19
24
  ## Run ruby irb console
20
25
  console:
21
26
  @docker-compose run --service-ports --rm rubypitaya-console bundle exec ruby ./bin/console
@@ -34,11 +39,15 @@ test: test-rspec test-cucumber
34
39
 
35
40
  ## Run rspec tests. FILE=spec.rb:10
36
41
  test-rspec:
37
- @docker-compose run --service-ports --rm rubypitaya bundle exec rspec $(FILE)
42
+ @docker-compose run --service-ports --rm -e RUBYPITAYA_SERVER_ENVIRONMENT="test" rubypitaya bundle exec rspec $(FILE)
38
43
 
39
44
  ## Run cucumber tests. FILE=something.feature
40
45
  test-cucumber:
41
- @docker-compose run --service-ports --rm rubypitaya bundle exec cucumber --publish-quiet $(FILE)
46
+ @docker-compose run --service-ports --rm -e RUBYPITAYA_SERVER_ENVIRONMENT="test" rubypitaya bundle exec cucumber --publish-quiet $(FILE)
47
+
48
+ ## Setup project dependencies for tests
49
+ setup-test: clear
50
+ @docker-compose run --service-ports --rm -e RUBYPITAYA_SERVER_ENVIRONMENT="test" rubypitaya ./setup/test/main
42
51
 
43
52
  ## Update gems dependencies on Gemfile.lock
44
53
  update-dependencies:
@@ -83,7 +92,7 @@ db-reset:
83
92
 
84
93
  ## Setup test database
85
94
  db-test-setup:
86
- @docker-compose run --service-ports --rm rubypitaya-commands bundle exec rake db:test:setup
95
+ @docker-compose run --service-ports --rm -e RUBYPITAYA_SERVER_ENVIRONMENT="test" rubypitaya-commands bundle exec rake db:test:setup
87
96
 
88
97
  ## + Deployment commands
89
98
 
@@ -1,6 +1,6 @@
1
1
  Given(/^[Tt]he [Pp]layer ["'](.+)["'] is authenticated$/) do |player_name|
2
2
  player = Player.find_by_name(player_name)
3
- @handler_helper.authenticate(player.user_id)
3
+ @app_helper.authenticate(player.user_id)
4
4
  end
5
5
 
6
6
  Given(/^[Tt]he following [Pp]layer[s]*[:]*$/) do |table|
@@ -1,47 +1,47 @@
1
1
  Given(/^[Cc]lient call route ["'](.+)["']$/) do |route|
2
- @handler_helper.request(route)
2
+ @app_helper.request(route)
3
3
  end
4
4
 
5
5
  Given(/^[Cc]lient call route ["'](.+)["'] with param[s]*[:]*$/) do |route, table|
6
6
  params = table.hashes.first.symbolize_keys
7
- @handler_helper.request(route, params)
7
+ @app_helper.request(route, params)
8
8
  end
9
9
 
10
10
  Given(/^[Cc]lient call route ["'](.+)["'] with json param[s]*[:]*$/) do |route, json|
11
11
  params = JSON.parse(json, symbolize_names: true)
12
- @handler_helper.request(route, params)
12
+ @app_helper.request(route, params)
13
13
  end
14
14
 
15
15
  Given(/^[Ss]erver should response ["'](.+)["'] as ["'](.+)["']$/) do |response_key, expected_value|
16
- response_value = @handler_helper.response.dig(*response_key.split('.').map(&:to_sym))
16
+ response_value = @app_helper.response.dig(*response_key.split('.').map(&:to_sym))
17
17
 
18
18
  expect(response_value.to_s).to eq(expected_value)
19
19
  end
20
20
 
21
21
  Given(/^[Ss]erver should response the following json[:]*$/) do |expected_json|
22
22
  expected_json = JSON.generate(JSON.parse(expected_json.strip))
23
- response_json = JSON.generate(@handler_helper.response)
23
+ response_json = JSON.generate(@app_helper.response)
24
24
 
25
- puts JSON.pretty_generate(@handler_helper.response) if expected_json != response_json
25
+ puts JSON.pretty_generate(@app_helper.response) if expected_json != response_json
26
26
 
27
27
  expect(response_json).to eq(expected_json)
28
28
  end
29
29
 
30
30
  Given(/^[Ss]etup key ["'](.+)["'] is ["'](.+)["']$/) do |key, value|
31
- @handler_helper.add_setup(key, value)
31
+ @app_helper.add_setup(key, value)
32
32
  end
33
33
 
34
34
  Given(/^[Cc]onfig key ["'](.+)["'] is ["'](.+)["']$/) do |key, value|
35
- @handler_helper.add_config(key, value)
35
+ @app_helper.add_config(key, value)
36
36
  end
37
37
 
38
38
  Given(/^[Cc]onfig is the following json[:]*$/) do |config_json|
39
39
  config = JSON.parse(config_json)
40
- @handler_helper.set_config(config)
40
+ @app_helper.set_config(config)
41
41
  end
42
42
 
43
43
  Given(/^[Pp]rint server response$/) do
44
- puts "response: #{@handler_helper.response}"
44
+ puts "response: #{@app_helper.response}"
45
45
  end
46
46
 
47
47
  Given(/^(?:[Nn]ow\s)?[Tt]oday is ["'](.+)["']$/) do |date_text|
@@ -51,7 +51,7 @@ Given(/^(?:[Nn]ow\s)?[Tt]oday is ["'](.+)["']$/) do |date_text|
51
51
  end
52
52
 
53
53
  Given(/^[Tt]he [Uu]ser ["'](.+)["'] is authenticated$/) do |user_id|
54
- @handler_helper.authenticate(user_id)
54
+ @app_helper.authenticate(user_id)
55
55
  end
56
56
 
57
57
  Given(/^[Tt]he following [Uu]ser[s]*[:]*$/) do |table|
@@ -62,8 +62,8 @@ end
62
62
 
63
63
  Before do
64
64
  ActiveRecord::Base.descendants.each { |c| c.delete_all unless c == ActiveRecord::SchemaMigration }
65
- RubyPitaya::HandlerSpecHelper.update_before_each
66
- @handler_helper = RubyPitaya::HandlerSpecHelperClass.new('cucumber')
65
+ RubyPitaya::AppSpecHelper.update_before_each
66
+ @app_helper = RubyPitaya::AppSpecHelperClass.new('cucumber')
67
67
  end
68
68
 
69
69
  # After do
@@ -2,12 +2,12 @@ require 'rspec'
2
2
  require 'cucumber/rspec/doubles'
3
3
 
4
4
  require 'rubypitaya/core/helpers/setup_helper'
5
- require 'rubypitaya/core/spec-helpers/handler_spec_helper_class'
5
+ require 'rubypitaya/core/spec-helpers/app_spec_helper_class'
6
6
 
7
7
  ENV['RUBYPITAYA_ENV'] = 'test'
8
8
 
9
- RubyPitaya::HandlerSpecHelper.initialize_before_suite
9
+ RubyPitaya::AppSpecHelper.initialize_before_suite
10
10
 
11
11
  at_exit do
12
- RubyPitaya::HandlerSpecHelper.finalize_after_suite
12
+ RubyPitaya::AppSpecHelper.finalize_after_suite
13
13
  end
@@ -0,0 +1,3 @@
1
+ #!/bin/bash
2
+
3
+ bundle exec rake db:reset
@@ -0,0 +1,4 @@
1
+ #!/bin/bash
2
+
3
+ echo "Setup database"
4
+ ./setup/development/database
@@ -0,0 +1,3 @@
1
+ #!/bin/bash
2
+
3
+ bundle exec rake db:test:setup
@@ -0,0 +1,4 @@
1
+ #!/bin/bash
2
+
3
+ echo "Setup database"
4
+ ./setup/test/database
@@ -7,7 +7,7 @@ require 'rubypitaya/core/spec-helpers/postman_spec_helper'
7
7
 
8
8
  module RubyPitaya
9
9
 
10
- module HandlerSpecHelper
10
+ module AppSpecHelper
11
11
 
12
12
  def self.initialize_before_suite
13
13
  default_setup = Setup.new.get_config
@@ -36,6 +36,7 @@ module RubyPitaya
36
36
  end
37
37
 
38
38
  def self.finalize_after_suite
39
+ clear_all_services_data
39
40
  disconnect_services
40
41
  end
41
42
 
@@ -0,0 +1,8 @@
1
+ require 'rubypitaya/core/spec-helpers/app_spec_helper'
2
+
3
+ module RubyPitaya
4
+
5
+ class AppSpecHelperClass
6
+ include AppSpecHelper
7
+ end
8
+ end
@@ -3,21 +3,21 @@ require 'rspec'
3
3
  ENV['RUBYPITAYA_ENV'] = 'test'
4
4
 
5
5
  require 'rubypitaya/core/helpers/setup_helper'
6
- require 'rubypitaya/core/spec-helpers/handler_spec_helper'
6
+ require 'rubypitaya/core/spec-helpers/app_spec_helper'
7
7
 
8
8
  RSpec.configure do |config|
9
- config.include RubyPitaya::HandlerSpecHelper
9
+ config.include RubyPitaya::AppSpecHelper
10
10
 
11
11
  config.before(:suite) do
12
- RubyPitaya::HandlerSpecHelper.initialize_before_suite
12
+ RubyPitaya::AppSpecHelper.initialize_before_suite
13
13
  end
14
14
 
15
15
  config.after(:suite) do
16
- RubyPitaya::HandlerSpecHelper.finalize_after_suite
16
+ RubyPitaya::AppSpecHelper.finalize_after_suite
17
17
  end
18
18
 
19
19
  config.before(:each) do
20
- RubyPitaya::HandlerSpecHelper.update_before_each
20
+ RubyPitaya::AppSpecHelper.update_before_each
21
21
  ActiveRecord::Base.descendants.each { |c| c.delete_all unless c == ActiveRecord::SchemaMigration }
22
22
  end
23
23
 
@@ -1,3 +1,3 @@
1
1
  module RubyPitaya
2
- VERSION = '3.7.0'
2
+ VERSION = '3.9.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubypitaya
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.0
4
+ version: 3.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luciano Prestes Cavalcanti
@@ -330,6 +330,10 @@ files:
330
330
  - "./lib/rubypitaya/app-template/kubernetes/statefulset-postgres.yaml"
331
331
  - "./lib/rubypitaya/app-template/kubernetes/statefulset-redis.yaml"
332
332
  - "./lib/rubypitaya/app-template/plugins.yaml"
333
+ - "./lib/rubypitaya/app-template/setup/development/database"
334
+ - "./lib/rubypitaya/app-template/setup/development/main"
335
+ - "./lib/rubypitaya/app-template/setup/test/database"
336
+ - "./lib/rubypitaya/app-template/setup/test/main"
333
337
  - "./lib/rubypitaya/app-template/spec/hello_world_handler_spec.rb"
334
338
  - "./lib/rubypitaya/app-template/spec/player_handler_spec.rb"
335
339
  - "./lib/rubypitaya/app-template/spec/redis_service_spec.rb"
@@ -366,9 +370,9 @@ files:
366
370
  - "./lib/rubypitaya/core/service_holder.rb"
367
371
  - "./lib/rubypitaya/core/session.rb"
368
372
  - "./lib/rubypitaya/core/setup.rb"
373
+ - "./lib/rubypitaya/core/spec-helpers/app_spec_helper.rb"
374
+ - "./lib/rubypitaya/core/spec-helpers/app_spec_helper_class.rb"
369
375
  - "./lib/rubypitaya/core/spec-helpers/config_spec_helper.rb"
370
- - "./lib/rubypitaya/core/spec-helpers/handler_spec_helper.rb"
371
- - "./lib/rubypitaya/core/spec-helpers/handler_spec_helper_class.rb"
372
376
  - "./lib/rubypitaya/core/spec-helpers/postman_spec_helper.rb"
373
377
  - "./lib/rubypitaya/core/spec-helpers/rubypitaya_spec_helper.rb"
374
378
  - "./lib/rubypitaya/core/spec-helpers/setup_spec_helper.rb"
@@ -1,8 +0,0 @@
1
- require 'rubypitaya/core/spec-helpers/handler_spec_helper'
2
-
3
- module RubyPitaya
4
-
5
- class HandlerSpecHelperClass
6
- include HandlerSpecHelper
7
- end
8
- end