deploy_log 0.1.9 → 0.2.0

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: 433af166c02a7dbe45cc06c6e3eb65f9dfa317ed7186fc2126e6c3aaea3bab86
4
- data.tar.gz: 1d905ad1660a270d6b3710a741b21e0f2ab0ab1a7be92847f31dde3342d2a300
3
+ metadata.gz: 9a55f9f4ac0e32ac7583402b612176d5d4213e87c423bb1f893ecea5fa9a4f07
4
+ data.tar.gz: fd1ee61246e3457f233906078e7d467e80792c87e850ae608424d4f43d27a76b
5
5
  SHA512:
6
- metadata.gz: 1e493fc1fd5cbf25f717198590c311f2e4aa0404a41259fcab07669bd1e538cd44c93117fbeba2ae8234b0b1e70cc9bcc560ac194aa73778418758936f669dfb
7
- data.tar.gz: 97c33592502adf8b0e16decd63cd0a469cc45a2a832e8853e76511c8023d46d0e25af3df00dfb9ec571cf46f1f54768d91af998b3e880c1fbf6f1d3dca876cc9
6
+ metadata.gz: 534b369854c1cb72f47f9598a0e352c29eb4c17f978298a8c1e3d9493e20ddf7684944990a14324fb17a3e4332bda12d54c8136975e2514dc06eebe407bb29ae
7
+ data.tar.gz: f9c11c4773037cf5ccb59574188b494eb07837f940bb9983c05f60849ac44c0eae03755a9e56002337c85eee40551ac7e84cc0296e1473b5a78d32194655ec18
@@ -2,8 +2,30 @@
2
2
 
3
3
  module DeployLog
4
4
  class Calendar
5
- def self.start_of_week(week_num)
6
- puts week_num
5
+ def week(week_num)
6
+ year_calendar(2019).to_a[week_num]
7
+ end
8
+
9
+ private
10
+
11
+ def range_for(year)
12
+ start = Date.parse("#{year}-01-01")
13
+ finish = Date.parse("#{year}-12-31")
14
+
15
+ (start..finish)
16
+ end
17
+
18
+ def year_calendar(year)
19
+ date_range = range_for(year)
20
+ output = (1..52).to_a.map { |w| { w => [] } }
21
+
22
+ date_range.each do |day|
23
+ output[day.cweek] = {}
24
+ output[day.cweek][:first] = (day - 7).to_time
25
+ output[day.cweek][:last] = day.to_time + (24 * 60 * 60) - 1
26
+ end
27
+
28
+ output
7
29
  end
8
30
  end
9
- end
31
+ 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)
@@ -33,10 +34,9 @@ module DeployLog
33
34
  def merged_during_week(week_num)
34
35
  return Notify.error 'Week number (--week|-w) is a required argument' if week_num.nil?
35
36
 
36
- start = DeployLog::Calendar.start_of_week(24)
37
- finish = start + 24 * 60 * 60 - 1
37
+ week = @calendar.week(week_num.to_i)
38
38
 
39
- @github.pulls_in_timeframe(start, finish)
39
+ @github.pulls_in_timeframe(week[:first], week[:last])
40
40
  end
41
41
 
42
42
  def pr_title(title)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DeployLog
4
- VERSION = '0.1.9'
4
+ VERSION = '0.2.0'
5
5
  end
data/lib/deploy_log.rb CHANGED
@@ -4,6 +4,7 @@ require 'notifaction'
4
4
  require 'octokit'
5
5
  require 'optionparser'
6
6
  require 'time'
7
+ require 'date'
7
8
  require 'deploy_log/version'
8
9
  require 'deploy_log/calendar'
9
10
  require 'deploy_log/github/helper'
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.9
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Priebe