pdd 0.17.3 → 0.17.4

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
  SHA1:
3
- metadata.gz: 9737f2ffe3116e23bfcc57021b402e0ef01dd580
4
- data.tar.gz: 71d0b9a2044217d12c978473c19843ede5759988
3
+ metadata.gz: 8e3a86ea459f81e85300aca8db83ac75fa4900ef
4
+ data.tar.gz: 0e0b0382904a578a64e43066bb06ae8b8be78b56
5
5
  SHA512:
6
- metadata.gz: df79e23a678a56d0623496d7fde7cf5ba3782ae868ddf854919bfa5d93952e1e03a77c84bdb46f395352a082eccf24af666e6b425e08b70b5bfbf98f00eea9a8
7
- data.tar.gz: bb5703913a301601dee492be977948950e19e6515398cbc4ecd4958a227c0da9edd713cb71df709c92cca1ceaa7b1726f888e6901618a5f1a5755d94c292e458
6
+ metadata.gz: fb8ed0d9236f69ad90bfb6f81ae7d8439c9982e004351ea18a10ee4236eadd3d7272d532c1cb0976a28edd10f238ee3121a37ac8e00ab7560be7b9c8bee2e601
7
+ data.tar.gz: c0aad26728527b0f345932dbcdb0c022e6693e91c076e8f81280b7db5243285dfead016ebfdcf191d8f7ea1201ddb19af8d5a315c7c9d88a4e1b24c578e9eabf
data/.simplecov CHANGED
@@ -38,6 +38,6 @@ else
38
38
  SimpleCov.start do
39
39
  add_filter "/test/"
40
40
  add_filter "/features/"
41
- minimum_coverage 100
41
+ minimum_coverage 90
42
42
  end
43
43
  end
data/Rakefile CHANGED
@@ -61,11 +61,10 @@ RuboCop::RakeTask.new(:rubocop) do |task|
61
61
  end
62
62
 
63
63
  require 'cucumber/rake/task'
64
- Cucumber::Rake::Task.new(:features) do |t|
64
+ Cucumber::Rake::Task.new(:features) do
65
65
  Rake::Cleaner.cleanup_files(['coverage'])
66
- t.profile = 'travis'
67
66
  end
68
- Cucumber::Rake::Task.new(:"features:html") do |t|
67
+ Cucumber::Rake::Task.new(:'features:html') do |t|
69
68
  t.profile = 'html_report'
70
69
  end
71
70
 
data/bin/pdd CHANGED
@@ -23,53 +23,26 @@
23
23
 
24
24
  STDOUT.sync = true
25
25
 
26
- require 'pdd'
27
26
  require 'slop'
28
- require 'pdd/version'
29
27
  require 'nokogiri'
28
+ require_relative '../lib/pdd'
29
+ require_relative '../lib/pdd/version'
30
30
 
31
31
  args = []
32
32
  args += File.read('.pdd').split(/\s+/).map(&:strip) if File.exist?('.pdd')
33
33
  args += ARGV
34
34
 
35
- opts = Slop.parse(args, strict: true, help: true) do
36
- banner "Usage (#{PDD::VERSION}): pdd [options]"
37
- on 'v', 'verbose', 'Enable verbose mode'
38
- on 'q', 'quiet', 'Enable quiet mode'
39
- on 'version', 'Show current version'
40
- on(
41
- 's',
42
- 'source',
43
- 'Source directory to parse',
44
- argument: :required
45
- )
46
- on(
47
- 'f',
48
- 'file',
49
- 'File to save XML into',
50
- argument: :required
51
- )
52
- on(
53
- 'e',
54
- 'exclude',
55
- 'Glob pattern to exclude',
56
- as: Array,
57
- argument: :required
58
- )
59
- on(
60
- 't',
61
- 'format',
62
- 'Format to use (xml|html)',
63
- argument: :required
64
- )
65
- on(
66
- 'r',
67
- 'rule',
68
- 'Format to use (xml|html)',
69
- argument: :required,
70
- as: Array,
71
- limit: 1
72
- )
35
+ opts = Slop.parse(args, strict: true, help: true) do |o|
36
+ o.banner = "Usage (#{PDD::VERSION}): pdd [options]"
37
+ o.bool '-h', '--help', 'Show these instructions'
38
+ o.bool '-v', '--verbose', 'Enable verbose mode'
39
+ o.bool '-q', '--quiet', 'Enable quiet mode'
40
+ o.bool '--version', 'Show current version'
41
+ o.string '-s', '--source', 'Source directory to parse'
42
+ o.string '-f', '--file', 'File to save XML into'
43
+ o.array '-e', '--exclude', 'Glob pattern to exclude'
44
+ o.string '-t', '--format', 'Format to use (xml|html)'
45
+ o.array '-r', '--rule', 'Rule to apply'
73
46
  end
