pdd 0.18.3 → 0.19

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
  SHA1:
3
- metadata.gz: 2e29823260d1cc31b98a35ffd3940f2c219b2c33
4
- data.tar.gz: 5b0fd69dcd221feb6d376357ae6991cb94fe90a0
3
+ metadata.gz: 1301f2639525558a458d49bf60f7b0782ff64411
4
+ data.tar.gz: 72f951b344e6356b743e5c8b41c5fd3b52ea8be1
5
5
  SHA512:
6
- metadata.gz: 0e8535949ab4eca5803b306de3f7a3cf4c586786f9be15760eb4f10a24e83b44c88a49686f359637a8598477f4591b396ff3e2b339d9c2ee11a11a8cd4a17c1e
7
- data.tar.gz: 63f9baf67bd70db429d8d42f5366024e483f51c6c8c594f639c0faa247a005f68321b42266f18b0567c4fc147a91e6de90ee0105d505a49f0cd78af495e8eda6
6
+ metadata.gz: 322b941959f93466b62046260c8b34ebdedc71d916b435251a2f3566d798a6197fe066d45bd3c13cd2c18122746504dc86304e1e090ab3ff885aff0e4b2e17c2
7
+ data.tar.gz: f5e136c6e729887be579b0b2231ee8de5e781323c4d45ebe4a2b1e2aaa5a1b52d7eb508cccfdea99ecc1602e5a8db3fdfd54110cdec459d55416113f553c5f9f
data/.rubocop.yml CHANGED
@@ -9,7 +9,7 @@ MethodLength:
9
9
  Style/ClassLength:
10
10
  Max: 150
11
11
  Metrics/AbcSize:
12
- Max: 37
12
+ Max: 40
13
13
  Style/MultilineBlockChain:
14
14
  Enabled: false
15
15
  Metrics/BlockLength:
data/bin/pdd CHANGED
@@ -26,6 +26,7 @@ require 'nokogiri'
26
26
  require 'rainbow'
27
27
  require_relative '../lib/pdd'
28
28
  require_relative '../lib/pdd/version'
29
+ require_relative '../lib/pdd/source'
29
30
 
30
31
  begin
31
32
  args = []
@@ -97,12 +98,15 @@ https://github.com/yegor256/pdd/blob/master/README.md"
97
98
  rescue SystemExit => ex
98
99
  puts ex.message unless ex.success?
99
100
  exit(ex.status)
100
- rescue StandardError => ex
101
+ rescue Source::Error => ex
101
102
  puts "#{Rainbow('ERROR').red}: #{ex.message}"
102
103
  puts "If you can't understand the cause of this issue or you don't know \
103
104
  how to fix it, please submit a GitHub issue, we will try to help you: \
104
105
  https://github.com/yegor256/pdd/issues. This tool is still in its beta \
105
106
  version and we will appreciate your feedback. Here is where you can find \
106
107
  more documentation: https://github.com/yegor256/pdd/blob/master/README.md."
108
+ exit(1)
109
+ rescue StandardError => ex
110
+ puts "#{Rainbow('ERROR').red}: #{ex.message}"
107
111
  exit(-1)
108
112
  end
data/lib/pdd.rb CHANGED
@@ -22,7 +22,6 @@ require 'nokogiri'
22
22
  require 'logger'
23
23
  require 'time'
24
24
  require 'rainbow'
25
- require_relative 'pdd/sources'
26
25
  require_relative 'pdd/version'
27
26
  require_relative 'pdd/rule/estimates'
28
27
  require_relative 'pdd/rule/text'
@@ -86,6 +85,7 @@ module PDD
86
85
  def xml
87
86
  dir = @opts[:source] ? @opts[:source] : Dir.pwd
88
87
  PDD.log.info "Reading #{dir}"
88
+ require_relative 'pdd/sources'
89
89
  sources = Sources.new(dir)
90
90
  unless @opts[:exclude].nil?
91
91
  @opts[:exclude].each do |p|
data/lib/pdd/source.rb CHANGED
@@ -20,11 +20,15 @@
20
20
 
21
21
  require 'digest/md5'
22
22
  require 'shellwords'
23
+ require_relative '../pdd'
23
24
  require_relative '../pdd/puzzle'
24
25
 
25
26
  module PDD
26
27
  # Source.
27
28
  class Source
29
+ # If it breaks.
30
+ class Error < PDD::Error
31
+ end
28
32
  # Ctor.
29
33
  # +file+:: Absolute file name with source code
30
34
  # +path+:: Path to show (without full file name)
@@ -41,7 +45,7 @@ module PDD
41
45
  lines.each_with_index do |line, idx|
42
46
  begin
43
47
  /[^\s]@todo/.match(line) do |_|
44
- raise Error, 'TODO must have a leading space to become a puzzle,
48
+ raise Error, 'TODO must have a leading space to become a puzzle, \
45
49
  as this page explains: https://github.com/yegor256/pdd#how-to-format'
46
50
  end
47
51
  /@todo(?!\s+#)/.match(line) do |_|
data/lib/pdd/version.rb CHANGED
@@ -23,5 +23,5 @@
23
23
  # Copyright:: Copyright (c) 2014-2017 Yegor Bugayenko
24
24
  # License:: MIT
25
25
  module PDD
26
- VERSION = '0.18.3'.freeze
26
+ VERSION = '0.19'.freeze
27
27
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pdd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.3
4
+ version: '0.19'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko