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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ef403935ef17b5557fc09f725c84b7fffa991747
4
- data.tar.gz: db3b912fc5aee03656991a07aa9073045a7cfe67
3
+ metadata.gz: 12716974eac388586df7653ab531b8a4d824a1cc
4
+ data.tar.gz: d08b0e40e6cdc0abf5693a24a516a8fdb77596cb
5
5
  SHA512:
6
- metadata.gz: 6bfb7f28b3d897426bcf0a604918384624d7dd22af1282ced7ce8fab0299c110a1cda0b778bbf6d36e41aa8d09fe360f8ae90e123fa65e6b43f43b028d476f94
7
- data.tar.gz: f0c8d524f7d86d9f5834c882fb72ff7cd1aca575fc19888cc73aa092e540f1efdbaeb560f7aaf6e28c261afb9799bff68174fab5d8c6a8e145fe28a7d6c148f8
6
+ metadata.gz: fa7f430447fe65113ed13830ef3b14f23d3bd029a09d6873ccbc4762a71c71cc69d1d058f08096958d9c66192dc4dbddc18ba7f1fc4d1dc5d5d191b8d0f4afac
7
+ data.tar.gz: c0f8e54087336d002e7c2e68c3a84f7b845348cd85e4b4f022304ce19841147dfba1665e583dcd41c9ae3bcff339646a0310435a21af06613ee77469ea0b726a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- branch-cleaner (0.1.0)
4
+ branch-cleaner (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,5 +1,5 @@
1
1
  module Branch
2
2
  module Cleaner
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
@@ -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 2
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: branch-cleaner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - tripleCC