pdd 0.19.2 → 0.19.3

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: 39b17b27fc5abf3a65daa3f936c96d6968757485
4
- data.tar.gz: 2835caf28f81e80a098921bfba476c220fa2b9ad
3
+ metadata.gz: 8622ba0c2c8bd96bc34c573743c5c547d0b23793
4
+ data.tar.gz: '070296107be448d09103f0ebba885c3eafae10ec'
5
5
  SHA512:
6
- metadata.gz: fcd1254a03181424c502cd20b14b5df208bb81d126f3df17bccd98b5741ac20c881a94a939492623eabe53ff5a8f1dea8a6a0c74804d51c4d5a2309644b5e71c
7
- data.tar.gz: 616fe34b598bdc3cae70727e0a8c754639abaa448ef6abf975061e2e9ea4fa998d86fc3ee4f0b2df465b38f1a1a329031a83735cad4472c03d2b5379f2770315
6
+ metadata.gz: 98595337e4d0da7ef8feb663fcaca35d812ddfcad03791cc75958293c047bcfbcf00bc341a9c632d7b1fc43b6add23070b697c3b965aa8d9a5fe10af180f4b48
7
+ data.tar.gz: 430ccd3afbcab4918a47d8acb4f64817249c86c98c3cb918efb2b511b0604ac50cf5ab7bf74abdb685754131eb60f5063eaf6ab0ab7f0b33bfcadb91360b6943
data/bin/pdd CHANGED
@@ -97,6 +97,7 @@ https://github.com/yegor256/pdd/blob/master/README.md"
97
97
  file << output
98
98
  rescue SystemExit => ex
99
99
  puts ex.message unless ex.success?
100
+ PDD.log.info "Exit code is #{ex.status}"
100
101
  exit(ex.status)
101
102
  rescue PDD::Error => ex
102
103
  puts "#{Rainbow('ERROR').red}: #{ex.message}. \
@@ -105,8 +106,10 @@ how to fix it, please submit a GitHub issue, we will try to help you: \
105
106
  https://github.com/yegor256/pdd/issues. This tool is still in its beta \
106
107
  version and we will appreciate your feedback. Here is where you can find \
107
108
  more documentation: https://github.com/yegor256/pdd/blob/master/README.md."
109
+ PDD.log.info 'Exit code is 1'
108
110
  exit(1)
109
111
  rescue StandardError => ex
110
112
  puts "#{Rainbow('ERROR').red} (#{ex.class.name}): #{ex.message}"
111
- exit(-1)
113
+ PDD.log.info 'Exit code is 255'
114
+ exit(255)
112
115
  end
@@ -28,7 +28,7 @@ module PDD
28
28
  # Ctor.
29
29
  # +dir+:: Directory with source code files
30
30
  def initialize(dir, ptns = [])
31
- @dir = dir
31
+ @dir = File.absolute_path(dir)
32
32
  @exclude = ptns + ['.git/**/*']
33
33
  end
34
34
 
@@ -46,10 +46,8 @@ module PDD
46
46
  end
47
47
  PDD.log.info "#{files.size} file(s) found, #{excluded} excluded"
48
48
  files.reject { |f| binary?(f) }.map do |file|
49
- VerboseSource.new(
50
- file,
51
- Source.new(file, file[@dir.length + 1, file.length])
52
- )
49
+ path = file[@dir.length + 1, file.length]
50
+ VerboseSource.new(path, Source.new(file, path))
53
51
  end
54
52
  end
55
53
 
@@ -23,5 +23,5 @@
23
23
  # Copyright:: Copyright (c) 2014-2017 Yegor Bugayenko
24
24
  # License:: MIT
25
25
  module PDD
26
- VERSION = '0.19.2'.freeze
26
+ VERSION = '0.19.3'.freeze
27
27
  end
@@ -82,9 +82,19 @@ class TestSources < Minitest::Test
82
82
  end
83
83
  end
84
84
 
85
+ def test_fails_with_verbose_output
86
+ in_temp do |dir|
87
+ File.write(File.join(dir, 'z1.txt'), "\x40todobroken\n")
88
+ error = assert_raises PDD::Error do
89
+ PDD::Sources.new(dir).fetch[0].puzzles
90
+ end
91
+ assert error.message.start_with?('z1.txt; '), error.message
92
+ end
93
+ end
94
+
85
95
  private
86
96
 
87
- def in_temp(files)
97
+ def in_temp(files = [])
88
98
  Dir.mktmpdir 'x' do |dir|
89
99
  files.each do |path|
90
100
  file = File.join(dir, path)
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.19.2
4
+ version: 0.19.3
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-12-07 00:00:00.000000000 Z
11
+ date: 2017-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri