repos_report 2.0.3 → 3.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fc3663c3fa77e055d3842b6cb0e8c8b013dfc276
4
- data.tar.gz: 33357575db4cf1081f7603349271b4c63c88c19f
3
+ metadata.gz: c6367bb17f00e283a1ed5f0aad41a975c01a4f8d
4
+ data.tar.gz: 9d008023b8c91dc082581aa0b1871cb34bfb8e66
5
5
  SHA512:
6
- metadata.gz: d1229ff946f8684703910b0a3cb6a875ef3701e656871530f67eef41ece5bd32c65d4cccecfc0e8334d8492742bf5b12db627edd8276e7da8deec92b35e910d8
7
- data.tar.gz: 5e26abfc0206fadd5f9aa413595118d111b9155b62dddbd7f1c2eb7685d20c55c1246e3b71172d91eb6b6e1717cc09902e9fe7ceaa8286471f91e532fcf1923f
6
+ metadata.gz: 88a91551414dbbae38f3492a8c3fa5fbb5f84fa518db86d0ddd6bf979761029980bb84fc00dfb096604dc8c0ed024f1fb35839208d3e0e9a4bb09e357589efa8
7
+ data.tar.gz: 030748e3d8442513def9a6994ec6edb27f850ae232b25f677fdaf2421be7c8731fb002853127777f474140a83ca128061e6e85719dacd955d610c3d3a2950571
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ ![Gem output](https://raw.githubusercontent.com/neurodynamic/repos_report/master/example_output.png)
2
+
1
3
  # Purpose
2
4
 
3
5
  Prints info on the status of all repos under a given directory.
data/bin/rep2 CHANGED
@@ -2,13 +2,23 @@
2
2
 
3
3
  require_relative '../lib/repos_report'
4
4
 
5
+ def get_directory(directory_arg)
6
+ if directory_arg
7
+ directory_arg.sub(/\/\z/,'') # Remove trailing slashes
8
+ else
9
+ Dir.pwd # Current directory if none specified
10
+ end
11
+ end
12
+
5
13
  case ARGV[0]
6
14
  when 'list'
7
- ReposReport.list_all_repos(ARGV[1])
15
+ directory = get_directory(ARGV[1])
16
+ ReposReport.list_all_repos(directory)
8
17
 
9
18
  when /\//
10
- ReposReport.print_status_of_projects_under(ARGV[0])
19
+ directory = get_directory(ARGV[0])
20
+ ReposReport.print_status_of_projects_under(directory)
11
21
 
12
22
  else
13
23
  puts "Run 'rep2 [directory_path]' get a report on the status of repos in that directory."
14
- end
24
+ end
Binary file
data/lib/repos_report.rb CHANGED
@@ -4,33 +4,34 @@ module ReposReport
4
4
  class << self
5
5
  def print_status_of_projects_under(directory)
6
6
  repos = RepoFinder.repos_in_or_below(directory)
7
+ padding = whitespace_padding_for(repos)
7
8
 
8
- if repos.any?
9
- print_statuses_of(repos)
10
- else
11
- puts "No repos found in this directory."
9
+ puts_repo_data(repos) do |repo|
10
+ repo.concise_status(padding)
12
11
  end
13
12
  end
14
13
 
15
14
  def list_all_repos(directory)
16
15
  repos = RepoFinder.repos_in_or_below(directory)
17
16
 
18
- newline_pad_output do
19
- repos.each do |repo|
20
- puts repo.directory
21
- end
22
- end
17
+ puts_repo_data(repos, &:directory)
23
18
  end
24
19
 
25
20
  private
26
21
 
27
- def print_statuses_of(repos)
28
- padding_amount = whitespace_padding_for(repos)
22
+ def puts_repo_data(repos, &block)
23
+ if repos.any?
24
+ puts
25
+ puts_all(repos, &block)
26
+ puts
27
+ else
28
+ puts "No repos found."
29
+ end
30
+ end
29
31
 
30
- newline_pad_output do
31
- repos.each do |r|
32
- puts r.concise_status(padding_amount)
33
- end
32
+ def puts_all(items, &stringy_block)
33
+ items.each do |item|
34
+ puts stringy_block.call(item)
34
35
  end
35
36
  end
36
37
 
@@ -38,10 +39,6 @@ module ReposReport
38
39
  longest_repo_project_name(repos) + 3
39
40
  end
40
41
 
41
- def newline_pad_output
42
- puts; yield; puts
43
- end
44
-
45
42
  def longest_repo_project_name(array_of_repos)
46
43
  array_of_repos.map(&:project_name_length).max
47
44
  end
@@ -1,3 +1,3 @@
1
1
  module ReposReport
2
- VERSION = "2.0.3"
2
+ VERSION = "3.0.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: repos_report
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - neurodynamic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-28 00:00:00.000000000 Z
11
+ date: 2016-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,6 +66,7 @@ files:
66
66
  - README.md
67
67
  - Rakefile
68
68
  - bin/rep2
69
+ - example_output.png
69
70
  - lib/repos_report.rb
70
71
  - lib/repos_report/repo.rb
71
72
  - lib/repos_report/repo_finder.rb