Class: Mj::Git::Commands::DeleteStaleBranchesCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/mj/git/commands/delete_stale_branches_command.rb

Instance Method Summary collapse

Constructor Details

#initialize(options: {}) ⇒ DeleteStaleBranchesCommand

Returns a new instance of DeleteStaleBranchesCommand.



7
8
9
# File 'lib/mj/git/commands/delete_stale_branches_command.rb', line 7

def initialize(options: {})
  @options = options
end

Instance Method Details

#after_dateObject



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/mj/git/commands/delete_stale_branches_command.rb', line 15

def after_date
  if @after_date
    return @after_date
  end

  if @options[:after_date]
    @after_date ||= DateTime.parse(@options[:after_date])
  end

  # Default to 100+ years ago - sure there are no commits that old
  @after_date ||= DateTime.new(1900, 1, 1, 0, 0, 0)
end

#before_dateObject



28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/mj/git/commands/delete_stale_branches_command.rb', line 28

def before_date
  if @before_date
    return @before_date
  end

  if @options[:before_date]
    @before_date ||= DateTime.parse(@options[:before_date])
  end

  # Default to now, because all things happened before now.
  @before_date ||= DateTime.now
end

#dry_run?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/mj/git/commands/delete_stale_branches_command.rb', line 11

def dry_run?
  @options[:dry_run]
end

#from_commitersObject



53
54
55
# File 'lib/mj/git/commands/delete_stale_branches_command.rb', line 53

def from_commiters
  @options[:from_commiters].to_s.split(",")
end

#from_pull_requestorsObject



49
50
51
# File 'lib/mj/git/commands/delete_stale_branches_command.rb', line 49

def from_pull_requestors
  @options[:from_pull_requestors].to_s.split(",")
end

#only_with_closed_prsObject



45
46
47
# File 'lib/mj/git/commands/delete_stale_branches_command.rb', line 45

def only_with_closed_prs
  @options[:only_with_closed_prs]
end

#only_with_prsObject



41
42
43
# File 'lib/mj/git/commands/delete_stale_branches_command.rb', line 41

def only_with_prs
  @options[:only_with_prs]
end