hellgrid 0.4.0 → 0.6.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 +4 -4
- data/Gemfile +2 -0
- data/Gemfile.lock +15 -15
- data/README.md +19 -2
- data/bin/hellgrid +1 -0
- data/exe/hellgrid +1 -0
- data/hellgrid.gemspec +14 -4
- data/lib/hellgrid/cli.rb +9 -2
- data/lib/hellgrid/matrix.rb +5 -3
- data/lib/hellgrid/project.rb +4 -2
- data/lib/hellgrid/version.rb +3 -1
- data/lib/hellgrid/views/console.rb +4 -4
- data/lib/hellgrid.rb +2 -0
- data/spec/hellgrid/matrix_spec.rb +84 -55
- data/spec/hellgrid/project_spec.rb +32 -30
- data/spec/hellgrid/views/console_spec.rb +20 -16
- data/spec/hellgrid_spec.rb +104 -87
- data/spec/spec_helper.rb +3 -1
- metadata +6 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0f138a05d08063ddc1d002fbf3d7d195e96207c564b2ff73adaa3b668be48b8
|
4
|
+
data.tar.gz: b450c6cee8da0a0cc7ff7c9581257a9613f2ddf4a501d5dd3bba72fd78f16818
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '083415ebc8dcae4086b35643caf0f9bc00dd2dc3afd7e7c122802a6d2ce99c9118f5cfd62fe1456d1cf6a3ae0bfc436434e9d55c51dad3699f3674e84160c4d5'
|
7
|
+
data.tar.gz: dea3e5793165bb105f95be2b1bde34a46e7107cd9a25d6c6ef88384ed0877031886a76377e91ee34b79af2ced35ba605efbb87dbdf690536c2e59e6da9d06300
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,26 +1,26 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
hellgrid (0.
|
4
|
+
hellgrid (0.6.0)
|
5
5
|
bundler (>= 1.11.0, < 3)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
diff-lcs (1.
|
11
|
-
rspec (3.
|
12
|
-
rspec-core (~> 3.
|
13
|
-
rspec-expectations (~> 3.
|
14
|
-
rspec-mocks (~> 3.
|
15
|
-
rspec-core (3.
|
16
|
-
rspec-support (~> 3.
|
17
|
-
rspec-expectations (3.
|
10
|
+
diff-lcs (1.6.0)
|
11
|
+
rspec (3.13.0)
|
12
|
+
rspec-core (~> 3.13.0)
|
13
|
+
rspec-expectations (~> 3.13.0)
|
14
|
+
rspec-mocks (~> 3.13.0)
|
15
|
+
rspec-core (3.13.3)
|
16
|
+
rspec-support (~> 3.13.0)
|
17
|
+
rspec-expectations (3.13.3)
|
18
18
|
diff-lcs (>= 1.2.0, < 2.0)
|
19
|
-
rspec-support (~> 3.
|
20
|
-
rspec-mocks (3.
|
19
|
+
rspec-support (~> 3.13.0)
|
20
|
+
rspec-mocks (3.13.2)
|
21
21
|
diff-lcs (>= 1.2.0, < 2.0)
|
22
|
-
rspec-support (~> 3.
|
23
|
-
rspec-support (3.
|
22
|
+
rspec-support (~> 3.13.0)
|
23
|
+
rspec-support (3.13.2)
|
24
24
|
|
25
25
|
PLATFORMS
|
26
26
|
ruby
|
@@ -28,7 +28,7 @@ PLATFORMS
|
|
28
28
|
|
29
29
|
DEPENDENCIES
|
30
30
|
hellgrid!
|
31
|
-
rspec (~> 3.
|
31
|
+
rspec (~> 3.13)
|
32
32
|
|
33
33
|
BUNDLED WITH
|
34
|
-
2.
|
34
|
+
2.6.2
|
data/README.md
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
Utility which will output a table containing gem versions used across your projects.
|
4
4
|
|
5
5
|
[](https://github.com/FundingCircle/hellgrid/actions/workflows/build-and-test.yml)
|
6
|
+
[](https://badge.fury.io/rb/hellgrid)
|
6
7
|
|
7
8
|
## Install
|
8
9
|
|
@@ -15,12 +16,14 @@ gem install hellgrid
|
|
15
16
|
Let say that you have a directory `/path/to/root/dir` somewhere in which the Ruby projects `foo` and `bar` could be found.
|
16
17
|
|
17
18
|
Executing:
|
19
|
+
|
18
20
|
```bash
|
19
21
|
hellgrid /path/to/root/dir
|
20
22
|
```
|
21
23
|
|
22
24
|
To search recursively (should you have nested projects), use the `-r ` flag:
|
23
|
-
|
25
|
+
|
26
|
+
```bash
|
24
27
|
hellgrid -r /path/to/root/dir
|
25
28
|
```
|
26
29
|
|
@@ -35,7 +38,21 @@ Should result in:
|
|
35
38
|
rspec-mocks | 2.0.0 | 3.0.4
|
36
39
|
rake | 10.0.0 | 11.1.0
|
37
40
|
rspec-support | x | 3.0.4
|
38
|
-
|
41
|
+
```
|
42
|
+
|
43
|
+
To have the gems as columns, use the `-t` flag:
|
44
|
+
|
45
|
+
```bash
|
46
|
+
hellgrid -t /path/to/root/dir
|
47
|
+
```
|
48
|
+
|
49
|
+
Should result in:
|
50
|
+
|
51
|
+
```bash
|
52
|
+
x | diff-lcs | rake | rspec | rspec-core | rspec-expectations | rspec-mocks | rspec-support
|
53
|
+
--------+----------+--------+-------+------------+--------------------+-------------+---------------
|
54
|
+
bar | 1.2.5 | 10.0.0 | 2.0.0 | 2.0.0 | 2.0.0 | 2.0.0 | x
|
55
|
+
foo | 1.2.5 | 11.1.0 | 3.0.0 | 3.0.4 | 3.0.4 | 3.0.4 | 3.0.4
|
39
56
|
```
|
40
57
|
|
41
58
|
## License
|
data/bin/hellgrid
CHANGED
data/exe/hellgrid
CHANGED
data/hellgrid.gemspec
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
project_root = File.dirname(__FILE__)
|
2
4
|
lib = File.join(project_root, 'lib')
|
3
5
|
|
@@ -11,15 +13,23 @@ Gem::Specification.new do |s|
|
|
11
13
|
s.description = 'Display gem versions used across your projects in a table'
|
12
14
|
s.authors = ['Deyan Dobrinov', 'Aleksandar Ivanov']
|
13
15
|
s.email = ['engineering+hellgrid@fundingcircle.com']
|
14
|
-
s.files = Dir.chdir(project_root)
|
16
|
+
s.files = Dir.chdir(project_root) do
|
17
|
+
Dir['lib/**/*.rb'] +
|
18
|
+
Dir['bin/*'] +
|
19
|
+
Dir['exe/*'] +
|
20
|
+
Dir['spec/**/*.rb'] +
|
21
|
+
%w[Gemfile Gemfile.lock README.md hellgrid.gemspec]
|
22
|
+
end
|
15
23
|
s.bindir = 'exe'
|
16
|
-
s.executables = s.files.grep(
|
17
|
-
s.test_files = s.files.grep(
|
24
|
+
s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
25
|
+
s.test_files = s.files.grep(%r{^spec/})
|
18
26
|
s.require_paths = ['lib']
|
19
27
|
s.homepage = 'https://github.com/FundingCircle/hellgrid'
|
20
28
|
s.license = 'BSD-3-Clause'
|
21
29
|
|
30
|
+
s.required_ruby_version = '>= 3.1.0'
|
31
|
+
|
22
32
|
s.add_runtime_dependency 'bundler', '>= 1.11.0', '< 3'
|
23
33
|
|
24
|
-
s.add_development_dependency 'rspec', '~> 3.
|
34
|
+
s.add_development_dependency 'rspec', '~> 3.13'
|
25
35
|
end
|
data/lib/hellgrid/cli.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Hellgrid
|
2
4
|
class CLI
|
3
5
|
def self.start(argv = ARGV)
|
@@ -11,7 +13,9 @@ module Hellgrid
|
|
11
13
|
attr_reader :argv
|
12
14
|
|
13
15
|
def start
|
14
|
-
recursive_search =
|
16
|
+
recursive_search = !argv.delete('-r').nil?
|
17
|
+
transpose = !argv.delete('-t').nil?
|
18
|
+
|
15
19
|
folders = argv.empty? ? [Dir.pwd] : argv
|
16
20
|
|
17
21
|
folders.each do |folder|
|
@@ -24,7 +28,10 @@ module Hellgrid
|
|
24
28
|
end
|
25
29
|
end
|
26
30
|
|
27
|
-
|
31
|
+
data = matrix.sorted_by_most_used
|
32
|
+
data = data.transpose if transpose
|
33
|
+
|
34
|
+
view = Hellgrid::Views::Console.new(data)
|
28
35
|
|
29
36
|
view.render
|
30
37
|
end
|
data/lib/hellgrid/matrix.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Hellgrid
|
2
4
|
class Matrix
|
3
5
|
attr_reader :projects
|
@@ -11,7 +13,7 @@ module Hellgrid
|
|
11
13
|
end
|
12
14
|
|
13
15
|
def projects_sorted_by_name
|
14
|
-
@projects.sort { |a,b| a.name <=> b.name }
|
16
|
+
@projects.sort { |a, b| a.name <=> b.name }
|
15
17
|
end
|
16
18
|
|
17
19
|
def project_names
|
@@ -36,12 +38,12 @@ module Hellgrid
|
|
36
38
|
gem_usage = Hash.new(0)
|
37
39
|
|
38
40
|
projects.each do |project|
|
39
|
-
project.dependency_matrix.
|
41
|
+
project.dependency_matrix.each_key do |gem|
|
40
42
|
gem_usage[gem] += 1
|
41
43
|
end
|
42
44
|
end
|
43
45
|
|
44
|
-
gem_usage.sort_by {|key, value| [-value, key] }.to_h
|
46
|
+
gem_usage.sort_by { |key, value| [-value, key] }.to_h
|
45
47
|
end
|
46
48
|
end
|
47
49
|
end
|
data/lib/hellgrid/project.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Hellgrid
|
2
4
|
class Project
|
3
5
|
attr_reader :path
|
@@ -8,11 +10,11 @@ module Hellgrid
|
|
8
10
|
end
|
9
11
|
|
10
12
|
def name
|
11
|
-
File.expand_path(path).gsub(File.expand_path(root)
|
13
|
+
File.expand_path(path).gsub("#{File.expand_path(root)}/", '')
|
12
14
|
end
|
13
15
|
|
14
16
|
def dependency_matrix
|
15
|
-
@dependency_matrix ||= specs.inject(
|
17
|
+
@dependency_matrix ||= specs.inject({}) { |h, spec| h.merge!(spec.name.to_s => spec.version.version) }
|
16
18
|
end
|
17
19
|
|
18
20
|
private
|
data/lib/hellgrid/version.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Hellgrid
|
2
4
|
module Views
|
3
5
|
class Console
|
@@ -21,7 +23,7 @@ module Hellgrid
|
|
21
23
|
string << row_as_string(row)
|
22
24
|
end
|
23
25
|
|
24
|
-
string.join("\n")
|
26
|
+
"#{string.join("\n")}\n"
|
25
27
|
end
|
26
28
|
|
27
29
|
private
|
@@ -35,9 +37,7 @@ module Hellgrid
|
|
35
37
|
|
36
38
|
matrix.each do |row|
|
37
39
|
row.each_with_index do |value, col_i|
|
38
|
-
if value && (widths[col_i] < value.size)
|
39
|
-
widths[col_i] = value.size
|
40
|
-
end
|
40
|
+
widths[col_i] = value.size if value && (widths[col_i] < value.size)
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
data/lib/hellgrid.rb
CHANGED
@@ -1,71 +1,90 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe Hellgrid::Matrix do
|
4
6
|
subject(:matrix) { described_class.new }
|
5
|
-
let(:project) { [] }
|
6
7
|
|
7
|
-
|
8
|
-
|
8
|
+
def stub_project(name: 'foo', dependency_matrix: {})
|
9
|
+
instance_double(Hellgrid::Project, name:, dependency_matrix:)
|
10
|
+
end
|
9
11
|
|
12
|
+
describe '#add_project' do
|
10
13
|
it 'adds a project' do
|
11
14
|
expect do
|
12
|
-
matrix.add_project(
|
15
|
+
matrix.add_project(stub_project)
|
13
16
|
end.to change { matrix.projects.count }.by(1)
|
14
17
|
end
|
15
18
|
end
|
16
19
|
|
17
20
|
describe '#project_names' do
|
18
21
|
it 'returns project names' do
|
19
|
-
matrix.add_project(
|
20
|
-
matrix.add_project(
|
22
|
+
matrix.add_project(stub_project(name: 'foo'))
|
23
|
+
matrix.add_project(stub_project(name: 'bar'))
|
21
24
|
|
22
|
-
expect(matrix.project_names).to eq([
|
25
|
+
expect(matrix.project_names).to eq(%w[bar foo])
|
23
26
|
end
|
24
27
|
end
|
25
28
|
|
26
29
|
describe '#gem_names' do
|
27
30
|
it 'returns gem names' do
|
28
|
-
matrix.add_project(
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
31
|
+
matrix.add_project(
|
32
|
+
stub_project(
|
33
|
+
dependency_matrix: {
|
34
|
+
'a' => '1.0.1',
|
35
|
+
'b' => '2.0.1',
|
36
|
+
'c' => '3.0.1'
|
37
|
+
}
|
38
|
+
)
|
39
|
+
)
|
40
|
+
|
41
|
+
matrix.add_project(
|
42
|
+
stub_project(
|
43
|
+
dependency_matrix: {
|
44
|
+
'b' => '2.0.2',
|
45
|
+
'c' => '3.0.2',
|
46
|
+
'd' => '4.0.2'
|
47
|
+
}
|
48
|
+
)
|
49
|
+
)
|
50
|
+
|
51
|
+
expect(matrix.gem_names).to eq(%w[a b c d])
|
41
52
|
end
|
42
53
|
end
|
43
54
|
|
44
55
|
describe '#gems_by_usage' do
|
45
56
|
before do
|
46
|
-
matrix.add_project(
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
+
matrix.add_project(
|
58
|
+
stub_project(
|
59
|
+
dependency_matrix: {
|
60
|
+
'a' => '1.0.1',
|
61
|
+
'b' => '2.0.1',
|
62
|
+
'c' => '3.0.1'
|
63
|
+
}
|
64
|
+
)
|
65
|
+
)
|
66
|
+
|
67
|
+
matrix.add_project(
|
68
|
+
stub_project(
|
69
|
+
dependency_matrix: {
|
70
|
+
'b' => '2.0.2',
|
71
|
+
'c' => '3.0.2',
|
72
|
+
'd' => '4.0.2'
|
73
|
+
}
|
74
|
+
)
|
75
|
+
)
|
57
76
|
end
|
58
77
|
|
59
78
|
it 'returns an array' do
|
60
79
|
expect(matrix.gems_by_usage).to be_a(Hash)
|
61
80
|
end
|
62
81
|
|
63
|
-
it 'returns ordered
|
82
|
+
it 'returns ordered' do
|
64
83
|
expected_result = {
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
84
|
+
'b' => 2,
|
85
|
+
'c' => 2,
|
86
|
+
'a' => 1,
|
87
|
+
'd' => 1
|
69
88
|
}
|
70
89
|
|
71
90
|
expect(matrix.gems_by_usage).to eq(expected_result)
|
@@ -73,9 +92,9 @@ describe Hellgrid::Matrix do
|
|
73
92
|
end
|
74
93
|
|
75
94
|
describe '#projects_sorted_by_name' do
|
76
|
-
let(:project_a) {
|
77
|
-
let(:project_b) {
|
78
|
-
let(:project_c) {
|
95
|
+
let(:project_a) { stub_project(name: 'a') }
|
96
|
+
let(:project_b) { stub_project(name: 'b') }
|
97
|
+
let(:project_c) { stub_project(name: 'c') }
|
79
98
|
|
80
99
|
before do
|
81
100
|
matrix.add_project(project_b)
|
@@ -92,26 +111,36 @@ describe Hellgrid::Matrix do
|
|
92
111
|
|
93
112
|
describe '#sorted_by_most_used' do
|
94
113
|
before do
|
95
|
-
matrix.add_project(
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
114
|
+
matrix.add_project(
|
115
|
+
stub_project(
|
116
|
+
name: 'foo',
|
117
|
+
dependency_matrix: {
|
118
|
+
'a' => '1.0.1',
|
119
|
+
'b' => '2.0.1',
|
120
|
+
'c' => '3.0.1'
|
121
|
+
}
|
122
|
+
)
|
123
|
+
)
|
124
|
+
|
125
|
+
matrix.add_project(
|
126
|
+
stub_project(
|
127
|
+
name: 'bar',
|
128
|
+
dependency_matrix: {
|
129
|
+
'b' => '2.0.2',
|
130
|
+
'c' => '3.0.2',
|
131
|
+
'd' => '4.0.2'
|
132
|
+
}
|
133
|
+
)
|
134
|
+
)
|
106
135
|
end
|
107
136
|
|
108
137
|
it 'returns matrix' do
|
109
138
|
expected_result = [
|
110
|
-
[
|
111
|
-
[
|
112
|
-
[
|
113
|
-
[
|
114
|
-
[
|
139
|
+
[nil, 'bar', 'foo'],
|
140
|
+
['b', '2.0.2', '2.0.1'],
|
141
|
+
['c', '3.0.2', '3.0.1'],
|
142
|
+
['a', nil, '1.0.1'],
|
143
|
+
['d', '4.0.2', nil]
|
115
144
|
]
|
116
145
|
|
117
146
|
expect(matrix.sorted_by_most_used).to eq(expected_result)
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe Hellgrid::Project do
|
@@ -10,33 +12,33 @@ describe Hellgrid::Project do
|
|
10
12
|
before do
|
11
13
|
delete_tmp_folder
|
12
14
|
|
13
|
-
create_file lockfile_path,
|
14
|
-
GEM
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
15
|
+
create_file lockfile_path, <<~FOO_GEMFILE
|
16
|
+
GEM
|
17
|
+
remote: https://rubygems.org/
|
18
|
+
specs:
|
19
|
+
diff-lcs (1.2.5)
|
20
|
+
rake (11.1.0)
|
21
|
+
rspec (3.0.0)
|
22
|
+
rspec-core (~> 3.0.0)
|
23
|
+
rspec-expectations (~> 3.0.0)
|
24
|
+
rspec-mocks (~> 3.0.0)
|
25
|
+
rspec-core (3.0.4)
|
26
|
+
rspec-support (~> 3.0.0)
|
27
|
+
rspec-expectations (3.0.4)
|
28
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
29
|
+
rspec-support (~> 3.0.0)
|
30
|
+
rspec-mocks (3.0.4)
|
31
|
+
rspec-support (~> 3.0.0)
|
32
|
+
rspec-support (3.0.4)
|
31
33
|
|
32
|
-
PLATFORMS
|
33
|
-
|
34
|
+
PLATFORMS
|
35
|
+
ruby
|
34
36
|
|
35
|
-
DEPENDENCIES
|
36
|
-
|
37
|
-
|
37
|
+
DEPENDENCIES
|
38
|
+
rake (= 11.1.0)
|
39
|
+
rspec (= 3.0.0)
|
38
40
|
|
39
|
-
FOO_GEMFILE
|
41
|
+
FOO_GEMFILE
|
40
42
|
end
|
41
43
|
|
42
44
|
describe '#name' do
|
@@ -52,13 +54,13 @@ FOO_GEMFILE
|
|
52
54
|
|
53
55
|
it 'returns dependencies' do
|
54
56
|
expected_result = {
|
55
|
-
'diff-lcs'
|
56
|
-
'rake'
|
57
|
-
'rspec'
|
58
|
-
'rspec-core'
|
57
|
+
'diff-lcs' => '1.2.5',
|
58
|
+
'rake' => '11.1.0',
|
59
|
+
'rspec' => '3.0.0',
|
60
|
+
'rspec-core' => '3.0.4',
|
59
61
|
'rspec-expectations' => '3.0.4',
|
60
|
-
'rspec-mocks'
|
61
|
-
'rspec-support'
|
62
|
+
'rspec-mocks' => '3.0.4',
|
63
|
+
'rspec-support' => '3.0.4'
|
62
64
|
}
|
63
65
|
|
64
66
|
expect(subject.dependency_matrix).to eq(expected_result)
|
@@ -1,26 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe Hellgrid::Views::Console do
|
4
|
-
subject(:console)
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
subject(:console) do
|
7
|
+
described_class.new(
|
8
|
+
[
|
9
|
+
[nil, 'bar', 'foo'],
|
10
|
+
['b', '2.0.2', '2.0.1'],
|
11
|
+
['c', '3.0.2', '3.0.1'],
|
12
|
+
['a', nil, '1.0.1'],
|
13
|
+
['d', '4.0.2', nil]
|
14
|
+
]
|
15
|
+
)
|
12
16
|
end
|
13
17
|
|
14
18
|
describe '#render_as_string' do
|
15
19
|
it 'renders matrix' do
|
16
|
-
expected_result =
|
17
|
-
|
18
|
-
---+-------+-------
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
TABLE
|
20
|
+
expected_result = <<~TABLE
|
21
|
+
x | bar | foo#{' '}
|
22
|
+
---+-------+-------
|
23
|
+
b | 2.0.2 | 2.0.1#{' '}
|
24
|
+
c | 3.0.2 | 3.0.1#{' '}
|
25
|
+
a | x | 1.0.1#{' '}
|
26
|
+
d | 4.0.2 | x#{' '}
|
27
|
+
TABLE
|
24
28
|
|
25
29
|
expect(console.render_as_string).to eq(expected_result)
|
26
30
|
end
|
data/spec/hellgrid_spec.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe 'bin/hellgrid' do
|
@@ -12,89 +14,89 @@ describe 'bin/hellgrid' do
|
|
12
14
|
before do
|
13
15
|
delete_tmp_folder
|
14
16
|
|
15
|
-
create_file 'spec/tmp/in/foo/Gemfile.lock',
|
16
|
-
GEM
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
PLATFORMS
|
35
|
-
|
36
|
-
|
37
|
-
DEPENDENCIES
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
FOO_GEMFILE
|
42
|
-
|
43
|
-
create_file 'spec/tmp/bar/Gemfile.lock',
|
44
|
-
GEM
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
PLATFORMS
|
61
|
-
|
62
|
-
|
63
|
-
DEPENDENCIES
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
BAR_GEMFILE
|
17
|
+
create_file 'spec/tmp/in/foo/Gemfile.lock', <<~FOO_GEMFILE
|
18
|
+
GEM
|
19
|
+
remote: https://rubygems.org/
|
20
|
+
specs:
|
21
|
+
diff-lcs (1.2.5)
|
22
|
+
rake (11.1.0)
|
23
|
+
rspec (3.0.0)
|
24
|
+
rspec-core (~> 3.0.0)
|
25
|
+
rspec-expectations (~> 3.0.0)
|
26
|
+
rspec-mocks (~> 3.0.0)
|
27
|
+
rspec-core (3.0.4)
|
28
|
+
rspec-support (~> 3.0.0)
|
29
|
+
rspec-expectations (3.0.4)
|
30
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
31
|
+
rspec-support (~> 3.0.0)
|
32
|
+
rspec-mocks (3.0.4)
|
33
|
+
rspec-support (~> 3.0.0)
|
34
|
+
rspec-support (3.0.4)
|
35
|
+
|
36
|
+
PLATFORMS
|
37
|
+
ruby
|
38
|
+
|
39
|
+
DEPENDENCIES
|
40
|
+
rake (= 11.1.0)
|
41
|
+
rspec (= 3.0.0)
|
42
|
+
|
43
|
+
FOO_GEMFILE
|
44
|
+
|
45
|
+
create_file 'spec/tmp/bar/Gemfile.lock', <<~BAR_GEMFILE
|
46
|
+
GEM
|
47
|
+
remote: https://rubygems.org/
|
48
|
+
specs:
|
49
|
+
diff-lcs (1.2.5)
|
50
|
+
rake (10.0.0)
|
51
|
+
rspec (2.0.0)
|
52
|
+
rspec-core (= 2.0.0)
|
53
|
+
rspec-expectations (= 2.0.0)
|
54
|
+
rspec-mocks (= 2.0.0)
|
55
|
+
rspec-core (2.0.0)
|
56
|
+
rspec-expectations (2.0.0)
|
57
|
+
diff-lcs (>= 1.1.2)
|
58
|
+
rspec-mocks (2.0.0)
|
59
|
+
rspec-core (= 2.0.0)
|
60
|
+
rspec-expectations (= 2.0.0)
|
61
|
+
|
62
|
+
PLATFORMS
|
63
|
+
ruby
|
64
|
+
|
65
|
+
DEPENDENCIES
|
66
|
+
rake (= 10.0.0)
|
67
|
+
rspec (= 2.0.0)
|
68
|
+
|
69
|
+
BAR_GEMFILE
|
68
70
|
end
|
69
71
|
|
70
72
|
it 'returns a matrix with the versions of all used gems' do
|
71
|
-
expected_result =
|
72
|
-
|
73
|
-
--------------------+--------+--------
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
TABLE
|
73
|
+
expected_result = <<~TABLE
|
74
|
+
x | bar | in/foo#{' '}
|
75
|
+
--------------------+--------+--------
|
76
|
+
diff-lcs | 1.2.5 | 1.2.5#{' '}
|
77
|
+
rake | 10.0.0 | 11.1.0#{' '}
|
78
|
+
rspec | 2.0.0 | 3.0.0#{' '}
|
79
|
+
rspec-core | 2.0.0 | 3.0.4#{' '}
|
80
|
+
rspec-expectations | 2.0.0 | 3.0.4#{' '}
|
81
|
+
rspec-mocks | 2.0.0 | 3.0.4#{' '}
|
82
|
+
rspec-support | x | 3.0.4#{' '}
|
83
|
+
TABLE
|
82
84
|
|
83
85
|
expect(`#{PROJECT_ROOT}/bin/hellgrid #{PROJECT_ROOT}/spec/tmp`).to eq(expected_result)
|
84
86
|
end
|
85
87
|
|
86
88
|
it 'could be run from random directory' do
|
87
|
-
expected_result =
|
88
|
-
|
89
|
-
--------------------+--------+--------
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
TABLE
|
89
|
+
expected_result = <<~TABLE
|
90
|
+
x | bar | in/foo#{' '}
|
91
|
+
--------------------+--------+--------
|
92
|
+
diff-lcs | 1.2.5 | 1.2.5#{' '}
|
93
|
+
rake | 10.0.0 | 11.1.0#{' '}
|
94
|
+
rspec | 2.0.0 | 3.0.0#{' '}
|
95
|
+
rspec-core | 2.0.0 | 3.0.4#{' '}
|
96
|
+
rspec-expectations | 2.0.0 | 3.0.4#{' '}
|
97
|
+
rspec-mocks | 2.0.0 | 3.0.4#{' '}
|
98
|
+
rspec-support | x | 3.0.4#{' '}
|
99
|
+
TABLE
|
98
100
|
|
99
101
|
with_unbundled_env do
|
100
102
|
expect(`cd ~ && #{PROJECT_ROOT}/bin/hellgrid #{PROJECT_ROOT}/spec/tmp`).to eq(expected_result)
|
@@ -102,17 +104,17 @@ TABLE
|
|
102
104
|
end
|
103
105
|
|
104
106
|
it 'uses the current working directory by default' do
|
105
|
-
expected_result =
|
106
|
-
|
107
|
-
--------------------+--------+--------
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
TABLE
|
107
|
+
expected_result = <<~TABLE
|
108
|
+
x | bar | in/foo#{' '}
|
109
|
+
--------------------+--------+--------
|
110
|
+
diff-lcs | 1.2.5 | 1.2.5#{' '}
|
111
|
+
rake | 10.0.0 | 11.1.0#{' '}
|
112
|
+
rspec | 2.0.0 | 3.0.0#{' '}
|
113
|
+
rspec-core | 2.0.0 | 3.0.4#{' '}
|
114
|
+
rspec-expectations | 2.0.0 | 3.0.4#{' '}
|
115
|
+
rspec-mocks | 2.0.0 | 3.0.4#{' '}
|
116
|
+
rspec-support | x | 3.0.4#{' '}
|
117
|
+
TABLE
|
116
118
|
|
117
119
|
with_unbundled_env do
|
118
120
|
expect(`cd #{PROJECT_ROOT}/spec/tmp && #{PROJECT_ROOT}/bin/hellgrid`).to eq(expected_result)
|
@@ -126,10 +128,25 @@ TABLE
|
|
126
128
|
include(
|
127
129
|
'hellgrid',
|
128
130
|
'spec/tmp/bar',
|
129
|
-
'spec/tmp/in/foo'
|
131
|
+
'spec/tmp/in/foo'
|
130
132
|
)
|
131
133
|
)
|
132
134
|
end
|
133
135
|
end
|
134
136
|
end
|
137
|
+
|
138
|
+
context 'when passing -t' do
|
139
|
+
it 'transposes the result and the project names on the left' do
|
140
|
+
expected_result = <<~TABLE
|
141
|
+
x | diff-lcs | rake | rspec | rspec-core | rspec-expectations | rspec-mocks | rspec-support#{' '}
|
142
|
+
--------+----------+--------+-------+------------+--------------------+-------------+---------------
|
143
|
+
bar | 1.2.5 | 10.0.0 | 2.0.0 | 2.0.0 | 2.0.0 | 2.0.0 | x#{' '}
|
144
|
+
in/foo | 1.2.5 | 11.1.0 | 3.0.0 | 3.0.4 | 3.0.4 | 3.0.4 | 3.0.4#{' '}
|
145
|
+
TABLE
|
146
|
+
|
147
|
+
with_unbundled_env do
|
148
|
+
expect(`cd #{PROJECT_ROOT}/spec/tmp && #{PROJECT_ROOT}/bin/hellgrid -t`).to eq(expected_result)
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
135
152
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'fileutils'
|
2
4
|
require 'hellgrid'
|
3
5
|
require 'hellgrid/project'
|
4
6
|
require 'hellgrid/matrix'
|
5
7
|
require 'hellgrid/views/console'
|
6
8
|
|
7
|
-
PROJECT_ROOT = File.expand_path('
|
9
|
+
PROJECT_ROOT = File.expand_path('..', __dir__)
|
8
10
|
|
9
11
|
def create_file(path, content)
|
10
12
|
full_path = File.join(PROJECT_ROOT, path)
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hellgrid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Deyan Dobrinov
|
8
8
|
- Aleksandar Ivanov
|
9
|
-
autorequire:
|
10
9
|
bindir: exe
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2025-02-21 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: bundler
|
@@ -37,14 +36,14 @@ dependencies:
|
|
37
36
|
requirements:
|
38
37
|
- - "~>"
|
39
38
|
- !ruby/object:Gem::Version
|
40
|
-
version: 3.
|
39
|
+
version: '3.13'
|
41
40
|
type: :development
|
42
41
|
prerelease: false
|
43
42
|
version_requirements: !ruby/object:Gem::Requirement
|
44
43
|
requirements:
|
45
44
|
- - "~>"
|
46
45
|
- !ruby/object:Gem::Version
|
47
|
-
version: 3.
|
46
|
+
version: '3.13'
|
48
47
|
description: Display gem versions used across your projects in a table
|
49
48
|
email:
|
50
49
|
- engineering+hellgrid@fundingcircle.com
|
@@ -74,7 +73,6 @@ homepage: https://github.com/FundingCircle/hellgrid
|
|
74
73
|
licenses:
|
75
74
|
- BSD-3-Clause
|
76
75
|
metadata: {}
|
77
|
-
post_install_message:
|
78
76
|
rdoc_options: []
|
79
77
|
require_paths:
|
80
78
|
- lib
|
@@ -82,15 +80,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
82
80
|
requirements:
|
83
81
|
- - ">="
|
84
82
|
- !ruby/object:Gem::Version
|
85
|
-
version:
|
83
|
+
version: 3.1.0
|
86
84
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
85
|
requirements:
|
88
86
|
- - ">="
|
89
87
|
- !ruby/object:Gem::Version
|
90
88
|
version: '0'
|
91
89
|
requirements: []
|
92
|
-
rubygems_version: 3.
|
93
|
-
signing_key:
|
90
|
+
rubygems_version: 3.6.2
|
94
91
|
specification_version: 4
|
95
92
|
summary: Gem version dependency matrix
|
96
93
|
test_files:
|