newsman 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/newsman +2 -1
- data/lib/newsman/issues.rb +17 -0
- data/lib/newsman/pull_request.rb +4 -1
- data/lib/newsman/report.rb +18 -0
- data/lib/newsman/stdout_output.rb +3 -1
- data/lib/newsman/txt_output.rb +8 -4
- data/lib/newsman.rb +88 -70
- data/test/test_report.rb +54 -0
- data/test/test_txtout.rb +7 -5
- data/test/test_week_before.rb +6 -5
- data/test/test_week_of_a_year.rb +7 -5
- metadata +26 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75f205e7d044fd681d85d0be8985808dfae181b49f4c18dfac392aeadbe34dab
|
4
|
+
data.tar.gz: 06f7cc6020990be40c1bbc4e1c28aea4d967e949c5a96ef56a67e278f4db9728
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e4e5ac7ff8f076e0e1cb0a84101de4b85a1266b265f82a075c6c3cc46891992343a08e46a3f84e1da9a77eaac8ac787bd84d591274accf22fa40b1758484f17
|
7
|
+
data.tar.gz: e2f695629a396e1e330df94b8d15c541ba319c196f7f02165d7e7b5c0f07e3ff896f708b5737a2b3549bb66f3899b48d772cb016e9c1bd3389e7c80694892494
|
data/bin/newsman
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Issue
|
4
|
+
attr_accessor :title, :body, :repo, :number
|
5
|
+
|
6
|
+
def initialize(title, body, repo, number)
|
7
|
+
@title = title
|
8
|
+
@body = body
|
9
|
+
@repo = repo
|
10
|
+
@number = number
|
11
|
+
end
|
12
|
+
|
13
|
+
def to_s
|
14
|
+
"title: ```#{@title}```,\ndescription: ```#{@body}```,\nrepo: ```#{@repo}```,\nissue number: \##{@number}\n"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
data/lib/newsman/pull_request.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class PullRequest
|
2
4
|
attr_accessor :repository, :title, :description
|
3
5
|
|
@@ -8,6 +10,7 @@ class PullRequest
|
|
8
10
|
end
|
9
11
|
|
10
12
|
def to_s
|
11
|
-
"title: ```#{@title}
|
13
|
+
"title: ```#{@title}```,\ndescription: ```#{@description}```,\nrepo: ```#{@repository}```\n"
|
12
14
|
end
|
13
15
|
end
|
16
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
class Report
|
4
|
+
def initialize(user, position, title)
|
5
|
+
@user = user
|
6
|
+
@position = position
|
7
|
+
@title = title
|
8
|
+
end
|
9
|
+
def build(achievements, plans, date)
|
10
|
+
return "From: #{@user}\nSubject: #{week_of_a_year(@title, date)}\n\nHi all,\n\nLast week achievements:\n#{achievements}\n\nNext week plans:\n#{plans}\n\nRisks:\n- <todo>\n\nBest regards,\n#{@user}\n#{@position}\n#{date}"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def week_of_a_year(project, today)
|
15
|
+
number = today.strftime('%U').to_i + 1
|
16
|
+
"WEEK #{number} #{project}"
|
17
|
+
end
|
18
|
+
|
data/lib/newsman/txt_output.rb
CHANGED
@@ -1,17 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class Txtout
|
2
|
-
def initialize(root=
|
3
|
-
@root=root
|
4
|
+
def initialize(root = '.')
|
5
|
+
@root = root
|
4
6
|
end
|
7
|
+
|
5
8
|
def print(report, reporter)
|
6
9
|
puts "Create a file in a directory #{@root}"
|
7
|
-
file = File.new(File.join(@root, filename(reporter)),
|
10
|
+
file = File.new(File.join(@root, filename(reporter)), 'w')
|
8
11
|
puts "File #{file.path} was successfully created"
|
9
12
|
file.puts report
|
10
13
|
puts "Report was successfully printed to a #{file.path}"
|
11
14
|
file.close
|
12
15
|
end
|
16
|
+
|
13
17
|
def filename(reporter)
|
14
18
|
date = Time.new.strftime('%d.%m.%Y')
|
15
|
-
"#{date}.#{reporter}.txt"
|
19
|
+
"#{date}.#{reporter}.txt"
|
16
20
|
end
|
17
21
|
end
|
data/lib/newsman.rb
CHANGED
@@ -1,35 +1,41 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
require 'octokit'
|
4
5
|
require 'openai'
|
5
6
|
require 'dotenv'
|
6
7
|
require 'optparse'
|
7
|
-
require_relative 'newsman/pull_request
|
8
|
-
require_relative 'newsman/
|
9
|
-
require_relative 'newsman/
|
8
|
+
require_relative 'newsman/pull_request'
|
9
|
+
require_relative 'newsman/issues'
|
10
|
+
require_relative 'newsman/stdout_output'
|
11
|
+
require_relative 'newsman/txt_output'
|
12
|
+
require_relative 'newsman/report'
|
10
13
|
|
11
14
|
def generate
|
12
15
|
# Load all options required
|
13
16
|
# Pay attention that some of them have default values.
|
14
17
|
options = {}
|
15
18
|
OptionParser.new do |opts|
|
16
|
-
opts.banner =
|
17
|
-
opts.on(
|
18
|
-
options[:name] = n
|
19
|
+
opts.banner = 'Usage: newsman [options]'
|
20
|
+
opts.on('-n', '--name NAME', 'Reporter name. Human readable name that will be used in a report') do |n|
|
21
|
+
options[:name] = n
|
19
22
|
end
|
20
|
-
opts.on(
|
23
|
+
opts.on('-u', '--username USERNAME', "GitHub username. For example, 'volodya-lombrozo'") do |u|
|
21
24
|
options[:username] = u
|
22
25
|
end
|
23
|
-
opts.on(
|
26
|
+
opts.on('-r', '--repository REPOSITORIES',
|
27
|
+
"Specify which repositories to include in a report. You can specify several repositories using a comma separator, for example: '-r objectionary/jeo-maven-plugin,objectionary/opeo-maven-plugin'") do |r|
|
24
28
|
options[:repositories] = r
|
25
29
|
end
|
26
|
-
opts.on(
|
30
|
+
opts.on('-p', '--position POSITION',
|
31
|
+
"Reporter position in a company. Default value is a 'Software Developer'.") do |p|
|
27
32
|
options[:position] = p
|
28
33
|
end
|
29
|
-
opts.on(
|
34
|
+
opts.on('-o', '--output OUTPUT',
|
35
|
+
"Output type. Newsman prints a report to a stdout by default. You can choose another options like '-o html' or '-o txt'") do |o|
|
30
36
|
options[:output] = o
|
31
37
|
end
|
32
|
-
opts.on(
|
38
|
+
opts.on('-t', '--title TITLE', 'Project Title. Empty by default') do |t|
|
33
39
|
options[:title] = t
|
34
40
|
end
|
35
41
|
end.parse!
|
@@ -39,29 +45,30 @@ def generate
|
|
39
45
|
end
|
40
46
|
|
41
47
|
# Check for required options
|
42
|
-
options.require_option(:name,
|
43
|
-
options.require_option(:username,
|
44
|
-
options.require_option(:repositories,
|
45
|
-
|
46
|
-
options[:
|
47
|
-
options[:
|
48
|
-
|
48
|
+
options.require_option(:name, 'Reporter name is required. Please specify using -n or --name.')
|
49
|
+
options.require_option(:username, 'GitHub username is required. Please specify using -u or --username.')
|
50
|
+
options.require_option(:repositories,
|
51
|
+
'GitHub repository is required. Please specify one or several repositories using -r or --repositories.')
|
52
|
+
options[:position] ||= 'Software Developer'
|
53
|
+
options[:output] ||= 'stdout'
|
54
|
+
options[:title] ||= ''
|
55
|
+
all_params = options.map { |key, value| "#{key}: #{value}" }.join(', ')
|
49
56
|
puts "Parsed parameters: #{all_params}"
|
50
57
|
|
51
58
|
# Load all required environment variables
|
52
59
|
Dotenv.load
|
53
|
-
Dotenv.require_keys(
|
60
|
+
Dotenv.require_keys('GITHUB_TOKEN', 'OPENAI_TOKEN')
|
54
61
|
|
55
62
|
# Init all required parameters
|
56
63
|
# Reporter Info
|
57
64
|
reporter = options[:name]
|
58
65
|
reporter_position = options[:position]
|
59
|
-
# GitHub
|
66
|
+
# GitHub
|
60
67
|
github_username = options[:username]
|
61
|
-
github_repositories = options[:repositories].split(
|
62
|
-
|
68
|
+
github_repositories = options[:repositories].split(',').map { |repo| "repo:#{repo}" }.join(' ')
|
69
|
+
|
63
70
|
# Your GitHub personal access token
|
64
|
-
# Make sure it has the 'repo'
|
71
|
+
# Make sure it has the 'repo'
|
65
72
|
github_token = ENV['GITHUB_TOKEN']
|
66
73
|
# Your OpenAI personal access token
|
67
74
|
openai_token = ENV['OPENAI_TOKEN']
|
@@ -70,70 +77,86 @@ def generate
|
|
70
77
|
# Calculate the date one week ago
|
71
78
|
report_date = Date.today
|
72
79
|
one_week_ago = date_one_week_ago(Date.today)
|
80
|
+
one_month_ago = Date.today.prev_month.strftime('%Y-%m-%d')
|
73
81
|
# Display pull request
|
74
82
|
query = "is:pr author:#{github_username} created:>=#{one_week_ago} #{github_repositories}"
|
83
|
+
issues_query = "is:issue is:open author:#{github_username} author:0pdd created:>=#{one_month_ago} #{github_repositories}"
|
75
84
|
puts "Searching pull requests for #{github_username}."
|
76
85
|
puts "Newsman uses the following request to GitHub to gather the required information about user activity: '#{query}'"
|
77
86
|
prs = []
|
78
87
|
pull_requests = client.search_issues(query)
|
79
88
|
pull_requests.items.each do |pr|
|
80
|
-
title =
|
81
|
-
description =
|
89
|
+
title = pr.title.to_s
|
90
|
+
description = pr.body.to_s
|
82
91
|
repository = pr.repository_url.split('/').last
|
83
92
|
puts "Found PR in #{repository}: #{title}"
|
84
93
|
# Create a new PullRequest object and add it to the list
|
85
94
|
pr = PullRequest.new(repository, title, description)
|
86
95
|
prs << pr
|
87
96
|
end
|
97
|
+
prs = prs.map(&:to_s).join("\n\n\n")
|
98
|
+
|
99
|
+
puts "Searching issues using the following query: '#{issues_query}'"
|
100
|
+
issues = []
|
101
|
+
client.search_issues(issues_query).items.each do |issue|
|
102
|
+
title = issue.title.to_s
|
103
|
+
body = issue.body.to_s
|
104
|
+
repository = issue.repository_url.split('/').last
|
105
|
+
number = issue.number.to_s
|
106
|
+
puts "Found issue in #{repository}:[##{number}] #{title}"
|
107
|
+
issues << Issue.new(title, body, repository, number)
|
108
|
+
end
|
109
|
+
issues = issues.map(&:to_s).join("\n\n\n")
|
110
|
+
#puts "Found issues:\n #{issues}"
|
111
|
+
|
88
112
|
puts "\nNow lets test some aggregation using OpenAI\n\n"
|
89
113
|
openai_client = OpenAI::Client.new(access_token: openai_token)
|
90
114
|
|
91
|
-
|
92
|
-
|
93
|
-
example = "
|
94
|
-
Last week achievements.
|
95
|
-
jeo-meven-plugin:
|
115
|
+
example = "jeo-meven-plugin:
|
96
116
|
- Added 100 new files to the Dataset [#168]
|
97
117
|
- Fixed the deployment of XYZ [#169]
|
98
118
|
- Refined the requirements [#177]
|
99
|
-
opeo-maven-plugin
|
119
|
+
opeo-maven-plugin:
|
100
120
|
- Removed XYZ class [#57]
|
101
|
-
- Refactored http module [#69]
|
121
|
+
- Refactored http module [#69]"
|
102
122
|
|
103
|
-
|
104
|
-
|
105
|
-
-
|
123
|
+
example_plans = "jeo-maven-plugin:
|
124
|
+
- To publish ABC package draft [#27]
|
125
|
+
- To review first draft of the report [#56]
|
106
126
|
opeo-maven-plugin:
|
107
|
-
-
|
127
|
+
- To implement optimization for the class X [#125]"
|
108
128
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
#{
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
129
|
+
response = openai_client.chat(
|
130
|
+
parameters: {
|
131
|
+
model: 'gpt-3.5-turbo',
|
132
|
+
messages: [
|
133
|
+
{ role: 'system',
|
134
|
+
content: 'You are a developer tasked with composing a concise report detailing your activities and progress for the previous week, intended for submission to your supervisor.' },
|
135
|
+
{ role: 'user',
|
136
|
+
content: "Please compile a summary of the work completed in the following Pull Requests (PRs). Each PR should be summarized in a single sentence, focusing more on the PR title and less on implementation details. Group the sentences by repositories, each identified by its name mentioned in the 'repository:[name]' attribute of the PR. The grouping is important an should be precise. Ensure that each sentence includes the corresponding issue number as an integer value. If a PR doesn't mention an issue number, just print [#chore]. Combine all the information from each PR into a concise and fluent sentence, as if you were a developer reporting on your work. Please strictly adhere to the example template provided. Example of a report: #{example}. List of Pull Requests: [#{prs}]" }
|
137
|
+
],
|
138
|
+
temperature: 0.3
|
139
|
+
}
|
140
|
+
)
|
141
|
+
answer = response.dig('choices', 0, 'message', 'content')
|
142
|
+
issues_response = openai_client.chat(
|
122
143
|
parameters: {
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
144
|
+
model: 'gpt-3.5-turbo',
|
145
|
+
messages: [
|
146
|
+
{ role: 'system',
|
147
|
+
content: 'You are a developer tasked with composing a concise report detailing your activities and progress for the previous week, intended for submission to your supervisor.' },
|
148
|
+
{ role: 'user',
|
149
|
+
content: "Please compile a summary of the plans for the next week using the following GitHub Issues descriptions. Each issue should be summarized in a single sentence, focusing more on the issue title and less on implementation details. Group the sentences by repositories, each identified by its name mentioned in the 'repository:[name]' attribute of the issue. The grouping is important an should be precise. Ensure that each sentence includes the corresponding issue number as an integer value. If an issue doesn't mention an issue number, just print [#chore]. Combine all the information from each Issue into a concise and fluent sentences, as if you were a developer reporting on your work. Please strictly adhere to the example template provided: #{example_plans}. List of GitHub issues to aggregate: [#{issues}]. Use the same formatting as here \n```#{answer}```\n" }
|
150
|
+
],
|
151
|
+
temperature: 0.3
|
152
|
+
}
|
153
|
+
)
|
154
|
+
issues_full_answer = issues_response.dig('choices', 0, 'message', 'content')
|
130
155
|
output_mode = options[:output]
|
131
156
|
puts "Output mode is '#{output_mode}'"
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
if output_mode.eql? "txt"
|
136
|
-
output = Txtout.new(".")
|
157
|
+
full_answer = Report.new(reporter, reporter_position, options[:title]).build(answer, issues_full_answer, Date.today)
|
158
|
+
if output_mode.eql? 'txt'
|
159
|
+
output = Txtout.new('.')
|
137
160
|
output.print(full_answer, github_username)
|
138
161
|
else
|
139
162
|
output = Stdout.new
|
@@ -141,25 +164,20 @@ response = openai_client.chat(
|
|
141
164
|
end
|
142
165
|
end
|
143
166
|
|
144
|
-
|
145
167
|
def date_one_week_ago(today)
|
146
168
|
# Convert today to a Date object if it's not already
|
147
169
|
today = Date.parse(today) unless today.is_a?(Date)
|
148
170
|
# Subtract 7 days to get the date one week ago
|
149
171
|
one_week_ago = today - 7
|
150
172
|
# Format the date as "YYYY-MM-DD"
|
151
|
-
|
173
|
+
one_week_ago.strftime('%Y-%m-%d')
|
152
174
|
# Return the formatted date
|
153
|
-
return formatted_date
|
154
175
|
end
|
155
176
|
|
156
177
|
def week_of_a_year(project, today)
|
157
|
-
number =
|
158
|
-
|
178
|
+
number = today.strftime('%U').to_i + 1
|
179
|
+
"WEEK #{number} #{project}"
|
159
180
|
end
|
160
181
|
|
161
182
|
# Execute the function only if this script is run directly like `./newsman.rb`
|
162
|
-
if __FILE__ == $
|
163
|
-
generate()
|
164
|
-
end
|
165
|
-
|
183
|
+
generate if __FILE__ == $PROGRAM_NAME
|
data/test/test_report.rb
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
# Copyright (c) 2024 Volodya Lombrozo
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in all
|
14
|
+
# copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
# SOFTWARE.
|
23
|
+
|
24
|
+
require 'minitest/autorun'
|
25
|
+
require_relative '../lib/newsman/report.rb'
|
26
|
+
|
27
|
+
class TestReport < Minitest::Test
|
28
|
+
def test_report
|
29
|
+
expected = "From: User
|
30
|
+
Subject: WEEK 11 Project
|
31
|
+
|
32
|
+
Hi all,
|
33
|
+
|
34
|
+
Last week achievements:
|
35
|
+
repository-a:
|
36
|
+
- Did a lot of for (a) repository
|
37
|
+
|
38
|
+
Next week plans:
|
39
|
+
repository-b:
|
40
|
+
- I will do a lot for repository (b)
|
41
|
+
|
42
|
+
Risks:
|
43
|
+
- <todo>
|
44
|
+
|
45
|
+
Best regards,
|
46
|
+
User
|
47
|
+
Developer
|
48
|
+
2024-03-14"
|
49
|
+
report = Report.new('User', 'Developer', 'Project')
|
50
|
+
out = report.build("repository-a:\n - Did a lot of for (a) repository", "repository-b:\n - I will do a lot for repository (b)", Date.new(2024, 3, 14))
|
51
|
+
assert_equal expected, out
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
data/test/test_txtout.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
#
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
# Copyright (c) 2024 Volodya Lombrozo
|
3
5
|
#
|
4
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
7
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -20,15 +22,15 @@
|
|
20
22
|
# SOFTWARE.
|
21
23
|
|
22
24
|
require 'minitest/autorun'
|
23
|
-
require_relative '../lib/newsman/txt_output
|
25
|
+
require_relative '../lib/newsman/txt_output'
|
24
26
|
|
25
27
|
class TestTxtout < Minitest::Test
|
26
28
|
def test_writes_to_a_file
|
27
|
-
Dir.mktmpdir do |temp_dir|
|
29
|
+
Dir.mktmpdir do |temp_dir|
|
28
30
|
output = Txtout.new(temp_dir)
|
29
|
-
today = Date.today.strftime(
|
31
|
+
today = Date.today.strftime('%d.%m.%Y')
|
30
32
|
expected = "#{today}.volodya-lombrozo.txt"
|
31
|
-
output.print(
|
33
|
+
output.print('496', 'volodya-lombrozo')
|
32
34
|
puts "Expected #{expected}"
|
33
35
|
assert(File.exist?(File.join(temp_dir, expected)))
|
34
36
|
assert_equal("496\n", File.read(File.join(temp_dir, expected)))
|
data/test/test_week_before.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
#
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
# Copyright (c) 2024 Volodya Lombrozo
|
3
5
|
#
|
4
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
7
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -20,12 +22,11 @@
|
|
20
22
|
# SOFTWARE.
|
21
23
|
|
22
24
|
require 'minitest/autorun'
|
23
|
-
require_relative '../lib/newsman
|
25
|
+
require_relative '../lib/newsman'
|
24
26
|
|
25
27
|
class TestDateOneWeekAgo < Minitest::Test
|
26
28
|
def test_date_one_week_ago
|
27
|
-
assert_equal
|
28
|
-
assert_equal
|
29
|
+
assert_equal '2024-03-07', date_one_week_ago(Date.new(2024, 3, 14))
|
30
|
+
assert_equal '2024-02-29', date_one_week_ago(Date.new(2024, 3, 7))
|
29
31
|
end
|
30
32
|
end
|
31
|
-
|
data/test/test_week_of_a_year.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
#
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
# Copyright (c) 2024 Volodya Lombrozo
|
3
5
|
#
|
4
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
7
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -20,12 +22,12 @@
|
|
20
22
|
# SOFTWARE.
|
21
23
|
|
22
24
|
require 'minitest/autorun'
|
23
|
-
require_relative '../lib/newsman
|
25
|
+
require_relative '../lib/newsman'
|
24
26
|
|
25
27
|
class TestWeekOfYear < Minitest::Test
|
26
|
-
def test_week_of_a_year
|
27
|
-
assert_equal
|
28
|
-
assert_equal
|
28
|
+
def test_week_of_a_year
|
29
|
+
assert_equal 'WEEK 11 JEO', week_of_a_year('JEO', Date.new(2024, 3, 14))
|
30
|
+
assert_equal 'WEEK 9 OPEO', week_of_a_year('OPEO', Date.new(2024, 2, 29))
|
29
31
|
end
|
30
32
|
end
|
31
33
|
|
metadata
CHANGED
@@ -1,113 +1,113 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: newsman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Volodya Lombrozo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-03-
|
11
|
+
date: 2024-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: minitest
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '5.22'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '5.22'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '3.2'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '3.2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: dotenv
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '3.1'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '3.1'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: faraday-retry
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: '2.2'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: '2.2'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: octokit
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '8.0'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '8.0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: optparse
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 0.4.0
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: 0.4.0
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: ruby-openai
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '3
|
103
|
+
version: '6.3'
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '3
|
110
|
+
version: '6.3'
|
111
111
|
description: A simple gem that gathers GitHub statistics and creates human-readable
|
112
112
|
report
|
113
113
|
email:
|
@@ -121,9 +121,12 @@ files:
|
|
121
121
|
- README.md
|
122
122
|
- bin/newsman
|
123
123
|
- lib/newsman.rb
|
124
|
+
- lib/newsman/issues.rb
|
124
125
|
- lib/newsman/pull_request.rb
|
126
|
+
- lib/newsman/report.rb
|
125
127
|
- lib/newsman/stdout_output.rb
|
126
128
|
- lib/newsman/txt_output.rb
|
129
|
+
- test/test_report.rb
|
127
130
|
- test/test_txtout.rb
|
128
131
|
- test/test_week_before.rb
|
129
132
|
- test/test_week_of_a_year.rb
|