mj 1.0.0 → 1.1.0

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
  SHA256:
3
- metadata.gz: 3ae71fd8808a2f04a8cfb7838d347f529a5df0aa9b5a3d6eb3618b089c9724c3
4
- data.tar.gz: e8f7c0778fc83b5fe2e5206b14a84ba297f85c5337d3248d48ff36e5099bfa7b
3
+ metadata.gz: 89e001fe208b12ec28ecf985f50e778fcfc295171c28b5fbeff5329711aeb1bb
4
+ data.tar.gz: 92b72966a17d0753e46823a5e7d6b4359b8753347d415025b4d3b40b5d5c8fd6
5
5
  SHA512:
6
- metadata.gz: 33aafd4dc0b0bc9910442c625b04da211b71fb86d82d2f2b13282fb3a3ded0a081ea3877d98eac8fc5c6b18a0532d90f6d59926c108b5c0b753a672d35d4ffe2
7
- data.tar.gz: d9dfd28ccbdc9aa8e615d2fa1ef81d57ccc33707ea8c519fe0cfce55e2fc17b8fc1345d43da241e929da05a70c70fa11bf89376fd1e14beae6d4f895569ca44a
6
+ metadata.gz: 83db7c1361d041476e30e1c8818f7d873603a27e0ab11d773b05d9603b3388fc374192ae5f37af6df430f42a5884860f982e45e09e97cec62c1ea343e3ca4408
7
+ data.tar.gz: bf0ed35c9eb853c1e617abbeced2fa9b2e710cdca2f76ef853e538f4c5f64ccb9d131aaca9c93701b3e6790ed0a342ba144c8140145c4d43c7d3c7da37a24b1a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mj (1.0.0)
4
+ mj (1.1.0)
5
5
  colorize
6
6
  koine-rest_client
7
7
  mj-hash_utils
@@ -111,7 +111,7 @@ GEM
111
111
  strscan (3.1.0)
112
112
  thor (1.2.2)
113
113
  unicode-display_width (2.5.0)
114
- uri (0.13.0)
114
+ uri (0.13.1)
115
115
 
116
116
  PLATFORMS
117
117
  arm64-darwin-23
data/README.md CHANGED
@@ -38,6 +38,7 @@ bundle exec mj git delete_stale_branches \
38
38
  [--dry-run] \
39
39
  [--only-with-prs] \
40
40
  [--only-with-closed-prs] \
41
+ [--after-date=2021-01-01] \
41
42
  [--before-date=2021-01-01]
42
43
  ```
43
44
 
@@ -12,6 +12,19 @@ module Mj
12
12
  @options[:dry_run]
13
13
  end
14
14
 
15
+ def after_date
16
+ if @after_date
17
+ return @after_date
18
+ end
19
+
20
+ if @options[:after_date]
21
+ @after_date ||= DateTime.parse(@options[:after_date])
22
+ end
23
+
24
+ # Default to 100+ years ago - sure there are no commits that old
25
+ @after_date ||= DateTime.new(1900, 1, 1, 0, 0, 0)
26
+ end
27
+
15
28
  def before_date
16
29
  if @before_date
17
30
  return @before_date
@@ -43,7 +43,12 @@ module Mj
43
43
  end
44
44
 
45
45
  if branch.last_commit_date >= command.before_date
46
- puts("Skipping #{branch.name}. Not before #{command.before_date}", color: :yellow)
46
+ puts("Skipping #{branch.name}. Not before #{command.before_date}.", color: :yellow)
47
+ return false
48
+ end
49
+
50
+ if branch.last_commit_date < command.after_date
51
+ puts("Skipping #{branch.name}. Not after #{command.after_date}.", color: :yellow)
47
52
  return false
48
53
  end
49
54
 
@@ -62,8 +67,8 @@ module Mj
62
67
 
63
68
  def delete(branch)
64
69
  branch.delete
65
- rescue StandardError => exception
66
- log("Could not delete branch #{branch.name}: #{exception.message}", color: :red)
70
+ rescue Mj::Git::CommandExecuter::Error => exception
71
+ puts("Could not delete branch #{branch.name}: #{exception.message}.", color: :red)
67
72
  end
68
73
 
69
74
  def puts(string, color: nil)
@@ -30,6 +30,10 @@ module Mj
30
30
  type: :boolean,
31
31
  banner: "Do not delete if PRs are in DRAFT or OPEN - will they maybe be merged?",
32
32
  aliases: :c
33
+ option :after_date,
34
+ type: :string,
35
+ banner: "Formatted date YYY-MM-DD",
36
+ aliases: :a
33
37
  option :before_date,
34
38
  type: :string,
35
39
  banner: "Formatted date YYY-MM-DD",
data/lib/mj/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Mj
4
- VERSION = "1.0.0"
4
+ VERSION = "1.1.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mj
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcelo Jacobus