hellgrid 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +33 -0
- data/README.md +34 -0
- data/bin/hellgrid +25 -0
- data/circle.yml +7 -0
- data/hellgrid.gemspec +22 -0
- data/lib/hellgrid/matrix.rb +47 -0
- data/lib/hellgrid/project.rb +31 -0
- data/lib/hellgrid/version.rb +3 -0
- data/lib/hellgrid/views/console.rb +48 -0
- data/lib/hellgrid.rb +6 -0
- data/spec/hellgrid/matrix_spec.rb +120 -0
- data/spec/hellgrid/project_spec.rb +60 -0
- data/spec/hellgrid/views/console_spec.rb +28 -0
- data/spec/hellgrid_spec.rb +95 -0
- data/spec/spec_helper.rb +17 -0
- metadata +110 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4dfacd198e7064ce22b3a2ad8dab0d18eca80990
|
4
|
+
data.tar.gz: b3ab4a7f97d35968269c8aa932bace13b9a7ea10
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 07af70bc3c68dd58734effe9cceee4a05843ef09b59a7786ba28b8f00df148bdcee75b78ffe696fcde543640ce1da204304995be880b80f007fce1188e1a6185
|
7
|
+
data.tar.gz: e24445314da3b84cf9a231eeae038beb7348b42df98ee8e97d6874b66fe7676748e5385303579e3eba728be1b94747695e590b49cdf067a2408d7867624d99e8
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
hellgrid (0.0.1)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
diff-lcs (1.2.5)
|
10
|
+
rspec (3.4.0)
|
11
|
+
rspec-core (~> 3.4.0)
|
12
|
+
rspec-expectations (~> 3.4.0)
|
13
|
+
rspec-mocks (~> 3.4.0)
|
14
|
+
rspec-core (3.4.2)
|
15
|
+
rspec-support (~> 3.4.0)
|
16
|
+
rspec-expectations (3.4.0)
|
17
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
18
|
+
rspec-support (~> 3.4.0)
|
19
|
+
rspec-mocks (3.4.1)
|
20
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
21
|
+
rspec-support (~> 3.4.0)
|
22
|
+
rspec-support (3.4.1)
|
23
|
+
|
24
|
+
PLATFORMS
|
25
|
+
ruby
|
26
|
+
|
27
|
+
DEPENDENCIES
|
28
|
+
bundler (~> 1.11, >= 1.11.0)
|
29
|
+
hellgrid!
|
30
|
+
rspec (~> 3.4, >= 3.4.0)
|
31
|
+
|
32
|
+
BUNDLED WITH
|
33
|
+
1.11.2
|
data/README.md
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# Hellgrid
|
2
|
+
|
3
|
+
Utility which will output a table containing gem versions used across your projects.
|
4
|
+
|
5
|
+
![Build Status](https://circleci.com/gh/dobrinov/hellgrid.svg?style=shield&circle-token=:circle-token)
|
6
|
+
|
7
|
+
## Install
|
8
|
+
|
9
|
+
```bash
|
10
|
+
gem install hellgrid
|
11
|
+
```
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
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
|
+
Executing:
|
18
|
+
```bash
|
19
|
+
hellgrid /path/to/root/dir
|
20
|
+
```
|
21
|
+
|
22
|
+
Should result in:
|
23
|
+
```bash
|
24
|
+
x | bar | foo
|
25
|
+
---------------------------+--------+--------
|
26
|
+
diff-lcs | 1.2.5 | 1.2.5
|
27
|
+
rspec | 2.0.0 | 3.0.0
|
28
|
+
rspec-core | 2.0.0 | 3.0.4
|
29
|
+
rspec-expectations | 2.0.0 | 3.0.4
|
30
|
+
rspec-mocks | 2.0.0 | 3.0.4
|
31
|
+
rake | 10.0.0 | 11.1.0
|
32
|
+
rspec-support | x | 3.0.4
|
33
|
+
hellgrid | x | x
|
34
|
+
```
|
data/bin/hellgrid
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'pathname'
|
4
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', Pathname.new(__FILE__).realpath)
|
5
|
+
|
6
|
+
require 'rubygems'
|
7
|
+
require 'bundler/setup'
|
8
|
+
require 'find'
|
9
|
+
|
10
|
+
require 'hellgrid'
|
11
|
+
|
12
|
+
ARGV.each do |folder|
|
13
|
+
matrix = Hellgrid::Matrix.new
|
14
|
+
|
15
|
+
Find.find(folder) do |path|
|
16
|
+
if File.directory?(path) && File.exists?(File.join(path, 'Gemfile.lock'))
|
17
|
+
matrix.add_project(Hellgrid::Project.new(path))
|
18
|
+
Find.prune
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
view = Hellgrid::Views::Console.new(matrix.sorted_by_most_used)
|
23
|
+
|
24
|
+
view.render
|
25
|
+
end
|
data/circle.yml
ADDED
data/hellgrid.gemspec
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'hellgrid/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = 'hellgrid'
|
7
|
+
s.version = Hellgrid::VERSION
|
8
|
+
s.date = '2016-03-28'
|
9
|
+
s.summary = 'Gem version dependecy matrix'
|
10
|
+
s.description = ''
|
11
|
+
s.authors = ['Deyan Dobrinov', 'Aleksandar Ivanov']
|
12
|
+
s.email = ['deyan.dobrinov@gmail.com', 'aivanov92@gmail.com']
|
13
|
+
s.files = `git ls-files -z`.split("\x0")
|
14
|
+
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
15
|
+
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
16
|
+
s.require_paths = ['lib']
|
17
|
+
s.homepage = 'http://github.com/dobrinov/hellgrid'
|
18
|
+
s.license = 'MIT'
|
19
|
+
|
20
|
+
s.add_development_dependency 'rspec', '~> 3.4', '>= 3.4.0'
|
21
|
+
s.add_development_dependency 'bundler', '~> 1.11', '>= 1.11.0'
|
22
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Hellgrid
|
2
|
+
class Matrix
|
3
|
+
attr_reader :projects
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
@projects = []
|
7
|
+
end
|
8
|
+
|
9
|
+
def add_project(project)
|
10
|
+
@projects << project
|
11
|
+
end
|
12
|
+
|
13
|
+
def projects_sorted_by_name
|
14
|
+
@projects.sort { |a,b| a.name <=> b.name }
|
15
|
+
end
|
16
|
+
|
17
|
+
def project_names
|
18
|
+
projects_sorted_by_name.map(&:name)
|
19
|
+
end
|
20
|
+
|
21
|
+
def gem_names
|
22
|
+
@projects.map { |p| p.dependency_matrix.keys }.flatten.uniq
|
23
|
+
end
|
24
|
+
|
25
|
+
def sorted_by_most_used
|
26
|
+
header = [nil] + project_names
|
27
|
+
|
28
|
+
body = gems_by_usage.keys.map do |gem|
|
29
|
+
[gem] + projects_sorted_by_name.map { |project| project.dependency_matrix[gem] }
|
30
|
+
end
|
31
|
+
|
32
|
+
[header] + body
|
33
|
+
end
|
34
|
+
|
35
|
+
def gems_by_usage
|
36
|
+
gem_usage = Hash.new(0)
|
37
|
+
|
38
|
+
projects.each do |project|
|
39
|
+
project.dependency_matrix.each do |gem, _|
|
40
|
+
gem_usage[gem] += 1
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
gem_usage.sort_by {|key, value| [-value, key] }.to_h
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Hellgrid
|
2
|
+
class Project
|
3
|
+
attr_reader :path
|
4
|
+
|
5
|
+
def initialize(path)
|
6
|
+
@path = path
|
7
|
+
end
|
8
|
+
|
9
|
+
def name
|
10
|
+
File.basename(File.expand_path(path))
|
11
|
+
end
|
12
|
+
|
13
|
+
def dependency_matrix
|
14
|
+
@dependency_matrix ||= specs.inject(Hash.new) { |h,spec| h.merge!(spec.name.to_s => spec.version.version) }
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def lockfile
|
20
|
+
File.join(@path, 'Gemfile.lock')
|
21
|
+
end
|
22
|
+
|
23
|
+
def parsed_lockfile
|
24
|
+
Bundler::LockfileParser.new(Bundler.read_file(lockfile))
|
25
|
+
end
|
26
|
+
|
27
|
+
def specs
|
28
|
+
parsed_lockfile.specs
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module Hellgrid
|
2
|
+
module Views
|
3
|
+
class Console
|
4
|
+
attr_reader :matrix
|
5
|
+
|
6
|
+
def initialize(matrix)
|
7
|
+
@matrix = matrix
|
8
|
+
end
|
9
|
+
|
10
|
+
def render
|
11
|
+
puts render_as_string
|
12
|
+
end
|
13
|
+
|
14
|
+
def render_as_string
|
15
|
+
string = []
|
16
|
+
|
17
|
+
string << row_as_string(matrix[0])
|
18
|
+
string << column_widths.map { |width| '-' * width }.join('+')
|
19
|
+
|
20
|
+
matrix[1..matrix.size].each do |row|
|
21
|
+
string << row_as_string(row)
|
22
|
+
end
|
23
|
+
|
24
|
+
string.join("\n") + "\n"
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def row_as_string(row)
|
30
|
+
column_widths.map.with_index { |width, i| (row[i] || 'x').center(width) }.join('|')
|
31
|
+
end
|
32
|
+
|
33
|
+
def column_widths
|
34
|
+
widths = Array.new(matrix[0].size, 0)
|
35
|
+
|
36
|
+
matrix.each do |row|
|
37
|
+
row.each_with_index do |value, col_i|
|
38
|
+
if value && (widths[col_i] < value.size)
|
39
|
+
widths[col_i] = value.size
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
widths.map { |width| width + 2 }
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/lib/hellgrid.rb
ADDED
@@ -0,0 +1,120 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Hellgrid::Matrix do
|
4
|
+
subject(:matrix) { described_class.new }
|
5
|
+
let(:project) { [] }
|
6
|
+
|
7
|
+
describe '#add_project' do
|
8
|
+
let(:project) { double(:project) }
|
9
|
+
|
10
|
+
it 'adds a project' do
|
11
|
+
expect do
|
12
|
+
matrix.add_project(project)
|
13
|
+
end.to change { matrix.projects.count }.by(1)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe '#project_names' do
|
18
|
+
it 'returns project names' do
|
19
|
+
matrix.add_project(double(:project, name: 'foo'))
|
20
|
+
matrix.add_project(double(:project, name: 'bar'))
|
21
|
+
|
22
|
+
expect(matrix.project_names).to eq(['bar', 'foo'])
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe '#gem_names' do
|
27
|
+
it 'returns gem names' do
|
28
|
+
matrix.add_project(double(:project, dependency_matrix: {
|
29
|
+
'a' => '1.0.1',
|
30
|
+
'b' => '2.0.1',
|
31
|
+
'c' => '3.0.1'
|
32
|
+
}))
|
33
|
+
|
34
|
+
matrix.add_project(double(:project, dependency_matrix: {
|
35
|
+
'b' => '2.0.2',
|
36
|
+
'c' => '3.0.2',
|
37
|
+
'd' => '4.0.2'
|
38
|
+
}))
|
39
|
+
|
40
|
+
expect(matrix.gem_names).to eq(['a', 'b', 'c', 'd'])
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe '#gems_by_usage' do
|
45
|
+
before do
|
46
|
+
matrix.add_project(double(:project, dependency_matrix: {
|
47
|
+
'a' => '1.0.1',
|
48
|
+
'b' => '2.0.1',
|
49
|
+
'c' => '3.0.1'
|
50
|
+
}))
|
51
|
+
|
52
|
+
matrix.add_project(double(:project, dependency_matrix: {
|
53
|
+
'b' => '2.0.2',
|
54
|
+
'c' => '3.0.2',
|
55
|
+
'd' => '4.0.2'
|
56
|
+
}))
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'returns an array' do
|
60
|
+
expect(matrix.gems_by_usage).to be_a(Hash)
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'returns ordered ' do
|
64
|
+
expected_result = {
|
65
|
+
"b"=>2,
|
66
|
+
"c"=>2,
|
67
|
+
"a"=>1,
|
68
|
+
"d"=>1
|
69
|
+
}
|
70
|
+
|
71
|
+
expect(matrix.gems_by_usage).to eq(expected_result)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
describe '#projects_sorted_by_name' do
|
76
|
+
let(:project_a) { double(:project, name: 'a') }
|
77
|
+
let(:project_b) { double(:project, name: 'b') }
|
78
|
+
let(:project_c) { double(:project, name: 'c') }
|
79
|
+
|
80
|
+
before do
|
81
|
+
matrix.add_project(project_b)
|
82
|
+
matrix.add_project(project_c)
|
83
|
+
matrix.add_project(project_a)
|
84
|
+
end
|
85
|
+
|
86
|
+
it 'sorted by name projects' do
|
87
|
+
expected_result = [project_a, project_b, project_c].map(&:name)
|
88
|
+
|
89
|
+
expect(matrix.projects_sorted_by_name.map(&:name)).to eq(expected_result)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
describe '#sorted_by_most_used' do
|
94
|
+
before do
|
95
|
+
matrix.add_project(double(:project, name: 'foo', dependency_matrix: {
|
96
|
+
'a' => '1.0.1',
|
97
|
+
'b' => '2.0.1',
|
98
|
+
'c' => '3.0.1'
|
99
|
+
}))
|
100
|
+
|
101
|
+
matrix.add_project(double(:project, name: 'bar', dependency_matrix: {
|
102
|
+
'b' => '2.0.2',
|
103
|
+
'c' => '3.0.2',
|
104
|
+
'd' => '4.0.2'
|
105
|
+
}))
|
106
|
+
end
|
107
|
+
|
108
|
+
it 'returns matrix' do
|
109
|
+
expected_result = [
|
110
|
+
[ nil, 'bar', 'foo' ],
|
111
|
+
[ 'b', '2.0.2', '2.0.1' ],
|
112
|
+
[ 'c', '3.0.2', '3.0.1' ],
|
113
|
+
[ 'a', nil, '1.0.1' ],
|
114
|
+
[ 'd', '4.0.2', nil ]
|
115
|
+
]
|
116
|
+
|
117
|
+
expect(matrix.sorted_by_most_used).to eq(expected_result)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Hellgrid::Project do
|
4
|
+
subject(:project) { described_class.new(project_path) }
|
5
|
+
|
6
|
+
let(:project_path) { 'spec/tmp/foo/' }
|
7
|
+
let(:lockfile_path) { File.join project_path, 'Gemfile.lock' }
|
8
|
+
|
9
|
+
before do
|
10
|
+
delete_tmp_folder
|
11
|
+
|
12
|
+
create_file lockfile_path, <<-FOO_GEMFILE
|
13
|
+
GEM
|
14
|
+
remote: https://rubygems.org/
|
15
|
+
specs:
|
16
|
+
diff-lcs (1.2.5)
|
17
|
+
rake (11.1.0)
|
18
|
+
rspec (3.0.0)
|
19
|
+
rspec-core (~> 3.0.0)
|
20
|
+
rspec-expectations (~> 3.0.0)
|
21
|
+
rspec-mocks (~> 3.0.0)
|
22
|
+
rspec-core (3.0.4)
|
23
|
+
rspec-support (~> 3.0.0)
|
24
|
+
rspec-expectations (3.0.4)
|
25
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
26
|
+
rspec-support (~> 3.0.0)
|
27
|
+
rspec-mocks (3.0.4)
|
28
|
+
rspec-support (~> 3.0.0)
|
29
|
+
rspec-support (3.0.4)
|
30
|
+
|
31
|
+
PLATFORMS
|
32
|
+
ruby
|
33
|
+
|
34
|
+
DEPENDENCIES
|
35
|
+
rake (= 11.1.0)
|
36
|
+
rspec (= 3.0.0)
|
37
|
+
|
38
|
+
FOO_GEMFILE
|
39
|
+
end
|
40
|
+
|
41
|
+
describe '#dependency_matrix' do
|
42
|
+
it 'is a Hash' do
|
43
|
+
expect(subject.dependency_matrix).to be_a(Hash)
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'returns dependencies' do
|
47
|
+
expected_result = {
|
48
|
+
'diff-lcs' => '1.2.5',
|
49
|
+
'rake' => '11.1.0',
|
50
|
+
'rspec' => '3.0.0',
|
51
|
+
'rspec-core' => '3.0.4',
|
52
|
+
'rspec-expectations' => '3.0.4',
|
53
|
+
'rspec-mocks' => '3.0.4',
|
54
|
+
'rspec-support' => '3.0.4'
|
55
|
+
}
|
56
|
+
|
57
|
+
expect(subject.dependency_matrix).to eq(expected_result)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Hellgrid::Views::Console do
|
4
|
+
subject(:console) { described_class.new(matrix.sorted_by_most_used) }
|
5
|
+
let(:matrix) do
|
6
|
+
double :matrix,
|
7
|
+
sorted_by_most_used: [[ nil, 'bar', 'foo' ],
|
8
|
+
[ 'b', '2.0.2', '2.0.1' ],
|
9
|
+
[ 'c', '3.0.2', '3.0.1' ],
|
10
|
+
[ 'a', nil, '1.0.1' ],
|
11
|
+
[ 'd', '4.0.2', nil ]]
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '#render_as_string' do
|
15
|
+
it 'renders matrix' do
|
16
|
+
expected_result = <<-TABLE
|
17
|
+
x | bar | foo
|
18
|
+
---+-------+-------
|
19
|
+
b | 2.0.2 | 2.0.1
|
20
|
+
c | 3.0.2 | 3.0.1
|
21
|
+
a | x | 1.0.1
|
22
|
+
d | 4.0.2 | x
|
23
|
+
TABLE
|
24
|
+
|
25
|
+
expect(console.render_as_string).to eq(expected_result)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,95 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'bin/hellgrid' do
|
4
|
+
before do
|
5
|
+
delete_tmp_folder
|
6
|
+
|
7
|
+
create_file 'spec/tmp/foo/Gemfile.lock', <<-FOO_GEMFILE
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
diff-lcs (1.2.5)
|
12
|
+
rake (11.1.0)
|
13
|
+
rspec (3.0.0)
|
14
|
+
rspec-core (~> 3.0.0)
|
15
|
+
rspec-expectations (~> 3.0.0)
|
16
|
+
rspec-mocks (~> 3.0.0)
|
17
|
+
rspec-core (3.0.4)
|
18
|
+
rspec-support (~> 3.0.0)
|
19
|
+
rspec-expectations (3.0.4)
|
20
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
21
|
+
rspec-support (~> 3.0.0)
|
22
|
+
rspec-mocks (3.0.4)
|
23
|
+
rspec-support (~> 3.0.0)
|
24
|
+
rspec-support (3.0.4)
|
25
|
+
|
26
|
+
PLATFORMS
|
27
|
+
ruby
|
28
|
+
|
29
|
+
DEPENDENCIES
|
30
|
+
rake (= 11.1.0)
|
31
|
+
rspec (= 3.0.0)
|
32
|
+
|
33
|
+
FOO_GEMFILE
|
34
|
+
|
35
|
+
create_file 'spec/tmp/bar/Gemfile.lock', <<-BAR_GEMFILE
|
36
|
+
GEM
|
37
|
+
remote: https://rubygems.org/
|
38
|
+
specs:
|
39
|
+
diff-lcs (1.2.5)
|
40
|
+
rake (10.0.0)
|
41
|
+
rspec (2.0.0)
|
42
|
+
rspec-core (= 2.0.0)
|
43
|
+
rspec-expectations (= 2.0.0)
|
44
|
+
rspec-mocks (= 2.0.0)
|
45
|
+
rspec-core (2.0.0)
|
46
|
+
rspec-expectations (2.0.0)
|
47
|
+
diff-lcs (>= 1.1.2)
|
48
|
+
rspec-mocks (2.0.0)
|
49
|
+
rspec-core (= 2.0.0)
|
50
|
+
rspec-expectations (= 2.0.0)
|
51
|
+
|
52
|
+
PLATFORMS
|
53
|
+
ruby
|
54
|
+
|
55
|
+
DEPENDENCIES
|
56
|
+
rake (= 10.0.0)
|
57
|
+
rspec (= 2.0.0)
|
58
|
+
|
59
|
+
BAR_GEMFILE
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'returns a matrix with the versions of all used gems' do
|
63
|
+
expected_result = <<-TABLE
|
64
|
+
x | bar | foo
|
65
|
+
--------------------+--------+--------
|
66
|
+
diff-lcs | 1.2.5 | 1.2.5
|
67
|
+
rake | 10.0.0 | 11.1.0
|
68
|
+
rspec | 2.0.0 | 3.0.0
|
69
|
+
rspec-core | 2.0.0 | 3.0.4
|
70
|
+
rspec-expectations | 2.0.0 | 3.0.4
|
71
|
+
rspec-mocks | 2.0.0 | 3.0.4
|
72
|
+
rspec-support | x | 3.0.4
|
73
|
+
TABLE
|
74
|
+
|
75
|
+
expect(`#{PROJECT_ROOT}/bin/hellgrid #{PROJECT_ROOT}/spec/tmp`).to eq(expected_result)
|
76
|
+
end
|
77
|
+
|
78
|
+
it 'could be run from random directory' do
|
79
|
+
expected_result = <<-TABLE
|
80
|
+
x | bar | foo
|
81
|
+
--------------------+--------+--------
|
82
|
+
diff-lcs | 1.2.5 | 1.2.5
|
83
|
+
rake | 10.0.0 | 11.1.0
|
84
|
+
rspec | 2.0.0 | 3.0.0
|
85
|
+
rspec-core | 2.0.0 | 3.0.4
|
86
|
+
rspec-expectations | 2.0.0 | 3.0.4
|
87
|
+
rspec-mocks | 2.0.0 | 3.0.4
|
88
|
+
rspec-support | x | 3.0.4
|
89
|
+
TABLE
|
90
|
+
|
91
|
+
Bundler.with_clean_env do
|
92
|
+
expect(`cd ~ && #{PROJECT_ROOT}/bin/hellgrid #{PROJECT_ROOT}/spec/tmp`).to eq(expected_result)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'hellgrid'
|
3
|
+
require 'hellgrid/project'
|
4
|
+
require 'hellgrid/matrix'
|
5
|
+
require 'hellgrid/views/console'
|
6
|
+
|
7
|
+
PROJECT_ROOT = File.expand_path('../..', __FILE__)
|
8
|
+
|
9
|
+
def create_file(path, content)
|
10
|
+
full_path = File.join(PROJECT_ROOT, path)
|
11
|
+
FileUtils.mkdir_p File.dirname(full_path)
|
12
|
+
File.write(full_path, content)
|
13
|
+
end
|
14
|
+
|
15
|
+
def delete_tmp_folder
|
16
|
+
FileUtils.rm_rf File.join(PROJECT_ROOT, '/spec/tmp')
|
17
|
+
end
|
metadata
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: hellgrid
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Deyan Dobrinov
|
8
|
+
- Aleksandar Ivanov
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2016-03-28 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rspec
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '3.4'
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 3.4.0
|
24
|
+
type: :development
|
25
|
+
prerelease: false
|
26
|
+
version_requirements: !ruby/object:Gem::Requirement
|
27
|
+
requirements:
|
28
|
+
- - "~>"
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '3.4'
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 3.4.0
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: bundler
|
36
|
+
requirement: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.11'
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 1.11.0
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - "~>"
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '1.11'
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 1.11.0
|
54
|
+
description: ''
|
55
|
+
email:
|
56
|
+
- deyan.dobrinov@gmail.com
|
57
|
+
- aivanov92@gmail.com
|
58
|
+
executables:
|
59
|
+
- hellgrid
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- ".gitignore"
|
64
|
+
- Gemfile
|
65
|
+
- Gemfile.lock
|
66
|
+
- README.md
|
67
|
+
- bin/hellgrid
|
68
|
+
- circle.yml
|
69
|
+
- hellgrid.gemspec
|
70
|
+
- lib/hellgrid.rb
|
71
|
+
- lib/hellgrid/matrix.rb
|
72
|
+
- lib/hellgrid/project.rb
|
73
|
+
- lib/hellgrid/version.rb
|
74
|
+
- lib/hellgrid/views/console.rb
|
75
|
+
- spec/hellgrid/matrix_spec.rb
|
76
|
+
- spec/hellgrid/project_spec.rb
|
77
|
+
- spec/hellgrid/views/console_spec.rb
|
78
|
+
- spec/hellgrid_spec.rb
|
79
|
+
- spec/spec_helper.rb
|
80
|
+
homepage: http://github.com/dobrinov/hellgrid
|
81
|
+
licenses:
|
82
|
+
- MIT
|
83
|
+
metadata: {}
|
84
|
+
post_install_message:
|
85
|
+
rdoc_options: []
|
86
|
+
require_paths:
|
87
|
+
- lib
|
88
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
requirements: []
|
99
|
+
rubyforge_project:
|
100
|
+
rubygems_version: 2.5.1
|
101
|
+
signing_key:
|
102
|
+
specification_version: 4
|
103
|
+
summary: Gem version dependecy matrix
|
104
|
+
test_files:
|
105
|
+
- spec/hellgrid/matrix_spec.rb
|
106
|
+
- spec/hellgrid/project_spec.rb
|
107
|
+
- spec/hellgrid/views/console_spec.rb
|
108
|
+
- spec/hellgrid_spec.rb
|
109
|
+
- spec/spec_helper.rb
|
110
|
+
has_rdoc:
|