hellgrid 0.0.1 → 0.1.0

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
  SHA1:
3
- metadata.gz: 4dfacd198e7064ce22b3a2ad8dab0d18eca80990
4
- data.tar.gz: b3ab4a7f97d35968269c8aa932bace13b9a7ea10
3
+ metadata.gz: f81a55d2ae00696f507989aa1873596eb2f946eb
4
+ data.tar.gz: b6d73b4de893f29e65a8537830ab5294f83322ed
5
5
  SHA512:
6
- metadata.gz: 07af70bc3c68dd58734effe9cceee4a05843ef09b59a7786ba28b8f00df148bdcee75b78ffe696fcde543640ce1da204304995be880b80f007fce1188e1a6185
7
- data.tar.gz: e24445314da3b84cf9a231eeae038beb7348b42df98ee8e97d6874b66fe7676748e5385303579e3eba728be1b94747695e590b49cdf067a2408d7867624d99e8
6
+ metadata.gz: 53f171f7e20fcb3909ab8bcb8a35038047f57e3cd6b2b49274c32708b77d8f1e7abb111909b850e370646ead98c46979ea5b9d395e3b4c96a5b7c673b38c081b
7
+ data.tar.gz: 03bfe0761f3def79ec00ee970b21afba21496698f2d03cfd5436216dd2684e23d3d5f6da895dcd6a26077466592ee4cd827e031fd6b538e497313cf54b425e6a
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Utility which will output a table containing gem versions used across your projects.
4
4
 