74
47
 
75
48
  raise '-f is mandatory when using -v' if opts.verbose? && !opts.file?
@@ -20,20 +20,20 @@
20
20
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  # SOFTWARE.
22
22
 
23
- require 'pdd'
24
23
  require 'nokogiri'
25
24
  require 'tmpdir'
26
25
  require 'slop'
27
26
  require 'English'
27
+ require_relative '../../lib/pdd'
28
28
 
29
29
  Before do
30
30
  @cwd = Dir.pwd
31
31
  @dir = Dir.mktmpdir('test')
32
32
  FileUtils.mkdir_p(@dir) unless File.exist?(@dir)
33
33
  Dir.chdir(@dir)
34
- @opts = Slop.parse ['-v', '-s', @dir] do
35
- on 'v', 'verbose'
36
- on 's', 'source', argument: :required
34
+ @opts = Slop.parse ['-v', '-s', @dir] do |o|
35
+ o.bool '-v', '--verbose'
36
+ o.string '-s', '--source'
37
37
  end
38
38
  end
39
39
 
@@ -21,4 +21,4 @@
21
21
  # SOFTWARE.
22
22
 
23
23
  require 'simplecov'
24
- require 'pdd'
24
+ require_relative '../../lib/pdd'
@@ -22,6 +22,6 @@ Feature: Unicode
22
22
  # @todo #44 \xFF hey
23
23
  \xFF test again
