multipull 0.0.1 → 0.0.2

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
  SHA256:
3
- metadata.gz: 2f1d52ce7937a9cbdf187fb67e70da3d855674c967f2d933a236d7ae11260f53
4
- data.tar.gz: 3d852fa553f4fbfaa5777ce0a05edbfa4a43361023b5b6357f43f1cb2e603904
3
+ metadata.gz: ebfa0a655ff29ebdefed299f27fc87a0826bde332aef7c4d1317af16df996b1f
4
+ data.tar.gz: bb175cd6e2f4d7f7bf5eac3ee5b2c92f848d8451005cfe173e9b6145c0a522e9
5
5
  SHA512:
6
- metadata.gz: 66e216ce8dfc83b588d5fb20affb37daf38e9b54c203b2763d0b8218e5cefcf640261ca5a2d7e5c807e4a07cef8b1be1cbd7d99aaa1c7c7f1bd5076272b5c9ce
7
- data.tar.gz: e13b11f4b9b6ffaa15e1f9da814d8bcef561054444cf06097133c50f32350ed57b66545d8395f8cd08943261b148717e8a36b7f4f98fb541289b2b8e83017609
6
+ metadata.gz: b01599cad75d41f2f64f706ea2e35c594d964d62aad8879b895d93bb3950b54e3fa2df08cc5d4f423e9a592d2b1ac1c80d995abe5a74941fa908a63eeb34dedf
7
+ data.tar.gz: 4560a68c1ed27422ede1dee6c1faa18da618768529112945f8e3d10115ab516f6295f95fe8ba4a7fa6671c80f6c49c9dbe7aee69a1b8c111647947b33f5987c0
@@ -10,6 +10,7 @@ module Multipull
10
10
  def initialize
11
11
  # @options = {}
12
12
  @dirs = []
13
+ @git_opts = []
13
14
  end
14
15
 
15
16
  def run
@@ -20,19 +21,25 @@ module Multipull
20
21
  private
21
22
 
22
23
  def parse_options
23
- OptionParser.new do |opts|
24
- opts.banner = 'Usage: multipull [options] [dir...]'
24
+ opts = OptionParser.new
25
+ opts.banner = 'Usage: multipull [options] [dir...]'
25
26
 
26
- opts.on('-v', '--version', 'Show version') do
27
- puts VERSION
28
- exit
29
- end
27
+ opts.on('--version', 'Show version') do
28
+ puts VERSION
29
+ exit
30
+ end
30
31
 
31
- opts.on('-h', '--help', 'Show help') do
32
- puts opts
33
- exit
34
- end
35
- end.parse!
32
+ opts.on('--help', 'Show help') do
33
+ puts opts
34
+ exit
35
+ end
36
+
37
+ begin
38
+ opts.parse!
39
+ rescue OptionParser::InvalidOption => e
40
+ @git_opts += e.args
41
+ retry
42
+ end
36
43
 
37
44
  @dirs = ARGV.empty? ? ['.'] : ARGV
38
45
  end
@@ -49,14 +56,24 @@ module Multipull
49
56
  puts magenta("#{dir} is not a directory")
50
57
  next
51
58
  end
59
+
60
+ succeeded = []
61
+ failed = []
52
62
  Dir.chdir(dir) do
53
63
  Dir.glob('*/').each do |subdir|
54
- puts blue(bold(subdir))
55
64
  Dir.chdir(subdir) do
56
- system('git pull')
65
+ dirname = subdir.delete_suffix('/')
66
+ puts blue(bold(dirname))
67
+ if system("git pull #{@git_opts.join(' ')}")
68
+ succeeded << dirname
69
+ else
70
+ failed << dirname
71
+ end
57
72
  end
58
73
  end
59
74
  end
75
+ warn bold(green('Succeeded : ')) + succeeded.join(' ')
76
+ warn bold(magenta('Failed : ')) + failed.join(' ')
60
77
  end
61
78
  end
62
79
  end
@@ -6,6 +6,10 @@ module Multipull
6
6
  "\e[1m#{s}\e[22m"
7
7
  end
8
8
 
9
+ def green(s)
10
+ "\e[32m#{s}\e[0m"
11
+ end
12
+
9
13
  def cyan(s)
10
14
  "\e[36m#{s}\e[0m"
11
15
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Multipull
4
- VERSION = '0.0.1'
4
+ VERSION = '0.0.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multipull
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - kojix2
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-06-01 00:00:00.000000000 Z
11
+ date: 2022-06-06 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Git pull multiple repositories at once
14
14
  email:
@@ -28,7 +28,7 @@ homepage: https://github.com/kojix2/multipull
28
28
  licenses:
29
29
  - MIT
30
30
  metadata: {}
31
- post_install_message:
31
+ post_install_message:
32
32
  rdoc_options: []
33
33
  require_paths:
34
34
  - lib
@@ -44,7 +44,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
44
44
  version: '0'
45
45
  requirements: []
46
46
  rubygems_version: 3.3.7
47
- signing_key:
47
+ signing_key:
48
48
  specification_version: 4
49
49
  summary: Git pull multiple repositories at once
50
50
  test_files: []