gitbulk 0.0.2.134791 → 0.0.4.364358

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: f5c03ef62e25a53ea023523a020655f3423dd251029f88b58dd00cb651f4944a
4
- data.tar.gz: da52e5cd6b838ed7da24705dd755e2cf3998c23bf7d11b083b11ad353c7ea6bc
3
+ metadata.gz: e29dea4cfdce01915173810d85d40b352c9ad90be8312befb8ea3b40673205f4
4
+ data.tar.gz: 9b726814f608faf38e9b0f7df3db4f8568e7aae7d73c5eb3c60ddaa13103dd86
5
5
  SHA512:
6
- metadata.gz: 7f6d48f0dbcfd87fddcb8ef42d5e062ab3c8e6379b33ae2ec0f952ec3371ac9014f03933cf6775907b9539a6acfc9d805dde60637eb8e29e0d17c8eba35a8637
7
- data.tar.gz: dfb6b8e5a04cd428357f13796b75537657786c21cd35a1845a53243bd43108abed24288030b3cc525fa9bdf8a193e708be9d7ff634595ee8594744d9bb84d53c
6
+ metadata.gz: da3884065254794978673213083d3d6a5a17133dae0fb240a4dff886c45ccb7cbe7903fbaba29a07c6bed12fc79a83bde2cb2d19bc6989d2c6f0a81dab57dcdb
7
+ data.tar.gz: 6420e17a0df2cfc7eed470aea3f83a0f6188b23c4f26780ae3ee2a53694a64fe7f066379195629358a2b8a37ef380fdc8675b5a6360b4154b0dfcc34800aad10
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitbulk (0.0.2.134791)
5
- activesupport (~> 6.0)
4
+ gitbulk (0.0.4)
5
+ activesupport
6
6
  colorize
7
7
  fileutils
8
8
  json
@@ -13,93 +13,117 @@ PATH
13
13
  GEM
14
14
  remote: https://rubygems.org/
15
15
  specs:
16
- activesupport (6.1.7.3)
17
- concurrent-ruby (~> 1.0, >= 1.0.2)
16
+ activesupport (8.1.3)
17
+ base64
18
+ bigdecimal
19
+ concurrent-ruby (~> 1.0, >= 1.3.1)
20
+ connection_pool (>= 2.2.5)
21
+ drb
18
22
  i18n (>= 1.6, < 2)
23
+ json
24
+ logger (>= 1.4.2)
19
25
  minitest (>= 5.1)
20
- tzinfo (~> 2.0)
21
- zeitwerk (~> 2.3)
22
- addressable (2.8.1)
23
- public_suffix (>= 2.0.2, < 6.0)
26
+ securerandom (>= 0.3)
27
+ tzinfo (~> 2.0, >= 2.0.5)
28
+ uri (>= 0.13.1)
29
+ addressable (2.8.9)
30
+ public_suffix (>= 2.0.2, < 8.0)
24
31
  ansi (1.5.0)
25
- ast (2.4.2)
26
- colorize (0.8.1)
27
- concurrent-ruby (1.2.2)
28
- crack (0.4.5)
32
+ ast (2.4.3)
33
+ base64 (0.3.0)
34
+ bigdecimal (4.0.1)
35
+ colorize (1.1.0)
36
+ concurrent-ruby (1.3.6)
37
+ connection_pool (3.0.2)
38
+ crack (1.0.1)
39
+ bigdecimal
29
40
  rexml
30
- diff-lcs (1.5.0)
31
- docile (1.4.0)
32
- fileutils (1.7.1)
33
- hashdiff (1.0.1)
34
- i18n (1.12.0)
41
+ diff-lcs (1.6.2)
42
+ docile (1.4.1)
43
+ drb (2.2.3)
44
+ fileutils (1.8.0)
45
+ hashdiff (1.2.1)
46
+ i18n (1.14.8)
35
47
  concurrent-ruby (~> 1.0)
36
- json (2.6.3)
37
- minitest (5.18.0)
38
- parallel (1.22.1)
39
- parser (3.2.1.1)
48
+ json (2.19.3)
49
+ language_server-protocol (3.17.0.5)
50
+ lint_roller (1.1.0)
51
+ logger (1.7.0)
52
+ minitest (6.0.2)
53
+ drb (~> 2.0)
54
+ prism (~> 1.5)
55
+ parallel (1.27.0)
56
+ parser (3.3.11.1)
40
57
  ast (~> 2.4.1)
41
- public_suffix (5.0.1)
58
+ racc
59
+ prism (1.9.0)
60
+ public_suffix (7.0.5)
61
+ racc (1.8.1)
42
62
  rainbow (3.1.1)
43
- rake (13.0.6)
44
- regexp_parser (2.7.0)
45
- rexml (3.2.5)
46
- rspec (3.12.0)
47
- rspec-core (~> 3.12.0)
48
- rspec-expectations (~> 3.12.0)
49
- rspec-mocks (~> 3.12.0)
50
- rspec-core (3.12.1)
51
- rspec-support (~> 3.12.0)
52
- rspec-expectations (3.12.2)
63
+ rake (13.3.1)
64
+ regexp_parser (2.11.3)
65
+ rexml (3.4.4)
66
+ rspec (3.13.2)
67
+ rspec-core (~> 3.13.0)
68
+ rspec-expectations (~> 3.13.0)
69
+ rspec-mocks (~> 3.13.0)
70
+ rspec-core (3.13.6)
71
+ rspec-support (~> 3.13.0)
72
+ rspec-expectations (3.13.5)
53
73
  diff-lcs (>= 1.2.0, < 2.0)
54
- rspec-support (~> 3.12.0)
55
- rspec-mocks (3.12.4)
74
+ rspec-support (~> 3.13.0)
75
+ rspec-mocks (3.13.8)
56
76
  diff-lcs (>= 1.2.0, < 2.0)
57
- rspec-support (~> 3.12.0)
58
- rspec-support (3.12.0)
77
+ rspec-support (~> 3.13.0)
78
+ rspec-support (3.13.7)
59
79
  rspec_junit_formatter (0.6.0)
60
80
  rspec-core (>= 2, < 4, != 2.12.0)
61
- rubocop (1.48.1)
81
+ rubocop (1.86.0)
62
82
  json (~> 2.3)
83
+ language_server-protocol (~> 3.17.0.2)
84
+ lint_roller (~> 1.1.0)
63
85
  parallel (~> 1.10)
64
- parser (>= 3.2.0.0)
86
+ parser (>= 3.3.0.2)
65
87
  rainbow (>= 2.2.2, < 4.0)
66
- regexp_parser (>= 1.8, < 3.0)
67
- rexml (>= 3.2.5, < 4.0)
68
- rubocop-ast (>= 1.26.0, < 2.0)
88
+ regexp_parser (>= 2.9.3, < 3.0)
89
+ rubocop-ast (>= 1.49.0, < 2.0)
69
90
  ruby-progressbar (~> 1.7)
70
- unicode-display_width (>= 2.4.0, < 3.0)
71
- rubocop-ast (1.28.0)
72
- parser (>= 3.2.1.0)
91
+ unicode-display_width (>= 2.4.0, < 4.0)
92
+ rubocop-ast (1.49.1)
93
+ parser (>= 3.3.7.2)
94
+ prism (~> 1.7)
73
95
  ruby-progressbar (1.13.0)
96
+ securerandom (0.4.1)
74
97
  simplecov (0.22.0)
75
98
  docile (~> 1.1)
76
99
  simplecov-html (~> 0.11)
77
100
  simplecov_json_formatter (~> 0.1)
78
- simplecov-console (0.9.1)
101
+ simplecov-console (0.9.5)
79
102
  ansi
80
103
  simplecov
81
104
  terminal-table
82
- simplecov-html (0.12.3)
105
+ simplecov-html (0.13.2)
83
106
  simplecov_json_formatter (0.1.4)
84
- terminal-table (3.0.2)
85
- unicode-display_width (>= 1.1.1, < 3)
86
- thor (1.2.1)
107
+ terminal-table (4.0.0)
108
+ unicode-display_width (>= 1.1.1, < 4)
109
+ thor (1.5.0)
87
110
  tzinfo (2.0.6)
88
111
  concurrent-ruby (~> 1.0)
89
- unicode-display_width (2.4.2)
90
- uri (0.12.1)
91
- webmock (3.18.1)
112
+ unicode-display_width (3.2.0)
113
+ unicode-emoji (~> 4.1)
114
+ unicode-emoji (4.2.0)
115
+ uri (1.1.1)
116
+ webmock (3.26.2)
92
117
  addressable (>= 2.8.0)
93
118
  crack (>= 0.3.2)
94
119
  hashdiff (>= 0.4.0, < 2.0.0)
95
- yaml (0.2.1)
96
- zeitwerk (2.6.7)
120
+ yaml (0.4.0)
97
121
 
98
122
  PLATFORMS
99
123
  x86_64-linux
100
124
 
101
125
  DEPENDENCIES
102
- bundler (~> 2.2, >= 2.2.1)
126
+ bundler
103
127
  gitbulk!
104
128
  rake
105
129
  rspec
@@ -110,4 +134,4 @@ DEPENDENCIES
110
134
  webmock
111
135
 
112
136
  BUNDLED WITH
113
- 2.2.33
137
+ 4.0.7
data/bin/gitbulk CHANGED
@@ -25,6 +25,7 @@ Gitbulk::Util.setup
25
25
 
26
26
  @opts = {
27
27
  dryrun: ENV.fetch('GITBULK_DRYRUN', 'false').to_bool,
28
+ twoway: ENV.fetch('GITBULK_TWOWAY', 'false').to_bool,
28
29
  config: ENV.fetch('GITBULK_CONFIG', './gitbulk.yml'),
29
30
  log_level: ENV.fetch('LOG_LEVEL', ::Logger::INFO)
30
31
  }
@@ -37,6 +38,11 @@ parser = OptionParser.new do |o|
37
38
  @opts[:config] = File.expand_path(path.strip)
38
39
  end
39
40
 
41
+ o.on('--twoway',
42
+ 'ENV[GITBULK_TWOWAY]'.ljust(25) + 'Experimental using https://github.com/it3xl/git-repo-sync') do
43
+ @opts[:twoway] = true
44
+ end
45
+
40
46
  o.on('--dryrun',
41
47
  'ENV[GITBULK_DRYRUN]'.ljust(25) + 'Dry Run') do
42
48
  @opts[:dryrun] = true
@@ -68,17 +74,45 @@ Dir.chdir(config['workdir']) do |_dir|
68
74
 
69
75
  logger.info "Mirroring: #{git.inspect}".colorize(:green)
70
76
 
71
-
72
- Gitbulk::Util.within_repo(git, logger: logger) do |_name|
73
- repo['mirrors'].shuffle.each do |mirror|
74
- logger.info "Pushing to #{mirror}".colorize(:blue)
75
-
76
- # cmd = "git push --mirror #{mirror}"
77
- cmd = "git push --all #{mirror}"
78
- if @opts[:dryrun]
79
- logger.tagged('DRYRUN') { logger.info cmd }
80
- else
81
- Gitbulk::Util.cmd!(cmd)
77
+ if @opts[:twoway]
78
+ spec = Gem::Specification.find_by_name("gitbulk")
79
+ gem_root = spec.gem_dir
80
+ syncer_home = File.join(gem_root, "lib", "git-repo-sync")
81
+ syncer = "git-sync.sh"
82
+ ENV['PATH'] = "#{ENV['PATH']}:#{syncer_home}"
83
+ logger.tagged('TWOWAY'.colorize(:red)) do
84
+ repo['mirrors'].shuffle.each do |mirror|
85
+ name = Gitbulk::Util.name_slug(git) + '_' + Gitbulk::Util.name_slug(mirror)
86
+ cmd = "git_sync_project_folder=#{Gitbulk::Util.name_slug(name)} url_a=#{git} url_b=#{mirror} git-sync.sh"
87
+ allcmd = "git push origin_b --all"
88
+ tagscmd = "git push origin_b --tags"
89
+ if @opts[:dryrun]
90
+ logger.tagged('DRYRUN') { logger.info cmd }
91
+ logger.tagged('DRYRUN') { logger.info allcmd }
92
+ logger.tagged('DRYRUN') { logger.info tagscmd }
93
+ else
94
+ logger.info cmd
95
+ Gitbulk::Util.cmd!(cmd)
96
+ Dir.chdir("#{syncer_home}/sync-projects/#{name}/sync_repo") do |_dir|
97
+ Gitbulk::Util.cmd!(allcmd)
98
+ Gitbulk::Util.cmd!(tagscmd)
99
+ end
100
+ end
101
+ end
102
+ end
103
+ else
104
+ # generic way
105
+ Gitbulk::Util.within_repo(git, logger: logger) do |_name|
106
+ repo['mirrors'].shuffle.each do |mirror|
107
+ logger.info "Pushing to #{mirror}".colorize(:blue)
108
+
109
+ # cmd = "git push --mirror #{mirror}"
110
+ cmd = "git push --all #{mirror}"
111
+ if @opts[:dryrun]
112
+ logger.tagged('DRYRUN') { logger.info cmd }
113
+ else
114
+ Gitbulk::Util.cmd!(cmd)
115
+ end
82
116
  end
