harbr 0.1.78 → 0.1.79

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/harbr/job.rb +35 -34
  3. data/lib/harbr/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b4a65b911aa833cdf524c7c891b494b6e57692b4ade158d2ec91020c3d747a12
4
- data.tar.gz: 4c0aaafbfdcb5c2480d8f2696d343a915a4e5745c7742f5c872f78d9a65d6156
3
+ metadata.gz: 37b87fce15b28fc1fcb24fb58991bbaa6fbba945e322547791eccf2208af9416
4
+ data.tar.gz: 6aa9c0d7e8206ef7bf2332548430b6f7d0f61d553ca2ff13dd403f9636b1d63b
5
5
  SHA512:
6
- metadata.gz: 404516df35fae94ac5dc6a1f90253865290ddbdff59957baf20b106a6c23722b6600ba4ba0a0b5b5be477a40ab5fce6ff93d0a1e81df0ac1e1940e11b90c6f74
7
- data.tar.gz: 8f8c7ac1c97ca8fef9b936fb3c9a7644fcf5e2459d13601e4f2823b98300be607ac20f2047802dbe86b95c6e19f07426f9d8cfde95a0edb2082870178899d6b3
6
+ metadata.gz: 3ca12a0b31514c3e67781db39286a9021451b0bc2e1160179f0b30069a17d69c972f75de6a0506038613e133e2ecaae54db363222055f944686d59525f982058
7
+ data.tar.gz: 851bdb11d33038299231fc654181dfc73c1eaac4fd374e7ef46077e58b2b6b3b9b98ea2d0e90684a4a42e94d32cec827c94cd96df8654d9575d8d7118bdd0e39
data/lib/harbr/job.rb CHANGED
@@ -42,7 +42,7 @@ module Harbr
42
42
  def collate_containers(name, host, port, host_header_aliases = [])
43
43
  containers = Harbr::Container::Repository.new
44
44
  container = containers.find_by_header(host)
45
-
45
+
46
46
  if container.nil?
47
47
  container = Harbr::Container.new
48
48
  container.name = name
@@ -50,22 +50,23 @@ module Harbr
50
50
  container.ip = "127.0.0.1"
51
51
  container.port = port
52
52
  containers.create(container)
53
-
53
+
54
54
  else
55
55
  container.port = port
56
56
  containers.update(container)
57
57
  end
58
58
 
59
- host_header_aliases.each do |host_header_alias|
60
- container = Harbr::Container.new
61
- container.name = "#{name} -> #{host_header_alias}"
62
- container.host_header = host_header_alias
63
- container.ip = "127.0.0.1"
64
- container.port = port
65
- containers.create(container) unless containers.find_by_header(host_header_alias)
59
+ if host_header_alias
60
+ host_header_aliases.each do |host_header_alias|
61
+ container = Harbr::Container.new
62
+ container.name = "#{name} -> #{host_header_alias}"
63
+ container.host_header = host_header_alias
64
+ container.ip = "127.0.0.1"
65
+ container.port = port
66
+ containers.create(container) unless containers.find_by_header(host_header_alias)
67
+ end
66
68
  end
67
69
 
68
-
69
70
  containers.all
70
71
  end
71
72
 
@@ -146,14 +147,14 @@ module Harbr
146
147
 
147
148
  system "sv restart #{env}.#{name}" if env == "next"
148
149
  system "sv restart #{name}" if env == "current"
149
-
150
+
150
151
 
151
152
 
152
153
  puts "harbr: #{version} of #{name} in #{env} environment"
153
154
  end
154
155
 
155
156
  def bundle_install_if_needed(path)
156
-
157
+
157
158
  check_dir_exists(path)
158
159
 
159
160
  Dir.chdir(path) do
@@ -190,26 +191,26 @@ module Harbr
190
191
 
191
192
  end
192
193
 
193
-
194
+
194
195
  end
195
196
 
196
197
  def link_directories(name, version, env)
197
198
  if env == "next"
198
- `rm -f /etc/service/#{env}.#{name}`
199
- `rm -f /var/harbr/containers/#{name}/#{env}`
200
- `ln -sf /var/harbr/containers/#{name}/versions/#{version} /var/harbr/containers/#{name}/#{env}`
201
- `ln -sf /etc/sv/harbr/#{name}/#{env} /etc/service/#{env}.#{name}`
199
+ `rm -f /etc/service/#{env}.#{name}`
200
+ `rm -f /var/harbr/containers/#{name}/#{env}`
201
+ `ln -sf /var/harbr/containers/#{name}/versions/#{version} /var/harbr/containers/#{name}/#{env}`
202
+ `ln -sf /etc/sv/harbr/#{name}/#{env} /etc/service/#{env}.#{name}`
202
203
  end
203
204
 
204
205
  if env == "current"
205
-
206
- `rm -f /etc/service/#{name}`
207
- `rm -f /var/harbr/containers/#{name}/current`
208
206
 
209
- `ln -sf /var/harbr/containers/#{name}/versions/#{version} /var/harbr/containers/#{name}/current`
210
- `ln -sf /etc/sv/harbr/#{name} /etc/service/#{name}`
207
+ `rm -f /etc/service/#{name}`
208
+ `rm -f /var/harbr/containers/#{name}/current`
209
+
210
+ `ln -sf /var/harbr/containers/#{name}/versions/#{version} /var/harbr/containers/#{name}/current`
211
+ `ln -sf /etc/sv/harbr/#{name} /etc/service/#{name}`
211
212
  end
212
-
213
+
213
214
  end
214
215
 
215
216
  def sync_live_data_if_next(name)
@@ -228,27 +229,27 @@ module Harbr
228
229
 
229
230
  def run_script
230
231
  <<~SCRIPT
231
- #!/bin/sh
232
- exec 2>&1
233
- cd /var/harbr/containers/#{@container_name}/#{@env}
234
- exec ./exe/run #{@port} #{@env}
235
- echo "started #{@container_name} on port #{@port}"
232
+ #!/bin/sh
233
+ exec 2>&1
234
+ cd /var/harbr/containers/#{@container_name}/#{@env}
235
+ exec ./exe/run #{@port} #{@env}
236
+ echo "started #{@container_name} on port #{@port}"
236
237
  SCRIPT
237
238
  end
238
239
 
239
240
  def finish_script
240
241
  <<~SCRIPT
241
- #!/bin/sh
242
- lsof -i :#{@port} | awk 'NR!=1 {print $2}' | xargs kill
243
- echo "killed #{@container_name} on port #{@port}"
242
+ #!/bin/sh
243
+ lsof -i :#{@port} | awk 'NR!=1 {print $2}' | xargs kill
244
+ echo "killed #{@container_name} on port #{@port}"
244
245
  SCRIPT
245
246
  end
246
247
 
247
248
  def log_script
248
249
  <<~SCRIPT
249
- #!/bin/sh
250
- echo "starting log for #{@container_name} on port #{@port}"
251
- exec svlogd -tt /var/log/harbr/#{@container_name}/#{@env}/
250
+ #!/bin/sh
251
+ echo "starting log for #{@container_name} on port #{@port}"
252
+ exec svlogd -tt /var/log/harbr/#{@container_name}/#{@env}/
252
253
  SCRIPT
253
254
  end
254
255
  end
data/lib/harbr/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Harbr
4
- VERSION = "0.1.78"
4
+ VERSION = "0.1.79"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: harbr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.78
4
+ version: 0.1.79
5
5
  platform: ruby
6
6
  authors:
7
7
  - Delaney Kuldvee Burke
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-01-02 00:00:00.000000000 Z
11
+ date: 2024-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: listen