newsman 0.2.0 → 0.2.1

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: c0ec4c08d224982a75fc3ae533368cdeff2c4d7cab0072441fcfbd604f194b42
4
- data.tar.gz: 8633c4f4dc84b0f6a285e06b67b0cb9dd3f9e7a18d6dc032589237652181d36f
3
+ metadata.gz: 8c6a05f14ca92420bb79aeb13311a33dd2f3a4dae4af2c72256199c7e33546e6
4
+ data.tar.gz: cc49e991af6f2f033f2c1e29edd0c137c6bbaf2522981693b432d52c8df3801c
5
5
  SHA512:
6
- metadata.gz: 85df6a743456154cdfcd2999a2f3a1977347cf9b101c8f2e35bd0b13024e6e1d66e8cf699bc7a11feac586f5b7bb6a2bdc08b75936bf967b011afdc2f1963716
7
- data.tar.gz: e4aa02defb4c4a02dee05fe334fb799f0f10b825110e194e0f3d7e5da79ce54144e5a77d1543c57acbdc56ca444fa4be625f4e16a9c83487abc917711d0e771c
6
+ metadata.gz: ce4f8c54e47fc83b43b1806fbcb08d3c7938ebd1110861d1729822910f77ac356d9d85a2b31413395174b02401ab4570cc9a8f8175159595434913c26ab07abe
7
+ data.tar.gz: 3f4da0c1dd1cf65647d6300f2a9facb0f5f750aa70a337a90a3d0b0d94ad172c726f1922d20a01745e4ef4a6b099baa428a8830b71d2f29423024b00ceb09e71
data/README.md CHANGED
@@ -38,6 +38,7 @@ 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
@@ -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
- "#{date}.#{reporter}.html"
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
@@ -66,6 +66,9 @@ def generate
66
66
  opts.on('-t', '--title TITLE', 'Project Title. Empty by default') do |t|
67
67
  options[:title] = t
68
68
  end
69
+ opts.on('-m', '--model MODEL', 'AI model to use. gpt-3.5-turbo by default') do |m|
70
+ options[:model] = m
71
+ end
69
72
  end.parse!
70
73
  # Custom method to raise exception with a human-readable message
71
74
  def options.require_option(key, message)
@@ -80,6 +83,7 @@ def generate
80
83
  options[:position] ||= 'Software Developer'
81
84
  options[:output] ||= 'stdout'
82
85
  options[:title] ||= ''
86
+ options[:model] ||= 'gpt-3.5-turbo'
83
87
  all_params = options.map { |key, value| "#{key}: #{value}" }.join(', ')
84
88
  puts "Parsed parameters: #{all_params}"
85
89
  load_environment_variables
@@ -99,7 +103,7 @@ def generate
99
103
  prs = github.pull_requests(github_username, github_repositories)
100
104
  issues = github.issues(github_username, github_repositories)
101
105
  puts "\nNow lets test some aggregation using OpenAI\n\n"
102
- assistant = Assistant.new(openai_token)
106
+ assistant = Assistant.new(openai_token, model: options[:model])
103
107
  # Build previous results
104
108
  answer = ''
105
109
  prs.group_by(&:repository).each do |repository, rprs|
@@ -135,7 +139,7 @@ def generate
135
139
  elsif output_mode.eql? 'html'
136
140
  puts 'Print result to html file'
137
141
  output = Htmlout.new('.')
138
- output.print(full_answer, github_username)
142
+ output.print(full_answer, github_username, options[:model])
139
143
  else
140
144
  puts 'Print result to stdout'
141
145
  output = Stdout.new
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.0
4
+ version: 0.2.1
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-06-03 00:00:00.000000000 Z
11
+ date: 2024-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest