newsman 0.2.0 → 0.2.2
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/README.md +3 -2
- data/lib/newsman/github.rb +2 -2
- data/lib/newsman/html_output.rb +5 -4
- data/lib/newsman.rb +5 -5
- data/test/test_htmlout.rb +3 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b217b1d0fee448151ff8a04b2099a6e311275e781112144a87f62a4e2a49e03
|
4
|
+
data.tar.gz: 78de209a3631b3e1589caab3b1bb336925009bcd52861e570e53b589d3ed8a65
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 317b520b605b309c9ce5aeed0ac3ba385afb6865a8469a3547189232f248011920a67c3a3cc9bb40470e1f0f0ec0b7014f667f106275e56e9df48469d810f757
|
7
|
+
data.tar.gz: 65eacb6e1debdcb1581af1d40c0b043d641825fc70780b01471f496c0bf5a336fbc8d13a43eab89ea0dacd39890b7ec38f684c842472d9be970508de20a46f70
|
data/README.md
CHANGED
@@ -38,18 +38,19 @@ Usage: newsman [options]
|
|
38
38
|
-p, --position POSITION Reporter position in a company. Default value is a 'Software Developer'.
|
39
39
|
-o, --output OUTPUT Output type. Newsman prints a report to a stdout by default. You can choose another options like '-o html', '-o txt' or even '-o html'
|
40
40
|
-t, --title TITLE Project Title. Empty by default
|
41
|
+
-m, --model MODEL AI model to use. gpt-3.5-turbo by default
|
41
42
|
```
|
42
43
|
|
43
44
|
### Example
|
44
45
|
To run `newsman` use the following command:
|
45
46
|
```shell
|
46
|
-
newsman --name "Vladimir
|
47
|
+
newsman --name "Vladimir Lombrozo" --username "volodya-lombrozo" --repository objectionary/jeo-maven-plugin,objectionary/opeo-maven-plugin
|
47
48
|
```
|
48
49
|
|
49
50
|
Don't forget to set your own values for `name`, `username` and `repository` parameters.
|
50
51
|
Also you can download this repository and run the newsman script directly using the following command:
|
51
52
|
```shell
|
52
|
-
./bin/newsman --name "Vladimir
|
53
|
+
./bin/newsman --name "Vladimir Lombrozo" --username "volodya-lombrozo" --repository objectionary/jeo-maven-plugin,objectionary/opeo-maven-plugin
|
53
54
|
```
|
54
55
|
|
55
56
|
## How to build a gem from sources
|
data/lib/newsman/github.rb
CHANGED
@@ -39,9 +39,9 @@ class Github
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def issues(username, repositories)
|
42
|
-
|
42
|
+
one_year_ago = Date.today.prev_year.strftime('%Y-%m-%d')
|
43
43
|
query = "is:issue is:open author:#{username}"\
|
44
|
-
" author:0pdd created:>=#{
|
44
|
+
" author:0pdd created:>=#{one_year_ago} #{repositories}"
|
45
45
|
puts "Searching issues using the following query: '#{query}'"
|
46
46
|
@client.search_issues(query).items.map do |issue|
|
47
47
|
parse_issue(issue)
|
data/lib/newsman/html_output.rb
CHANGED
@@ -41,11 +41,11 @@ class Htmlout
|
|
41
41
|
end
|
42
42
|
|
43
43
|
# rubocop:disable Metrics/AbcSize
|
44
|
-
def print(report, reporter)
|
44
|
+
def print(report, reporter, model)
|
45
45
|
title = title(reporter)
|
46
46
|
body = to_html(report)
|
47
47
|
puts "Create a html file in a directory #{@root}"
|
48
|
-
file = File.new(File.join(@root, filename(reporter)), 'w')
|
48
|
+
file = File.new(File.join(@root, filename(reporter, model)), 'w')
|
49
49
|
puts "File #{file.path} was successfully created"
|
50
50
|
file.puts Nokogiri::HTML(ERB.new(TEMPLATE).result(binding), &:noblanks).to_xhtml(indent: 2)
|
51
51
|
puts "Report was successfully printed to a #{file.path}"
|
@@ -58,9 +58,10 @@ class Htmlout
|
|
58
58
|
"#{reporter} #{date}"
|
59
59
|
end
|
60
60
|
|
61
|
-
def filename(reporter)
|
61
|
+
def filename(reporter, model)
|
62
62
|
date = Time.new.strftime('%d.%m.%Y')
|
63
|
-
|
63
|
+
model = model.gsub('.', '-')
|
64
|
+
"#{date}.#{reporter}.#{model}.html"
|
64
65
|
end
|
65
66
|
|
66
67
|
def to_html(report)
|
data/lib/newsman.rb
CHANGED
@@ -63,9 +63,8 @@ def generate
|
|
63
63
|
"You can choose another options like '-o html', '-o txt' or even '-o html'") do |o|
|
64
64
|
options[:output] = o
|
65
65
|
end
|
66
|
-
opts.on('-t', '--title TITLE', 'Project Title. Empty by default')
|
67
|
-
|
68
|
-
end
|
66
|
+
opts.on('-t', '--title TITLE', 'Project Title. Empty by default') { |t| options[:title] = t }
|
67
|
+
opts.on('-m', '--model MODEL', 'AI model to use. gpt-3.5-turbo by default') { |m| options[:model] = m }
|
69
68
|
end.parse!
|
70
69
|
# Custom method to raise exception with a human-readable message
|
71
70
|
def options.require_option(key, message)
|
@@ -80,6 +79,7 @@ def generate
|
|
80
79
|
options[:position] ||= 'Software Developer'
|
81
80
|
options[:output] ||= 'stdout'
|
82
81
|
options[:title] ||= ''
|
82
|
+
options[:model] ||= 'gpt-3.5-turbo'
|
83
83
|
all_params = options.map { |key, value| "#{key}: #{value}" }.join(', ')
|
84
84
|
puts "Parsed parameters: #{all_params}"
|
85
85
|
load_environment_variables
|
@@ -99,7 +99,7 @@ def generate
|
|
99
99
|
prs = github.pull_requests(github_username, github_repositories)
|
100
100
|
issues = github.issues(github_username, github_repositories)
|
101
101
|
puts "\nNow lets test some aggregation using OpenAI\n\n"
|
102
|
-
assistant = Assistant.new(openai_token)
|
102
|
+
assistant = Assistant.new(openai_token, model: options[:model])
|
103
103
|
# Build previous results
|
104
104
|
answer = ''
|
105
105
|
prs.group_by(&:repository).each do |repository, rprs|
|
@@ -135,7 +135,7 @@ def generate
|
|
135
135
|
elsif output_mode.eql? 'html'
|
136
136
|
puts 'Print result to html file'
|
137
137
|
output = Htmlout.new('.')
|
138
|
-
output.print(full_answer, github_username)
|
138
|
+
output.print(full_answer, github_username, options[:model])
|
139
139
|
else
|
140
140
|
puts 'Print result to stdout'
|
141
141
|
output = Stdout.new
|
data/test/test_htmlout.rb
CHANGED
@@ -48,9 +48,10 @@ List is here:<br/>
|
|
48
48
|
Dir.mktmpdir do |temp_dir|
|
49
49
|
output = Htmlout.new(temp_dir)
|
50
50
|
today = Date.today.strftime('%d.%m.%Y')
|
51
|
-
expected = "#{today}.volodya-lombrozo.html"
|
51
|
+
expected = "#{today}.volodya-lombrozo.gpt-3-5-turbo.html"
|
52
52
|
output.print("Issue description\n\nHere is a new paragraph\nList is here:\n - one\n - two\n - three",
|
53
|
-
'volodya-lombrozo'
|
53
|
+
'volodya-lombrozo',
|
54
|
+
'gpt-3.5-turbo')
|
54
55
|
assert(File.exist?(File.join(temp_dir, expected)))
|
55
56
|
assert_equal(EXPECTED, File.read(File.join(temp_dir, expected)))
|
56
57
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: newsman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
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-
|
11
|
+
date: 2024-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -214,7 +214,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
214
214
|
- !ruby/object:Gem::Version
|
215
215
|
version: '0'
|
216
216
|
requirements: []
|
217
|
-
rubygems_version: 3.5.
|
217
|
+
rubygems_version: 3.5.18
|
218
218
|
signing_key:
|
219
219
|
specification_version: 4
|
220
220
|
summary: GitHub user weekly news
|