branch_cleaner 0.1.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a8fa8cf28f6f6b14ba600f51c2b4ebd7672bc094
4
+ data.tar.gz: b480562f355473d3bdf2c94656528cb73fa12ef9
5
+ SHA512:
6
+ metadata.gz: 3951b67729e2e56633eb3a96f32121d832b90bafbce13d57b540f70a88a89ed0694343fa936c204eb3f560ba8c78c25ff60a78984c7957b87485abaa9550ddef
7
+ data.tar.gz: 5a5b1127b1c8f0759455141530b1f65302319fdf3025455003ca6606d97344499a967bbec9f1c56d1d722dd51d4026564d46d1dc57d706239a69bbf4625eb91a
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'branch_cleaner'
4
+ puts BranchCleaner.clean()
@@ -0,0 +1,48 @@
1
+ require 'set'
2
+
3
+ class BranchCleaner
4
+
5
+ KEEP_BRANCHES_PATH = "./.keep_branches"
6
+
7
+ def self.get_branches()
8
+ branches = `git branch`.split("\n")
9
+ end
10
+
11
+ def self.clean()
12
+ branches = get_branches()
13
+ branches_to_keep = Set.new ["master"]
14
+ for branch in branches do
15
+ branch = branch.gsub(/^\s+/, '')
16
+ if branch.start_with?('*') || branches_to_keep.include?(branch)
17
+ puts "Skipping branch " + branch.gsub(/^\*?\s*/, '')
18
+ else
19
+ system("git branch -d " + branch)
20
+ end
21
+ end
22
+ end
23
+ end
24
+
25
+ # def get_branches_to_keep()
26
+ # branches_to_keep = Set.new ["master"]
27
+ # File.open(KEEP_BRANCHES_PATH, "r") do |f|
28
+ # f.each_line do |line|
29
+ # branches_to_keep.add(line.gsub(/\n/, ''))
30
+ # end
31
+ # end
32
+ # return branches_to_keep
33
+ # end
34
+
35
+ # def clean_branches()
36
+ # branches_to_keep = Set.new ["master"]
37
+ # branches = `git branch`.split("\n")
38
+ # for branch in branches do
39
+ # branch = branch.gsub(/^\s+/, '')
40
+ # if branch.start_with?('*') || branches_to_keep.include?(branch)
41
+ # puts "Skipping branch " + branch.gsub(/^\*?\s*/, '')
42
+ # else
43
+ # system("git branch -d " + branch)
44
+ # end
45
+ # end
46
+ # end
47
+ #
48
+ # clean_branches()
metadata ADDED
@@ -0,0 +1,47 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: branch_cleaner
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Matt Flickner
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-03-13 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Simple gem that will delete all fully merged branches.
14
+ email: mwflickner@gmail.com
15
+ executables:
16
+ - cleanbranches
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - bin/cleanbranches
21
+ - lib/branch_cleaner.rb
22
+ homepage: https://rubygems.org/gems/example
23
+ licenses:
24
+ - MIT
25
+ metadata:
26
+ source_code_uri: https://github.com/mwflickner/git-branch-cleaner
27
+ post_install_message:
28
+ rdoc_options: []
29
+ require_paths:
30
+ - lib
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ required_rubygems_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ requirements: []
42
+ rubyforge_project:
43
+ rubygems_version: 2.5.1
44
+ signing_key:
45
+ specification_version: 4
46
+ summary: This is an example!
47
+ test_files: []