kuby-core 0.18.0 → 0.20.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c537d5778b44ceab6bbd75ae91b2c8569bdba7356c25112c172ce10533a5b073
4
- data.tar.gz: c8fda1880975e51a5e398ccb5e42474ead68e7a179ea403ded3b15ee615dc4f1
3
+ metadata.gz: c3e98a72e5798436209eb36042b9cb6e59ea7491d772c3b04ea04ea12b81b612
4
+ data.tar.gz: 1a8b6a6e8704c885d3326e4a8e4e2aaf77fff5f67d9a9c4d8bb3cac546798fd6
5
5
  SHA512:
6
- metadata.gz: ea78f96fa54b86a8917e252af444e92465b43e9017c52e25e9e643df50095a31a15462ba48f8db1f94063aff414ce9d2eb2a9e3617e2c9581823d339c810a0af
7
- data.tar.gz: b791c2e2190e8c16a52b1039f565f9e6f04d55bc47395d0133581503beb882019139199da14efecf2d488a26e6229e7beaf649375c5067df69db6c0c7787fcf2
6
+ metadata.gz: 17f78515bf3e52d54299f678e3f55a6a11e4b5ad0272aff8051b447bc0904787df10f382fea3ecb470d6c46f67b0fb935817f4bd3816d292a4e5f55f37e8594a
7
+ data.tar.gz: 200a1df0299181a7334e4deaa737f69b6d3f30cbc5583c71be73b7ae088cb7f71e3bdf4b3418b6f1173ed3161bde00387410ecbe2b85d8f4c10bca6fa8a5ad64
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## Unreleased
2
+
3
+ ## 0.20.0
4
+ * Modify the Rails generator to add the `activerecord-cockroachdb-adapter` to your bundle.
5
+ * Add the `LayerStack#replace` and corresponding `Docker::Spec#replace` methods for replacing phases. This can be a lot easier than using `#insert` and `#delete`, which can mess with the relative order of the phases and cause surprising results.
6
+ * Don't run init containers for creating and migrating the database if database management is turned off.
7
+
8
+ ## 0.19.0
9
+ * Add support for configuring the number of web workers for puma (#124, @zhalltyemill)
10
+
1
11
  ## 0.18.0
2
12
  * Add the ability to specify your app's root directory.
3
13
  - Call `app_root <path>` inside the `docker` section of your Kuby config file.
data/Gemfile CHANGED
@@ -7,7 +7,7 @@ group :development, :test do
7
7
  gem 'rake'
8
8
 
9
9
  gem 'curdle', '~> 1.2'
10
- gem 'parlour', github: 'camertron/parlour', branch: 'initialize_void' # '~> 7.0'
10
+ gem 'parlour', '~> 8.0'
11
11
  gem 'tapioca', '~> 0.7'
12
12
  gem 'sorbet-runtime', '= 0.5.9897'
13
13
  gem 'sorbet-static', '= 0.5.9897'
data/bin/kuby CHANGED
@@ -2,5 +2,7 @@
2
2
 
3
3
  $stdout.sync = true
4
4
 
5
+ require 'sorbet-runtime'
6
+
5
7
  require 'kuby'
6
8
  exit Kuby::Commands.run(ARGV)
@@ -94,6 +94,15 @@ module Kuby
94
94
  end
95
95
  end
96
96
 
97
+ # T::Sig::WithoutRuntime.sig { params(name: Symbol, layer: Layer).void }
98
+ def replace(name, layer)
99
+ unless layers.include?(name)
100
+ raise ArgumentError, "Could not find existing layer '#{name}'"
101
+ end
102
+
103
+ layers[name] = layer
104
+ end
105
+
97
106
  # T::Sig::WithoutRuntime.sig { params(name: Symbol).void }
98
107
  def delete(name)
99
108
  stack.delete(name)
@@ -145,6 +145,11 @@ module Kuby
145
145
  layer_stack.insert(name, layer, options, &block)
146
146
  end
147
147
 
148
+ # T::Sig::WithoutRuntime.sig { params(name: Symbol, layer: Layer).void }
149
+ def replace(name, layer)
150
+ layer_stack.replace(name, layer)
151
+ end
152
+
148
153
  # T::Sig::WithoutRuntime.sig { params(name: Symbol).void }
149
154
  def delete(name)
150
155
  layer_stack.delete(name)
@@ -28,7 +28,7 @@ module Kuby
28
28
  def apply_to(dockerfile)
29
29
  dockerfile.cmd(
30
30
  'puma',
31
- '--workers', '4',
31
+ '--workers', phase.workers.to_s,
32
32
  '--bind', 'tcp://0.0.0.0',
33
33
  '--port', phase.port.to_s,
34
34
  '--pidfile', './server.pid',
@@ -40,11 +40,15 @@ module Kuby
40
40
  end
41
41
 
42
42
  DEFAULT_PORT = 8080
43
+ DEFAULT_WORKERS = 4
43
44
  WEBSERVER_MAP = { puma: Puma }.freeze
44
45
 
45
46
  # T::Sig::WithoutRuntime.sig { params(port: Integer).returns(Integer) }
46
47
  attr_writer :port
47
48
 
49
+ # T::Sig::WithoutRuntime.sig { params(workers: Integer).returns(Integer) }
50
+ attr_writer :workers
51
+
48
52
  # T::Sig::WithoutRuntime.sig { returns(T.nilable(Symbol)) }
49
53
  attr_reader :webserver
50
54
 
@@ -56,6 +60,7 @@ module Kuby
56
60
  super
57
61
 
58
62
  # @port = T.let(@port, T.nilable(Integer))
63
+ # @workers = T.let(@workers, T.nilable(Integer))
59
64
  # @webserver = T.let(@webserver, T.nilable(Symbol))
60
65
  end
61
66
 
@@ -73,6 +78,11 @@ module Kuby
73
78
  @port || DEFAULT_PORT
74
79
  end
75
80
 
81
+ # T::Sig::WithoutRuntime.sig { returns(Integer) }
82
+ def workers
83
+ @workers || DEFAULT_WORKERS
84
+ end
85
+
76
86
  private
77
87
 
78
88
  # T::Sig::WithoutRuntime.sig { returns(T.nilable(Symbol)) }
@@ -1,4 +1,4 @@
1
- # typed: false
1
+ # typed: ignore
2
2
 
3
3
  require 'rails/generators'
4
4
  require 'rails/generators/base'
@@ -109,6 +109,14 @@ class KubyGenerator < Rails::Generators::Base
109
109
  )
110
110
  end
111
111
 
112
+ def add_cockroach_adapter
113
+ if Rails::VERSION::STRING > '5.2'
114
+ gem 'activerecord-cockroachdb-adapter', version: '~> 6.0'
115
+ else
116
+ gem 'activerecord-cockroachdb-adapter', version: '~> 5.2'
117
+ end
118
+ end
119
+
112
120
  private
113
121
 
114
122
  def app_name
@@ -106,12 +106,14 @@ module Kuby
106
106
  image image_with_tag
107
107
  end
108
108
 
109
- init_container(:create_db) do
110
- image image_with_tag
111
- end
109
+ if spec.manage_database?
110
+ init_container(:create_db) do
111
+ image image_with_tag
112
+ end
112
113
 
113
- init_container(:migrate_db) do
114
- image image_with_tag
114
+ init_container(:migrate_db) do
115
+ image image_with_tag
116
+ end
115
117
  end
116
118
  end
117
119
  end
@@ -308,36 +310,38 @@ module Kuby
308
310
  end
309
311
  end
310
312
 
311
- init_container(:create_db) do
312
- name "#{kube_spec.selector_app}-create-db"
313
- command %w(bundle exec rake kuby:rails_app:db:bootstrap)
313
+ if kube_spec.manage_database?
314
+ init_container(:create_db) do
315
+ name "#{kube_spec.selector_app}-create-db"
316
+ command %w(bundle exec rake kuby:rails_app:db:bootstrap)
314
317
 
315
- env_from do
316
- config_map_ref do
317
- name kube_spec.config_map.metadata.name
318
+ env_from do
319
+ config_map_ref do
320
+ name kube_spec.config_map.metadata.name
321
+ end
318
322
  end
319
- end
320
323
 
321
- env_from do
322
- secret_ref do
323
- name kube_spec.app_secrets.metadata.name
324
+ env_from do
325
+ secret_ref do
326
+ name kube_spec.app_secrets.metadata.name
327
+ end
324
328
  end
325
329
  end
326
- end
327
330
 
328
- init_container(:migrate_db) do
329
- name "#{kube_spec.selector_app}-migrate-db"
330
- command %w(bundle exec rake kuby:rails_app:db:migrate)
331
+ init_container(:migrate_db) do
332
+ name "#{kube_spec.selector_app}-migrate-db"
333
+ command %w(bundle exec rake kuby:rails_app:db:migrate)
331
334
 
332
- env_from do
333
- config_map_ref do
334
- name kube_spec.config_map.metadata.name
335
+ env_from do
336
+ config_map_ref do
337
+ name kube_spec.config_map.metadata.name
338
+ end
335
339
  end
336
- end
337
340
 
338
- env_from do
339
- secret_ref do
340
- name kube_spec.app_secrets.metadata.name
341
+ env_from do
342
+ secret_ref do
343
+ name kube_spec.app_secrets.metadata.name
344
+ end
341
345
  end
342
346
  end
343
347
  end
data/lib/kuby/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # typed: true
2
2
 
3
3
  module Kuby
4
- VERSION = '0.18.0'.freeze
4
+ VERSION = '0.20.0'.freeze
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kuby-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.0
4
+ version: 0.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cameron Dutro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-07 00:00:00.000000000 Z
11
+ date: 2023-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize