kuby-core 0.10.1 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/Gemfile +1 -0
- data/README.md +4 -2
- data/kuby-core.gemspec +2 -1
- data/lib/kuby-core.rb +1 -0
- data/lib/kuby.rb +7 -0
- data/lib/kuby/basic_logger.rb +1 -0
- data/lib/kuby/cli_base.rb +1 -0
- data/lib/kuby/commands.rb +1 -0
- data/lib/kuby/definition.rb +1 -0
- data/lib/kuby/dev_setup.rb +1 -0
- data/lib/kuby/docker.rb +3 -0
- data/lib/kuby/docker/alpine.rb +16 -12
- data/lib/kuby/docker/assets_phase.rb +5 -0
- data/lib/kuby/docker/bundler_phase.rb +36 -2
- data/lib/kuby/docker/cli.rb +36 -2
- data/lib/kuby/docker/copy_phase.rb +11 -3
- data/lib/kuby/docker/credentials.rb +1 -0
- data/lib/kuby/docker/debian.rb +14 -10
- data/lib/kuby/docker/dev_spec.rb +82 -18
- data/lib/kuby/docker/distro.rb +43 -0
- data/lib/kuby/docker/dockerfile.rb +66 -18
- data/lib/kuby/docker/errors.rb +8 -0
- data/lib/kuby/docker/inline_layer.rb +7 -0
- data/lib/kuby/docker/layer.rb +11 -0
- data/lib/kuby/docker/layer_stack.rb +43 -6
- data/lib/kuby/docker/local_tags.rb +23 -2
- data/lib/kuby/docker/metadata.rb +35 -7
- data/lib/kuby/docker/package_list.rb +22 -3
- data/lib/kuby/docker/package_phase.rb +25 -5
- data/lib/kuby/docker/packages.rb +1 -0
- data/lib/kuby/docker/packages/managed_package.rb +20 -2
- data/lib/kuby/docker/packages/nodejs.rb +8 -0
- data/lib/kuby/docker/packages/package.rb +15 -1
- data/lib/kuby/docker/packages/simple_managed_package.rb +10 -1
- data/lib/kuby/docker/packages/yarn.rb +14 -0
- data/lib/kuby/docker/remote_tags.rb +21 -2
- data/lib/kuby/docker/setup_phase.rb +35 -4
- data/lib/kuby/docker/spec.rb +89 -13
- data/lib/kuby/docker/tags.rb +37 -2
- data/lib/kuby/docker/timestamp_tag.rb +14 -2
- data/lib/kuby/docker/webserver_phase.rb +40 -5
- data/lib/kuby/docker/yarn_phase.rb +5 -0
- data/lib/kuby/environment.rb +4 -0
- data/lib/kuby/kubernetes.rb +1 -0
- data/lib/kuby/kubernetes/deploy_task.rb +1 -0
- data/lib/kuby/kubernetes/deployer.rb +1 -0
- data/lib/kuby/kubernetes/docker_config.rb +1 -0
- data/lib/kuby/kubernetes/docker_desktop_provider.rb +1 -0
- data/lib/kuby/kubernetes/errors.rb +1 -0
- data/lib/kuby/kubernetes/manifest.rb +1 -0
- data/lib/kuby/kubernetes/provider.rb +1 -0
- data/lib/kuby/kubernetes/registry_secret.rb +1 -0
- data/lib/kuby/kubernetes/spec.rb +1 -0
- data/lib/kuby/middleware.rb +1 -0
- data/lib/kuby/middleware/health_check.rb +1 -0
- data/lib/kuby/plugin.rb +1 -0
- data/lib/kuby/plugin_registry.rb +1 -0
- data/lib/kuby/plugins.rb +1 -0
- data/lib/kuby/plugins/nginx_ingress.rb +1 -0
- data/lib/kuby/plugins/rails_app.rb +1 -0
- data/lib/kuby/plugins/rails_app/asset_copy_task.rb +1 -0
- data/lib/kuby/plugins/rails_app/assets.rb +1 -0
- data/lib/kuby/plugins/rails_app/database.rb +9 -7
- data/lib/kuby/plugins/rails_app/generators/kuby.rb +43 -40
- data/lib/kuby/plugins/rails_app/mysql.rb +1 -0
- data/lib/kuby/plugins/rails_app/plugin.rb +10 -5
- data/lib/kuby/plugins/rails_app/postgres.rb +1 -0
- data/lib/kuby/plugins/rails_app/rewrite_db_config.rb +1 -0
- data/lib/kuby/plugins/rails_app/sqlite.rb +1 -0
- data/lib/kuby/rails_commands.rb +1 -0
- data/lib/kuby/railtie.rb +1 -0
- data/lib/kuby/tasks.rb +1 -0
- data/lib/kuby/trailing_hash.rb +5 -3
- data/lib/kuby/version.rb +3 -1
- data/spec/docker/metadata_spec.rb +1 -0
- data/spec/docker/spec_spec.rb +37 -0
- data/spec/docker/timestamp_tag_spec.rb +1 -0
- data/spec/dummy/app/channels/application_cable/channel.rb +1 -0
- data/spec/dummy/app/channels/application_cable/connection.rb +1 -0
- data/spec/dummy/app/controllers/application_controller.rb +1 -0
- data/spec/dummy/app/helpers/application_helper.rb +1 -0
- data/spec/dummy/app/jobs/application_job.rb +1 -0
- data/spec/dummy/app/mailers/application_mailer.rb +1 -0
- data/spec/dummy/app/models/application_record.rb +1 -0
- data/spec/dummy/config/application.rb +1 -0
- data/spec/dummy/config/boot.rb +1 -0
- data/spec/dummy/config/environment.rb +1 -0
- data/spec/dummy/config/environments/development.rb +1 -0
- data/spec/dummy/config/environments/production.rb +1 -0
- data/spec/dummy/config/environments/test.rb +1 -0
- data/spec/dummy/config/initializers/application_controller_renderer.rb +1 -0
- data/spec/dummy/config/initializers/assets.rb +1 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +1 -0
- data/spec/dummy/config/initializers/content_security_policy.rb +1 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +1 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +1 -0
- data/spec/dummy/config/initializers/inflections.rb +1 -0
- data/spec/dummy/config/initializers/mime_types.rb +1 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +1 -0
- data/spec/dummy/config/puma.rb +1 -0
- data/spec/dummy/config/routes.rb +1 -0
- data/spec/dummy/config/spring.rb +1 -0
- data/spec/dummy/db/seeds.rb +1 -0
- data/spec/dummy/test/application_system_test_case.rb +1 -0
- data/spec/dummy/test/channels/application_cable/connection_test.rb +1 -0
- data/spec/dummy/test/test_helper.rb +1 -0
- data/spec/spec_helper.rb +10 -0
- data/spec/support/docker/fake_cli.rb +1 -0
- data/spec/support/docker/remote/fake_client.rb +1 -0
- data/spec/trailing_hash_spec.rb +2 -0
- metadata +20 -4
@@ -1,3 +1,4 @@
|
|
1
|
+
# typed: false
|
1
2
|
require 'kube-dsl'
|
2
3
|
require 'kuby/cert-manager'
|
3
4
|
|
@@ -32,7 +33,7 @@ module Kuby
|
|
32
33
|
@asset_url = DEFAULT_ASSET_URL
|
33
34
|
@packs_url = DEFAULT_PACKS_URL
|
34
35
|
@asset_path = DEFAULT_ASSET_PATH
|
35
|
-
@database = Database.get(self)
|
36
|
+
# @database = Database.get(self)
|
36
37
|
end
|
37
38
|
|
38
39
|
def configure(&block)
|
@@ -42,8 +43,9 @@ module Kuby
|
|
42
43
|
def after_configuration
|
43
44
|
context = self
|
44
45
|
|
45
|
-
if database
|
46
|
-
|
46
|
+
if manage_database? && @database = Database.get(self)
|
47
|
+
@database.plugin.instance_eval(&@database_block) if @database_block
|
48
|
+
environment.kubernetes.plugins[@database.plugin_name] = @database.plugin
|
47
49
|
environment.kubernetes.add_plugin(:kube_db)
|
48
50
|
|
49
51
|
unless environment.development?
|
@@ -114,8 +116,11 @@ module Kuby
|
|
114
116
|
end
|
115
117
|
|
116
118
|
def database(&block)
|
117
|
-
|
118
|
-
|
119
|
+
if block
|
120
|
+
@database_block = block
|
121
|
+
elsif environment.configured?
|
122
|
+
@database
|
123
|
+
end
|
119
124
|
end
|
120
125
|
|
121
126
|
def service(&block)
|
data/lib/kuby/rails_commands.rb
CHANGED
data/lib/kuby/railtie.rb
CHANGED
data/lib/kuby/tasks.rb
CHANGED
data/lib/kuby/trailing_hash.rb
CHANGED
@@ -1,14 +1,16 @@
|
|
1
|
+
# typed: true
|
2
|
+
|
1
3
|
module Kuby
|
2
4
|
class TrailingHash < Hash
|
3
|
-
def each
|
4
|
-
return to_enum(__method__) unless block_given?
|
5
|
+
def each(&block)
|
6
|
+
return to_enum(T.must(__method__)) unless block_given?
|
5
7
|
|
6
8
|
seen_keys = []
|
7
9
|
keys_before = keys
|
8
10
|
|
9
11
|
until keys_before.empty?
|
10
12
|
keys_before.each do |k|
|
11
|
-
yield k, self[k]
|
13
|
+
yield k, T.must(self[k])
|
12
14
|
seen_keys << k
|
13
15
|
end
|
14
16
|
|
data/lib/kuby/version.rb
CHANGED
data/spec/docker/spec_spec.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# typed: false
|
1
2
|
require 'spec_helper'
|
2
3
|
require 'timecop'
|
3
4
|
|
@@ -263,4 +264,40 @@ describe Kuby::Docker::Spec do
|
|
263
264
|
it { is_expected.to eq(previous_tag) }
|
264
265
|
end
|
265
266
|
end
|
267
|
+
|
268
|
+
describe '#insert' do
|
269
|
+
subject { spec.to_dockerfile.to_s }
|
270
|
+
|
271
|
+
context 'with a custom class-based build phase' do
|
272
|
+
before do
|
273
|
+
foo_phase = Class.new do
|
274
|
+
def apply_to(dockerfile)
|
275
|
+
dockerfile.insert_at(0) do
|
276
|
+
dockerfile.run('echo "foo"')
|
277
|
+
end
|
278
|
+
end
|
279
|
+
end
|
280
|
+
|
281
|
+
spec.insert :foo_phase, foo_phase.new, after: :webserver_phase
|
282
|
+
end
|
283
|
+
|
284
|
+
it 'inserts the commands' do
|
285
|
+
expect(subject).to match(/\ARUN echo "foo"$/)
|
286
|
+
end
|
287
|
+
end
|
288
|
+
|
289
|
+
context 'with a custom inline build phase' do
|
290
|
+
before do
|
291
|
+
spec.insert :hello, after: :webserver_phase do |dockerfile|
|
292
|
+
dockerfile.insert_at(0) do
|
293
|
+
dockerfile.run('echo "foo"')
|
294
|
+
end
|
295
|
+
end
|
296
|
+
end
|
297
|
+
|
298
|
+
it 'allows inserting custom build phases' do
|
299
|
+
expect(subject).to match(/\ARUN echo "foo"$/)
|
300
|
+
end
|
301
|
+
end
|
302
|
+
end
|
266
303
|
end
|
data/spec/dummy/config/boot.rb
CHANGED
data/spec/dummy/config/puma.rb
CHANGED
data/spec/dummy/config/routes.rb
CHANGED
data/spec/dummy/config/spring.rb
CHANGED
data/spec/dummy/db/seeds.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# typed: false
|
1
2
|
$:.push(File.expand_path('.', __dir__))
|
2
3
|
|
3
4
|
require 'kuby'
|
@@ -23,6 +24,7 @@ require 'support/docker/fake_cli'
|
|
23
24
|
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
24
25
|
|
25
26
|
Kuby.register_package(:fake_package)
|
27
|
+
Kuby.env = :production
|
26
28
|
|
27
29
|
module SpecHelpers
|
28
30
|
extend RSpec::SharedContext
|
@@ -69,6 +71,14 @@ module SpecHelpers
|
|
69
71
|
end
|
70
72
|
end
|
71
73
|
end
|
74
|
+
|
75
|
+
environment(:development) do
|
76
|
+
kubernetes do
|
77
|
+
configure_plugin(:rails_app) do
|
78
|
+
root File.expand_path(File.join(*%w(. dummy)), __dir__)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
72
82
|
end
|
73
83
|
|
74
84
|
docker = definition.environment.docker
|
data/spec/trailing_hash_spec.rb
CHANGED
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.
|
4
|
+
version: 0.11.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: 2020-
|
11
|
+
date: 2020-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -106,14 +106,14 @@ dependencies:
|
|
106
106
|
requirements:
|
107
107
|
- - "~>"
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: '0.
|
109
|
+
version: '0.4'
|
110
110
|
type: :runtime
|
111
111
|
prerelease: false
|
112
112
|
version_requirements: !ruby/object:Gem::Requirement
|
113
113
|
requirements:
|
114
114
|
- - "~>"
|
115
115
|
- !ruby/object:Gem::Version
|
116
|
-
version: '0.
|
116
|
+
version: '0.4'
|
117
117
|
- !ruby/object:Gem::Dependency
|
118
118
|
name: kuby-kube-db
|
119
119
|
requirement: !ruby/object:Gem::Requirement
|
@@ -170,6 +170,20 @@ dependencies:
|
|
170
170
|
- - "~>"
|
171
171
|
- !ruby/object:Gem::Version
|
172
172
|
version: '3.0'
|
173
|
+
- !ruby/object:Gem::Dependency
|
174
|
+
name: sorbet-runtime-stub
|
175
|
+
requirement: !ruby/object:Gem::Requirement
|
176
|
+
requirements:
|
177
|
+
- - "~>"
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
version: '0.2'
|
180
|
+
type: :runtime
|
181
|
+
prerelease: false
|
182
|
+
version_requirements: !ruby/object:Gem::Requirement
|
183
|
+
requirements:
|
184
|
+
- - "~>"
|
185
|
+
- !ruby/object:Gem::Version
|
186
|
+
version: '0.2'
|
173
187
|
- !ruby/object:Gem::Dependency
|
174
188
|
name: rspec
|
175
189
|
requirement: !ruby/object:Gem::Requirement
|
@@ -199,6 +213,7 @@ files:
|
|
199
213
|
- Rakefile
|
200
214
|
- bin/kuby
|
201
215
|
- kuby-core.gemspec
|
216
|
+
- lib/kuby-core.rb
|
202
217
|
- lib/kuby.rb
|
203
218
|
- lib/kuby/basic_logger.rb
|
204
219
|
- lib/kuby/cli_base.rb
|
@@ -214,6 +229,7 @@ files:
|
|
214
229
|
- lib/kuby/docker/credentials.rb
|
215
230
|
- lib/kuby/docker/debian.rb
|
216
231
|
- lib/kuby/docker/dev_spec.rb
|
232
|
+
- lib/kuby/docker/distro.rb
|
217
233
|
- lib/kuby/docker/dockerfile.rb
|
218
234
|
- lib/kuby/docker/errors.rb
|
219
235
|
- lib/kuby/docker/inline_layer.rb
|