dry-stack 0.1.15 → 0.1.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/dry-stack/stack.rb +14 -13
  3. data/lib/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1fdde5aef97bb0e9cd381fe8fb9191b7a4dcb3fcbb2a93daa8dc92dc09b7d8cd
4
- data.tar.gz: d8205d27f505739e7dd7316170b98f2924c7cf700910ad5c5cf2e92376f68015
3
+ metadata.gz: b5ebf65f6db6234c39d5bfe0b4b6c0be4dc1a2528a361a497b3aa80d093b3e02
4
+ data.tar.gz: 823bc35c24d568a2c76b4ed921e13e2ed6c9779a1deab5abcf22cc54bb97bc58
5
5
  SHA512:
6
- metadata.gz: '082bc6ed927bd5e5946c63faf531377fb3df998bafae31bd407a61256bf9a28166c78eb3b69a1e5988c6d1dec93405cc2c26a1feb6185f4d92b7261acad53748'
7
- data.tar.gz: 7519e0d150a5dd434775ad88d249312d114c9229e3049c60d62f2cd8f9ba18f0889ad7929e6456bcf0851c207e80f37352f17cd36a1d0183d36eba72acc6b382
6
+ metadata.gz: 0eb24c92c82d33345308c66f430ffce14cad8fc841c212c9f9927f13c3273c9d66eff66f9dffe25ca7aad43e26a10b5cedda1fef1572b45ac23875490497e03c
7
+ data.tar.gz: 829f7596fda69391400a2166256632c2e4b5516cf6b07ae445a7c7eb49c24c90e8df80cc9558424b2dc9d3e6f36a33fc0e2abb56eb82be89fac18f262dd17a30
@@ -41,6 +41,19 @@ module Dry
41
41
  end
42
42
  end
43
43
 
44
+ def expand_hash(hash)
45
+ hash.select { _1.to_s =~ /\./ }.each do |k, v|
46
+ name = k.to_s.scan(/([^\.]*)\.(.*)/).flatten
47
+ hash.delete k
48
+ hash[name[0]] ||= {}
49
+ hash[name[0]][name[1]] ||= {}
50
+ hash[name[0]][name[1]].merge! v if v.is_a?(Hash)
51
+ hash[name[0]][name[1]] = v unless v.is_a?(Hash)
52
+ end
53
+ hash.each { expand_hash(_2) if _2.is_a?(Hash) }
54
+ hash
55
+ end
56
+
44
57
  attr_accessor :cmd_params
45
58
  @cmd_params = {}
46
59
 
@@ -64,6 +77,7 @@ module Dry
64
77
  def command(cmd)= @service[:command] = cmd
65
78
  def entrypoint(cmd)= @service[:entrypoint] = cmd
66
79
  def deploy_label(str)= @service[:deploy][:labels] << str
80
+ def deploy(opts)=@service[:deploy].merge! expand_hash(opts)
67
81
  def config(name = nil, opts)= (@service[:configs] ||= []) << {source: name.to_s}.merge(opts)
68
82
  def logging(opts) = (@service[:logging] ||= {}).merge! opts
69
83
  def user(user) = @service[:user] = user # "${UID}:${GID}", "www-data:www-data"
@@ -106,19 +120,6 @@ module Dry
106
120
  @configurations = {}
107
121
  end
108
122
 
109
- def expand_hash(hash)
110
- hash.select { _1.to_s =~ /\./ }.each do |k, v|
111
- name = k.to_s.scan(/([^\.]*)\.(.*)/).flatten
112
- hash.delete k
113
- hash[name[0]] ||= {}
114
- hash[name[0]][name[1]] ||= {}
115
- hash[name[0]][name[1]].merge! v if v.is_a?(Hash)
116
- hash[name[0]][name[1]] = v unless v.is_a?(Hash)
117
- end
118
- hash.each { expand_hash(_2) if _2.is_a?(Hash) }
119
- hash
120
- end
121
-
122
123
  def nginx_host2regexp(str)
123
124
  # http://nginx.org/en/docs/http/server_names.html
124
125
  if str[0] == '~'
data/lib/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Dry
2
2
  class Stack
3
- VERSION = '0.1.15'
3
+ VERSION = '0.1.16'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-stack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.15
4
+ version: 0.1.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artyom B
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-05 00:00:00.000000000 Z
11
+ date: 2024-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake