class DeployLog::Github::Deploys

Public Class Methods

new() click to toggle source
# File lib/deploy_log/github/deploys.rb, line 6
def initialize
  @github = Helper.new(ARGV.first)
end

Public Instance Methods

merged_between(start, finish = nil) click to toggle source
# 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?

  render @github.pulls_in_timeframe(start, finish)
end
merged_during_week(week_num = nil) click to toggle source
# File lib/deploy_log/github/deploys.rb, line 33
def merged_during_week(week_num = nil)
  calendar = DeployLog::Calendar.new
  week = calendar.week(week_num.to_i)

  render @github.pulls_in_timeframe(week[:first], week[:last])
end
merged_on(start) click to toggle source
# 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

  render @github.pulls_in_timeframe(start, finish)
end
merged_today() click to toggle source
# 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

  render @github.pulls_in_timeframe(start, finish)
end
pr_for_branch(branch) click to toggle source
# File lib/deploy_log/github/deploys.rb, line 44
def pr_for_branch(branch)
  render @github.search_pulls_by(branch, :ref)
end
pr_title(title) click to toggle source
# File lib/deploy_log/github/deploys.rb, line 40
def pr_title(title)
  render @github.search_pulls_by(title, :title)
end

Private Instance Methods

render(data) click to toggle source
# File lib/deploy_log/github/deploys.rb, line 50
def render(data)
  puts data if data.is_a? String
  data
end