5
- ![Build Status](https://circleci.com/gh/dobrinov/hellgrid.svg?style=shield&circle-token=:circle-token)
5
+ ![Build Status](https://circleci.com/gh/FundingCircle/hellgrid.svg?style=shield&circle-token=:circle-token)
6
6
 
7
7
  ## Install
8
8
 
@@ -30,5 +30,5 @@ Should result in:
30
30
  rspec-mocks | 2.0.0 | 3.0.4
31
31
  rake | 10.0.0 | 11.1.0
32
32
  rspec-support | x | 3.0.4
33
- hellgrid | x | x
33
+ hellgrid | x | x
34
34
  ```
data/bin/hellgrid CHANGED
@@ -9,12 +9,14 @@ require 'find'
9
9
 
10
10
  require 'hellgrid'
11
11
 
12
- ARGV.each do |folder|
12
+ folders = ARGV.empty? ? [Dir.pwd] : ARGV
13
+
14
+ folders.each do |folder|
13
15
  matrix = Hellgrid::Matrix.new
14
16
 
15
17
  Find.find(folder) do |path|
16
18
  if File.directory?(path) && File.exists?(File.join(path, 'Gemfile.lock'))
17
- matrix.add_project(Hellgrid::Project.new(path))
19
+ matrix.add_project(Hellgrid::Project.new(folder, path))
18
20
  Find.prune
19
21
  end
20
22
  end
data/hellgrid.gemspec CHANGED
@@ -1,4 +1,6 @@
1
- lib = File.expand_path('../lib', __FILE__)
1
+ project_root = File.dirname(__FILE__)
2
+ lib = File.join(project_root, 'lib')
3
+
2
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
5
  require 'hellgrid/version'
4
6
 
@@ -6,15 +8,15 @@ Gem::Specification.new do |s|
6
8
  s.name = 'hellgrid'
7
9
  s.version = Hellgrid::VERSION
8
10
  s.date = '2016-03-28'
9
- s.summary = 'Gem version dependecy matrix'
11
+ s.summary = 'Gem version dependency matrix'
10
12
  s.description = ''
11
13
  s.authors = ['Deyan Dobrinov', 'Aleksandar Ivanov']
12
14
  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)/})
15
+ s.files = Dir.chdir(project_root) { Dir['lib/**/*.rb'] + Dir['bin/*'] + Dir['spec/**/*.rb'] + %w(Gemfile Gemfile.lock README.md hellgrid.gemspec) }
16
+ s.executables = s.files.grep(/^bin\//) { |f| File.basename(f) }
17
+ s.test_files = s.files.grep(/^spec\//)
16
18
  s.require_paths = ['lib']
17
- s.homepage = 'http://github.com/dobrinov/hellgrid'
19
+ s.homepage = 'https://github.com/FundingCircle/hellgrid'
18
20
  s.license = 'MIT'
19
21
 
20
22
  s.add_development_dependency 'rspec', '~> 3.4', '>= 3.4.0'
@@ -2,12 +2,13 @@ module Hellgrid
2
2
  class Project
3
3
  attr_reader :path
4
4
 
5
- def initialize(path)
5
+ def initialize(root, path)
6
+ @root = root
6
7
  @path = path
7
8
  end
8
9
 
9
10
  def name
10
- File.basename(File.expand_path(path))
11
+ File.expand_path(path).gsub(File.expand_path(root) + '/', '')
11
12
  end
12
13
 
13
14
  def dependency_matrix
@@ -16,8 +17,10 @@ module Hellgrid
16
17
 
17
18
  private
18
19
 
20
+ attr_reader :root
21
+
19
22
  def lockfile
20
- File.join(@path, 'Gemfile.lock')
23
+ File.join(path, 'Gemfile.lock')
21
24
  end
22
25
 
23
26
  def parsed_lockfile
@@ -1,3 +1,3 @@
1
1
  module Hellgrid
2
- VERSION = '0.0.1'
2
+ VERSION = '0.1.0'
3
3
  end
@@ -1,8 +1,9 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Hellgrid::Project do
4
- subject(:project) { described_class.new(project_path) }
4
+ subject(:project) { described_class.new(root_path, project_path) }
5
5
 
6
+ let(:root_path) { 'spec' }
6
7
  let(:project_path) { 'spec/tmp/foo/' }
7
8
  let(:lockfile_path) { File.join project_path, 'Gemfile.lock' }
8
9
 
@@ -38,6 +39,12 @@ DEPENDENCIES
38
39
  FOO_GEMFILE
39
40
  end
40
41
 
42
+ describe '#name' do
43
+ it 'returns the relative path from the root' do
44
+ expect(subject.name).to eq('tmp/foo')
45
+ end
46
+ end
47
+
41
48
  describe '#dependency_matrix' do
42
49
  it 'is a Hash' do
43
50
  expect(subject.dependency_matrix).to be_a(Hash)
@@ -4,7 +4,7 @@ describe 'bin/hellgrid' do
4
4
  before do
5
5
  delete_tmp_folder
6
6
 
7
- create_file 'spec/tmp/foo/Gemfile.lock', <<-FOO_GEMFILE
7
+ create_file 'spec/tmp/in/foo/Gemfile.lock', <<-FOO_GEMFILE
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
@@ -61,7 +61,7 @@ BAR_GEMFILE
61
61
 
62
62
  it 'returns a matrix with the versions of all used gems' do
63
63
  expected_result = <<-TABLE
64
- x | bar | foo
64
+ x | bar | in/foo
65
65
  --------------------+--------+--------
66
66
  diff-lcs | 1.2.5 | 1.2.5
67
67
  rake | 10.0.0 | 11.1.0
@@ -77,7 +77,7 @@ TABLE
77
77
 
78
78
  it 'could be run from random directory' do
79
79
  expected_result = <<-TABLE
80
- x | bar | foo
80
+ x | bar | in/foo
81
81
  --------------------+--------+--------
82
82
  diff-lcs | 1.2.5 | 1.2.5
83
83
  rake | 10.0.0 | 11.1.0
@@ -92,4 +92,22 @@ TABLE
92
92
  expect(`cd ~ && #{PROJECT_ROOT}/bin/hellgrid #{PROJECT_ROOT}/spec/tmp`).to eq(expected_result)
93
93
  end
94
94
  end
95
+
96
+ it 'uses the current working directory by default' do
97
+ expected_result = <<-TABLE
98
+ x | bar | in/foo
99
+ --------------------+--------+--------
100
+ diff-lcs | 1.2.5 | 1.2.5
101
+ rake | 10.0.0 | 11.1.0
102
+ rspec | 2.0.0 | 3.0.0
103
+ rspec-core | 2.0.0 | 3.0.4
104
+ rspec-expectations | 2.0.0 | 3.0.4
105
+ rspec-mocks | 2.0.0 | 3.0.4
106
+ rspec-support | x | 3.0.4
107
+ TABLE
108
+
109
+ Bundler.with_clean_env do
110
+ expect(`cd #{PROJECT_ROOT}/spec/tmp && #{PROJECT_ROOT}/bin/hellgrid`).to eq(expected_result)
111
+ end
112
+ end
95
113
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hellgrid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Deyan Dobrinov
@@ -60,12 +60,10 @@ executables:
60
60
  extensions: []
61
61
  extra_rdoc_files: []
62
62
  files:
63
- - ".gitignore"
64
63
  - Gemfile
65
64
  - Gemfile.lock
66
65
  - README.md
67
66
  - bin/hellgrid
68
- - circle.yml
69
67
  - hellgrid.gemspec
70
68
  - lib/hellgrid.rb
71
69
  - lib/hellgrid/matrix.rb
@@ -77,7 +75,7 @@ files:
77
75
  - spec/hellgrid/views/console_spec.rb
78
76
  - spec/hellgrid_spec.rb
79
77
  - spec/spec_helper.rb
80
- homepage: http://github.com/dobrinov/hellgrid
78
+ homepage: https://github.com/FundingCircle/hellgrid
81
79
  licenses:
82
80
  - MIT
83
81
  metadata: {}
@@ -100,7 +98,7 @@ rubyforge_project:
100
98
  rubygems_version: 2.5.1
101
99
  signing_key:
102
100
  specification_version: 4
103
- summary: Gem version dependecy matrix
101
+ summary: Gem version dependency matrix
104
102
  test_files:
105
103
  - spec/hellgrid/matrix_spec.rb
106
104
  - spec/hellgrid/project_spec.rb
data/.gitignore DELETED
@@ -1,2 +0,0 @@
1
- spec/tmp
2
- hellgrid-*.gem
data/circle.yml DELETED
@@ -1,7 +0,0 @@
1
- machine:
2
- ruby:
3
- version: 2.3.0
4
-
5
- dependencies:
6
- pre:
7
- - gem install bundler -v 1.11.2