deploy_log 0.1.3 → 0.1.4

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: 23d0960ccf7f887e89ae3a12161c82448f92475f41c765c589a133a11a168682
4
- data.tar.gz: 8069578f9c142ced9585b07d4757938fa2dd91305dec5c9a15ba2d8ebe4cb2a0
3
+ metadata.gz: 4a27a0cdd050660183c126442e8200d7d68179cda6f16da222cee3112220734c
4
+ data.tar.gz: 8165b8f69d8c738ec6ebd94490c7bc6d490efe944a171d05e4142484b0429df8
5
5
  SHA512:
6
- metadata.gz: 2e82325ee4fd877a8bea8a3b31b42f68a6a47fff4d94fad123c0787375537a2bede5b3809627fef6f0298971a21182150103bd41fa922e87effdad7d3519977e
7
- data.tar.gz: 0c137aa45ae14b8a82dcfea66d9716f9bbf703bb971bcbe08108d2d71403fc0719e05463f5bfafa8135c18008ab52d1f0a869a1860e0d835e3c07510601e73c8
6
+ metadata.gz: 0d06a24b59094fa8650567974228653ae0267bf33044c78e4e88cd3c828b548d649b186533b39d326cf933108a3dee4c029b3006d7dbd2049c6b71cfd37fdcdc
7
+ data.tar.gz: 76df1d0276aa4aee03cbfdc8e42e87bf0957a825998cac71d208ec89ce314d2e33aacaf11aa43b37e9ab777a406cf294c2e2871b8da33f22493a635c88282f8a
data/bin/deploy_log CHANGED
@@ -29,7 +29,7 @@ OptionParser.new do |opt|
29
29
  end.parse!
30
30
 
31
31
  model = DeployLog::Github::Deploys.new
32
- model.merged_between(start, finish) if start && finish
32
+ model.merged_between(start, finish) if start
33
33
  model.pr_title(title) if title
34
34
  model.pr_for_branch(branch) if branch
35
35
  model.merged_today if title.nil? && branch.nil? && start.nil? && finish.nil?
@@ -7,10 +7,10 @@ module DeployLog
7
7
  @github = Helper.new(ARGV.first)
8
8
  end
9
9
 
10
- def merged_between(start, finish)
11
- unless start && finish
12
- Notify.error("Start and end dates (--start= and --end=) are required")
13
- end
10
+ def merged_between(start, finish = nil)
11
+ return Notify.error 'Start (--start=) is a required argument' if start.nil?
12
+
13
+ finish = Date.today.to_time + (24 * 60 * 60) - 1 if finish.nil?
14
14
 
15
15
  @github.pulls_in_timeframe(start, finish)
16
16
  end
@@ -23,9 +23,7 @@ module DeployLog
23
23
  end
24
24
 
25
25
  def merged_on(start)
26
- unless start
27
- Notify.error("Start date (--start=) is required")
28
- end
26
+ return Notify.error 'Start (--start=) is a required argument' if start.nil?
29
27
 
30
28
  finish = start + 24 * 60 * 60 - 1
31
29
 
@@ -5,6 +5,8 @@ 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"
9
+
8
10
  def initialize(user_repo)
9
11
  @client = ::Octokit::Client.new(login: ENV['GITHUB_USER'], password: ENV['GITHUB_TOKEN'])
10
12
  @repo_location = user_repo
@@ -18,7 +20,6 @@ module DeployLog
18
20
  sort: 'long-running'
19
21
  )
20
22
 
21
- pr_format_str = "%s (%s)\n - Created by %s\n - Branch: %s\n - Merged by %s on %s\n - Changes: %s\n\n"
22
23
  prs_covered = 0
23
24
 
24
25
  File.open('/tmp/github-deploys.log', 'w+') do |f|
@@ -29,7 +30,7 @@ module DeployLog
29
30
 
30
31
  f.write(
31
32
  sprintf(
32
- pr_format_str,
33
+ LINE_FORMAT,
33
34
  pr.title,
34
35
  pr.html_url,
35
36
  pr.user.login,
@@ -54,8 +55,6 @@ module DeployLog
54
55
  :state => :all,
55
56
  :per_page => 100
56
57
  )
57
- # pr_format_str = "%s (%s)\n - Created by %s\n - Branch: %s\n - Changes: %s\n\n"
58
- pr_format_str = "%s (%s)\n - Created by %s\n - Branch: %s\n - Merged by %s on %s\n - Changes: %s\n\n"
59
58
  prs_covered = 0
60
59
 
61
60
  File.open('/tmp/github-deploys.log', 'w+') do |f|
@@ -66,7 +65,7 @@ module DeployLog
66
65
 
67
66
  f.write(
68
67
  sprintf(
69
- pr_format_str,
68
+ LINE_FORMAT,
70
69
  pr.title,
71
70
  pr.html_url,
72
71
  pr.user.login,
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module DeployLog
2
- VERSION = '0.1.3'.freeze
4
+ VERSION = '0.1.4'.freeze
3
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.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Priebe