wslc-wip 0.2.0 → 0.3.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: bc4331f98464658b13ec0ac51737183931ce6ed5320d15cf64b2313b50aa7999
4
- data.tar.gz: 3d9cac0a97bd2abb2a0c30f5c5bc5a8c626320d900f4ac7cd46aca682368b56c
3
+ metadata.gz: aacee07e7929d736a13e1a7a4812a52155431b311913a4e5fa25409f6c772f60
4
+ data.tar.gz: 31de690c5b1040a9d0cb0c12890f20cf8d07f1d3d57e74d44140d8af30d7e0f0
5
5
  SHA512:
6
- metadata.gz: 8568791708d1e6b87b85c209568d47580daf0008253dc41b824c9a4377d35f08c2b1005a6082b7ab3eefeaf2cc7ead6ce8357a31047bc17dda0b9f6afcc70266
7
- data.tar.gz: 827d83e3244bc9269b12139f5e4554f7b0e2137b1a2a54ac3258799a2c531d355e9a3405ec4bbffff1b134b7b39cbcde0a13a1ba06df35f93cc995b45e4637b7
6
+ metadata.gz: 13e7a7c473c92063c6c9bc505ea72b03a8fab8269a6deb0ae2f27fb6309a2848477257b3d759b917eb2e6ddf86dc3b3144fbb98031e6548ece4ae2eaf14f166e
7
+ data.tar.gz: 494a24787a32f87479e8c984617e1928c54b43864b9a247da042281b138cd48795970e05ebb69b9805b31a8dd239a0c190f5554f9f427b29f81c1b9a42b669d9
data/README.md CHANGED
@@ -45,6 +45,8 @@ defaults:
45
45
  - "3000:3000"
46
46
  volumes:
47
47
  - ".:/app"
48
+ up:
49
+ command: server # `wip up` がコンテナ作成時にイメージへ渡す常駐コマンド(未指定ならイメージの既定 CMD)
48
50
  commands:
49
51
  rails:
50
52
  type: exec
@@ -82,7 +84,7 @@ commands:
82
84
  | `wip doctor` | WSL2、相互運用、WSLC、設定、アーキテクチャ、Git を診断 |
83
85
  | `wip config` | デフォルト適用済み設定(秘密値をマスク) |
84
86
  | `wip build -- --no-cache` | build 定義でイメージをビルド |
85
- | `wip up [-d]` | `defaults.container` を起動(無ければ作成)。`-d` でバックグラウンド実行 |
87
+ | `wip up [-d]` | `defaults.container` を起動(無ければ `up.command` 付きで作成)。`-d` でバックグラウンド実行 |
86
88
  | `wip down` | `defaults.container` を停止・削除 |
87
89
  | `wip exec [--no-interactive] COMMAND...` | 既存コンテナ内で実行 |
88
90
  | `wip run [--no-interactive] COMMAND...` | `--rm` の新規コンテナで実行 |
@@ -32,6 +32,8 @@ module Wip
32
32
  command << '-d' if detach
33
33
  command << '-it' if !detach && tty?(true)
34
34
  command.concat(options(values)).push(required(values, 'image'))
35
+ command.concat(Shellwords.split(@config.up_command.to_s)) if @config.up_command
36
+ command
35
37
  end
36
38
 
37
39
  def start(detach: false)
data/lib/wip/config.rb CHANGED
@@ -17,6 +17,7 @@ module Wip
17
17
  def wslc_command = @raw.dig('wslc', 'command') || 'auto'
18
18
  def commands = @raw['commands'] || {}
19
19
  def defaults = DEFAULTS.merge(@raw['defaults'] || {})
20
+ def up_command = @raw.dig('up', 'command')
20
21
 
21
22
  def command(name)
22
23
  entry = commands[name.to_s]
@@ -27,6 +28,7 @@ module Wip
27
28
 
28
29
  def to_h(redact: true)
29
30
  value = { 'version' => 1, 'wslc' => { 'command' => wslc_command }, 'defaults' => defaults,
31
+ 'up' => { 'command' => up_command },
30
32
  'commands' => commands.transform_values { |entry| defaults.merge('type' => 'exec').merge(entry) } }
31
33
  redact ? redact_secrets(value) : value
32
34
  end
@@ -36,6 +38,7 @@ module Wip
36
38
  def validate!
37
39
  raise ConfigError, "Unsupported configuration version: #{@raw['version']}" unless (@raw['version'] || 1) == 1
38
40
  raise ConfigError, 'commands must be a mapping' unless commands.is_a?(Hash)
41
+ raise ConfigError, 'up must be a mapping' if @raw.key?('up') && !@raw['up'].is_a?(Hash)
39
42
 
40
43
  commands.each { |name, entry| validate_command!(name, entry) }
41
44
  end
data/lib/wip/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Wip
4
- VERSION = '0.2.0'
4
+ VERSION = '0.3.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wslc-wip
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wip contributors