git-multi 1.1.0 → 1.2.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
  SHA256:
3
- metadata.gz: 78f3a989686451a2c8da7e936efccc3c209a5128c2908650b640eef01f7f5997
4
- data.tar.gz: 304141ffe253506dfa598a095dd9023e38be5bc8cd9de7c4ff742cada0ccfb2e
3
+ metadata.gz: 13f924a6a3aad4601b2fd83d11b92f628756ba43bfaaa0d9a968754cd94ee67f
4
+ data.tar.gz: e75c6fe671c96eedb1c9b0c0c2c545e13ac86ae95dd7225dad99ee75a95728f7
5
5
  SHA512:
6
- metadata.gz: bbb67393419507f66f7c9936af27224d546f2fb3a69c6be00e1683b70ebce029aeaeabd21dce4ea3d2fdeaedd1e3f9214f9a9961f1be1da03b79ca7232969b0a
7
- data.tar.gz: bd96d42a7982341c95f1f453743f6701107fdb2468f66ce9d5b3532f3ed80dea105a04e775f2d3e223bef98986f51e0032451f725eff22544b754a880f52751e
6
+ metadata.gz: b5ccee6a83810fd1dbfa637d2e083695b31e8449dc76fb66829e642adab2fd42e73b013f220a40fc7889d4b6c308abf549d2cb6e15a1553370b99a82377d359f
7
+ data.tar.gz: 9aa769c201d6be15ef71b08d4120ba8129c3bfe319fefaf513503161c34e674c93bd7533ba24330e999caa82e928c1dd1f49d3e34fb21cfd8d917f68b3a74807
data/exe/git-multi CHANGED
@@ -11,7 +11,7 @@ if (command = ARGV.shift).start_with? '++'
11
11
  else
12
12
  abort \
13
13
  "Unknown multi repo: #{multi_repo}\n\n" \
14
- '(use --check to list all known multi repos)'
14
+ '(use --report to list all known multi repos)'
15
15
  end
16
16
  end
17
17
 
@@ -21,7 +21,7 @@ when /\A--/
21
21
  when '--version' then Git::Multi::Commands.version
22
22
  when '--help' then Git::Multi::Commands.help
23
23
  when '--html' then Git::Multi::Commands.html
24
- when '--check' then Git::Multi::Commands.check
24
+ when '--report' then Git::Multi::Commands.report
25
25
  when '--count' then Git::Multi::Commands.count
26
26
  when '--refresh' then Git::Multi::Commands.refresh
27
27
  when '--json' then Git::Multi::Commands.json(multi_repo)
@@ -47,7 +47,6 @@ when /\A--/
47
47
  when nil, '', '-h'
48
48
  Git::Multi::Commands.help
49
49
  else
50
- Git::Multi::Commands.report(multi_repo)
51
50
  Git::Multi::Commands.exec(command, ARGV, multi_repo)
52
51
  end
53
52
 
data/git-multi.gemspec CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
25
25
 
26
26
  spec.post_install_message = Git::Multi::PIM
27
27
 
28
- spec.add_dependency 'octokit', '~> 4.12'
28
+ spec.add_dependency 'octokit', '~> 4.13'
29
29
 
30
30
  spec.add_development_dependency 'bundler'
31
31
  spec.add_development_dependency 'pry'
data/lib/git/hub.rb CHANGED
@@ -77,11 +77,10 @@ module Git
77
77
 
78
78
  @user_repositories = Hash.new { |repos, (user, type)|
79
79
  repos[[user, type]] = begin
80
- notify("Refreshing #{type} '#{user}' repositories from GitHub")
81
- client
82
- .repositories(user, type: type)
83
- .sort_by { |repo| repo[:name].downcase }
84
- end
80
+ client
81
+ .repositories(user, type: type)
82
+ .sort_by { |repo| repo[:name].downcase }
83
+ end
85
84
  }
86
85
 
87
86
  def user_repositories(user, type = :owner)
@@ -95,11 +94,10 @@ module Git
95
94
 
96
95
  @org_repositories = Hash.new { |repos, (org, type)|
97
96
  repos[[org, type]] = begin
98
- notify("Refreshing #{type} '#{org}' repositories from GitHub")
99
- client
100
- .org_repositories(org, type: type)
101
- .sort_by { |repo| repo[:name].downcase }
102
- end
97
+ client
98
+ .org_repositories(org, type: type)
99
+ .sort_by { |repo| repo[:name].downcase }
100
+ end
103
101
  }
104
102
 
105
103
  def org_repositories(org, type = :owner)
data/lib/git/multi.rb CHANGED
@@ -9,7 +9,6 @@ require 'sawyer'
9
9
 
10
10
  require 'ext/dir'
11
11
  require 'ext/string'
12
- require 'ext/notify'
13
12
  require 'ext/kernel'
14
13
  require 'ext/commify'
15
14
  require 'ext/sawyer/resource'
@@ -155,7 +154,6 @@ module Git
155
154
  if File.size?(REPOSITORIES)
156
155
  # rubocop:disable Security/MarshalLoad
157
156
  @repositories ||= Marshal.load(File.read(REPOSITORIES)).tap do |projects|
158
- notify "Finished loading #{REPOSITORIES}"
159
157
  projects.each_with_index do |project, index|
160
158
  # ensure 'project' has handle on an Octokit client
161
159
  project.client = Git::Hub.send(:client)
@@ -16,15 +16,11 @@ module Git
16
16
  Kernel.exec "open #{Git::Multi::HTML_PAGE}"
17
17
  end
18
18
 
19
- def check
20
- # Settings.user_status(Git::Multi::USER)
21
- # Settings.organization_status(Git::Multi::ORGANIZATIONS)
22
- # Settings.token_status(Git::Multi::TOKEN)
19
+ def report
23
20
  Settings.home_status(Git::Multi::HOME)
24
21
  Settings.main_workarea_status(Git::Multi::WORKAREA)
25
22
  Settings.user_workarea_status(Git::Multi::USERS)
26
23
  Settings.organization_workarea_status(Git::Multi::ORGANIZATIONS)
27
- # Settings.file_status(Git::Multi::REPOSITORIES)
28
24
  end
29
25
 
30
26
  def count
@@ -79,7 +75,6 @@ module Git
79
75
  FileUtils.mkdir_p repo.parent_dir
80
76
  repo.just_do_it(
81
77
  ->(project) {
82
- notify "Cloning '#{repo.full_name}' repo into #{repo.parent_dir.parent}"
83
78
  Kernel.system "git clone -q #{project.rels[:ssh].href.shellescape}"
84
79
  },
85
80
  ->(project) {
@@ -150,14 +145,6 @@ module Git
150
145
  system(args.flatten, multi_repo)
151
146
  end
152
147
 
153
- def report(multi_repo = nil)
154
- (missing = Git::Multi.missing_repositories_for(multi_repo)).any? &&
155
- notify(
156
- missing.map(&:full_name),
157
- subtitle: "#{missing.count} missing repos"
158
- )
159
- end
160
-
161
148
  def exec(command, args = [], multi_repo = nil)
162
149
  args.unshift ['git', '--no-pager', command]
163
150
  system(args.flatten, multi_repo)
@@ -8,7 +8,7 @@ module Git
8
8
 
9
9
  module_function
10
10
 
11
- def setting_status(messages, valid, optional = false)
11
+ def setting_status(messages, valid = false, optional = true)
12
12
  fields = messages.compact.join(' - ')
13
13
  icon = valid ? TICK : optional ? ARROW : CROSS
14
14
  if interactive?
@@ -45,10 +45,22 @@ module Git
45
45
  [
46
46
  message,
47
47
  File.join(abbreviate(workarea, :workarea), owner),
48
- File.directory?(workarea) ? "#{Dir.new(workarea).git_repos(owner).count.commify} repos" : nil
49
48
  ],
50
49
  workarea
51
50
  )
51
+
52
+ github_count = Git::Multi.repositories_for(owner).count
53
+ cloned_count = Git::Multi.cloned_repositories_for(owner).count
54
+ missing_count = (github_count - cloned_count)
55
+ subdir_count = Dir.new(workarea).git_repos(owner).count
56
+ surplus_count = (subdir_count - cloned_count)
57
+
58
+ setting_status(["\tGitHub ", github_count])
59
+ setting_status(["\tcloned ", cloned_count, "(#{missing_count} missing)"])
60
+ Git::Multi.missing_repositories_for(owner).each do |missing|
61
+ setting_status(["\tmissing", missing.full_name], false, false)
62
+ end
63
+ setting_status(["\tsubdirs", subdir_count, "(#{surplus_count} surplus)"])
52
64
  end
53
65
 
54
66
  def user_status(user)
@@ -6,7 +6,7 @@ require 'addressable'
6
6
  module Git
7
7
  module Multi
8
8
  NAME = 'git-multi'.freeze
9
- VERSION = '1.1.0'.freeze
9
+ VERSION = '1.2.0'.freeze
10
10
 
11
11
  DEPENDENCY_VERSIONS = [
12
12
  "octokit.rb v#{Octokit::VERSION}",
data/man/git-multi.1 CHANGED
@@ -31,7 +31,7 @@
31
31
  git-multi \- execute the same git command in multiple repositories
32
32
  .SH "VERSION"
33
33
  .sp
34
- This is \fBv1\&.1\&.0\fR of \fIgit multi\fR \&... hooray!
34
+ This is \fBv1\&.2\&.0\fR of \fIgit multi\fR \&... hooray!
35
35
  .SH "SYNOPSIS"
36
36
  .sp
37
37
  There are some options for \fBgit multi\fR itself, in which case it is invoked as follows:
@@ -85,9 +85,9 @@ you\(cqre looking at it: show the man page
85
85
  open the HTML version of the man page
86
86
  .RE
87
87
  .PP
88
- \-\-check
88
+ \-\-report
89
89
  .RS 4
90
- checks all the required settings and configurations
90
+ report on various repository stats and metrics
91
91
  .RE
92
92
  .PP
93
93
  \-\-count
data/man/git-multi.erb CHANGED
@@ -64,8 +64,8 @@ OPTIONS
64
64
  --html::
65
65
  open the HTML version of the man page
66
66
 
67
- --check::
68
- checks all the required settings and configurations
67
+ --report::
68
+ report on various repository stats and metrics
69
69
 
70
70
  --count::
71
71
  print out the count of repos (per type)
data/man/git-multi.html CHANGED
@@ -748,7 +748,7 @@ git-multi(1) Manual Page
748
748
  <div class="sect1">
749
749
  <h2 id="_version">VERSION</h2>
750
750
  <div class="sectionbody">
751
- <div class="paragraph"><p>This is <code>v1.1.0</code> of <em>git multi</em> &#8230; hooray!</p></div>
751
+ <div class="paragraph"><p>This is <code>v1.2.0</code> of <em>git multi</em> &#8230; hooray!</p></div>
752
752
  </div>
753
753
  </div>
754
754
  <div class="sect1">
@@ -822,11 +822,11 @@ a single organization, the optional <code>++&lt;multi_repo&gt;</code> argument c
822
822
  </p>
823
823
  </dd>
824
824
  <dt class="hdlist1">
825
- --check
825
+ --report
826
826
  </dt>
827
827
  <dd>
828
828
  <p>
829
- checks all the required settings and configurations
829
+ report on various repository stats and metrics
830
830
  </p>
831
831
  </dd>
832
832
  <dt class="hdlist1">
@@ -1200,7 +1200,7 @@ the <code>jq</code> command-line utility:
1200
1200
  <div id="footer">
1201
1201
  <div id="footer-text">
1202
1202
  Last updated
1203
- 2018-11-09 14:11:04 GMT
1203
+ 2018-11-09 16:23:25 GMT
1204
1204
  </div>
1205
1205
  </div>
1206
1206
  </body>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-multi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Vandenberk
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '4.12'
19
+ version: '4.13'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '4.12'
26
+ version: '4.13'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -92,7 +92,6 @@ files:
92
92
  - lib/ext/commify.rb
93
93
  - lib/ext/dir.rb
94
94
  - lib/ext/kernel.rb
95
- - lib/ext/notify.rb
96
95
  - lib/ext/sawyer/resource.rb
97
96
  - lib/ext/string.rb
98
97
  - lib/git/hub.rb
data/lib/ext/notify.rb DELETED
@@ -1,20 +0,0 @@
1
- begin
2
- require 'terminal-notifier'
3
- rescue LoadError
4
- # NOOP - "TerminalNotifier" is optional
5
- # will only be used if it is installed!
6
- end
7
-
8
- def notify(message, options = {}, verbose = false)
9
- # print the given message to STDERR, if the
10
- # script is running with "--verbose" option
11
- subtitle = options[:subtitle]
12
- warn(subtitle ? "#{subtitle}: #{message}" : message) if $VERBOSE
13
- # send a given message to the Mac OS X Notification Center
14
- # but only if the git-multi script is running interactively
15
- # and if the "terminal-notifier" gem has been installed...
16
- interactive? && defined?(TerminalNotifier) && begin
17
- options[:title] ||= 'git-multi'
18
- TerminalNotifier.notify(message, options, verbose)
19
- end
20
- end