git-bundle 1.0.16 → 1.0.19

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: b3695e18c4ce00b28d229d3a0c471066be6fabb1117b2a363f2fa447766b8c4a
4
- data.tar.gz: 27ef1522b91ef11574b109096a36fb62f41990630de84d9b31c97110e1da2523
3
+ metadata.gz: 863b8414db95b8fac7f015027b77d76ac56566b44c5d2666543fd881ea0f6e86
4
+ data.tar.gz: 70dfb3f91242a1262e6a0fa24d283d3381c7ebade58f05a3f397cc0e661981f1
5
5
  SHA512:
6
- metadata.gz: 4322df4990c97e2fd8f6b41fda7471ace527a89c1f4aab6868e679493a88bc09df39a32bed5d3a5045b4b912497b6a3343ca796b1751582cb41ac8e31c60f358
7
- data.tar.gz: d6b2258ae386d3b39bcd9757e9c5f2dc3e902a6b5e28152f027d6050180053dc338915f550baa7ba5a6855e0698e7db5593bc0359ec071183a4f2d8369318aa7
6
+ metadata.gz: 659b2bd1f1390e5f2332dc6764fc07fe21ee53194ea2acfca92fbc80e12abdf104b061a3eff8f7addde4062ce8a15633a12d910874886be76fcef1d1df5cf943
7
+ data.tar.gz: aed803f26f4b3ad1195e5be1eac230cce5cede1b7a7b5b669075bc7073a42e9877ea567b2b6bddce7ef408ac0c1fdc704d5a8e7301dfb14262a5639496b7e3f1
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
1
  =======
2
+ .ruby-version
2
3
  *.gem
3
4
  /.idea/
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- git-bundle (1.0.15)
4
+ git-bundle (1.0.19)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -11,8 +11,8 @@ PLATFORMS
11
11
  ruby
12
12
 
13
13
  DEPENDENCIES
14
- bundler (~> 1.12)
14
+ bundler (~> 2.4.19)
15
15
  git-bundle!
16
16
 
17
17
  BUNDLED WITH
18
- 1.17.3
18
+ 2.4.19
data/git-bundle.gemspec CHANGED
@@ -6,8 +6,8 @@ require 'git_bundle/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'git-bundle'
8
8
  spec.version = GitBundle::VERSION
9
- spec.authors = ['Pierre Pretorius']
10
- spec.email = ['pierre@labs.epiuse.com']
9
+ spec.authors = ['Pierre Pretorius', 'Divan Burger']
10
+ spec.email = ['pierre@labs.epiuse.com', 'divan@labs.epiuse.com']
11
11
  spec.summary = %q{Simplifies working with gems from git repositories in combination with local overrides.}
12
12
  spec.description = %q{Simplifies working with gems from git repositories in combination with local overrides.
13
13
  See the github page for more detail.}
@@ -18,5 +18,5 @@ Gem::Specification.new do |spec|
18
18
  spec.executables = 'gitb'
19
19
  spec.require_paths = ['lib']
20
20
 
21
- spec.add_development_dependency 'bundler', '~> 1.12'
21
+ spec.add_development_dependency 'bundler', '~> 2.4.19'
22
22
  end
@@ -18,8 +18,26 @@ module GitBundle
18
18
  @current = read
19
19
  end
20
20
 
21
+ def remote(repo_name)
22
+ source = current[repo_name]
23
+ if source.include?(' ')
24
+ source.split(' ').first
25
+ else
26
+ nil
27
+ end
28
+ end
29
+
30
+ def branch(repo_name)
31
+ source = current[repo_name]
32
+ if source.include?(' ')
33
+ source.split(' ').last
34
+ else
35
+ source
36
+ end
37
+ end
38
+
21
39
  def read
22
- File.exists?(path) ? YAML.load_file(path) || {} : nil
40
+ File.exist?(path) ? YAML.load_file(path) || {} : nil
23
41
  end
24
42
 
25
43
  def changed?
@@ -28,8 +46,8 @@ module GitBundle
28
46
 
29
47
  def save
30
48
  if changed?
31
- File.open(path, 'w') {|file| file.write(current.to_yaml.lines[1..-1].join)}
32
- if File.exists?(path)
49
+ File.open(path, 'w') { |file| file.write(current.to_yaml.lines[1..-1].join) }
50
+ if File.exist?(path)
33
51
  puts "\t#{colorize('update', 34, bold: true)}\t#{filename}"
34
52
  else
35
53
  puts "\t#{colorize('create', 32, bold: true)}\t#{filename}"
@@ -10,55 +10,68 @@ module GitBundle
10
10
 
11
11
  def invoke
12
12
  @project.load_dependant_repositories
13
+ remaining_args = @args.dup
14
+ flag = remaining_args.first&.chars&.first == "-" ? remaining_args.shift : nil
15
+ branch = remaining_args.shift
13
16
 
14
- if @args.empty?
15
- checkout_parallel(@project.dependant_repositories, @project.main_repository.branch)
17
+ if remaining_args.any? || (flag && branch.nil?)
18
+ puts_error "Invalid arguments for checkout. Usage: \n\tgitb checkout\n\tgitb checkout <branch>\n\tgitb checkout <remote/branch>\n\tgitb checkout -b <new branch>\n\tgitb checkout -a <force branch all repositories>"
19
+ return
20
+ end
16
21
 
17
- elsif @args.size == 1
18
- if checkout(@project.main_repository, @args.first)
19
- checkout_parallel(@project.dependant_repositories, @args.first)
20
- end
21
- elsif @args.size == 2 && @args.first == '-b'
22
- if checkout(@project.main_repository, @args.last, create_new: true, force: true)
23
- @project.dependant_repositories.each {|r| checkout(r, @args.last, create_new: true)}
22
+ case
23
+ when flag == "-a" || flag == "--all"
24
+ if checkout(@project.main_repository, branch)
25
+ @project.dependant_repositories.each { |r| checkout(r, branch) }
24
26
  end
25
27
  @project.branch_config.save if @project.branch_config.changed?
26
- elsif @args.size == 2 && (@args.first == '-a' || @args.first == '--all')
27
- if checkout(@project.main_repository, @args.last)
28
- @project.dependant_repositories.each {|r| checkout(r, @args.last)}
28
+ when flag == "-b"
29
+ if checkout(@project.main_repository, branch, create_new: true, force: true)
30
+ @project.dependant_repositories.each { |r| checkout(r, branch, create_new: true) }
29
31
  end
30
32
  @project.branch_config.save if @project.branch_config.changed?
33
+ when branch.nil?
34
+ checkout_parallel(@project.dependant_repositories, fallback_branch: @project.main_repository.branch)
31
35
  else
32
- puts_error "Invalid arguments for checkout. Usage: \n\tgitb checkout\n\tgitb checkout <branch>\n\tgitb checkout -b <new branch>\n\tgitb checkout -a <force branch all repositories>"
36
+ if checkout(@project.main_repository, branch)
37
+ checkout_parallel(@project.dependant_repositories, fallback_branch: branch)
38
+ end
33
39
  end
34
40
  end
35
41
 
36
42
  def checkout(repo, branch, create_new: false, force: false)
43
+ args = ['checkout']
37
44
  if create_new
38
45
  unless force
39
46
  puts_repo_heading(repo)
40
47
  puts_prompt("Create #{branch}? (Y/N)")
41
48
  return unless STDIN.getch.upcase == 'Y'
42
49
  end
43
- args = ['checkout', '-b', branch]
44
- else
45
- args = ['checkout', branch]
50
+ args << '-b'
46
51
  end
52
+ args << branch
47
53
 
48
54
  output = repo.execute_git(args, color: true)
49
55
  success = $?.exitstatus == 0
50
56
  repo.refresh_branch
51
57
  puts_repo_heading(repo) unless create_new && !force
52
- success ? puts(output) : puts_error(output)
53
- if success && !repo.main && @project.branch_config.current && @project.branch_config.current[repo.name] != branch
54
- @project.branch_config.current[repo.name] = branch
58
+ if success && !repo.main && create_new && @project.branch_config.current
59
+ old_remote = @project.branch_config.remote(repo.name)
60
+ if old_remote
61
+ @project.branch_config.current[repo.name] = "#{old_remote} #{branch}"
62
+ else
63
+ @project.branch_config.current[repo.name] = branch
64
+ end
65
+ puts(output)
66
+ else
67
+ puts_error(output)
55
68
  end
56
69
  success
57
70
  end
58
71
 
59
- def checkout_parallel(repositories, fallback_branch)
72
+ def checkout_parallel(repositories, fallback_branch: nil)
60
73
  parallel(repositories) do |repo|
61
- output = repo.execute_git(['checkout', @project.branch_config.current&.dig(repo.name) || fallback_branch], color: true)
74
+ output = repo.execute_git(['checkout', @project.branch_config.branch(repo.name) || fallback_branch], color: true)
62
75
  repo.refresh_branch
63
76
  ExecutionResult.new($?.exitstatus != 0, output)
64
77
  end
@@ -16,7 +16,7 @@ module GitBundle
16
16
 
17
17
  def remote_branch_reference(repository)
18
18
  if repository.remote
19
- "#{repository.remote}/#{repository.branch}"
19
+ "#{repository.remote} #{repository.branch}"
20
20
  else
21
21
  repository.branch
22
22
  end
@@ -1,3 +1,3 @@
1
1
  module GitBundle
2
- VERSION = '1.0.16'
2
+ VERSION = '1.0.19'
3
3
  end
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-bundle
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.16
4
+ version: 1.0.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pierre Pretorius
8
- autorequire:
8
+ - Divan Burger
9
+ autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2021-12-06 00:00:00.000000000 Z
12
+ date: 2023-09-12 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: bundler
@@ -16,19 +17,20 @@ dependencies:
16
17
  requirements:
17
18
  - - "~>"
18
19
  - !ruby/object:Gem::Version
19
- version: '1.12'
20
+ version: 2.4.19
20
21
  type: :development
21
22
  prerelease: false
22
23
  version_requirements: !ruby/object:Gem::Requirement
23
24
  requirements:
24
25
  - - "~>"
25
26
  - !ruby/object:Gem::Version
26
- version: '1.12'
27
+ version: 2.4.19
27
28
  description: |-
28
29
  Simplifies working with gems from git repositories in combination with local overrides.
29
30
  See the github page for more detail.
30
31
  email:
31
32
  - pierre@labs.epiuse.com
33
+ - divan@labs.epiuse.com
32
34
  executables:
33
35
  - gitb
34
36
  extensions: []
@@ -59,7 +61,7 @@ homepage: https://github.com/EPI-USE-Labs/git-bundle
59
61
  licenses:
60
62
  - MIT
61
63
  metadata: {}
62
- post_install_message:
64
+ post_install_message:
63
65
  rdoc_options: []
64
66
  require_paths:
65
67
  - lib
@@ -74,8 +76,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
76
  - !ruby/object:Gem::Version
75
77
  version: '0'
76
78
  requirements: []
77
- rubygems_version: 3.1.4
78
- signing_key:
79
+ rubygems_version: 3.4.10
80
+ signing_key:
79
81
  specification_version: 4
80
82
  summary: Simplifies working with gems from git repositories in combination with local
81
83
  overrides.