mj 1.0.1 → 1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: de854df996b9ec36033b49f7d985e7ccc01a7c0e57c1d1facc62128623ecbda1
4
- data.tar.gz: 8525e716e78a261741fae76f10b3e56cc87e6c61d456ebe66b3aa654fb60122a
3
+ metadata.gz: 89e001fe208b12ec28ecf985f50e778fcfc295171c28b5fbeff5329711aeb1bb
4
+ data.tar.gz: 92b72966a17d0753e46823a5e7d6b4359b8753347d415025b4d3b40b5d5c8fd6
5
5
  SHA512:
6
- metadata.gz: 1b170449ed5da0e13b54f29f8bfd92c6b928f85882a03f726211bfcb8ad5fb3d6e9b6af27eff1aaeac822ca183b35e7e93f1728993df2f374331bfab80ca6b5e
7
- data.tar.gz: 53023f5352259df180d522286f513eb3804f8632465c2eb53dc5b3ebaa812e133ba6a15346290e65bb5c33aa002677127e8082591847d42df36d6b60b49a0fc7
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.1)
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
 
@@ -63,7 +68,7 @@ module Mj
63
68
  def delete(branch)
64
69
  branch.delete
65
70
  rescue Mj::Git::CommandExecuter::Error => exception
66
- puts("Could not delete branch #{branch.name}: #{exception.message}", color: :red)
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.1"
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.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcelo Jacobus