pdd 0.21.1 → 0.21.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/features/cli.feature +2 -2
- data/lib/pdd/source.rb +10 -0
- data/lib/pdd/version.rb +1 -1
- data/test/test_source.rb +25 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c76649118dbe4b4884f07d453b611ca05da5845e753357fcb98cd0e6e8324b64
|
4
|
+
data.tar.gz: 4b85d7b84b62f8d695d2e8b95a92bc03cb87d5e6acbef283723ac353a43c42cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a54147d056c4593c20142e9c45497308bc57c0ec34a63e84fc0f025e1722ed406102f9383196cec51a084baffe17d2de4174060c93173328605089410a48dff
|
7
|
+
data.tar.gz: 4270c5b9ec6e8b63ca371b2c6c5905b13394d5078943f1c66b8c8ec9ccc30ae25026efd375f3fd2d5bd8c2a1fd29080c86755935d5c91bc6d47baceda89e6edd
|
data/features/cli.feature
CHANGED
data/lib/pdd/source.rb
CHANGED
@@ -141,12 +141,21 @@ against the rules explained here: https://github.com/cqfn/pdd#how-to-format"
|
|
141
141
|
min
|
142
142
|
end
|
143
143
|
|
144
|
+
# rubocop:disable Metrics/CyclomaticComplexity
|
145
|
+
# @todo #209:30min temporarily disabled cyclomatic complexity for the method.
|
146
|
+
# below. Please fix soon.
|
147
|
+
#
|
144
148
|
# Fetch puzzle tail (all lines after the first one)
|
145
149
|
def tail(lines, prefix, start)
|
146
150
|
prefix = prefix.rstrip
|
147
151
|
prefix = " #{' ' * start}" if prefix.empty? # fallback to space indentation
|
152
|
+
line = lines[0][prefix.length + 1, lines[0].length] if lines[0]
|
153
|
+
is_indented = line&.start_with?(' ')
|
148
154
|
lines
|
149
155
|
.take_while { |t| match_markers(t).none? && t.start_with?(prefix) }
|
156
|
+
.take_while do |t|
|
157
|
+
!is_indented || t[prefix.length + 1, t.length].start_with?(' ')
|
158
|
+
end
|
150
159
|
.take_while do |t|
|
151
160
|
# account for carriage return in line endings
|
152
161
|
t_len = t.length - 1
|
@@ -155,6 +164,7 @@ against the rules explained here: https://github.com/cqfn/pdd#how-to-format"
|
|
155
164
|
.map { |t| t[prefix.length, t.length] }
|
156
165
|
.map { |t| t.start_with?(' ') ? t[1, t.length] : t }
|
157
166
|
end
|
167
|
+
# rubocop:enable Metrics/CyclomaticComplexity
|
158
168
|
|
159
169
|
# @todo #75:30min Let's make it possible to fetch Subversion data
|
160
170
|
# in a similar way as we are doing with Git. We should also just
|
data/lib/pdd/version.rb
CHANGED
data/test/test_source.rb
CHANGED
@@ -22,6 +22,7 @@ require 'minitest/autorun'
|
|
22
22
|
require 'tmpdir'
|
23
23
|
require_relative '../lib/pdd'
|
24
24
|
require_relative '../lib/pdd/sources'
|
25
|
+
require_relative 'test__helper'
|
25
26
|
|
26
27
|
# Source test.
|
27
28
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
@@ -46,8 +47,8 @@ class TestSource < Minitest::Test
|
|
46
47
|
list = source.puzzles
|
47
48
|
assert_equal 2, list.size
|
48
49
|
puzzle = list.first
|
49
|
-
assert_equal '2-
|
50
|
-
assert_equal 'привет, how are you doing?
|
50
|
+
assert_equal '2-3', puzzle.props[:lines]
|
51
|
+
assert_equal 'привет, how are you doing?', \
|
51
52
|
puzzle.props[:body]
|
52
53
|
assert_equal '44', puzzle.props[:ticket]
|
53
54
|
assert puzzle.props[:author].nil?
|
@@ -103,6 +104,28 @@ class TestSource < Minitest::Test
|
|
103
104
|
end
|
104
105
|
end
|
105
106
|
|
107
|
+
def test_space_indented_multiline_puzzle_block
|
108
|
+
Dir.mktmpdir 'test' do |dir|
|
109
|
+
file = File.join(dir, 'a.txt')
|
110
|
+
File.write(
|
111
|
+
file,
|
112
|
+
"
|
113
|
+
# \x40todo #99:30min hello
|
114
|
+
# good bye
|
115
|
+
# hello again
|
116
|
+
"
|
117
|
+
)
|
118
|
+
stub_source_find_github_user(file, 'hey') do |source|
|
119
|
+
PDD.opts = nil
|
120
|
+
assert_equal 1, source.puzzles.size
|
121
|
+
puzzle = source.puzzles.last
|
122
|
+
assert_equal '2-3', puzzle.props[:lines]
|
123
|
+
assert_equal 'hello good bye', puzzle.props[:body]
|
124
|
+
assert_equal '99', puzzle.props[:ticket]
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
106
129
|
def test_multiple_puzzles_single_comment_block
|
107
130
|
Dir.mktmpdir 'test' do |dir|
|
108
131
|
file = File.join(dir, 'a.txt')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pdd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.21.
|
4
|
+
version: 0.21.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yegor Bugayenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-07-
|
11
|
+
date: 2022-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|