Class: DeployLog::Github::Deploys

Inherits:
Object
  • Object
show all
Defined in:
lib/deploy_log/github/deploys.rb

Instance Method Summary collapse

Constructor Details

#initializeDeploys

Returns a new instance of Deploys.



6
7
8
# File 'lib/deploy_log/github/deploys.rb', line 6

def initialize
  @github = Helper.new(ARGV.first)
end

Instance Method Details

#merged_between(start, finish = nil) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/deploy_log/github/deploys.rb', line 10

def merged_between(start, finish = nil)
  return Notify.error 'Start (--start=) is a required argument' if start.nil?

  finish = Date.today.to_time + (24 * 60 * 60) - 1 if finish.nil?

  @github.pulls_in_timeframe(start, finish)
end

#merged_during_week(week_num) ⇒ Object



33
34
35
36
37
38
39
40
# File 'lib/deploy_log/github/deploys.rb', line 33

def merged_during_week(week_num)
  return Notify.error 'Week number (--week|-w) is a required argument' if week_num.nil?

  start = DeployLog::Calendar.start_of_week(24)
  finish = start + 24 * 60 * 60 - 1

  @github.pulls_in_timeframe(start, finish)
end

#merged_on(start) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/deploy_log/github/deploys.rb', line 25

def merged_on(start)
  return Notify.error 'Start (--start=) is a required argument' if start.nil?

  finish = start + 24 * 60 * 60 - 1

  @github.pulls_in_timeframe(start, finish)
end

#merged_todayObject



18
19
20
21
22
23
# File 'lib/deploy_log/github/deploys.rb', line 18

def merged_today
  start = Date.today.to_time # 12:00AM this morning
  finish = Date.today.to_time + (24 * 60 * 60) - 1 # 11:59PM tonight

  @github.pulls_in_timeframe(start, finish)
end

#pr_for_branch(branch) ⇒ Object



46
47
48
# File 'lib/deploy_log/github/deploys.rb', line 46

def pr_for_branch(branch)
  @github.search_pulls_by(branch, :ref)
end

#pr_title(title) ⇒ Object



42
43
44
# File 'lib/deploy_log/github/deploys.rb', line 42

def pr_title(title)
  @github.search_pulls_by(title, :title)
end