prick 0.39.6 → 0.39.7

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: 75169887ecaae27780bfc25f2aeb21c4f83362c698f855033eacfb02768b1fbd
4
- data.tar.gz: 23fa69d844aab5f9c1d9198d9ca5c016d96729e5fd6ad884438364b653384e10
3
+ metadata.gz: 7d27db668e8163dce24bb6c7548f5332a5f5e8c72ee4a5e266b10a032a06b782
4
+ data.tar.gz: c3e293fec4e73625c45e28198f112a52cef7d83816274ca3a63231cfc6746c28
5
5
  SHA512:
6
- metadata.gz: da581962a6423ee34d43cc879c718350d1b02bc963efba126037d98f598664f9570c1bff8dccd38372c0e0b162bf3bb8a0e6fe7cd2e1a2fbe32d955a4a6a1695
7
- data.tar.gz: 3c135facadbffa2c1c4b8a5f348d4b78584d01657d6c543d5c5453a3fc4f6b4cfc6f29de259df279ec4c4b16bf4f84681db055fdb13b63339d17e5460871e491
6
+ metadata.gz: 02fcb89d65a6c99e95b9263266c84353eac7a572a6338bcabde51d699377a4c32161dd785ef1b9ccdd16f58ba85e92174ba09e086eda7fd11426449d30c2fa2e
7
+ data.tar.gz: 7079b45ddf107b13c1ea22e131ea580c16c9e3378fc0f0ff3e1eb22b8b0e8b3c22a61e3732efb1f58180a29fc97d5453a0ff2a96cec2c4d3ac1a5083948a8e97
@@ -1,7 +1,7 @@
1
1
 
2
2
  module Fmt
3
3
  # Print table
4
- def self.puts_table(headers, table)
4
+ def self.puts_table(headers, table, bold: nil)
5
5
  widths = headers.map(&:size)
6
6
  signs = []
7
7
  types = []
@@ -58,8 +58,10 @@ module Fmt
58
58
  }
59
59
  puts
60
60
 
61
- for row in table
61
+ table.each.with_index { |row, rownum|
62
62
  # for index, sign, width, type, value in signs.zip(indexes, signs, widths, types, row) # FIXME doesn't work?
63
+ print "\033[1m" if rownum == bold
64
+
63
65
  for i in (0...headers.size)
64
66
  index, sign, width, type, value = indexes[i], signs[i], widths[i], types[i], row[i]
65
67
 
@@ -92,8 +94,8 @@ module Fmt
92
94
  printf "%#{sign}#{width}#{type} ", "#{value}"
93
95
  end
94
96
  end
95
- puts
96
- end
97
+ puts (rownum == bold ? "\033[0m" : "")
98
+ }
97
99
  end
98
100
  end
99
101
 
@@ -50,6 +50,7 @@ module Prick::SubCommand
50
50
  git_rev = Git.id[0...8]
51
51
 
52
52
  rows = []
53
+ current_database_row = nil
53
54
  Prick.databases { |database, conn|
54
55
  row = conn.record(%(
55
56
  select
@@ -58,6 +59,12 @@ module Prick::SubCommand
58
59
  from prick.versions
59
60
  ))
60
61
 
62
+ # Detect is this is the current database
63
+ if Prick.state.database == database
64
+ is_current_database = true
65
+ current_database_row = rows.size
66
+ end
67
+
61
68
  if row[:success]
62
69
  clean = row[:clean]
63
70
  same_revision = row[:branch] == git_branch && row[:rev] == git_rev
@@ -84,12 +91,13 @@ module Prick::SubCommand
84
91
  row[:built_at] = row[:built_at]&.strftime("%Y-%m-%d %H:%M")
85
92
 
86
93
  # Add current database marker
87
- last_column = (Prick.state.database == database ? "*" : "")
94
+ last_column = (is_current_database ? "*" : "")
95
+
88
96
  rows << row.values + [last_column]
89
97
  }
90
98
 
91
99
  headers = %w(database project version branch rev clean environment built success state) + [" "]
92
- Fmt.puts_table(headers, rows)
100
+ Fmt.puts_table(headers, rows, bold: current_database_row)
93
101
  end
94
102
  end
95
103
 
data/lib/prick/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Prick
4
- VERSION = "0.39.6"
4
+ VERSION = "0.39.7"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prick
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.39.6
4
+ version: 0.39.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claus Rasmussen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-07-19 00:00:00.000000000 Z
11
+ date: 2024-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: semantic