deploy_log 0.1.8a → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8efe330a5904b33493a0c20ea2b1eddf39c9fc8483ab6d7450a772f60b6a5f14
4
- data.tar.gz: 16cc0a1aeaca9548b31d1a190d27f0010f276c600b6631b2b602ee09ff79049b
3
+ metadata.gz: 0be5986780967ad9c7fe713a71f69b392919affb3ebaf82cab6adbb7c20dad22
4
+ data.tar.gz: 44e92a417ff45c4833939879c1b5e4adc7e8f3a2b309350e42a003f6f52222ae
5
5
  SHA512:
6
- metadata.gz: 733bba8d06fe7d725a50b66acfd2b7139e2aaf562079c1bcf6731013d11aa8565353c299b0162b5f735290b4bc3b754a52d00c6b11de8e23788b8ed8ca33c8b6
7
- data.tar.gz: 55cf93d87df9255b0edf4f8142746671932e645e96efac3454fed64d040e5443827eb1f06ecdf8814e1b49dec2a616b92ddf7150490ef333be0fbc5efb7bc555
6
+ metadata.gz: 82bda4ccab174bf8c523f86d4ab04d1f29e2b8b26fb9db0b26e799d7d443ab051d7acbd83ac653ccaa92e6667603417e46c3e0e26c713029ee74f2c415532dcc
7
+ data.tar.gz: 533e5362acfbe7d55970ceca4d3aea9e7f583e377465175a5600df2df903188fdb80aeec7ab70e52c59374d1917f90ee7758a48ab39f23a3de9b30b55ea38dac
@@ -5,13 +5,11 @@ require 'octokit'
5
5
  module DeployLog
6
6
  module Github
7
7
  class Helper
8
- LINE_FORMAT = "%s (%s)\n - Created by %s\n - Branch: %s\n - Merged by %s on %s\n - Changes: %s\n\n"
8
+ LINE_FORMAT = "%s (%s)\n - Created by %s\n - Branch: %s\n - Merged by %s on %s\n - Changes: %s\n -- %s\n\n"
9
9
 
10
10
  def initialize(user_repo)
11
11
  @client = ::Octokit::Client.new(login: ENV['GITHUB_USER'], password: ENV['GITHUB_TOKEN'])
12
12
  @repo_location = user_repo
13
- # cache last API response
14
- @last_response = nil
15
13
  end
16
14
 
17
15
  def pulls_in_timeframe(date_start = nil, date_end = nil)
@@ -27,7 +25,6 @@ module DeployLog
27
25
  File.open('/tmp/github-deploys.log', 'w+') do |f|
28
26
  list.each do |pr|
29
27
  next unless (date_start..date_end).cover? pr.merged_at
30
- _c = committers_for(pr.number)
31
28
 
32
29
  prs_covered += 1
33
30
 
@@ -39,8 +36,9 @@ module DeployLog
39
36
  pr.user.login,
40
37
  pr.head.ref,
41
38
  user_who_merged(pr.number),
42
- formatted_time(pr.merged_at),
43
- pr.diff_url
39
+ formatted_time(pr.merged_at, true),
40
+ pr.diff_url,
41
+ committers_for(pr.number).join("\n -- ")
44
42
  )
45
43
  )
46
44
  end
@@ -74,8 +72,9 @@ module DeployLog
74
72
  pr.user.login,
75
73
  pr.head.ref,
76
74
  user_who_merged(pr.number),
77
- formatted_time(pr.merged_at),
78
- pr.diff_url
75
+ formatted_time(pr.merged_at, true),
76
+ pr.diff_url,
77
+ committers_for(pr.number).join("\n -- ")
79
78
  )
80
79
  )
81
80
  end
@@ -90,22 +89,26 @@ module DeployLog
90
89
 
91
90
  private
92
91
 
93
- def user_who_merged(pr_number)
94
- pr = @client.pull_request(@repo_location, pr_number)
95
- @last_response = pr
96
-
92
+ def user_who_merged(num)
93
+ pr = @client.pull_request(@repo_location, num)
97
94
  pr.merged_by.login
98
95
  end
99
96
 
100
97
  def committers_for(num)
101
- puts @last_response.inspect
102
- # pr = @client.pull_request(@repo_location, num)
98
+ commits = @client.pull_request_commits(@repo_location, num)
99
+ commits.map do |c|
100
+ "#{c.author.login} committed '#{c.commit.message}'"
101
+ end
103
102
  end
104
103
 
105
- def formatted_time(time, correct_utc = false)
104
+ def formatted_time(time, use_local_time = false)
106
105
  time = Time.now if time.nil?
107
- time = time.localtime if correct_utc
108
- time.strftime('%e/%-m/%Y @ %I:%M:%S%P')
106
+ time = time.localtime if use_local_time
107
+
108
+ fmt = '%e/%-m/%Y @ %I:%M:%S%P'
109
+ fmt += ' UTC' unless use_local_time
110
+
111
+ time.strftime(fmt)
109
112
  end
110
113
 
111
114
  def nested_hash_value(obj, key)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DeployLog
4
- VERSION = '0.1.8a'
4
+ VERSION = '0.1.8'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deploy_log
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8a
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Priebe
@@ -118,9 +118,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
118
118
  version: '0'
119
119
  required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  requirements:
121
- - - ">"
121
+ - - ">="
122
122
  - !ruby/object:Gem::Version
123
- version: 1.3.1
123
+ version: '0'
124
124
  requirements: []
125
125
  rubygems_version: 3.0.1
126
126
  signing_key: