newsman 0.1.7 → 0.1.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 75f205e7d044fd681d85d0be8985808dfae181b49f4c18dfac392aeadbe34dab
4
- data.tar.gz: 06f7cc6020990be40c1bbc4e1c28aea4d967e949c5a96ef56a67e278f4db9728
3
+ metadata.gz: 6003cd186c9fc0dc4db267e6c51aecddbf3b1c5de58c63331efc985f3c99f996
4
+ data.tar.gz: 1255f0f57387649a4ffa9bac8c3e726f6f3e6e37fbd67fef022c17121c297f53
5
5
  SHA512:
6
- metadata.gz: 1e4e5ac7ff8f076e0e1cb0a84101de4b85a1266b265f82a075c6c3cc46891992343a08e46a3f84e1da9a77eaac8ac787bd84d591274accf22fa40b1758484f17
7
- data.tar.gz: e2f695629a396e1e330df94b8d15c541ba319c196f7f02165d7e7b5c0f07e3ff896f708b5737a2b3549bb66f3899b48d772cb016e9c1bd3389e7c80694892494
6
+ metadata.gz: dd1258731d17b2df35dd46bd2e74c5b22881fed9370c97430c2246db3a879f8dd7289b07f1fb36429ad3e9ed0320e7b886504ebe0a2b734461a18f702551be04
7
+ data.tar.gz: 70be6d66ebcc920367f1143212c14ed00feb14f2653c514b7a58e6a8e1b939a3d945d4990888a8264a9224d20cd39717e6bddb0c0d0baa6361c8f8243621fac8
@@ -1,3 +1,4 @@
1
+ require 'net/http'
1
2
  # frozen_string_literal: true
2
3
 
3
4
  class Issue
@@ -15,3 +16,28 @@ class Issue
15
16
  end
16
17
  end
17
18
 
19
+ class PddIssue
20
+
21
+ def initialize(title, body, repo, number)
22
+ @title = title
23
+ @body = body
24
+ @repo = repo
25
+ @number = number
26
+ end
27
+
28
+ def extract_real_body
29
+ address = issue_link()
30
+ line_numbers = address.scan(/#L(\d+)-L(\d+)/).flatten.map(&:to_i)
31
+ uri = URI(address)
32
+ return Net::HTTP.get(uri).lines[line_numbers[0]-1..line_numbers[1]]
33
+ end
34
+
35
+ def issue_link
36
+ return @body[/https:\/\/github\.com\/[\w\-\/]+\/blob\/[\w\d]+\/[\w\/\.\-]+#\w+-\w+/, 0].gsub('https://github.com','https://raw.githubusercontent.com').gsub('blob/', '')
37
+ end
38
+
39
+ def to_s
40
+ "title: ```#{@title}```,\ndescription: ```#{extract_real_body}```,\nrepo: ```#{@repo}```,\nissue number: \##{@number}\n"
41
+ end
42
+ end
43
+
data/lib/newsman.rb CHANGED
@@ -104,7 +104,11 @@ def generate
104
104
  repository = issue.repository_url.split('/').last
105
105
  number = issue.number.to_s
106
106
  puts "Found issue in #{repository}:[##{number}] #{title}"
107
- issues << Issue.new(title, body, repository, number)
107
+ if issue.user.login == "0pdd"
108
+ issues << PddIssue.new(title, body, repository, number)
109
+ else
110
+ issues << Issue.new(title, body, repository, number)
111
+ end
108
112
  end
109
113
  issues = issues.map(&:to_s).join("\n\n\n")
110
114
  #puts "Found issues:\n #{issues}"
@@ -0,0 +1,48 @@
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/issues'
26
+
27
+ class TestPddIssue < Minitest::Test
28
+ TEST_BODY = "
29
+ The puzzle `531-462261de` from #531 has to be resolved:
30
+
31
+ https://github.com/objectionary/jeo-maven-plugin/blob/5a42b2c9f7e0ff01cbb2c4626e1dc5dc3f8aa7b8/src/it/annotations/src/main/java/org/eolang/jeo/annotations/AnnotationsApplication.java#L32-L35
32
+
33
+ The puzzle was created by @volodya-lombrozo on 29-Mar-24.
34
+
35
+ Estimate: 90 minutes, role: DEV.
36
+
37
+ If you have any technical questions, don't ask me, submit new tickets instead. The task will be \"done\" when the problem is fixed and the text of the puzzle is _removed_ from the source code. Here is more about [PDD](http://www.yegor256.com/2009/03/04/pdd.html) and [about me](http://www.yegor256.com/2017/04/05/pdd-in-action.html).
38
+ "
39
+
40
+ EXPECTED_DESCRIPTION = " * @todo #531:90min Check default values for annotation properties.\n", " * We still encounter some problems with annotation processing.\n", " * Especially with Autowired annotation from Spring Framework.\n", " * It's relatively simple annotation, but it's not processed correctly.\n", " */\n"
41
+
42
+ def test_parses_pdd_issue
43
+ issue = PddIssue.new('AnnotationsApplication.java:32-35: Check default values...',
44
+ TEST_BODY,
45
+ 'jeo-maven-plugin', 531)
46
+ assert_equal(EXPECTED_DESCRIPTION, issue.extract_real_body)
47
+ end
48
+ 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.1.7
4
+ version: 0.1.8
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-25 00:00:00.000000000 Z
11
+ date: 2024-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '6.3'
111
+ - !ruby/object:Gem::Dependency
112
+ name: net-http
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '0.4'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '0.4'
111
125
  description: A simple gem that gathers GitHub statistics and creates human-readable
112
126
  report
113
127
  email:
@@ -126,6 +140,7 @@ files:
126
140
  - lib/newsman/report.rb
127
141
  - lib/newsman/stdout_output.rb
128
142
  - lib/newsman/txt_output.rb
143
+ - test/test_pdd_issue.rb
129
144
  - test/test_report.rb
130
145
  - test/test_txtout.rb
131
146
  - test/test_week_before.rb