git_eraser 0.1.2 โ 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/git_eraser.rb +38 -32
- data/lib/git_eraser/version.rb +1 -1
- metadata +29 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61f89f4cfe8c92ef7f463912ed445bf6f77b1b60ad8117c1f70e11d70847bcbc
|
4
|
+
data.tar.gz: d33df662cd6391e2c945c7fdf5ef134727fa2b6a6ff6c674e553e502f20eca11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e24527a9ec43fc498bd8f957d463580102ae6a64f9fd4e5f4d3bc6619508a490d95156b03cfe2fe7d218cd74d0e18ad9c05de42b9378e28f214fb32b01051223
|
7
|
+
data.tar.gz: 24aa72ecedd6591fbb9060c3a81f44d1bc886391716b5106695d2e34187a45a9d2a100649083b37b3a4ae73863426072e77df42d2ee0d1bfea3808c9d8ad583f
|
data/lib/git_eraser.rb
CHANGED
@@ -4,6 +4,7 @@ require "highline"
|
|
4
4
|
require "rainbow"
|
5
5
|
require "httpclient"
|
6
6
|
require "git"
|
7
|
+
require 'whirly'
|
7
8
|
|
8
9
|
module GitEraser
|
9
10
|
class Error < StandardError; end
|
@@ -44,7 +45,7 @@ module GitEraser
|
|
44
45
|
puts " ๐งน #{index + 1}. #{local_branch}"
|
45
46
|
end
|
46
47
|
|
47
|
-
puts "\n
|
48
|
+
puts "\n"
|
48
49
|
rescue
|
49
50
|
Helper.new.print_no_git_error_message
|
50
51
|
end
|
@@ -67,7 +68,7 @@ module GitEraser
|
|
67
68
|
puts " ๐งน #{index + 1}. #{origin_branch}"
|
68
69
|
end
|
69
70
|
|
70
|
-
puts "\n
|
71
|
+
puts "\n"
|
71
72
|
rescue
|
72
73
|
Helper.new.print_no_git_error_message
|
73
74
|
end
|
@@ -86,12 +87,12 @@ module GitEraser
|
|
86
87
|
puts " ๐งน #{index + 1}. #{local_branch}"
|
87
88
|
end
|
88
89
|
|
89
|
-
puts "\n
|
90
|
+
puts "\n"
|
90
91
|
|
91
92
|
inputStream = HighLine.new
|
92
93
|
should_delete_branches = inputStream.agree("Delete these branches? (y/n) ")
|
93
94
|
if should_delete_branches == true
|
94
|
-
puts "\n
|
95
|
+
puts "\n"
|
95
96
|
g.checkout('master')
|
96
97
|
g.branches.local.each_with_index do |local_branch, index|
|
97
98
|
begin
|
@@ -105,8 +106,9 @@ module GitEraser
|
|
105
106
|
puts " #{index + 1}. Can't remove '#{local_branch}' โ"
|
106
107
|
end
|
107
108
|
end
|
109
|
+
puts "\n#{Rainbow("All local branches that merged to master had been deleted successfuly").underline.bright.green} ๐๐"
|
108
110
|
end
|
109
|
-
puts "\n
|
111
|
+
puts "\n"
|
110
112
|
rescue
|
111
113
|
Helper.new.print_no_git_error_message
|
112
114
|
end
|
@@ -125,38 +127,42 @@ module GitEraser
|
|
125
127
|
puts " ๐งน #{index + 1}. #{origin_branch}"
|
126
128
|
end
|
127
129
|
|
128
|
-
puts "\n
|
130
|
+
puts "\n"
|
129
131
|
|
130
132
|
inputStream = HighLine.new
|
131
133
|
should_delete_branches = inputStream.agree("Delete these branches? (y/n) ")
|
132
134
|
|
133
135
|
if should_delete_branches == true
|
134
|
-
puts "\n
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
136
|
+
puts "\n"
|
137
|
+
Whirly.start do
|
138
|
+
Whirly.status = "Deleting Origin Branches..."
|
139
|
+
g.checkout('master')
|
140
|
+
g.pull('origin', 'master')
|
141
|
+
array_of_remote_deleted_branches = []
|
142
|
+
g.branches.remote.each_with_index do |origin_branch, index|
|
143
|
+
begin
|
144
|
+
branch_string = origin_branch.to_s
|
145
|
+
branch_string['remotes/origin/'] = ''
|
146
|
+
g.checkout(branch_string)
|
147
|
+
if g.branch('master').contains?(branch_string) && branch_string != 'master'
|
148
|
+
system "git push -u origin --delete #{branch_string} -q"
|
149
|
+
puts " #{index + 1}. '#{origin_branch}' Removed โ
"
|
150
|
+
array_of_remote_deleted_branches.append(branch_string)
|
151
|
+
elsif branch_string == 'master'
|
152
|
+
puts " #{index + 1}. '#{origin_branch}' Can't remove 'master' branch โ"
|
153
|
+
else
|
154
|
+
puts " #{index + 1}. '#{origin_branch}' Not merged into 'master' โ"
|
155
|
+
end
|
156
|
+
rescue
|
157
|
+
puts " #{index + 1}. Can't remove '#{origin_branch}' โ"
|
151
158
|
end
|
152
|
-
rescue
|
153
|
-
puts " #{index + 1}. Can't remove '#{origin_branch}' โ"
|
154
159
|
end
|
160
|
+
g.checkout('master')
|
161
|
+
delete_local_after_origin(array_of_remote_deleted_branches)
|
162
|
+
puts "\n#{Rainbow("All origin branches that merged to master had been deleted successfuly").underline.bright.green} ๐๐"
|
155
163
|
end
|
156
|
-
g.checkout('master')
|
157
|
-
delete_local_after_origin(array_of_remote_deleted_branches)
|
158
164
|
end
|
159
|
-
puts "\n
|
165
|
+
puts "\n"
|
160
166
|
rescue
|
161
167
|
Helper.new.print_no_git_error_message
|
162
168
|
end
|
@@ -169,9 +175,9 @@ module GitEraser
|
|
169
175
|
begin
|
170
176
|
g = Git.open("#{current_directory}")
|
171
177
|
g.branches.local.each do |local_branch|
|
172
|
-
puts "Local: #{local_branch}"
|
178
|
+
# puts "Local: #{local_branch}"
|
173
179
|
branches.each do |value|
|
174
|
-
puts "coming: #{value}"
|
180
|
+
# puts "coming: #{value}"
|
175
181
|
if local_branch.to_s == value
|
176
182
|
local_branch.delete
|
177
183
|
end
|
@@ -224,7 +230,7 @@ Here is a preview of your #{git_type} branches: \n\n"
|
|
224
230
|
"
|
225
231
|
puts "#{text2} \n"
|
226
232
|
puts "Welcome to the #{Rainbow("Git Eraser").underline.bright.red} ๐งน๐งน project! \n\n"
|
227
|
-
puts "โ ๏ธโ ๏ธ There is no #{Rainbow("git").underline.bright.red} directory here ๐ก \n
|
233
|
+
puts "โ ๏ธโ ๏ธ There is no #{Rainbow("git").underline.bright.red} directory here ๐ก \n"
|
228
234
|
end
|
229
235
|
|
230
236
|
def print_no_flag_error_message
|
@@ -238,7 +244,7 @@ Here is a preview of your #{git_type} branches: \n\n"
|
|
238
244
|
"
|
239
245
|
puts "#{text2} \n"
|
240
246
|
puts "Welcome to the #{Rainbow("Git Eraser").underline.bright.red} ๐งน๐งน project! \n\n"
|
241
|
-
puts "โ ๏ธโ ๏ธ You didn't specify any flag, please use --local or --origin flag ๐ก \n
|
247
|
+
puts "โ ๏ธโ ๏ธ You didn't specify any flag, please use --local or --origin flag ๐ก \n"
|
242
248
|
end
|
243
249
|
end
|
244
250
|
|
data/lib/git_eraser/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git_eraser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- KarimEbrahem
|
@@ -80,6 +80,34 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 2.8.3
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: whirly
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.2.6
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.2.6
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: paint
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 2.1.0
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 2.1.0
|
83
111
|
- !ruby/object:Gem::Dependency
|
84
112
|
name: bundler
|
85
113
|
requirement: !ruby/object:Gem::Requirement
|