rubypitaya 2.14.0 → 2.18.0

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: ef2357fb173bf33d95bf3d254c4eb6ff8943c420372dd4abccf1a0c40a5d43d8
4
- data.tar.gz: c0c66d8b81f67c8081d0ac0fa3dff7f9036e8e54cc3ff4e3ea370427cf067adb
3
+ metadata.gz: 38d15208a32190c01690735d3d8433bb0f8cc9b6f71a64f7897ba668c21e4e97
4
+ data.tar.gz: 7396c21b202d611ea5945fd9838b68323b4751777d3e154b20b31557ee470b7a
5
5
  SHA512:
6
- metadata.gz: 3568a02b718ec1b9f60063c01e1ef69256fdd45c3d4907a017ae668326e9486aff1f638e11abb068bd5e446efb93cdd4eaa737843a366609da3e7bf807950ef3
7
- data.tar.gz: 9de2d78d09e2a4aaf15df8e6d5f269a16aedd798ee72083e83bd537bf941d2d954cc0f1910e7234b12367827e544ac97f2c62926bc4d5e6aac27ab4628d60321
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.14.0'
3
+ gem 'rubypitaya', '2.18.0'
4
4
 
5
5
  group :development do
6
- gem 'pry', '0.12.2'
7
- gem 'bundler', '1.17.2'
8
- gem 'rspec', '3.8.0'
9
- gem 'listen', '3.2.1'
10
- gem 'cucumber', '2.4.0'
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.0.2)
5
- activesupport (= 6.0.2)
6
- activerecord (6.0.2)
7
- activemodel (= 6.0.2)
8
- activesupport (= 6.0.2)
9
- activesupport (6.0.2)
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 (>= 0.7, < 2)
12
- minitest (~> 5.1)
13
- tzinfo (~> 1.1)
14
- zeitwerk (~> 2.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.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
+ 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
- gherkin (4.1.3)
35
- google-protobuf (3.14.0)
36
- googleapis-common-protos-types (1.0.5)
37
- google-protobuf (~> 3.11)
38
- grpc (1.34.0)
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.6)
60
+ i18n (1.8.9)
42
61
  concurrent-ruby (~> 1.0)
43
- listen (3.2.1)
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.9.2)
65
+ method_source (1.0.0)
47
66
  middleware (0.1.0)
48
- minitest (5.14.2)
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.1.0)
56
- pg (0.21.0)
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
- pry (0.12.2)
63
- coderay (~> 1.1.0)
64
- method_source (~> 0.9.0)
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 (10.0.0)
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.1.3)
73
- rspec (3.8.0)
74
- rspec-core (~> 3.8.0)
75
- rspec-expectations (~> 3.8.0)
76
- rspec-mocks (~> 3.8.0)
77
- rspec-core (3.8.2)
78
- rspec-support (~> 3.8.0)
79
- rspec-expectations (3.8.6)
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.8.0)
82
- rspec-mocks (3.8.2)
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.8.0)
85
- rspec-support (3.8.3)
86
- ruby2_keywords (0.0.2)
87
- rubypitaya (2.14.0)
88
- activerecord (= 6.0.2)
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.1.0)
93
- pg (= 0.21.0)
116
+ ostruct (= 0.3.3)
117
+ pg (= 1.2.3)
94
118
  protobuf (= 3.10.0)
95
- rake (= 10.0)
96
- redis (= 4.1.3)
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
- thor (1.0.1)
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 (1.2.9)
114
- thread_safe (~> 0.1)
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.17.2)
122
- cucumber (= 2.4.0)
123
- listen (= 3.2.1)
124
- pry (= 0.12.2)
125
- rspec (= 3.8.0)
126
- rubypitaya (= 2.14.0)
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.17.2
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.6.6 bundle install
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']['name']
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']['name']
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.6.6
1
+ FROM ruby:2.7.2
2
2
 
3
- RUN apt update
4
- RUN apt install -y git vim postgresql-client docker.io --no-install-recommends
3
+ ENV LANG=C.UTF-8
4
+ ENV LC_ALL=C.UTF-8
5
5
 
6
- WORKDIR /app/rubypitaya/
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
- COPY . .
16
+ WORKDIR /app/rubypitaya/
13
17
 
14
- ENV LANG=C.UTF-8
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.6.6 as builder
1
+ FROM ruby:2.7.2 as builder
2
2
 
3
- WORKDIR /app/rubypitaya/
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 install --without development
10
+ RUN bundle config --local without "development test" && \
11
+ bundle install
8
12
 
9
- COPY . .
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.6.6-slim
15
+ FROM ruby:2.7.2-slim
12
16
 
13
- RUN apt update && apt install -y postgresql-client curl python3 bash vim --no-install-recommends
14
- RUN rm -rf /var/lib/apt/lists/*
17
+ ENV LANG=C.UTF-8
18
+ ENV LC_ALL=C.UTF-8
15
19
 
16
- 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
17
- RUN chmod +x ./kubectl
18
- RUN mv ./kubectl /usr/local/bin
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 /usr/local/bin/ruby /usr/local/bin/ruby
23
- COPY --from=builder /usr/local/lib/ruby/gems/2.6.0 /usr/local/lib/ruby/gems/2.6.0
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
- RUN rm -rf vendor/
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 = @config_core_override[key] unless @config_core_override.nil?
16
- result = @config_core[key] if result.nil?
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
- split_key = key.split('/')
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
- path_array = file_path.sub(/^#{configs_folder_path}/, '')[0..-6]
48
- .split('/')
46
+ file_name = file_path.sub(/^#{configs_folder_path}/, '')[0..-6]
49
47
 
50
- set_config_value(path_array, config_hash)
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