branch-cleaner 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/branch/cleaner/version.rb +1 -1
- data/lib/branch/cleaner.rb +3 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12716974eac388586df7653ab531b8a4d824a1cc
|
4
|
+
data.tar.gz: d08b0e40e6cdc0abf5693a24a516a8fdb77596cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa7f430447fe65113ed13830ef3b14f23d3bd029a09d6873ccbc4762a71c71cc69d1d058f08096958d9c66192dc4dbddc18ba7f1fc4d1dc5d5d191b8d0f4afac
|
7
|
+
data.tar.gz: c0f8e54087336d002e7c2e68c3a84f7b845348cd85e4b4f022304ce19841147dfba1665e583dcd41c9ae3bcff339646a0310435a21af06613ee77469ea0b726a
|
data/Gemfile.lock
CHANGED
data/lib/branch/cleaner.rb
CHANGED
@@ -5,6 +5,7 @@ require 'Time'
|
|
5
5
|
module Branch
|
6
6
|
module Cleaner
|
7
7
|
NOBLE_BRANCHES_NAMES = ["master", "develop"]
|
8
|
+
DEFAULT_WEEKS = 2
|
8
9
|
|
9
10
|
options = {}
|
10
11
|
OptionParser.new do |opts|
|
@@ -15,7 +16,7 @@ module Branch
|
|
15
16
|
end
|
16
17
|
|
17
18
|
opts.on('-w=NUMBER', '--week=NUMBER', 'number of weeks. If last commit of branch if before the date, the branch will be deleted.') do |value|
|
18
|
-
options[:weeks] = Float(value) rescue
|
19
|
+
options[:weeks] = Float(value) rescue DEFAULT_WEEKS
|
19
20
|
end
|
20
21
|
end.parse!
|
21
22
|
|
@@ -31,7 +32,7 @@ module Branch
|
|
31
32
|
branch_time = Time.parse(branch)
|
32
33
|
now_time = Time.new
|
33
34
|
weeks = (now_time - branch_time) / 3600 / 24 / 7
|
34
|
-
(weeks > options[:weeks]) && !(NOBLE_BRANCHES_NAMES.include?(branch.split(' ').last.split('/', 2).last))
|
35
|
+
(weeks > (options[:weeks] || DEFAULT_WEEKS)) && !(NOBLE_BRANCHES_NAMES.include?(branch.split(' ').last.split('/', 2).last))
|
35
36
|
end
|
36
37
|
|
37
38
|
puts <<-FOO
|