24
24
  """
25
- When I run bin/pdd with "--exclude=test.txt --v -f=/dev/null"
25
+ When I run bin/pdd with "--exclude=test.txt -v -f=/dev/null"
26
26
  Then Stdout contains "excluding test.txt"
27
27
  Then Exit code is zero
data/lib/pdd.rb CHANGED
@@ -20,15 +20,15 @@
20
20
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  # SOFTWARE.
22
22
 
23
- require 'pdd/sources'
24
- require 'pdd/version'
25
- require 'pdd/rule/estimates'
26
- require 'pdd/rule/text'
27
- require 'pdd/rule/duplicates'
28
- require 'pdd/rule/roles'
29
23
  require 'nokogiri'
30
24
  require 'logger'
31
25
  require 'time'
26
+ require_relative 'pdd/sources'
27
+ require_relative 'pdd/version'
28
+ require_relative 'pdd/rule/estimates'
29
+ require_relative 'pdd/rule/text'
30
+ require_relative 'pdd/rule/duplicates'
31
+ require_relative 'pdd/rule/roles'
32
32
 
33
33
  # PDD main module.
34
34
  # Author:: Yegor Bugayenko (yegor@teamed.io)
data/lib/pdd/source.rb CHANGED
@@ -21,7 +21,9 @@
21
21
  # SOFTWARE.
22
22
 
23
23
  require 'digest/md5'
24
- require 'pdd/puzzle'
24
+ require 'shellwords'
25
+ require_relative '../pdd'
26
+ require_relative '../pdd/puzzle'
25
27
 
26
28
  module PDD
27
29
  # Source.
@@ -105,10 +107,9 @@ module PDD
105
107
 
106
108
  # Git information at the line
107
109
  def git(pos)
108
- cmd = [
109
- "cd #{File.dirname(@file)}",
110
- "git blame -L #{pos},#{pos} --porcelain #{File.basename(@file)}"
111
- ].join(' && ')
110
+ cmd = "cd #{Shellwords.escape(File.dirname(@file))} && \
111
+ git blame -L #{pos},#{pos} --porcelain \
112
+ #{Shellwords.escape(File.basename(@file))}"
112
113
  Hash[
113
114
  `#{cmd}`.split("\n").map do |line|
114
115
  if line =~ /^author /
data/lib/pdd/sources.rb CHANGED
@@ -20,10 +20,10 @@
20
20
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  # SOFTWARE.
22
22
 
23
- require 'pdd'
24
- require 'pdd/source'
25
23
  require 'shellwords'
26
24
  require 'English'
25
+ require_relative '../pdd'
26
+ require_relative 'source'
27
27
 
28
28
  module PDD
29
29
  # Code base abstraction
data/lib/pdd/version.rb CHANGED
@@ -25,5 +25,5 @@
25
25
  # Copyright:: Copyright (c) 2014-2017 Yegor Bugayenko
26
26
  # License:: MIT
27
27
  module PDD
28
- VERSION = '0.17.3'.freeze
28
+ VERSION = '0.17.4'.freeze
29
29
  end
data/pdd.gemspec CHANGED
@@ -22,7 +22,7 @@
22
22
 
23
23
  lib = File.expand_path('../lib', __FILE__)
24
24
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
25
- require 'pdd/version'
25
+ require_relative 'lib/pdd/version'
26
26
 
27
27
  Gem::Specification.new do |s|
28
28
  s.specification_version = 2 if s.respond_to? :specification_version=
@@ -45,7 +45,7 @@ Gem::Specification.new do |s|
45
45
  s.rdoc_options = ['--charset=UTF-8']
46
46
  s.extra_rdoc_files = ['README.md', 'LICENSE.txt']
47
47
  s.add_runtime_dependency 'nokogiri', '~>1.6'
48
- s.add_runtime_dependency 'slop', '~>3.6'
48
+ s.add_runtime_dependency 'slop', '~>4.4.1'
49
49
  s.add_development_dependency 'rake', '10.5.0'
50
50
  s.add_development_dependency 'coveralls', '0.7.2'
51
51
  s.add_development_dependency 'rdoc', '4.2.0'
data/test/test__helper.rb CHANGED
@@ -23,5 +23,5 @@
23
23
  STDOUT.sync = true
24
24
 
25
25
  require 'simplecov'
26
- require 'pdd'
27
26
  require 'minitest/autorun'
27
+ require_relative '../lib/pdd'
@@ -22,7 +22,7 @@
22
22
 
23
23
  require 'minitest/autorun'
24
24
  require 'nokogiri'
25
- require 'pdd/rule/duplicates'
25
+ require_relative '../lib/pdd/rule/duplicates'
26
26
 
27
27
  # PDD::Rule::MaxDuplicates class test.
28
28
  # Author:: Yegor Bugayenko (yegor@teamed.io)
@@ -22,7 +22,7 @@
22
22
 
23
23
  require 'minitest/autorun'
24
24
  require 'nokogiri'
25
- require 'pdd/rule/estimates'
25
+ require_relative '../lib/pdd/rule/estimates'
26
26
 
27
27
  # PDD::Rule::Estimate module tests.
28
28
  # Author:: Yegor Bugayenko (yegor@teamed.io)
data/test/test_pdd.rb CHANGED
@@ -22,9 +22,9 @@
22
22
 
23
23
  require 'minitest/autorun'
24
24
  require 'nokogiri'
25
- require 'pdd'
26
25
  require 'tmpdir'
27
26
  require 'slop'
27
+ require_relative '../lib/pdd'
28
28
 
29
29
  # PDD main module test.
30
30
  # Author:: Yegor Bugayenko (yegor@teamed.io)
@@ -68,8 +68,13 @@ class TestPDD < Minitest::Test
68
68
  git init .
69
69
  git config user.email test@teamed.io
70
70
  git config user.name 'Mr. Tester'
71
- echo '@todo #1 this is the puzzle' > .x.txt
72
- git add .x.txt
71
+ mkdir 'a long dir name'
72
+ cd 'a long dir name'
73
+ mkdir 'a kid'
74
+ cd 'a kid'
75
+ echo '@todo #1 this is the puzzle' > '.это файл.txt'
76
+ cd ../..
77
+ git add -f .
73
78
  git commit -am 'first version'
74
79
  ")
75
80
  matches(
@@ -77,7 +82,7 @@ class TestPDD < Minitest::Test
77
82
  [
78
83
  '/puzzles[count(puzzle)=1]',
79
84
  '/puzzles/puzzle[id]',
80
- '/puzzles/puzzle[file=".x.txt"]',
85
+ '/puzzles/puzzle[file="a long dir name/a kid/.это файл.txt"]',
81
86
  '/puzzles/puzzle[author="Mr. Tester"]',
82
87
  '/puzzles/puzzle[email="test@teamed.io"]',
83
88
  '/puzzles/puzzle[time]'
@@ -89,11 +94,11 @@ class TestPDD < Minitest::Test
89
94
  private
90
95
 
91
96
  def opts(args)
92
- Slop.parse args do
93
- on 'v', 'verbose'
94
- on 's', 'source', argument: :required
95
- on 'e', 'exclude', as: Array, argument: :required
96
- on 'r', 'rule', as: Array, argument: :required
97
+ Slop.parse args do |o|
98
+ o.bool '-v', '--verbose'
99
+ o.string '-s', '--source'
100
+ o.array '-e', '--exclude'
101
+ o.array '-r', '--rule'
97
102
  end
98
103
  end
99
104
 
data/test/test_roles.rb CHANGED
@@ -22,7 +22,7 @@
22
22
 
23
23
  require 'minitest/autorun'
24
24
  require 'nokogiri'
25
- require 'pdd/rule/roles'
25
+ require_relative '../lib/pdd/rule/roles'
26
26
 
27
27
  # PDD::Rule::Role module tests.
28
28
  # Author:: Yegor Bugayenko (yegor@teamed.io)
data/test/test_source.rb CHANGED
@@ -21,8 +21,8 @@
21
21
  # SOFTWARE.
22
22
 
23
23
  require 'minitest/autorun'
24
- require 'pdd/sources'
25
24
  require 'tmpdir'
25
+ require_relative '../lib/pdd/sources'
26
26
 
27
27
  # Source test.
28
28
  # Author:: Yegor Bugayenko (yegor@teamed.io)
data/test/test_sources.rb CHANGED
@@ -23,9 +23,8 @@
23
23
  require 'minitest/autorun'
24
24
  require 'fileutils'
25
25
  require 'tmpdir'
26
- require 'pdd/sources'
27
-
28
26
  require_relative '../test/test__helper'
27
+ require_relative '../lib/pdd/sources'
29
28
 
30
29
  # Sources test.
31
30
  # Author:: Yegor Bugayenko (yegor@teamed.io)
data/test/test_text.rb CHANGED
@@ -22,7 +22,7 @@
22
22
 
23
23
  require 'minitest/autorun'
24
24
  require 'nokogiri'
25
- require 'pdd/rule/text'
25
+ require_relative '../lib/pdd/rule/text'
26
26
 
27
27
  # PDD::Rule::Text module tests.
28
28
  # Author:: Yegor Bugayenko (yegor@teamed.io)
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.17.3
4
+ version: 0.17.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-07 00:00:00.000000000 Z
11
+ date: 2017-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '3.6'
33
+ version: 4.4.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '3.6'
40
+ version: 4.4.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement