rubypitaya 2.10.0 → 2.13.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 +4 -4
- data/lib/rubypitaya.rb +11 -0
- data/lib/rubypitaya/app-template/.gitlab-ci.yml +24 -0
- data/lib/rubypitaya/app-template/Gemfile +2 -1
- data/lib/rubypitaya/app-template/Gemfile.lock +18 -3
- data/lib/rubypitaya/app-template/Makefile +22 -14
- data/lib/rubypitaya/app-template/app/app_initializer.rb +39 -42
- data/lib/rubypitaya/app-template/app/bll/player_bll.rb +7 -10
- data/lib/rubypitaya/app-template/app/constants/status_codes.rb +19 -22
- data/lib/rubypitaya/app-template/app/handlers/hello_world_handler.rb +9 -12
- data/lib/rubypitaya/app-template/app/handlers/player_handler.rb +65 -68
- data/lib/rubypitaya/app-template/app/models/player.rb +9 -12
- data/lib/rubypitaya/app-template/bin/console +2 -1
- data/lib/rubypitaya/app-template/config/routes.rb +1 -1
- data/lib/rubypitaya/app-template/docker-compose.yml +6 -0
- data/lib/rubypitaya/app-template/features/hello_world.feature +8 -0
- data/lib/rubypitaya/app-template/features/player.feature +29 -0
- data/lib/rubypitaya/app-template/features/step_definitions/application_steps.rb +12 -0
- data/lib/rubypitaya/app-template/features/step_definitions/rubypitaya_steps.rb +47 -0
- data/lib/rubypitaya/app-template/features/support/env.rb +7 -0
- data/lib/rubypitaya/app-template/spec/hello_world_handler_spec.rb +10 -13
- data/lib/rubypitaya/app-template/spec/player_handler_spec.rb +31 -34
- data/lib/rubypitaya/app-template/spec/spec_helper.rb +102 -0
- data/lib/rubypitaya/core/handler_router.rb +2 -0
- data/lib/rubypitaya/core/helpers/setup_helper.rb +37 -0
- data/lib/rubypitaya/core/spec-helpers/config_spec_helper.rb +18 -2
- data/lib/rubypitaya/core/spec-helpers/handler_spec_helper.rb +8 -0
- data/lib/rubypitaya/core/spec-helpers/handler_spec_helper_class.rb +8 -0
- data/lib/rubypitaya/core/spec-helpers/rubypitaya_spec_helper.rb +2 -37
- data/lib/rubypitaya/core/spec-helpers/setup_spec_helper.rb +18 -1
- data/lib/rubypitaya/core/templates/template_migration.rb.erb +1 -1
- data/lib/rubypitaya/version.rb +1 -1
- metadata +25 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7cad906ad9159e4045b1ab90fd56ecb0985b6cc9e2478e8bfe63437967b223e4
|
4
|
+
data.tar.gz: a6d0684ac9693ad3336c7f45cac5acf6fdb79928abb0109d45538a168b004c21
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e5278e4d406a0a2fcfe6e5d29be2808c3f27a054d87e0b4fd5c3f6220ce3b454089b887954075f7f9109f24a3bdd127b90f8507e3851a0004767b84362cb0cf
|
7
|
+
data.tar.gz: da4c6fd074fa1c9a9e696bb192cb4c14a05649e107cfc652ce21c3e9205087017ac8d0ffbef8c119c6388ed89c9b290ac11b161e5c9d9992953025b10da589e7
|
data/lib/rubypitaya.rb
CHANGED
@@ -49,6 +49,17 @@ 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/')
|
53
|
+
plugin_migrations_files = Dir[File.join(plugin_migrations_path, '*')]
|
54
|
+
base_migration_timestamp = Time.now.utc.to_i
|
55
|
+
|
56
|
+
plugin_migrations_files.each_with_index do |migration_file, i|
|
57
|
+
migration_timestamp = base_migration_timestamp + i
|
58
|
+
new_file = migration_file.gsub(/^(.+\/migration\/)\d+(_.+)$/, "\\1#{migration_timestamp}\\2")
|
59
|
+
|
60
|
+
File.rename(migration_file, new_file)
|
61
|
+
end
|
62
|
+
|
52
63
|
plugin_name
|
53
64
|
end
|
54
65
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
stages:
|
2
|
+
- test
|
3
|
+
|
4
|
+
|
5
|
+
variables:
|
6
|
+
IMAGE_TAG: $CI_COMMIT_SHORT_SHA
|
7
|
+
|
8
|
+
METAGAME_FOLDER: ./
|
9
|
+
|
10
|
+
test-metagame:
|
11
|
+
stage: test
|
12
|
+
image: docker:latest
|
13
|
+
when: always
|
14
|
+
services:
|
15
|
+
- docker:dind
|
16
|
+
before_script:
|
17
|
+
- cd $METAGAME_FOLDER
|
18
|
+
- apk update && apk add make && apk add docker-compose
|
19
|
+
script:
|
20
|
+
- docker login -u "gitlab-ci-token" -p "$CI_JOB_TOKEN" $CI_REGISTRY
|
21
|
+
- make build
|
22
|
+
- make db-test-setup
|
23
|
+
- make test
|
24
|
+
|
@@ -12,20 +12,33 @@ GEM
|
|
12
12
|
minitest (~> 5.1)
|
13
13
|
tzinfo (~> 1.1)
|
14
14
|
zeitwerk (~> 2.2)
|
15
|
+
builder (3.2.4)
|
15
16
|
coderay (1.1.3)
|
16
17
|
concurrent-ruby (1.1.7)
|
18
|
+
cucumber (2.4.0)
|
19
|
+
builder (>= 2.1.2)
|
20
|
+
cucumber-core (~> 1.5.0)
|
21
|
+
cucumber-wire (~> 0.0.1)
|
22
|
+
diff-lcs (>= 1.1.3)
|
23
|
+
gherkin (~> 4.0)
|
24
|
+
multi_json (>= 1.7.5, < 2.0)
|
25
|
+
multi_test (>= 0.1.2)
|
26
|
+
cucumber-core (1.5.0)
|
27
|
+
gherkin (~> 4.0)
|
28
|
+
cucumber-wire (0.0.1)
|
17
29
|
diff-lcs (1.4.4)
|
18
30
|
etcdv3 (0.10.2)
|
19
31
|
grpc (~> 1.17)
|
20
32
|
eventmachine (1.2.7)
|
21
33
|
ffi (1.14.2)
|
34
|
+
gherkin (4.1.3)
|
22
35
|
google-protobuf (3.14.0)
|
23
36
|
googleapis-common-protos-types (1.0.5)
|
24
37
|
google-protobuf (~> 3.11)
|
25
38
|
grpc (1.34.0)
|
26
39
|
google-protobuf (~> 3.13)
|
27
40
|
googleapis-common-protos-types (~> 1.0)
|
28
|
-
i18n (1.8.
|
41
|
+
i18n (1.8.6)
|
29
42
|
concurrent-ruby (~> 1.0)
|
30
43
|
listen (3.2.1)
|
31
44
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
@@ -34,6 +47,7 @@ GEM
|
|
34
47
|
middleware (0.1.0)
|
35
48
|
minitest (5.14.2)
|
36
49
|
multi_json (1.15.0)
|
50
|
+
multi_test (0.1.2)
|
37
51
|
mustermann (1.1.1)
|
38
52
|
ruby2_keywords (~> 0.0.1)
|
39
53
|
nats (0.11.0)
|
@@ -70,7 +84,7 @@ GEM
|
|
70
84
|
rspec-support (~> 3.8.0)
|
71
85
|
rspec-support (3.8.3)
|
72
86
|
ruby2_keywords (0.0.2)
|
73
|
-
rubypitaya (2.
|
87
|
+
rubypitaya (2.13.0)
|
74
88
|
activerecord (= 6.0.2)
|
75
89
|
etcdv3 (= 0.10.2)
|
76
90
|
eventmachine (= 1.2.7)
|
@@ -105,10 +119,11 @@ PLATFORMS
|
|
105
119
|
|
106
120
|
DEPENDENCIES
|
107
121
|
bundler (= 1.17.2)
|
122
|
+
cucumber (= 2.4.0)
|
108
123
|
listen (= 3.2.1)
|
109
124
|
pry (= 0.12.2)
|
110
125
|
rspec (= 3.8.0)
|
111
|
-
rubypitaya (= 2.
|
126
|
+
rubypitaya (= 2.13.0)
|
112
127
|
|
113
128
|
BUNDLED WITH
|
114
129
|
1.17.2
|
@@ -21,15 +21,23 @@ console:
|
|
21
21
|
## Run bash on container
|
22
22
|
bash:
|
23
23
|
@docker-compose run --service-ports --rm rubypitaya bash
|
24
|
-
|
25
|
-
## Run tests
|
26
|
-
test:
|
27
|
-
@docker-compose run --service-ports --rm rubypitaya bundle exec rspec
|
28
|
-
|
29
24
|
## Kill all containers
|
30
25
|
kill:
|
31
26
|
@docker rm -f $$(docker-compose ps -aq)
|
32
27
|
|
28
|
+
## + Test Commands
|
29
|
+
|
30
|
+
## Run all tests
|
31
|
+
test: test-rspec test-cucumber
|
32
|
+
|
33
|
+
## Run rspec tests. FILE=spec.rb:10
|
34
|
+
test-rspec:
|
35
|
+
@docker-compose run --service-ports --rm rubypitaya bundle exec rspec $(FILE)
|
36
|
+
|
37
|
+
## Run cucumber tests. FILE=something.feature
|
38
|
+
test-cucumber:
|
39
|
+
@docker-compose run --service-ports --rm rubypitaya bundle exec cucumber $(FILE)
|
40
|
+
|
33
41
|
## Update gems dependencies on Gemfile.lock
|
34
42
|
update-dependencies:
|
35
43
|
@rm -f Gemfile.lock
|
@@ -39,41 +47,41 @@ update-dependencies:
|
|
39
47
|
|
40
48
|
## Create new migrgation. NAME=[migration-name]
|
41
49
|
create-migration:
|
42
|
-
@docker-compose run --service-ports --rm rubypitaya-
|
50
|
+
@docker-compose run --service-ports --rm rubypitaya-commands bundle exec rubypitaya create-migration $(NAME)
|
43
51
|
|
44
52
|
## Add or update a plugim. GIT=[plugin-git-link]
|
45
53
|
add-plugin:
|
46
|
-
@docker-compose run --service-ports --rm rubypitaya-
|
54
|
+
@docker-compose run --service-ports --rm rubypitaya-commands bundle exec rubypitaya add-plugin $(GIT)
|
47
55
|
|
48
56
|
## + Database Commands
|
49
57
|
|
50
58
|
## Create database
|
51
59
|
db-create:
|
52
|
-
@docker-compose run --service-ports --rm rubypitaya bundle exec rake db:create
|
60
|
+
@docker-compose run --service-ports --rm rubypitaya-commands bundle exec rake db:create
|
53
61
|
|
54
62
|
## Run migrations to database
|
55
63
|
db-migrate:
|
56
|
-
@docker-compose run --service-ports --rm rubypitaya bundle exec rake db:migrate
|
64
|
+
@docker-compose run --service-ports --rm rubypitaya-commands bundle exec rake db:migrate
|
57
65
|
|
58
66
|
## Show migrations status on database
|
59
67
|
db-migrate-status:
|
60
|
-
@docker-compose run --service-ports --rm rubypitaya bundle exec rake db:status
|
68
|
+
@docker-compose run --service-ports --rm rubypitaya-commands bundle exec rake db:status
|
61
69
|
|
62
70
|
## Rollback migrations STEP=1
|
63
71
|
db-rollback:
|
64
|
-
@docker-compose run --service-ports --rm -e STEP="$(STEP)" rubypitaya bundle exec rake db:rollback
|
72
|
+
@docker-compose run --service-ports --rm -e STEP="$(STEP)" rubypitaya-commands bundle exec rake db:rollback
|
65
73
|
|
66
74
|
## Drop database
|
67
75
|
db-drop:
|
68
|
-
@docker-compose run --service-ports --rm rubypitaya bundle exec rake db:drop
|
76
|
+
@docker-compose run --service-ports --rm rubypitaya-commands bundle exec rake db:drop
|
69
77
|
|
70
78
|
## Reset database
|
71
79
|
db-reset:
|
72
|
-
@docker-compose run --service-ports --rm rubypitaya bundle exec rake db:reset
|
80
|
+
@docker-compose run --service-ports --rm rubypitaya-commands bundle exec rake db:reset
|
73
81
|
|
74
82
|
## Setup test database
|
75
83
|
db-test-setup:
|
76
|
-
@docker-compose run --service-ports --rm rubypitaya bundle exec rake db:test:setup
|
84
|
+
@docker-compose run --service-ports --rm rubypitaya-commands bundle exec rake db:test:setup
|
77
85
|
|
78
86
|
## + Deployment commands
|
79
87
|
|
@@ -1,49 +1,46 @@
|
|
1
|
-
|
1
|
+
class AppInitializer < RubyPitaya::InitializerBase
|
2
2
|
|
3
|
-
|
3
|
+
# method: run
|
4
|
+
# parameter: initializer_content
|
5
|
+
# attributes:
|
6
|
+
# - bll
|
7
|
+
# - class: RubyPitaya::InstanceHolder
|
8
|
+
# - link: https://gitlab.com/LucianoPC/ruby-pitaya/-/blob/master/lib/rubypitaya/core/instance_holder.rb
|
9
|
+
# - methods:
|
10
|
+
# - add_instance(key, instance)
|
11
|
+
# - add any instance to any key
|
12
|
+
# - [](key)
|
13
|
+
# - get instance by key
|
14
|
+
# - redis
|
15
|
+
# - link: https://github.com/redis/redis-rb/
|
16
|
+
# - config
|
17
|
+
# - class: RubyPitaya::Config
|
18
|
+
# - link: https://gitlab.com/LucianoPC/ruby-pitaya/-/blob/master/lib/rubypitaya/core/config.rb
|
19
|
+
# - methods:
|
20
|
+
# - [](key)
|
21
|
+
# - get config file by config path
|
22
|
+
# - setup
|
23
|
+
# - class: RubyPitaya::Setup
|
24
|
+
# - link: https://gitlab.com/LucianoPC/ruby-pitaya/-/blob/master/lib/rubypitaya/core/setup.rb
|
25
|
+
# - methods:
|
26
|
+
# - [](key)
|
27
|
+
# - get config file by config path
|
28
|
+
# - log
|
29
|
+
# - class: Logger
|
30
|
+
# - link: https://ruby-doc.org/stdlib-2.6.4/libdoc/logger/rdoc/Logger.html
|
31
|
+
# - methods:
|
32
|
+
# - info
|
33
|
+
# - log information
|
4
34
|
|
5
|
-
|
6
|
-
|
7
|
-
# attributes:
|
8
|
-
# - bll
|
9
|
-
# - class: RubyPitaya::InstanceHolder
|
10
|
-
# - link: https://gitlab.com/LucianoPC/ruby-pitaya/-/blob/master/lib/rubypitaya/core/instance_holder.rb
|
11
|
-
# - methods:
|
12
|
-
# - add_instance(key, instance)
|
13
|
-
# - add any instance to any key
|
14
|
-
# - [](key)
|
15
|
-
# - get instance by key
|
16
|
-
# - redis
|
17
|
-
# - link: https://github.com/redis/redis-rb/
|
18
|
-
# - config
|
19
|
-
# - class: RubyPitaya::Config
|
20
|
-
# - link: https://gitlab.com/LucianoPC/ruby-pitaya/-/blob/master/lib/rubypitaya/core/config.rb
|
21
|
-
# - methods:
|
22
|
-
# - [](key)
|
23
|
-
# - get config file by config path
|
24
|
-
# - setup
|
25
|
-
# - class: RubyPitaya::Setup
|
26
|
-
# - link: https://gitlab.com/LucianoPC/ruby-pitaya/-/blob/master/lib/rubypitaya/core/setup.rb
|
27
|
-
# - methods:
|
28
|
-
# - [](key)
|
29
|
-
# - get config file by config path
|
30
|
-
# - log
|
31
|
-
# - class: Logger
|
32
|
-
# - link: https://ruby-doc.org/stdlib-2.6.4/libdoc/logger/rdoc/Logger.html
|
33
|
-
# - methods:
|
34
|
-
# - info
|
35
|
-
# - log information
|
35
|
+
def run(initializer_content)
|
36
|
+
bll = initializer_content.bll
|
36
37
|
|
37
|
-
|
38
|
-
bll = initializer_content.bll
|
38
|
+
playerBll = PlayerBLL.new
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
bll.add_instance(:player, playerBll)
|
43
|
-
end
|
40
|
+
bll.add_instance(:player, playerBll)
|
41
|
+
end
|
44
42
|
|
45
|
-
|
46
|
-
|
47
|
-
end
|
43
|
+
def self.path
|
44
|
+
__FILE__
|
48
45
|
end
|
49
46
|
end
|
@@ -1,14 +1,11 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
class PlayerBLL
|
1
|
+
class PlayerBLL
|
4
2
|
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
def create_new_player(setup, config)
|
4
|
+
name = config['initial_player']['name']
|
5
|
+
gold = setup['initial_player.wallet.gold']
|
8
6
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
end
|
7
|
+
player = Player.new(name: name, gold: gold, user: User.new)
|
8
|
+
player.save
|
9
|
+
player
|
13
10
|
end
|
14
11
|
end
|
@@ -1,25 +1,22 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
class StatusCodes
|
1
|
+
class StatusCodes
|
4
2
|
|
5
|
-
|
3
|
+
CODE_OK = RubyPitaya::StatusCodes::CODE_OK
|
6
4
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
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_FOUND = 'RP-001'
|
16
|
+
# RubyPitaya::StatusCodes::CODE_ACTION_NOT_FOUND = '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
|
+
################
|
25
22
|
end
|
@@ -1,16 +1,13 @@
|
|
1
|
-
|
1
|
+
class HelloWorldHandler < RubyPitaya::HandlerBase
|
2
2
|
|
3
|
-
|
3
|
+
non_authenticated_actions :sayHello
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
data: {
|
11
|
-
message: 'Hello!'
|
12
|
-
}
|
5
|
+
def sayHello
|
6
|
+
response = {
|
7
|
+
code: 'RP-200',
|
8
|
+
data: {
|
9
|
+
message: 'Hello!'
|
13
10
|
}
|
14
|
-
|
11
|
+
}
|
15
12
|
end
|
16
|
-
end
|
13
|
+
end
|
@@ -1,82 +1,79 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
class PlayerHandler < RubyPitaya::HandlerBase
|
1
|
+
class PlayerHandler < RubyPitaya::HandlerBase
|
4
2
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
3
|
+
# class: HandlerBase
|
4
|
+
# attributes:
|
5
|
+
# - @bll
|
6
|
+
# - class: InstanceHolder
|
7
|
+
# - methods:
|
8
|
+
# - [](key)
|
9
|
+
# - info: get bll by key
|
10
|
+
#
|
11
|
+
# - @redis
|
12
|
+
# - link: https://github.com/redis/redis-rb/
|
13
|
+
#
|
14
|
+
# - @config
|
15
|
+
# - info: Hash with config json files inside of 'app/config'
|
16
|
+
# - example:
|
17
|
+
# Given you have the following file "app/config/initial_player.json"
|
18
|
+
# And this json content is {'name': 'Guest'}
|
19
|
+
# And you can get the initial player name
|
20
|
+
# Then you can run the following code: @config['initial_player']['name']
|
21
|
+
#
|
22
|
+
# - @params
|
23
|
+
# - info: Special hash with the request parameters
|
24
|
+
# - link: https://api.rubyonrails.org/classes/ActionController/Parameters.html
|
25
|
+
#
|
26
|
+
# - @session
|
27
|
+
# - attributes:
|
28
|
+
# - id :: session id
|
29
|
+
# - uid :: user id
|
30
|
+
# - data :: session data
|
31
|
+
# - metadata :: session data
|
32
|
+
# - frontend_id :: connector server id
|
33
|
+
#
|
34
|
+
# - @postman
|
35
|
+
# - info: Send messages to server and clients
|
36
|
+
# - methods:
|
37
|
+
# - bind_session(session)
|
38
|
+
# - info:
|
39
|
+
# Send a session to connector, you can use to set the userId
|
40
|
+
# of the session, for example you can set an userId on
|
41
|
+
# @session, like `@session.uid = '123'`, and then you can
|
42
|
+
# bind this session with `@postman.bind_session(@session)`
|
45
43
|
|
46
|
-
|
44
|
+
non_authenticated_actions :authenticate
|
47
45
|
|
48
|
-
|
49
|
-
|
46
|
+
def authenticate
|
47
|
+
user_id = @params[:userId]
|
50
48
|
|
51
|
-
|
52
|
-
|
49
|
+
player = Player.find_by_user_id(user_id)
|
50
|
+
player = @bll[:player].create_new_player(@setup, @config) if player.nil?
|
53
51
|
|
54
|
-
|
52
|
+
@session.uid = player.user_id
|
55
53
|
|
56
|
-
|
54
|
+
bind_session_response = @postman.bind_session(@session)
|
57
55
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
}
|
63
|
-
end
|
64
|
-
|
65
|
-
response = {
|
66
|
-
code: StatusCodes::CODE_OK,
|
67
|
-
data: player.to_hash,
|
56
|
+
unless bind_session_response.dig(:error, :code).nil?
|
57
|
+
return response = {
|
58
|
+
code: RubyPitaya::StatusCodes::CODE_AUTHENTICATION_ERROR,
|
59
|
+
msg: 'Error to authenticate',
|
68
60
|
}
|
69
61
|
end
|
70
62
|
|
71
|
-
|
72
|
-
|
63
|
+
response = {
|
64
|
+
code: StatusCodes::CODE_OK,
|
65
|
+
data: player.to_hash,
|
66
|
+
}
|
67
|
+
end
|
73
68
|
|
74
|
-
|
69
|
+
def getInfo
|
70
|
+
user_id = @session.uid
|
75
71
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
72
|
+
player = Player.find_by_user_id(user_id)
|
73
|
+
|
74
|
+
response = {
|
75
|
+
code: StatusCodes::CODE_OK,
|
76
|
+
data: player.to_hash,
|
77
|
+
}
|
81
78
|
end
|
82
79
|
end
|
@@ -1,19 +1,16 @@
|
|
1
1
|
require 'active_record'
|
2
2
|
|
3
|
-
|
3
|
+
class Player < ActiveRecord::Base
|
4
4
|
|
5
|
-
|
5
|
+
belongs_to :user
|
6
6
|
|
7
|
-
|
7
|
+
validates_presence_of :name, :gold, :user
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
userId: user_id,
|
16
|
-
}
|
17
|
-
end
|
9
|
+
def to_hash
|
10
|
+
{
|
11
|
+
name: name,
|
12
|
+
gold: gold,
|
13
|
+
userId: user_id,
|
14
|
+
}
|
18
15
|
end
|
19
16
|
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
Feature: Hello World
|
2
|
+
|
3
|
+
As a developer I want to see the hello world messages
|
4
|
+
|
5
|
+
Scenario: Hello World message
|
6
|
+
Given client call route 'rubypitaya.helloWorldHandler.sayHello'
|
7
|
+
Then server should response 'code' as 'RP-200'
|
8
|
+
And server should response 'data.message' as 'Hello!'
|
@@ -0,0 +1,29 @@
|
|
1
|
+
Feature: Player
|
2
|
+
|
3
|
+
As a game player I want to have a player on database
|
4
|
+
|
5
|
+
Scenario: Create new player
|
6
|
+
Given setup key 'initial_player.wallet.gold' is '10'
|
7
|
+
And config key 'initial_player.name' is 'Guest'
|
8
|
+
When client call route 'rubypitaya.playerHandler.authenticate'
|
9
|
+
Then server should response 'code' as 'RP-200'
|
10
|
+
And server should response 'data.name' as 'Guest'
|
11
|
+
And server should response 'data.gold' as '10'
|
12
|
+
|
13
|
+
Scenario: Get player info
|
14
|
+
Given the following player:
|
15
|
+
| name | gold | user_id |
|
16
|
+
| Someone | 15 | 00000000-0000-0000-0000-000000000001 |
|
17
|
+
And the player 'Someone' is authenticated
|
18
|
+
When client call route 'rubypitaya.playerHandler.getInfo'
|
19
|
+
Then server should response the following json:
|
20
|
+
"""
|
21
|
+
{
|
22
|
+
'code': 'RP-200',
|
23
|
+
'data': {
|
24
|
+
'name': 'Someone',
|
25
|
+
'gold': 15,
|
26
|
+
'userId': '00000000-0000-0000-0000-000000000001'
|
27
|
+
}
|
28
|
+
}
|
29
|
+
"""
|
@@ -0,0 +1,12 @@
|
|
1
|
+
Given(/^[Tt]he [Pp]layer ["'](.+)["'] is authenticated$/) do |player_name|
|
2
|
+
player = Player.find_by_name(player_name)
|
3
|
+
@handler_helper.authenticate(player.user_id)
|
4
|
+
end
|
5
|
+
|
6
|
+
Given(/^[Tt]he following [Pp]layer[s]*[:]*$/) do |table|
|
7
|
+
player_hashes = table.hashes
|
8
|
+
player_hashes.each do |player_hash|
|
9
|
+
player_hash[:user] = User.new(id: player_hash[:user_id])
|
10
|
+
Player.create(player_hash)
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
Given(/^[Cc]lient call route ["'](.+)["']$/) do |route|
|
2
|
+
@handler_helper.request(route)
|
3
|
+
end
|
4
|
+
|
5
|
+
Given(/^[Ss]erver should response ["'](.+)["'] as ["'](.+)["']$/) do |response_key, expected_value|
|
6
|
+
response_value = @handler_helper.response.dig(*response_key.split('.').map(&:to_sym))
|
7
|
+
|
8
|
+
expect(response_value.to_s).to eq(expected_value)
|
9
|
+
end
|
10
|
+
|
11
|
+
Given(/^[Ss]erver should response the following json[:]*$/) do |expected_json|
|
12
|
+
expected_json = expected_json.delete("\n").delete(' ')
|
13
|
+
response_json = @handler_helper.response.to_json.gsub("\"", "'")
|
14
|
+
|
15
|
+
expect(response_json).to eq(expected_json)
|
16
|
+
end
|
17
|
+
|
18
|
+
Given(/^[Ss]etup key ["'](.+)["'] is ["'](.+)["']$/) do |key, value|
|
19
|
+
@handler_helper.add_setup(key, value)
|
20
|
+
end
|
21
|
+
|
22
|
+
Given(/^[Cc]onfig key ["'](.+)["'] is ["'](.+)["']$/) do |key, value|
|
23
|
+
@handler_helper.add_config(key, value)
|
24
|
+
end
|
25
|
+
|
26
|
+
Given(/^[Cc]onfig is the following json[:]*$/) do |config_json|
|
27
|
+
config = JSON.parse(config_json)
|
28
|
+
@handler_helper.set_config(config)
|
29
|
+
end
|
30
|
+
|
31
|
+
Given(/^[Pp]rint server response$/) do
|
32
|
+
puts "response: #{@handler_helper.response}"
|
33
|
+
end
|
34
|
+
|
35
|
+
Given(/^(?:[Nn]ow\s)?[Tt]oday is ["'](.+)["']$/) do |date_text|
|
36
|
+
time_now = date_text.to_time
|
37
|
+
|
38
|
+
Time.stub(:now).and_return(time_now)
|
39
|
+
end
|
40
|
+
|
41
|
+
Before do
|
42
|
+
ActiveRecord::Base.descendants.each { |c| c.delete_all unless c == ActiveRecord::SchemaMigration }
|
43
|
+
@handler_helper = RubyPitaya::HandlerSpecHelperClass.new('cucumber')
|
44
|
+
end
|
45
|
+
|
46
|
+
# After do
|
47
|
+
# end
|
@@ -1,19 +1,16 @@
|
|
1
|
-
require '
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
|
-
|
3
|
+
RSpec.describe 'HelloWorldHandler', type: :request do
|
4
|
+
context 'sayHello' do
|
5
|
+
it 'success' do
|
6
|
+
request("rubypitaya.helloWorldHandler.sayHello")
|
4
7
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
8
|
+
expected_response = {
|
9
|
+
code: 'RP-200',
|
10
|
+
data: { message: 'Hello!' }
|
11
|
+
}
|
9
12
|
|
10
|
-
|
11
|
-
code: 'RP-200',
|
12
|
-
data: { message: 'Hello!' }
|
13
|
-
}
|
14
|
-
|
15
|
-
expect(response).to eq(expected_response)
|
16
|
-
end
|
13
|
+
expect(response).to eq(expected_response)
|
17
14
|
end
|
18
15
|
end
|
19
16
|
end
|
@@ -1,50 +1,47 @@
|
|
1
|
-
require '
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
|
-
|
3
|
+
RSpec.describe 'PlayerHandler', type: :request do
|
4
|
+
context 'authenticate' do
|
5
|
+
it 'create_new_user' do
|
6
|
+
setup = {'initial_player' => {'wallet' => {'gold' => 10}}}
|
7
|
+
config = {'initial_player' => {'name' => 'Guest'}}
|
4
8
|
|
5
|
-
|
6
|
-
|
7
|
-
it 'create_new_user' do
|
8
|
-
setup = {'initial_player.wallet.gold' => 10}
|
9
|
-
config = {'initial_player' => {'name' => 'Guest'}}
|
9
|
+
set_setup(setup)
|
10
|
+
set_config(config)
|
10
11
|
|
11
|
-
|
12
|
-
|
12
|
+
params = {}
|
13
|
+
request("rubypitaya.playerHandler.authenticate", params)
|
13
14
|
|
14
|
-
|
15
|
-
request("rubypitaya.playerHandler.authenticate", params)
|
15
|
+
player = Player.last
|
16
16
|
|
17
|
-
|
17
|
+
expect(response[:code]).to eq('RP-200')
|
18
|
+
expect(response[:data][:name]).to eq('Guest')
|
19
|
+
expect(response[:data][:gold]).to eq(10)
|
18
20
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
expect(::User.count).to eq(1)
|
24
|
-
expect(::MyApp::Player.count).to eq(1)
|
25
|
-
expect(player.name).to eq('Guest')
|
26
|
-
expect(player.gold).to eq(10)
|
27
|
-
end
|
21
|
+
expect(User.count).to eq(1)
|
22
|
+
expect(Player.count).to eq(1)
|
23
|
+
expect(player.name).to eq('Guest')
|
24
|
+
expect(player.gold).to eq(10)
|
28
25
|
end
|
26
|
+
end
|
29
27
|
|
30
|
-
|
31
|
-
|
32
|
-
|
28
|
+
context 'getInfo' do
|
29
|
+
it 'success' do
|
30
|
+
player = Player.create(name: 'Someone', gold: 12, user: User.new)
|
33
31
|
|
34
|
-
|
32
|
+
authenticate(player.user_id)
|
35
33
|
|
36
|
-
|
34
|
+
request("rubypitaya.playerHandler.getInfo")
|
37
35
|
|
38
|
-
|
39
|
-
|
40
|
-
|
36
|
+
expect(response[:code]).to eq('RP-200')
|
37
|
+
expect(response[:data]).to eq(player.to_hash)
|
38
|
+
end
|
41
39
|
|
42
|
-
|
43
|
-
|
40
|
+
it 'error_not_authenticated' do
|
41
|
+
request("rubypitaya.playerHandler.getInfo")
|
44
42
|
|
45
|
-
|
46
|
-
|
47
|
-
end
|
43
|
+
expect(response[:code]).to eq(RubyPitaya::StatusCodes::CODE_NOT_AUTHENTICATED)
|
44
|
+
expect(response[:msg]).to eq('Not authenticated')
|
48
45
|
end
|
49
46
|
end
|
50
47
|
end
|
@@ -0,0 +1,102 @@
|
|
1
|
+
require 'rubypitaya/core/spec-helpers/rubypitaya_spec_helper'
|
2
|
+
|
3
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
4
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
5
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
6
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
7
|
+
# files.
|
8
|
+
#
|
9
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
10
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
11
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
12
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
13
|
+
# a separate helper file that requires the additional dependencies and performs
|
14
|
+
# the additional setup, and require it from the spec files that actually need
|
15
|
+
# it.
|
16
|
+
#
|
17
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
18
|
+
RSpec.configure do |config|
|
19
|
+
# rspec-expectations config goes here. You can use an alternate
|
20
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
21
|
+
# assertions if you prefer.
|
22
|
+
config.expect_with :rspec do |expectations|
|
23
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
24
|
+
# and `failure_message` of custom matchers include text for helper methods
|
25
|
+
# defined using `chain`, e.g.:
|
26
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
27
|
+
# # => "be bigger than 2 and smaller than 4"
|
28
|
+
# ...rather than:
|
29
|
+
# # => "be bigger than 2"
|
30
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
31
|
+
end
|
32
|
+
|
33
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
34
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
35
|
+
config.mock_with :rspec do |mocks|
|
36
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
37
|
+
# a real object. This is generally recommended, and will default to
|
38
|
+
# `true` in RSpec 4.
|
39
|
+
mocks.verify_partial_doubles = true
|
40
|
+
end
|
41
|
+
|
42
|
+
# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
|
43
|
+
# have no way to turn it off -- the option exists only for backwards
|
44
|
+
# compatibility in RSpec 3). It causes shared context metadata to be
|
45
|
+
# inherited by the metadata hash of host groups and examples, rather than
|
46
|
+
# triggering implicit auto-inclusion in groups with matching metadata.
|
47
|
+
config.shared_context_metadata_behavior = :apply_to_host_groups
|
48
|
+
|
49
|
+
# The settings below are suggested to provide a good initial experience
|
50
|
+
# with RSpec, but feel free to customize to your heart's content.
|
51
|
+
=begin
|
52
|
+
# This allows you to limit a spec run to individual examples or groups
|
53
|
+
# you care about by tagging them with `:focus` metadata. When nothing
|
54
|
+
# is tagged with `:focus`, all examples get run. RSpec also provides
|
55
|
+
# aliases for `it`, `describe`, and `context` that include `:focus`
|
56
|
+
# metadata: `fit`, `fdescribe` and `fcontext`, respectively.
|
57
|
+
config.filter_run_when_matching :focus
|
58
|
+
|
59
|
+
# Allows RSpec to persist some state between runs in order to support
|
60
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
61
|
+
# you configure your source control system to ignore this file.
|
62
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
63
|
+
|
64
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
65
|
+
# recommended. For more details, see:
|
66
|
+
# - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
|
67
|
+
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
68
|
+
# - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
|
69
|
+
config.disable_monkey_patching!
|
70
|
+
|
71
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
72
|
+
# be too noisy due to issues in dependencies.
|
73
|
+
config.warnings = true
|
74
|
+
|
75
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
76
|
+
# file, and it's useful to allow more verbose output when running an
|
77
|
+
# individual spec file.
|
78
|
+
if config.files_to_run.one?
|
79
|
+
# Use the documentation formatter for detailed output,
|
80
|
+
# unless a formatter has already been configured
|
81
|
+
# (e.g. via a command-line flag).
|
82
|
+
config.default_formatter = "doc"
|
83
|
+
end
|
84
|
+
|
85
|
+
# Print the 10 slowest examples and example groups at the
|
86
|
+
# end of the spec run, to help surface which specs are running
|
87
|
+
# particularly slow.
|
88
|
+
config.profile_examples = 10
|
89
|
+
|
90
|
+
# Run specs in random order to surface order dependencies. If you find an
|
91
|
+
# order dependency and want to debug it, you can fix the order by providing
|
92
|
+
# the seed, which is printed after each run.
|
93
|
+
# --seed 1234
|
94
|
+
config.order = :random
|
95
|
+
|
96
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
97
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
98
|
+
# test failures related to randomization by passing the same `--seed` value
|
99
|
+
# as the one that triggered the failure.
|
100
|
+
Kernel.srand config.seed
|
101
|
+
=end
|
102
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'active_record'
|
2
|
+
|
3
|
+
require 'rubypitaya/core/database_config'
|
4
|
+
|
5
|
+
# Database connection
|
6
|
+
environment_name = ENV.fetch("RUBYPITAYA_ENV") { 'development' }
|
7
|
+
database_config = RubyPitaya::DatabaseConfig.new(environment_name, RubyPitaya::Path::DATABASE_CONFIG_PATH)
|
8
|
+
ActiveRecord::Base.establish_connection(database_config.connection_data)
|
9
|
+
# ActiveRecord::Base.logger = ActiveSupport::Logger.new(STDOUT)
|
10
|
+
# ActiveSupport::LogSubscriber.colorize_logging = true
|
11
|
+
|
12
|
+
connection_data = database_config.connection_data
|
13
|
+
migrations_paths = [RubyPitaya::Path::Core::MIGRATIONS_FOLDER_PATH]
|
14
|
+
migrations_paths += RubyPitaya::Path::Plugins::MIGRATIONS_FOLDER_PATHS
|
15
|
+
migrations_paths += [RubyPitaya::Path::MIGRATIONS_FOLDER_PATH]
|
16
|
+
ActiveRecord::Migrator.migrations_paths = migrations_paths
|
17
|
+
ActiveRecord::Migration.maintain_test_schema!
|
18
|
+
|
19
|
+
# Loading core files
|
20
|
+
Gem.find_files('rubypitaya/**/*.rb').each do |path|
|
21
|
+
require path unless path.end_with?('spec.rb') ||
|
22
|
+
path.include?('db/migration') ||
|
23
|
+
path.include?('core/templates') ||
|
24
|
+
path.include?('core/spec-helpers') ||
|
25
|
+
path.include?('app-template')
|
26
|
+
end
|
27
|
+
|
28
|
+
# Loading application files
|
29
|
+
app_folder_paths = RubyPitaya::Path::Plugins::APP_FOLDER_PATHS + [RubyPitaya::Path::APP_FOLDER_PATH]
|
30
|
+
app_folder_paths.each do |app_folder_path|
|
31
|
+
app_files_path = File.join(app_folder_path, '**/*.rb')
|
32
|
+
|
33
|
+
Dir[app_files_path].each do |path|
|
34
|
+
require path unless path.end_with?('spec.rb') ||
|
35
|
+
path.include?('db/migration')
|
36
|
+
end
|
37
|
+
end
|
@@ -7,7 +7,8 @@ module RubyPitaya
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def [](key)
|
10
|
-
|
10
|
+
split_key = key.split('.')
|
11
|
+
@config_mock.dig(*split_key)
|
11
12
|
end
|
12
13
|
|
13
14
|
def auto_reload
|
@@ -18,7 +19,22 @@ module RubyPitaya
|
|
18
19
|
end
|
19
20
|
|
20
21
|
def config_core_override=(value)
|
21
|
-
|
22
|
+
end
|
23
|
+
|
24
|
+
def add(key, value)
|
25
|
+
keys = key.split('.')
|
26
|
+
add_hash = undig(*keys, value)
|
27
|
+
@config_mock = merge_recursively(@config_mock, add_hash)
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def undig(*keys, value)
|
33
|
+
keys.empty? ? value : { keys.first=>undig(*keys.drop(1), value) }
|
34
|
+
end
|
35
|
+
|
36
|
+
def merge_recursively(a, b)
|
37
|
+
a.merge(b) {|key, a_item, b_item| merge_recursively(a_item, b_item) }
|
22
38
|
end
|
23
39
|
end
|
24
40
|
end
|
@@ -1,44 +1,9 @@
|
|
1
1
|
require 'rspec'
|
2
|
-
require 'active_record'
|
3
|
-
|
4
|
-
require 'rubypitaya/core/database_config'
|
5
|
-
require 'rubypitaya/core/spec-helpers/handler_spec_helper'
|
6
2
|
|
7
3
|
ENV['RUBYPITAYA_ENV'] = 'test'
|
8
4
|
|
9
|
-
|
10
|
-
|
11
|
-
database_config = RubyPitaya::DatabaseConfig.new(environment_name, RubyPitaya::Path::DATABASE_CONFIG_PATH)
|
12
|
-
ActiveRecord::Base.establish_connection(database_config.connection_data)
|
13
|
-
# ActiveRecord::Base.logger = ActiveSupport::Logger.new(STDOUT)
|
14
|
-
# ActiveSupport::LogSubscriber.colorize_logging = true
|
15
|
-
|
16
|
-
connection_data = database_config.connection_data
|
17
|
-
migrations_paths = [RubyPitaya::Path::Core::MIGRATIONS_FOLDER_PATH]
|
18
|
-
migrations_paths += RubyPitaya::Path::Plugins::MIGRATIONS_FOLDER_PATHS
|
19
|
-
migrations_paths += [RubyPitaya::Path::MIGRATIONS_FOLDER_PATH]
|
20
|
-
ActiveRecord::Migrator.migrations_paths = migrations_paths
|
21
|
-
ActiveRecord::Migration.maintain_test_schema!
|
22
|
-
|
23
|
-
# Loading core files
|
24
|
-
Gem.find_files('rubypitaya/**/*.rb').each do |path|
|
25
|
-
require path unless path.end_with?('spec.rb') ||
|
26
|
-
path.include?('db/migration') ||
|
27
|
-
path.include?('core/templates') ||
|
28
|
-
path.include?('core/spec-helpers') ||
|
29
|
-
path.include?('app-template')
|
30
|
-
end
|
31
|
-
|
32
|
-
# Loading application files
|
33
|
-
app_folder_paths = RubyPitaya::Path::Plugins::APP_FOLDER_PATHS + [RubyPitaya::Path::APP_FOLDER_PATH]
|
34
|
-
app_folder_paths.each do |app_folder_path|
|
35
|
-
app_files_path = File.join(app_folder_path, '**/*.rb')
|
36
|
-
|
37
|
-
Dir[app_files_path].each do |path|
|
38
|
-
require path unless path.end_with?('spec.rb') ||
|
39
|
-
path.include?('db/migration')
|
40
|
-
end
|
41
|
-
end
|
5
|
+
require 'rubypitaya/core/helpers/setup_helper'
|
6
|
+
require 'rubypitaya/core/spec-helpers/handler_spec_helper'
|
42
7
|
|
43
8
|
RSpec.configure do |config|
|
44
9
|
config.include RubyPitaya::HandlerSpecHelper
|
@@ -7,7 +7,8 @@ module RubyPitaya
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def [](key)
|
10
|
-
|
10
|
+
split_key = key.split('.')
|
11
|
+
@setup_mock.dig(*split_key)
|
11
12
|
end
|
12
13
|
|
13
14
|
def auto_reload
|
@@ -16,5 +17,21 @@ module RubyPitaya
|
|
16
17
|
def setup_mock=(value)
|
17
18
|
@setup_mock = value
|
18
19
|
end
|
20
|
+
|
21
|
+
def add(key, value)
|
22
|
+
keys = key.split('.')
|
23
|
+
add_hash = undig(*keys, value)
|
24
|
+
@setup_mock = merge_recursively(@setup_mock, add_hash)
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def undig(*keys, value)
|
30
|
+
keys.empty? ? value : { keys.first=>undig(*keys.drop(1), value) }
|
31
|
+
end
|
32
|
+
|
33
|
+
def merge_recursively(a, b)
|
34
|
+
a.merge(b) {|key, a_item, b_item| merge_recursively(a_item, b_item) }
|
35
|
+
end
|
19
36
|
end
|
20
37
|
end
|
data/lib/rubypitaya/version.rb
CHANGED
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.
|
4
|
+
version: 2.13.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-01-
|
11
|
+
date: 2021-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|
@@ -220,6 +220,20 @@ dependencies:
|
|
220
220
|
- - '='
|
221
221
|
- !ruby/object:Gem::Version
|
222
222
|
version: 3.2.1
|
223
|
+
- !ruby/object:Gem::Dependency
|
224
|
+
name: cucumber
|
225
|
+
requirement: !ruby/object:Gem::Requirement
|
226
|
+
requirements:
|
227
|
+
- - '='
|
228
|
+
- !ruby/object:Gem::Version
|
229
|
+
version: 2.4.0
|
230
|
+
type: :development
|
231
|
+
prerelease: false
|
232
|
+
version_requirements: !ruby/object:Gem::Requirement
|
233
|
+
requirements:
|
234
|
+
- - '='
|
235
|
+
- !ruby/object:Gem::Version
|
236
|
+
version: 2.4.0
|
223
237
|
description: RubyPitaya is an application to create servers using the pitaya protocol.
|
224
238
|
email:
|
225
239
|
- lucianopcbr@gmail.com
|
@@ -230,6 +244,7 @@ extra_rdoc_files: []
|
|
230
244
|
files:
|
231
245
|
- "./lib/rubypitaya.rb"
|
232
246
|
- "./lib/rubypitaya/app-template/.gitignore"
|
247
|
+
- "./lib/rubypitaya/app-template/.gitlab-ci.yml"
|
233
248
|
- "./lib/rubypitaya/app-template/.irbrc"
|
234
249
|
- "./lib/rubypitaya/app-template/Gemfile"
|
235
250
|
- "./lib/rubypitaya/app-template/Gemfile.lock"
|
@@ -254,6 +269,11 @@ files:
|
|
254
269
|
- "./lib/rubypitaya/app-template/docker/dev/Dockerfile"
|
255
270
|
- "./lib/rubypitaya/app-template/docker/entrypoint.sh"
|
256
271
|
- "./lib/rubypitaya/app-template/docker/prod/Dockerfile"
|
272
|
+
- "./lib/rubypitaya/app-template/features/hello_world.feature"
|
273
|
+
- "./lib/rubypitaya/app-template/features/player.feature"
|
274
|
+
- "./lib/rubypitaya/app-template/features/step_definitions/application_steps.rb"
|
275
|
+
- "./lib/rubypitaya/app-template/features/step_definitions/rubypitaya_steps.rb"
|
276
|
+
- "./lib/rubypitaya/app-template/features/support/env.rb"
|
257
277
|
- "./lib/rubypitaya/app-template/kubernetes/README.md"
|
258
278
|
- "./lib/rubypitaya/app-template/kubernetes/deployment-connector.yaml"
|
259
279
|
- "./lib/rubypitaya/app-template/kubernetes/deployment-rubypitaya.yaml"
|
@@ -276,6 +296,7 @@ files:
|
|
276
296
|
- "./lib/rubypitaya/app-template/kubernetes/statefulset-redis.yaml"
|
277
297
|
- "./lib/rubypitaya/app-template/spec/hello_world_handler_spec.rb"
|
278
298
|
- "./lib/rubypitaya/app-template/spec/player_handler_spec.rb"
|
299
|
+
- "./lib/rubypitaya/app-template/spec/spec_helper.rb"
|
279
300
|
- "./lib/rubypitaya/core/app/models/user.rb"
|
280
301
|
- "./lib/rubypitaya/core/application_files_importer.rb"
|
281
302
|
- "./lib/rubypitaya/core/config.rb"
|
@@ -286,6 +307,7 @@ files:
|
|
286
307
|
- "./lib/rubypitaya/core/etcd_connector.rb"
|
287
308
|
- "./lib/rubypitaya/core/handler_base.rb"
|
288
309
|
- "./lib/rubypitaya/core/handler_router.rb"
|
310
|
+
- "./lib/rubypitaya/core/helpers/setup_helper.rb"
|
289
311
|
- "./lib/rubypitaya/core/http_routes.rb"
|
290
312
|
- "./lib/rubypitaya/core/initializer_base.rb"
|
291
313
|
- "./lib/rubypitaya/core/initializer_broadcast.rb"
|
@@ -302,6 +324,7 @@ files:
|
|
302
324
|
- "./lib/rubypitaya/core/setup.rb"
|
303
325
|
- "./lib/rubypitaya/core/spec-helpers/config_spec_helper.rb"
|
304
326
|
- "./lib/rubypitaya/core/spec-helpers/handler_spec_helper.rb"
|
327
|
+
- "./lib/rubypitaya/core/spec-helpers/handler_spec_helper_class.rb"
|
305
328
|
- "./lib/rubypitaya/core/spec-helpers/postman_spec_helper.rb"
|
306
329
|
- "./lib/rubypitaya/core/spec-helpers/rubypitaya_spec_helper.rb"
|
307
330
|
- "./lib/rubypitaya/core/spec-helpers/setup_spec_helper.rb"
|