harbr 0.0.99 → 0.0.101

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cbffb3011062bde3912b59d39f3920e1ac7e9b3146a30a1328e005db1bf6bd41
4
- data.tar.gz: 1e83520dcb131440bae5c1fef6d25c0859852789ef942bedd3944129a1773065
3
+ metadata.gz: c1b0d736611f71d1f376882c03ea536faf2405ffca07be97f0c893e7f39dbd40
4
+ data.tar.gz: fecba1d996d65db0e6e1e9a93a8360c84eaea30071a2386036a47faddbcd5100
5
5
  SHA512:
6
- metadata.gz: 15f772d3739ce48a8faf41ada860b03b67b3730a705ecaec575efccf3505df954be3f14b9d0086c63e5621940e12914d045c3f6624327a43fe40b3592251867d
7
- data.tar.gz: df37941a81158ae00ab144e97a89fc3768ecaf277238e2680e148deabc9db3ba38d22bf0210285fe99050a2349ebb85555e0bb47a212b542714debadf634da7a
6
+ metadata.gz: b1c0756b84b18ce019d4628d77e2c50c3c289082f9bb374bf2dc82c78b7fc383562a4f0341d4abbec07d942a795ce3e11a93fae34835103e375b4a007371d91e
7
+ data.tar.gz: 33b768b79aa12303da9ba3aa94ddfad7cfcfebac8a03bd6f50303221e2a82e45f2863599457a04047e28cb4131684ef9e93ed14ff279fbaf7bca718e8d553305
data/exe/harbr CHANGED
@@ -7,10 +7,10 @@ class HarbrCLI < Thor
7
7
  return puts "No containers available." if containers.empty?
8
8
 
9
9
  # Define headers based on Container attributes
10
- headers = ["Name", "Host Header", "IP", "Port"]
10
+ headers = ["Name", "Host Header", "IP", "Port", "Current Version", "Next Version", "Previous Version"]
11
11
 
12
12
  rows = containers.map do |container|
13
- [container.name, container.host_header, container.ip.nil? ? "127.0.0.1" : container.ip, container.port]
13
+ [container.name, container.host_header, container.ip.nil? ? "127.0.0.1" : container.ip, container.port.to_s, container.current_version, container.next_version, container.previous_version]
14
14
  end
15
15
 
16
16
  table = ::Terminal::Table.new(headings: headers, rows: rows)
@@ -1,7 +1,7 @@
1
1
  module Harbr
2
2
  class Container
3
3
  include Dddr::Entity
4
- attr_accessor :name, :host_header, :ip, :port
4
+ attr_accessor :name, :host_header, :ip, :port,:current_version, :next_version,:previous_version
5
5
 
6
6
  queries do
7
7
  def find_by_header(host_header)
data/lib/harbr/job.rb CHANGED
@@ -56,6 +56,7 @@ module Harbr
56
56
  container.host_header =host
57
57
  container.ip = "127.0.0.1"
58
58
  container.port = port
59
+ container.current_version = 0
59
60
  containers.create(container)
60
61
  else
61
62
  container.port = port
@@ -50,22 +50,16 @@ module Harbr
50
50
  puts "Traefik configuration written to /etc/traefik/harbr.toml"
51
51
  end
52
52
 
53
- def collate_containers(name,host,port)
53
+ def collate_containers(name,port, version)
54
54
 
55
55
  containers = Harbr::Container::Repository.new
56
- container = containers.find_by_header(host)
56
+ container = containers.find_by_name(name)
57
57
 
58
- if container.nil?
59
- container = Harbr::Container.new
60
- container.name = name
61
- container.host_header =host
62
- container.ip = "127.0.0.1"
63
- container.port = port
64
- containers.create(container)
65
- else
66
- container.port = port
67
- containers.update(container)
68
- end
58
+ container.port = port
59
+ container.next_version = version
60
+ container.previous_version = container.current_version
61
+ containers.update(container)
62
+
69
63
  containers.all
70
64
  end
71
65
 
@@ -201,7 +195,7 @@ module Harbr
201
195
  system "ln -sf /etc/sv/harbr/#{name}/next /etc/service/next.#{name}"
202
196
  system "sv restart next.#{name}"
203
197
 
204
- containers = collate_containers("next.#{name}","next.#{manifest.host}",port)
198
+ containers = collate_containers("next.#{name}",port,version)
205
199
  create_traefik_config(containers)
206
200
  end
207
201
 
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.0.99"
4
+ VERSION = "0.0.101"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: harbr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.99
4
+ version: 0.0.101
5
5
  platform: ruby
6
6
  authors:
7
7
  - Delaney Kuldvee Burke