83
117
  end
84
118
  end
data/gitbulk.gemspec CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new 'gitbulk' do |spec|
20
20
  spec.executables = spec.files.grep(%r{^bin/gitbulk}) {|f| File.basename(f) }
21
21
  spec.require_paths = ['lib']
22
22
 
23
- spec.add_development_dependency 'bundler', '~> 2.2', '>= 2.2.1'
23
+ spec.add_development_dependency 'bundler'
24
24
  spec.add_development_dependency 'rake'
25
25
  spec.add_development_dependency 'rspec'
26
26
  spec.add_development_dependency 'rspec_junit_formatter'
@@ -29,7 +29,7 @@ Gem::Specification.new 'gitbulk' do |spec|
29
29
  spec.add_development_dependency 'simplecov-console'
30
30
  spec.add_development_dependency 'webmock'
31
31
 
32
- spec.add_runtime_dependency 'activesupport', '~> 6.0'
32
+ spec.add_runtime_dependency 'activesupport'
33
33
  spec.add_runtime_dependency 'colorize'
34
34
  spec.add_runtime_dependency 'json'
35
35
  spec.add_runtime_dependency 'thor'
data/lib/gitbulk/utils.rb CHANGED
@@ -49,6 +49,10 @@ module Gitbulk
49
49
  end
50
50
  end
51
51
 
52
+ def name_slug(git)
53
+ git.downcase.gsub(/\W+/, '_')
54
+ end
55
+
52
56
  def cmd!(cmd, capture: false, logger: $logger)
53
57
  $cmdnum ||= 0
54
58
  $cmdnum += 1
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Gitbulk
4
4
 
5
- VERSION = '0.0.2'
5
+ VERSION = '0.0.4'
6
6
 
7
7
  end
8
8
 
data/lib/gitbulk.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'logger'
3
4
  require 'active_support'
4
5
  require_relative 'gitbulk/version'
5
6
  require_relative 'gitbulk/utils'
metadata CHANGED
@@ -1,35 +1,28 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitbulk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2.134791
4
+ version: 0.0.4.364358
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samoilenko Yuri
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2023-04-04 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: bundler
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '2.2'
20
16
  - - ">="
21
17
  - !ruby/object:Gem::Version
22
- version: 2.2.1
18
+ version: '0'
23
19
  type: :development
24
20
  prerelease: false
25
21
  version_requirements: !ruby/object:Gem::Requirement
26
22
  requirements:
27
- - - "~>"
28
- - !ruby/object:Gem::Version
29
- version: '2.2'
30
23
  - - ">="
31
24
  - !ruby/object:Gem::Version
32
- version: 2.2.1
25
+ version: '0'
33
26
  - !ruby/object:Gem::Dependency
34
27
  name: rake
35
28
  requirement: !ruby/object:Gem::Requirement
@@ -132,16 +125,16 @@ dependencies:
132
125
  name: activesupport
133
126
  requirement: !ruby/object:Gem::Requirement
134
127
  requirements:
135
- - - "~>"
128
+ - - ">="
136
129
  - !ruby/object:Gem::Version
137
- version: '6.0'
130
+ version: '0'
138
131
  type: :runtime
139
132
  prerelease: false
140
133
  version_requirements: !ruby/object:Gem::Requirement
141
134
  requirements:
142
- - - "~>"
135
+ - - ">="
143
136
  - !ruby/object:Gem::Version
144
- version: '6.0'
137
+ version: '0'
145
138
  - !ruby/object:Gem::Dependency
146
139
  name: colorize
147
140
  requirement: !ruby/object:Gem::Requirement
@@ -251,7 +244,6 @@ licenses:
251
244
  metadata:
252
245
  homepage_uri: https://github.com/RnD-Soft/gitbulk
253
246
  source_code_uri: https://github.com/RnD-Soft/gitbulk
254
- post_install_message:
255
247
  rdoc_options: []
256
248
  require_paths:
257
249
  - lib
@@ -266,8 +258,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
266
258
  - !ruby/object:Gem::Version
267
259
  version: '0'
268
260
  requirements: []
269
- rubygems_version: 3.4.10
270
- signing_key:
261
+ rubygems_version: 4.0.6
271
262
  specification_version: 4
272
263
  summary: Gitbulk is cli for mirroring many git repositories at once
273
264
  test_files: []