Class: ReleaseRobot::Printer

Inherits:
Object
  • Object
show all
Defined in:
lib/release_robot/printer.rb

Constant Summary collapse

PODIO_URL_REGEX =
/https:\/\/podio.com\/hranswerlink-8ee92nawfl\/issue-tracker\/apps\/product-feedback\/items\/\d+/

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pull_requests, client) ⇒ Printer

Returns a new instance of Printer.



7
8
9
10
# File 'lib/release_robot/printer.rb', line 7

def initialize(pull_requests, client)
  @pull_requests = pull_requests
  @client = client
end

Instance Attribute Details

#clientObject

Returns the value of attribute client.



5
6
7
# File 'lib/release_robot/printer.rb', line 5

def client
  @client
end

#pull_requestsObject

Returns the value of attribute pull_requests.



5
6
7
# File 'lib/release_robot/printer.rb', line 5

def pull_requests
  @pull_requests
end

Instance Method Details

#podio_urls(repo_name, issue) ⇒ Object



55
56
57
58
# File 'lib/release_robot/printer.rb', line 55

def podio_urls(repo_name, issue)
  pr = client.pull_request(repo_name, issue.number)
  pr.body.scan PODIO_URL_REGEX
end


12
13
14
15
# File 'lib/release_robot/printer.rb', line 12

def print_all
  print_prep_list
  print_deploy_list
end


33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/release_robot/printer.rb', line 33

def print_deploy_list
  print_title 'List for #deploys'

  puts Date.today.strftime('%D')

  pull_requests.each_pair do |_, issues|
    issues.each do |(repo_name, issue)|
      slug = repo_name.gsub('MammothHR/', '')

      puts "(#{slug}) #{issue.title}"
    end
  end
end


17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/release_robot/printer.rb', line 17

def print_prep_list
  print_title 'Prep list for #releases'

  puts "For today's release:\n\n"

  pull_requests.each_pair do |status, issues|
    issues.each do |(repo_name, issue)|
      puts issue.title
      puts issue.html_url
      podio_urls(repo_name, issue).each { |url| puts url }
      puts "*Build #{status}*"
      puts
    end
  end
end


47
48
49
50
51
52
53
# File 'lib/release_robot/printer.rb', line 47

def print_title(title)
  puts
  puts '-' * 50
  puts title
  puts '-' * 50
  puts
end