rubypitaya 2.14.0 → 2.18.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/app-template/Gemfile +6 -6
- data/lib/rubypitaya/app-template/Gemfile.lock +93 -67
- data/lib/rubypitaya/app-template/Makefile +1 -1
- data/lib/rubypitaya/app-template/app/bll/player_bll.rb +2 -2
- data/lib/rubypitaya/app-template/app/handlers/player_handler.rb +1 -1
- data/lib/rubypitaya/app-template/docker/dev/Dockerfile +10 -7
- data/lib/rubypitaya/app-template/docker/prod/Dockerfile +19 -19
- data/lib/rubypitaya/core/config.rb +23 -4
- data/lib/rubypitaya/core/config_core.rb +4 -21
- data/lib/rubypitaya/core/db/migration/0000000001_create_user_migration.rb +1 -1
- data/lib/rubypitaya/core/main.rb +7 -5
- data/lib/rubypitaya/core/parameters.rb +449 -138
- data/lib/rubypitaya/core/spec-helpers/handler_spec_helper.rb +20 -0
- data/lib/rubypitaya/core/templates/template_migration.rb.erb +1 -1
- data/lib/rubypitaya/version.rb +1 -1
- metadata +23 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38d15208a32190c01690735d3d8433bb0f8cc9b6f71a64f7897ba668c21e4e97
|
4
|
+
data.tar.gz: 7396c21b202d611ea5945fd9838b68323b4751777d3e154b20b31557ee470b7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b70755f160f42aa9a145bf55c0709bb82ec92f1f2105874127439bdc286ea124e7f2093cdae34a377d595bb54e21e75af244d34cbd9c30f8feac08849db7d9a
|
7
|
+
data.tar.gz: 50df16ee2575fd5840b0af30cfa3aedb9a7e4b35d27291a3a484ac2233b09b41700618ef9a1d8b2223cc1dba3e0cc0d8c7fc42a168971e548bd0301e34b77e7d
|
@@ -1,11 +1,11 @@
|
|
1
1
|
source "https://rubygems.org"
|
2
2
|
|
3
|
-
gem 'rubypitaya', '2.
|
3
|
+
gem 'rubypitaya', '2.18.0'
|
4
4
|
|
5
5
|
group :development do
|
6
|
-
gem 'pry', '0.
|
7
|
-
gem 'bundler', '1.
|
8
|
-
gem 'rspec', '3.
|
9
|
-
gem 'listen', '3.
|
10
|
-
gem 'cucumber', '
|
6
|
+
gem 'pry', '0.14.0'
|
7
|
+
gem 'bundler', '2.1.4'
|
8
|
+
gem 'rspec', '3.10.0'
|
9
|
+
gem 'listen', '3.4.1'
|
10
|
+
gem 'cucumber', '5.3.0'
|
11
11
|
end
|
@@ -1,99 +1,123 @@
|
|
1
1
|
GEM
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
activemodel (6.
|
5
|
-
activesupport (= 6.
|
6
|
-
activerecord (6.
|
7
|
-
activemodel (= 6.
|
8
|
-
activesupport (= 6.
|
9
|
-
activesupport (6.
|
4
|
+
activemodel (6.1.3)
|
5
|
+
activesupport (= 6.1.3)
|
6
|
+
activerecord (6.1.3)
|
7
|
+
activemodel (= 6.1.3)
|
8
|
+
activesupport (= 6.1.3)
|
9
|
+
activesupport (6.1.3)
|
10
10
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
11
|
-
i18n (>=
|
12
|
-
minitest (
|
13
|
-
tzinfo (~>
|
14
|
-
zeitwerk (~> 2.
|
11
|
+
i18n (>= 1.6, < 2)
|
12
|
+
minitest (>= 5.1)
|
13
|
+
tzinfo (~> 2.0)
|
14
|
+
zeitwerk (~> 2.3)
|
15
15
|
builder (3.2.4)
|
16
16
|
coderay (1.1.3)
|
17
|
-
concurrent-ruby (1.1.
|
18
|
-
cucumber (
|
19
|
-
builder (>= 2.
|
20
|
-
cucumber-core (~>
|
21
|
-
cucumber-
|
22
|
-
|
23
|
-
gherkin (~>
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
17
|
+
concurrent-ruby (1.1.8)
|
18
|
+
cucumber (5.3.0)
|
19
|
+
builder (~> 3.2, >= 3.2.4)
|
20
|
+
cucumber-core (~> 8.0, >= 8.0.1)
|
21
|
+
cucumber-create-meta (~> 2.0, >= 2.0.2)
|
22
|
+
cucumber-cucumber-expressions (~> 10.3, >= 10.3.0)
|
23
|
+
cucumber-gherkin (~> 15.0, >= 15.0.2)
|
24
|
+
cucumber-html-formatter (~> 9.0, >= 9.0.0)
|
25
|
+
cucumber-messages (~> 13.1, >= 13.1.0)
|
26
|
+
cucumber-wire (~> 4.0, >= 4.0.1)
|
27
|
+
diff-lcs (~> 1.4, >= 1.4.4)
|
28
|
+
multi_test (~> 0.1, >= 0.1.2)
|
29
|
+
sys-uname (~> 1.2, >= 1.2.1)
|
30
|
+
cucumber-core (8.0.1)
|
31
|
+
cucumber-gherkin (~> 15.0, >= 15.0.2)
|
32
|
+
cucumber-messages (~> 13.0, >= 13.0.1)
|
33
|
+
cucumber-tag-expressions (~> 2.0, >= 2.0.4)
|
34
|
+
cucumber-create-meta (2.0.4)
|
35
|
+
cucumber-messages (~> 13.1, >= 13.1.0)
|
36
|
+
sys-uname (~> 1.2, >= 1.2.1)
|
37
|
+
cucumber-cucumber-expressions (10.3.0)
|
38
|
+
cucumber-gherkin (15.0.2)
|
39
|
+
cucumber-messages (~> 13.0, >= 13.0.1)
|
40
|
+
cucumber-html-formatter (9.0.0)
|
41
|
+
cucumber-messages (~> 13.0, >= 13.0.1)
|
42
|
+
cucumber-messages (13.2.1)
|
43
|
+
protobuf-cucumber (~> 3.10, >= 3.10.8)
|
44
|
+
cucumber-tag-expressions (2.0.4)
|
45
|
+
cucumber-wire (4.0.1)
|
46
|
+
cucumber-core (~> 8.0, >= 8.0.1)
|
47
|
+
cucumber-cucumber-expressions (~> 10.3, >= 10.3.0)
|
48
|
+
cucumber-messages (~> 13.0, >= 13.0.1)
|
29
49
|
diff-lcs (1.4.4)
|
30
50
|
etcdv3 (0.10.2)
|
31
51
|
grpc (~> 1.17)
|
32
52
|
eventmachine (1.2.7)
|
33
53
|
ffi (1.14.2)
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
google-protobuf (~> 3.13)
|
54
|
+
google-protobuf (3.15.3-x86_64-linux)
|
55
|
+
googleapis-common-protos-types (1.0.6)
|
56
|
+
google-protobuf (~> 3.14)
|
57
|
+
grpc (1.36.0-x86_64-linux)
|
58
|
+
google-protobuf (~> 3.14)
|
40
59
|
googleapis-common-protos-types (~> 1.0)
|
41
|
-
i18n (1.8.
|
60
|
+
i18n (1.8.9)
|
42
61
|
concurrent-ruby (~> 1.0)
|
43
|
-
listen (3.
|
62
|
+
listen (3.4.1)
|
44
63
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
45
64
|
rb-inotify (~> 0.9, >= 0.9.10)
|
46
|
-
method_source (0.
|
65
|
+
method_source (1.0.0)
|
47
66
|
middleware (0.1.0)
|
48
|
-
minitest (5.14.
|
67
|
+
minitest (5.14.4)
|
49
68
|
multi_json (1.15.0)
|
50
69
|
multi_test (0.1.2)
|
51
70
|
mustermann (1.1.1)
|
52
71
|
ruby2_keywords (~> 0.0.1)
|
53
72
|
nats (0.11.0)
|
54
73
|
eventmachine (~> 1.2, >= 1.2)
|
55
|
-
ostruct (0.
|
56
|
-
pg (
|
74
|
+
ostruct (0.3.3)
|
75
|
+
pg (1.2.3)
|
57
76
|
protobuf (3.10.0)
|
58
77
|
activesupport (>= 3.2)
|
59
78
|
middleware
|
60
79
|
thor
|
61
80
|
thread_safe
|
62
|
-
|
63
|
-
|
64
|
-
|
81
|
+
protobuf-cucumber (3.10.8)
|
82
|
+
activesupport (>= 3.2)
|
83
|
+
middleware
|
84
|
+
thor
|
85
|
+
thread_safe
|
86
|
+
pry (0.14.0)
|
87
|
+
coderay (~> 1.1)
|
88
|
+
method_source (~> 1.0)
|
65
89
|
rack (2.2.3)
|
66
90
|
rack-protection (2.1.0)
|
67
91
|
rack
|
68
|
-
rake (
|
92
|
+
rake (13.0.3)
|
69
93
|
rb-fsevent (0.10.4)
|
70
94
|
rb-inotify (0.10.1)
|
71
95
|
ffi (~> 1.0)
|
72
|
-
redis (4.
|
73
|
-
rspec (3.
|
74
|
-
rspec-core (~> 3.
|
75
|
-
rspec-expectations (~> 3.
|
76
|
-
rspec-mocks (~> 3.
|
77
|
-
rspec-core (3.
|
78
|
-
rspec-support (~> 3.
|
79
|
-
rspec-expectations (3.
|
96
|
+
redis (4.2.5)
|
97
|
+
rspec (3.10.0)
|
98
|
+
rspec-core (~> 3.10.0)
|
99
|
+
rspec-expectations (~> 3.10.0)
|
100
|
+
rspec-mocks (~> 3.10.0)
|
101
|
+
rspec-core (3.10.1)
|
102
|
+
rspec-support (~> 3.10.0)
|
103
|
+
rspec-expectations (3.10.1)
|
80
104
|
diff-lcs (>= 1.2.0, < 2.0)
|
81
|
-
rspec-support (~> 3.
|
82
|
-
rspec-mocks (3.
|
105
|
+
rspec-support (~> 3.10.0)
|
106
|
+
rspec-mocks (3.10.2)
|
83
107
|
diff-lcs (>= 1.2.0, < 2.0)
|
84
|
-
rspec-support (~> 3.
|
85
|
-
rspec-support (3.
|
86
|
-
ruby2_keywords (0.0.
|
87
|
-
rubypitaya (2.
|
88
|
-
activerecord (= 6.
|
108
|
+
rspec-support (~> 3.10.0)
|
109
|
+
rspec-support (3.10.2)
|
110
|
+
ruby2_keywords (0.0.4)
|
111
|
+
rubypitaya (2.18.0)
|
112
|
+
activerecord (= 6.1.3)
|
89
113
|
etcdv3 (= 0.10.2)
|
90
114
|
eventmachine (= 1.2.7)
|
91
115
|
nats (= 0.11.0)
|
92
|
-
ostruct (= 0.
|
93
|
-
pg (=
|
116
|
+
ostruct (= 0.3.3)
|
117
|
+
pg (= 1.2.3)
|
94
118
|
protobuf (= 3.10.0)
|
95
|
-
rake (=
|
96
|
-
redis (= 4.
|
119
|
+
rake (= 13.0.3)
|
120
|
+
redis (= 4.2.5)
|
97
121
|
sinatra (= 2.1.0)
|
98
122
|
sinatra-contrib (= 2.1.0)
|
99
123
|
sinatra (2.1.0)
|
@@ -107,23 +131,25 @@ GEM
|
|
107
131
|
rack-protection (= 2.1.0)
|
108
132
|
sinatra (= 2.1.0)
|
109
133
|
tilt (~> 2.0)
|
110
|
-
|
134
|
+
sys-uname (1.2.2)
|
135
|
+
ffi (~> 1.1)
|
136
|
+
thor (1.1.0)
|
111
137
|
thread_safe (0.3.6)
|
112
138
|
tilt (2.0.10)
|
113
|
-
tzinfo (
|
114
|
-
|
139
|
+
tzinfo (2.0.4)
|
140
|
+
concurrent-ruby (~> 1.0)
|
115
141
|
zeitwerk (2.4.2)
|
116
142
|
|
117
143
|
PLATFORMS
|
118
144
|
ruby
|
119
145
|
|
120
146
|
DEPENDENCIES
|
121
|
-
bundler (= 1.
|
122
|
-
cucumber (=
|
123
|
-
listen (= 3.
|
124
|
-
pry (= 0.
|
125
|
-
rspec (= 3.
|
126
|
-
rubypitaya (= 2.
|
147
|
+
bundler (= 2.1.4)
|
148
|
+
cucumber (= 5.3.0)
|
149
|
+
listen (= 3.4.1)
|
150
|
+
pry (= 0.14.0)
|
151
|
+
rspec (= 3.10.0)
|
152
|
+
rubypitaya (= 2.18.0)
|
127
153
|
|
128
154
|
BUNDLED WITH
|
129
|
-
1.
|
155
|
+
2.1.4
|
@@ -41,7 +41,7 @@ test-cucumber:
|
|
41
41
|
## Update gems dependencies on Gemfile.lock
|
42
42
|
update-dependencies:
|
43
43
|
@rm -f Gemfile.lock
|
44
|
-
@docker run --rm -v "$(PWD)":/usr/src/app -w /usr/src/app ruby:2.
|
44
|
+
@docker run --rm -v "$(PWD)":/usr/src/app -w /usr/src/app ruby:2.7.2 bundle install
|
45
45
|
|
46
46
|
## + Improve metagame
|
47
47
|
|
@@ -1,11 +1,11 @@
|
|
1
1
|
class PlayerBLL
|
2
2
|
|
3
3
|
def create_new_player(setup, config)
|
4
|
-
name = config['initial_player'][
|
4
|
+
name = config['initial_player'][:name]
|
5
5
|
gold = setup['initial_player.wallet.gold']
|
6
6
|
|
7
7
|
player = Player.new(name: name, gold: gold, user: User.new)
|
8
|
-
player.save
|
8
|
+
player.save!
|
9
9
|
player
|
10
10
|
end
|
11
11
|
end
|
@@ -17,7 +17,7 @@ class PlayerHandler < RubyPitaya::HandlerBase
|
|
17
17
|
# Given you have the following file "app/config/initial_player.json"
|
18
18
|
# And this json content is {'name': 'Guest'}
|
19
19
|
# And you can get the initial player name
|
20
|
-
# Then you can run the following code: @config['initial_player'][
|
20
|
+
# Then you can run the following code: @config['initial_player'][:name]
|
21
21
|
#
|
22
22
|
# - @params
|
23
23
|
# - info: Special hash with the request parameters
|
@@ -1,18 +1,21 @@
|
|
1
|
-
FROM ruby:2.
|
1
|
+
FROM ruby:2.7.2
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
ENV LANG=C.UTF-8
|
4
|
+
ENV LC_ALL=C.UTF-8
|
5
5
|
|
6
|
-
|
6
|
+
RUN apt update && \
|
7
|
+
apt install -y --no-install-recommends \
|
8
|
+
docker.io \
|
9
|
+
postgresql-client \
|
10
|
+
&& rm -rf /var/lib/apt/lists/*
|
7
11
|
|
8
12
|
COPY Gemfile Gemfile.lock ./
|
9
13
|
|
10
14
|
RUN bundle install
|
11
15
|
|
12
|
-
|
16
|
+
WORKDIR /app/rubypitaya/
|
13
17
|
|
14
|
-
|
15
|
-
ENV LC_ALL=C.UTF-8
|
18
|
+
COPY . .
|
16
19
|
|
17
20
|
ENTRYPOINT ["./docker/entrypoint.sh"]
|
18
21
|
|
@@ -1,35 +1,35 @@
|
|
1
|
-
FROM ruby:2.
|
1
|
+
FROM ruby:2.7.2 as builder
|
2
2
|
|
3
|
-
|
3
|
+
RUN apt update && \
|
4
|
+
apt install -y --no-install-recommends \
|
5
|
+
curl \
|
6
|
+
&& rm -rf /var/lib/apt/lists/*
|
4
7
|
|
5
8
|
COPY Gemfile Gemfile.lock ./
|
6
9
|
|
7
|
-
RUN bundle
|
10
|
+
RUN bundle config --local without "development test" && \
|
11
|
+
bundle install
|
8
12
|
|
9
|
-
|
13
|
+
RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
|
10
14
|
|
11
|
-
FROM ruby:2.
|
15
|
+
FROM ruby:2.7.2-slim
|
12
16
|
|
13
|
-
|
14
|
-
|
17
|
+
ENV LANG=C.UTF-8
|
18
|
+
ENV LC_ALL=C.UTF-8
|
15
19
|
|
16
|
-
RUN
|
17
|
-
|
18
|
-
|
20
|
+
RUN apt update && \
|
21
|
+
apt install -y --no-install-recommends \
|
22
|
+
postgresql-client \
|
23
|
+
&& rm -rf /var/lib/apt/lists/*
|
19
24
|
|
20
|
-
COPY --from=builder /usr/local/etc /usr/local/etc
|
21
25
|
COPY --from=builder /usr/local/bundle /usr/local/bundle
|
22
|
-
COPY --from=builder /
|
23
|
-
|
24
|
-
|
25
|
-
COPY --from=builder /app/rubypitaya /app/rubypitaya
|
26
|
+
COPY --from=builder /kubectl /usr/local/bin/kubectl
|
27
|
+
|
28
|
+
RUN chmod +x /usr/local/bin/kubectl
|
26
29
|
|
27
30
|
WORKDIR /app/rubypitaya/
|
28
31
|
|
29
|
-
|
30
|
-
|
31
|
-
ENV LANG=C.UTF-8
|
32
|
-
ENV LC_ALL=C.UTF-8
|
32
|
+
COPY . .
|
33
33
|
|
34
34
|
ENTRYPOINT ["./docker/entrypoint.sh"]
|
35
35
|
|
@@ -4,16 +4,26 @@ module RubyPitaya
|
|
4
4
|
|
5
5
|
class Config
|
6
6
|
|
7
|
-
attr_writer :config_core_override
|
8
|
-
|
9
7
|
def initialize
|
10
8
|
@config_core = ConfigCore.new
|
11
9
|
@config_core_override = nil
|
10
|
+
@has_config_core_override = false
|
11
|
+
|
12
|
+
@result_cache = {}
|
12
13
|
end
|
13
14
|
|
14
15
|
def [](key)
|
15
|
-
result = @
|
16
|
-
result
|
16
|
+
result = @result_cache[key]
|
17
|
+
return result unless result.nil?
|
18
|
+
|
19
|
+
if @has_config_core_override
|
20
|
+
result = @config_core_override[key]
|
21
|
+
else
|
22
|
+
result = @config_core[key]
|
23
|
+
end
|
24
|
+
|
25
|
+
@result_cache[key] = result.deep_symbolize_keys
|
26
|
+
|
17
27
|
result
|
18
28
|
end
|
19
29
|
|
@@ -21,5 +31,14 @@ module RubyPitaya
|
|
21
31
|
@config_core.auto_reload
|
22
32
|
@config_core_override.auto_reload unless @config_core_override.nil?
|
23
33
|
end
|
34
|
+
|
35
|
+
def clear_cache
|
36
|
+
@result_cache.clear
|
37
|
+
end
|
38
|
+
|
39
|
+
def config_core_override=(value)
|
40
|
+
@config_core_override = value
|
41
|
+
@has_config_core_override = !value.nil?
|
42
|
+
end
|
24
43
|
end
|
25
44
|
end
|
@@ -17,8 +17,7 @@ module RubyPitaya
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def [](key)
|
20
|
-
|
21
|
-
@config.dig(*split_key)
|
20
|
+
@config[key]
|
22
21
|
end
|
23
22
|
|
24
23
|
def auto_reload
|
@@ -42,12 +41,11 @@ module RubyPitaya
|
|
42
41
|
|
43
42
|
def load_config_file(configs_folder_path, file_path)
|
44
43
|
config_text = File.open(file_path, &:read)
|
45
|
-
config_hash = JSON.parse(config_text)
|
44
|
+
config_hash = JSON.parse(config_text, symbolize_names: true)
|
46
45
|
|
47
|
-
|
48
|
-
.split('/')
|
46
|
+
file_name = file_path.sub(/^#{configs_folder_path}/, '')[0..-6]
|
49
47
|
|
50
|
-
|
48
|
+
@config[file_name] = config_hash
|
51
49
|
|
52
50
|
rescue Exception => error
|
53
51
|
puts "ERROR: #{error}"
|
@@ -69,20 +67,5 @@ module RubyPitaya
|
|
69
67
|
puts "MODIFIED @config: #{path}"
|
70
68
|
end
|
71
69
|
end
|
72
|
-
|
73
|
-
def set_config_value(keys, value)
|
74
|
-
config = @config
|
75
|
-
|
76
|
-
keys.each_with_index do |key, index|
|
77
|
-
is_last_index = index == keys.size - 1
|
78
|
-
|
79
|
-
if is_last_index
|
80
|
-
config[key] = value
|
81
|
-
else
|
82
|
-
config[key] = {} unless config.key?(key)
|
83
|
-
config = config[key]
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
70
|
end
|
88
71
|
end
|