deploy_log 0.1.8 → 0.1.9a

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: 0be5986780967ad9c7fe713a71f69b392919affb3ebaf82cab6adbb7c20dad22
4
- data.tar.gz: 44e92a417ff45c4833939879c1b5e4adc7e8f3a2b309350e42a003f6f52222ae
3
+ metadata.gz: f133f81413c2ee7fca73d13ec91d787e2aa0fe464603f8e2749487c1510c355f
4
+ data.tar.gz: aaf5cb6f5d22c2f84d7949ea8f704afa0487649c9beb4c2f41eb47b2b06f2240
5
5
  SHA512:
6
- metadata.gz: 82bda4ccab174bf8c523f86d4ab04d1f29e2b8b26fb9db0b26e799d7d443ab051d7acbd83ac653ccaa92e6667603417e46c3e0e26c713029ee74f2c415532dcc
7
- data.tar.gz: 533e5362acfbe7d55970ceca4d3aea9e7f583e377465175a5600df2df903188fdb80aeec7ab70e52c59374d1917f90ee7758a48ab39f23a3de9b30b55ea38dac
6
+ metadata.gz: 787d77d87c80a0a7056b0c40c9187719b04490f2fc680b20e5ac5765f8bcd33e81c3e49fa4eae1269b43f533d89fc0cb3f1e7ea325707c2996e1036091acf279
7
+ data.tar.gz: 66720c373281e4656a4fe0307f0ea631251be675ecb26e89833d1c1885c8a908bc933c04bf2e7aaa80db115d13799f5b4e9c3fbeb167930efdd2b2d06ec33569
data/bin/deploy_log CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  require 'deploy_log'
5
5
 
6
- start, finish, title, branch, on = nil
6
+ start, finish, title, branch, on, week = nil
7
7
 
8
8
  OptionParser.new do |opt|
9
9
  opt.on('-s', '--start=START', 'Start of date range') do |time|
@@ -26,6 +26,10 @@ OptionParser.new do |opt|
26
26
  branch = br
27
27
  end
28
28
 
29
+ opt.on('-w', '--week=WEEK', 'Get PRs merged during week number X') do |w|
30
+ week = w
31
+ end
32
+
29
33
  opt.on('-v', '--version', 'Prints version information') do
30
34
  puts DeployLog::VERSION
31
35
  exit
@@ -33,6 +37,8 @@ OptionParser.new do |opt|
33
37
  end.parse!
34
38
 
35
39
  model = DeployLog::Github::Deploys.new
40
+
41
+ return model.merged_during_week(week) if week
36
42
  return model.merged_between(start, finish) if start
37
43
  return model.merged_on(on) if on
38
44
  return model.pr_title(title) if title
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal = true
2
+
3
+ module DeployLog
4
+ class Calendar
5
+ def start_of_week(week_num)
6
+ # puts "THIS IS WEEK #{Date.today.cweek}"
7
+ cal = year_calendar(2019).to_a#[Date.today.cweek]
8
+ puts cal.inspect
9
+ cal[:first]
10
+ end
11
+
12
+ private
13
+
14
+ def range_for(year)
15
+ start = Date.parse("#{year}-01-01")
16
+ finish = Date.parse("#{year}-12-31")
17
+
18
+ (start..finish)
19
+ end
20
+
21
+ def year_calendar(year)
22
+ date_range = range_for(year)
23
+ output = {}
24
+
25
+ date_range.each do |day|
26
+ output[day.cweek] = {}
27
+ output[day.cweek][:first] = day
28
+ # output[day.cweek][:last] = day
29
+ end
30
+ # puts output.inspect
31
+ output
32
+ end
33
+ end
34
+ end
@@ -5,6 +5,7 @@ module DeployLog
5
5
  class Deploys
6
6
  def initialize
7
7
  @github = Helper.new(ARGV.first)
8
+ @calendar = DeployLog::Calendar.new
8
9
  end
9
10
 
10
11
  def merged_between(start, finish = nil)
@@ -30,6 +31,15 @@ module DeployLog
30
31
  @github.pulls_in_timeframe(start, finish)
31
32
  end
32
33
 
34
+ def merged_during_week(week_num)
35
+ return Notify.error 'Week number (--week|-w) is a required argument' if week_num.nil?
36
+
37
+ start = @calendar.start_of_week(24)
38
+ # finish = start + 24 * 60 * 60 - 1
39
+
40
+ # @github.pulls_in_timeframe(start, finish)
41
+ end
42
+
33
43
  def pr_title(title)
34
44
  @github.search_pulls_by(title, :title)
35
45
  end
@@ -97,7 +97,7 @@ module DeployLog
97
97
  def committers_for(num)
98
98
  commits = @client.pull_request_commits(@repo_location, num)
99
99
  commits.map do |c|
100
- "#{c.author.login} committed '#{c.commit.message}'"
100
+ "#{c.author.login} committed '#{c.commit.message}' at #{formatted_time(c.commit.committer.date, true)}"
101
101
  end
102
102
  end
103
103
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DeployLog
4
- VERSION = '0.1.8'
4
+ VERSION = '0.1.9a'
5
5
  end
data/lib/deploy_log.rb CHANGED
@@ -4,7 +4,9 @@ require 'notifaction'
4
4
  require 'octokit'
5
5
  require 'optionparser'
6
6
  require 'time'
7
+ require 'date'
7
8
  require 'deploy_log/version'
9
+ require 'deploy_log/calendar'
8
10
  require 'deploy_log/github/helper'
9
11
  require 'deploy_log/github/deploys'
10
12
 
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.8
4
+ version: 0.1.9a
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Priebe
@@ -100,6 +100,7 @@ files:
100
100
  - bin/setup
101
101
  - deploy_log.gemspec
102
102
  - lib/deploy_log.rb
103
+ - lib/deploy_log/calendar.rb
103
104
  - lib/deploy_log/github/deploys.rb
104
105
  - lib/deploy_log/github/helper.rb
105
106
  - lib/deploy_log/version.rb
@@ -118,9 +119,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
118
119
  version: '0'
119
120
  required_rubygems_version: !ruby/object:Gem::Requirement
120
121
  requirements:
121
- - - ">="
122
+ - - ">"
122
123
  - !ruby/object:Gem::Version
123
- version: '0'
124
+ version: 1.3.1
124
125
  requirements: []
125
126
  rubygems_version: 3.0.1
126
127
  signing_key: