pdd 0.19.1 → 0.19.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/bin/pdd +0 -3
- data/lib/pdd/source.rb +9 -9
- data/lib/pdd/version.rb +1 -1
- data/test/test_pdd.rb +3 -3
- data/test/test_source.rb +16 -16
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39b17b27fc5abf3a65daa3f936c96d6968757485
|
4
|
+
data.tar.gz: 2835caf28f81e80a098921bfba476c220fa2b9ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fcd1254a03181424c502cd20b14b5df208bb81d126f3df17bccd98b5741ac20c881a94a939492623eabe53ff5a8f1dea8a6a0c74804d51c4d5a2309644b5e71c
|
7
|
+
data.tar.gz: 616fe34b598bdc3cae70727e0a8c754639abaa448ef6abf975061e2e9ea4fa998d86fc3ee4f0b2df465b38f1a1a329031a83735cad4472c03d2b5379f2770315
|
data/bin/pdd
CHANGED
data/lib/pdd/source.rb
CHANGED
@@ -41,17 +41,17 @@ module PDD
|
|
41
41
|
lines = File.readlines(@file)
|
42
42
|
lines.each_with_index do |line, idx|
|
43
43
|
begin
|
44
|
-
/[^\s]
|
45
|
-
raise Error,
|
46
|
-
as this page explains: https://github.com/yegor256/pdd#how-to-format
|
44
|
+
/[^\s]\x40todo/.match(line) do |_|
|
45
|
+
raise Error, "\x40todo must have a leading space to become \
|
46
|
+
a puzzle, as this page explains: https://github.com/yegor256/pdd#how-to-format"
|
47
47
|
end
|
48
|
-
|
49
|
-
raise Error, "
|
50
|
-
most probably because
|
51
|
-
explains: https://github.com/yegor256/pdd#how-to-format"
|
48
|
+
/\x40todo(?!\s+#)/.match(line) do |_|
|
49
|
+
raise Error, "\x40todo found, but puzzle can't be parsed, \
|
50
|
+
most probably because \x40todo is not followed by a puzzle marker, \
|
51
|
+
as this page explains: https://github.com/yegor256/pdd#how-to-format"
|
52
52
|
end
|
53
|
-
%r{(.*(?:^|\s))
|
54
|
-
puzzles << puzzle(lines.drop(idx + 1),
|
53
|
+
%r{(.*(?:^|\s))\x40todo\s+#([\w\-\.:/]+)\s+(.+)}.match(line) do |m|
|
54
|
+
puzzles << puzzle(lines.drop(idx + 1), m, idx)
|
55
55
|
end
|
56
56
|
rescue Error, ArgumentError => ex
|
57
57
|
raise Error, "puzzle at line ##{idx + 1}; #{ex.message}"
|
data/lib/pdd/version.rb
CHANGED
data/test/test_pdd.rb
CHANGED
@@ -32,7 +32,7 @@ class TestPDD < Minitest::Test
|
|
32
32
|
def test_basic
|
33
33
|
Dir.mktmpdir 'test' do |dir|
|
34
34
|
opts = opts(['-q', '-s', dir, '-e', '**/*.png', '-r', 'max-estimate:15'])
|
35
|
-
File.write(File.join(dir, 'a.txt'),
|
35
|
+
File.write(File.join(dir, 'a.txt'), "\x40todo #55 hello!")
|
36
36
|
matches(
|
37
37
|
Nokogiri::XML(PDD::Base.new(opts).xml),
|
38
38
|
[
|
@@ -49,7 +49,7 @@ class TestPDD < Minitest::Test
|
|
49
49
|
def test_rules_failure
|
50
50
|
Dir.mktmpdir 'test' do |dir|
|
51
51
|
opts = opts(['-q', '-s', dir, '-e', '**/*.png', '-r', 'min-estimate:30'])
|
52
|
-
File.write(File.join(dir, 'a.txt'),
|
52
|
+
File.write(File.join(dir, 'a.txt'), "\x40todo #90 hello!")
|
53
53
|
assert_raises PDD::Error do
|
54
54
|
PDD::Base.new(opts).xml
|
55
55
|
end
|
@@ -70,7 +70,7 @@ class TestPDD < Minitest::Test
|
|
70
70
|
cd 'a long dir name'
|
71
71
|
mkdir 'a kid'
|
72
72
|
cd 'a kid'
|
73
|
-
echo '
|
73
|
+
echo '\x40todo #1 this is some puzzle' > '.это файл.txt'
|
74
74
|
cd ../..
|
75
75
|
git add -f .
|
76
76
|
git commit --quiet -am 'first version'
|
data/test/test_source.rb
CHANGED
@@ -34,11 +34,11 @@ class TestSource < Minitest::Test
|
|
34
34
|
File.write(
|
35
35
|
file,
|
36
36
|
"
|
37
|
-
*
|
37
|
+
* \x40todo #44 hello,
|
38
38
|
* how are you\t\r\tdoing?
|
39
39
|
* -something else
|
40
40
|
Something else
|
41
|
-
~~
|
41
|
+
~~ \x40todo #ABC-3 this is another puzzle
|
42
42
|
~~ and it also has to work
|
43
43
|
"
|
44
44
|
)
|
@@ -59,10 +59,10 @@ class TestSource < Minitest::Test
|
|
59
59
|
file = File.join(dir, 'a.txt')
|
60
60
|
File.write(
|
61
61
|
file,
|
62
|
-
|
63
|
-
*
|
62
|
+
"
|
63
|
+
* \x40todo #44 this is an incorrectly formatted puzzle,
|
64
64
|
* with a second line without a leading space
|
65
|
-
|
65
|
+
"
|
66
66
|
)
|
67
67
|
error = assert_raises PDD::Error do
|
68
68
|
PDD::VerboseSource.new(file, PDD::Source.new(file, 'hey')).puzzles
|
@@ -76,14 +76,14 @@ class TestSource < Minitest::Test
|
|
76
76
|
file = File.join(dir, 'ff.txt')
|
77
77
|
File.write(
|
78
78
|
file,
|
79
|
-
|
80
|
-
*
|
81
|
-
|
79
|
+
"
|
80
|
+
* \x40todo this puzzle misses ticket name/number
|
81
|
+
"
|
82
82
|
)
|
83
83
|
error = assert_raises PDD::Error do
|
84
84
|
PDD::VerboseSource.new(file, PDD::Source.new(file, 'ff')).puzzles
|
85
85
|
end
|
86
|
-
assert !error.to_s.index(
|
86
|
+
assert !error.to_s.index("\x40todo is not followed by").nil?
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
@@ -91,7 +91,7 @@ class TestSource < Minitest::Test
|
|
91
91
|
skip if Gem.win_platform?
|
92
92
|
Dir.mktmpdir 'test' do |dir|
|
93
93
|
file = File.join(dir, 'xx.txt')
|
94
|
-
File.write(file, ' *
|
94
|
+
File.write(file, ' * \x40todo #44 this is a broken unicode: ' + 0x92.chr)
|
95
95
|
assert_raises PDD::Error do
|
96
96
|
PDD::VerboseSource.new(file, PDD::Source.new(file, 'xx')).puzzles
|
97
97
|
end
|
@@ -105,7 +105,7 @@ class TestSource < Minitest::Test
|
|
105
105
|
File.write(
|
106
106
|
file,
|
107
107
|
'
|
108
|
-
*
|
108
|
+
* \x40todo 44 this puzzle is not formatted correctly
|
109
109
|
'
|
110
110
|
)
|
111
111
|
error = assert_raises PDD::Error do
|
@@ -120,14 +120,14 @@ class TestSource < Minitest::Test
|
|
120
120
|
file = File.join(dir, 'hey.txt')
|
121
121
|
File.write(
|
122
122
|
file,
|
123
|
-
|
124
|
-
|
125
|
-
|
123
|
+
"
|
124
|
+
*\x40todo #999 this is an incorrectly formatted puzzle!
|
125
|
+
"
|
126
126
|
)
|
127
127
|
error = assert_raises PDD::Error do
|
128
128
|
PDD::VerboseSource.new(file, PDD::Source.new(file, 'x')).puzzles
|
129
129
|
end
|
130
|
-
assert !error.message.index(
|
130
|
+
assert !error.message.index("\x40todo must have a leading space").nil?
|
131
131
|
end
|
132
132
|
end
|
133
133
|
|
@@ -140,7 +140,7 @@ class TestSource < Minitest::Test
|
|
140
140
|
git init --quiet .
|
141
141
|
git config user.email test@teamed.io
|
142
142
|
git config user.name test
|
143
|
-
echo '
|
143
|
+
echo '\x40todo #1 this is the puzzle' > a.txt
|
144
144
|
git add a.txt
|
145
145
|
git commit --quiet -am 'first version'
|
146
146
|
")
|