socialcast-git-extensions 3.1.7 → 3.1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MjFhY2RkNmIxMTE0MTNjZDhjMzhhMjdkZjljOTRhYmIzMmE1MjllZA==
4
+ MTMxY2JlODhkMDhlYTE4YzkzMDg5MTExYzRiMGI2MzRmOWJjMzM3MA==
5
5
  data.tar.gz: !binary |-
6
- MWRiY2IwMTUwMmZmYWJlYjAzOTU5MmY1ZWY0ZTc4ODg1OWEyYWRiOA==
6
+ YTk4YTgyNDc4ZGRlMzU2NWJhMWEzNzYxYmNhN2Y3ZDcyMDgxNGQzMQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZTdjZTQxY2U1YjM3MTRmN2VlY2Y4MmQ4NTc1OTg4NzI1ZDZjMjE1MDlmODJk
10
- ZTU4ZDdmM2FiODg4NmE2NGVkMzRmYmM4YTc1NTA1ODU1YTE5ZGEwN2VkMTgz
11
- ODYxNjg4Mzg1YTkyNTYzNTdjMWMzNTZhYmNhMWIzNDg3NGVhMGQ=
9
+ YzVkOTkxMmRjOTY1Yzg3ZjlhMTAzMWMwZTBmMzUxYzY3MmFmN2ExZmVmZTk2
10
+ MGQ1MGMzZTFhMzFhMDdlYTNhYTNlMDVmYTJlOTM3NzcxOTMwZjljNDgwODA0
11
+ ZDAwM2ZiOGEyNmFiMGQyNWQ2NjNhYzE1OGM4Y2ViYjYwMmJlNzc=
12
12
  data.tar.gz: !binary |-
13
- OWY5ZGEwMGMzYjhhZjFhMWU5YTkzYjdiNDg3OGEzMThkYzUzYzRkYzVhNGZi
14
- YzI4MWU5YjFlN2E5NTc0NTFjM2ZmNTZmYzhhMmQwMmVlNTczM2I2M2VkOTFm
15
- NTRiNGE3YTc4M2E1NmVjOWZmNDY5ZmZiNGJhMmY4ZTk1NzZmNDY=
13
+ YjQxZTRmMTE5MTEzMzk1ZDBmY2I1OGI1ZjJiM2YwMjdkMWQ2YzA0NjE5YTQ5
14
+ MGEzMGZjYjA2MWVlODdmZGY3OTAxMWNkYTRjZDRlOTI1MDlhMDc0NjEwZTJm
15
+ YmE3MjliMTNjMWE3YTcwN2EyZTYzNjU2ZWUyYmIyNTEyNGQwYzA=
@@ -72,10 +72,10 @@ module Socialcast
72
72
  say "Deleting branches that have been merged into "
73
73
  say base_branch, :green
74
74
  branches(:merged => true, :remote => true).each do |branch|
75
- run_cmd "git push origin --delete #{branch}" unless reserved_branches.include?(branch)
75
+ run_cmd "git push origin --delete #{branch}" unless reserved_branch?(branch)
76
76
  end
77
77
  branches(:merged => true).each do |branch|
78
- run_cmd "git branch -d #{branch}" unless reserved_branches.include?(branch)
78
+ run_cmd "git branch -d #{branch}" unless reserved_branch?(branch)
79
79
  end
80
80
  end
81
81
 
@@ -6,7 +6,7 @@ module Socialcast
6
6
  module Git
7
7
  private
8
8
  def assert_not_protected_branch!(branch, action)
9
- raise "Cannot #{action} reserved branch" if reserved_branches.include?(branch) || aggregate_branch?(branch)
9
+ raise "Cannot #{action} reserved branch" if reserved_branch?(branch)
10
10
  end
11
11
 
12
12
  # lookup the current branch of the PWD
@@ -38,7 +38,7 @@ module Socialcast
38
38
  output.each do |branch|
39
39
  branch = branch.gsub(/\*/, '').strip.split(' ').first
40
40
  branch = branch.split('/').last if options[:remote]
41
- branches << branch unless reserved_branches.include?(branch)
41
+ branches << branch unless reserved_branch?(branch)
42
42
  end
43
43
  branches.uniq
44
44
  end
@@ -105,6 +105,10 @@ module Socialcast
105
105
  aggregate_branches.include?(branch) || branch.starts_with?('last_known_good')
106
106
  end
107
107
 
108
+ def reserved_branch?(branch)
109
+ aggregate_branch?(branch) || reserved_branches.include?(branch)
110
+ end
111
+
108
112
  # build a summary of changes
109
113
  def changelog_summary(branch)
110
114
  changes = `git diff --stat origin/#{base_branch}...#{branch}`.split("\n")
@@ -1,5 +1,5 @@
1
1
  module Socialcast
2
2
  module Gitx
3
- VERSION = "3.1.7"
3
+ VERSION = "3.1.8"
4
4
  end
5
5
  end
data/spec/cli_spec.rb CHANGED
@@ -391,4 +391,21 @@ describe Socialcast::Gitx::CLI do
391
391
  ]
392
392
  end
393
393
  end
394
+
395
+ describe '#cleanup' do
396
+ before do
397
+ Socialcast::Gitx::CLI.any_instance.should_receive(:branches).with(:merged => true, :remote => true).and_return(['master', 'foobar', 'last_known_good_master'])
398
+ Socialcast::Gitx::CLI.any_instance.should_receive(:branches).with(:merged => true).and_return(['staging', 'bazquux', 'last_known_good_prototype'])
399
+ Socialcast::Gitx::CLI.start ['cleanup']
400
+ end
401
+ it 'should only cleanup non-reserved branches' do
402
+ Socialcast::Gitx::CLI.stubbed_executed_commands.should == [
403
+ "git checkout master",
404
+ "git pull",
405
+ "git remote prune origin",
406
+ "git push origin --delete foobar",
407
+ "git branch -d bazquux"
408
+ ]
409
+ end
410
+ end
394
411
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: socialcast-git-extensions
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.7
4
+ version: 3.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Sonnek