git-bundle 1.0.5 → 1.0.6

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
  SHA1:
3
- metadata.gz: 467edc493a125e6a31d611f2fb4ae6fcab556294
4
- data.tar.gz: 86f3272c70dd19b54261a758a07bd686716fc888
3
+ metadata.gz: a8feeeb925b20aaf6289003e567f9f243e03d518
4
+ data.tar.gz: e8eac2a34eefd759c6a726c9e04e227fc736b623
5
5
  SHA512:
6
- metadata.gz: f922497c2a5c2dc38b784e4216a364d6325e541c51b85bba273a83bb2aaedbd89d9c0f9d1c074af2d24bcdd3ec8f944cbfb8d4514902277726e2b3d399ab7544
7
- data.tar.gz: 34bac554c411f39e3e835258ed3f275fe2618910fdf513926bd566ca6533828070c2b79bb80a071f699466a43d2803e8aa166685f620de37f8bf2349a52f5b66
6
+ metadata.gz: 457e165a94c0e638a4437b6eb85aa6ad983673ae4573c24abb52f08e6e41942b1ac3f5105e3a3bb79ff4e9df6edef349eb7ae06ee5807846a46809ba8196ffd5
7
+ data.tar.gz: f3c240557a740e25d9ee5baab591e9ff224123d7732f65f3703b8c44545418a02a747109fe489fdf3bd8df6237b9d8bc151b24ef843a74d81987ce28c3441c75
@@ -12,7 +12,7 @@ module GitBundle
12
12
  errors = []
13
13
  @repositories.each do |repo|
14
14
  puts_repo_heading(repo)
15
- puts repo.execute_git(@args.join(' '))
15
+ puts repo.execute_git(@args, color: true)
16
16
  errors << repo.name unless $?.exitstatus == 0
17
17
  end
18
18
 
@@ -21,7 +21,7 @@ module GitBundle
21
21
  end
22
22
 
23
23
  def branch
24
- @branch ||= execute_git('rev-parse --abbrev-ref HEAD')
24
+ @branch ||= execute_git('rev-parse', '--abbrev-ref', 'HEAD').chomp
25
25
  end
26
26
 
27
27
  def locked_branch
@@ -29,7 +29,7 @@ module GitBundle
29
29
  end
30
30
 
31
31
  def revision
32
- @revision ||= execute_git('rev-parse --verify HEAD').gsub("\n", '')
32
+ @revision ||= execute_git('rev-parse', '--verify', 'HEAD').gsub("\n", '')
33
33
  end
34
34
 
35
35
  def locked_revision
@@ -37,37 +37,47 @@ module GitBundle
37
37
  end
38
38
 
39
39
  def commits_not_pushed
40
- execute_git("rev-list --pretty=oneline --abbrev-commit origin/#{branch}..#{branch}")
40
+ execute_git('rev-list', '--pretty=oneline', '--abbrev-commit', "origin/#{branch}..#{branch}")
41
41
  end
42
42
 
43
43
  def commit_messages_not_pushed
44
- count = execute_git("rev-list origin/#{branch}..#{branch} --count").to_i
45
- count.times.map { |num| execute_git("rev-list --pretty=oneline --skip=#{num} --max-count=1 origin/#{branch}..#{branch}").sub(/\h*\s/, '').strip }
44
+ count = execute_git('rev-list', "origin/#{branch}..#{branch}", '--count').to_i
45
+ count.times.map { |num| execute_git('rev-list', '--pretty=oneline', "--skip=#{num}", '--max-count=1', "origin/#{branch}..#{branch}").sub(/\h*\s/, '').strip }
46
46
  end
47
47
 
48
48
  def push(args)
49
- puts execute_git("push #{args.join(' ')}")
49
+ puts execute_git('push', args)
50
50
  $?.exitstatus == 0
51
51
  end
52
52
 
53
53
  def file_changed?(filename)
54
- !execute_git("diff --name-only #{filename}").empty? && $?.exitstatus == 0
54
+ !execute_git('diff', '--name-only', filename).empty? && $?.exitstatus == 0
55
55
  end
56
56
 
57
57
  def add_file(filename)
58
- execute_git("add #{filename}")
58
+ execute_git('add', filename)
59
59
  $?.exitstatus == 0
60
60
  end
61
61
 
62
62
  def commit(message, *files)
63
- execute_git("commit -m '#{message}' #{files.join(' ')}")
63
+ execute_git('commit', '-m', message, files)
64
64
  $?.exitstatus == 0
65
65
  end
66
66
 
67
- def execute_git(command)
68
- full_command = "git -C #{@path} #{command}"
69
- puts full_command if ENV['DEBUG'] == 'true'
70
- `#{full_command}`.strip
67
+ def execute_git(*args, **options)
68
+ git_command = ['git', '-C', @path]
69
+ git_command += %w(-c color.status=always -c color.ui=always) if options.fetch(:color, false)
70
+ git_command += args.flatten
71
+ execute(*git_command)
72
+ end
73
+
74
+ def execute(*args)
75
+ puts args.map{ |arg| "'#{arg}'" }.join(' ') if ENV['DEBUG'] == 'true'
76
+
77
+ pipe_out, pipe_in = IO.pipe
78
+ system *args, out: pipe_in, err: pipe_in
79
+ pipe_in.close
80
+ pipe_out.read
71
81
  end
72
82
  end
73
83
  end
@@ -1,3 +1,3 @@
1
1
  module GitBundle
2
- VERSION = '1.0.5'
2
+ VERSION = '1.0.6'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-bundle
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pierre Pretorius
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-18 00:00:00.000000000 Z
11
+ date: 2017-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler