pdd 0.16.1 → 0.16.2

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: 7f39abf45e74c8b628a184ebf3af5f381dd1a6fa
4
- data.tar.gz: 7e5c582166939f646278e3026ddef64973aba9b4
3
+ metadata.gz: f70d3268af6c4b7f6fdf1e6401a1f73ed26f85f8
4
+ data.tar.gz: d2dab3ed08b56b2b3c1999feb2135f525b10711a
5
5
  SHA512:
6
- metadata.gz: f63302dde98c839ea1d415750e7535640c0cf2e34c739e2bdf7f4f9c3e5b2bd6bbf3d5c758068a977d041fcc63cab0f07f1e80187c99dc7a6cd8b6b561460135
7
- data.tar.gz: ee409a6da382ccace28f1e25a85440e5a93df7a06d16898991fb594e5b34be6860727709367b43f7615671244e7ce1b7efa48d113f71d6f456f62ebaef65f6ed
6
+ metadata.gz: 7a5fd5f873c59f78657c92b611965267ff712d4d7b50fd57ee349873f560f5359cc52410b2166d0080fd0b33812e812203706dab4e09813ddbf9df5664a168ae
7
+ data.tar.gz: 62ecc9002f192fee996038406473803e659c92b7efea421c612903ad3344ddb50a393d3ee758a8d6b51ed01d2bec42a17c56245cde842867ba9d7e173cf82f4c
data/lib/pdd/sources.rb CHANGED
@@ -21,7 +21,7 @@
21
21
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  # SOFTWARE.
23
23
 
24
- require 'filemagic'
24
+ require 'ptools'
25
25
  require 'pdd/source'
26
26
  require 'rake/file_list'
27
27
 
@@ -33,7 +33,6 @@ module PDD
33
33
  def initialize(dir, ptns = [])
34
34
  @dir = dir
35
35
  @exclude = ptns
36
- @magic = FileMagic.new(FileMagic::MAGIC_MIME)
37
36
  end
38
37
 
39
38
  # Fetch all sources.
@@ -46,15 +45,12 @@ module PDD
46
45
  end
47
46
  end.to_a
48
47
  PDD.log.info "#{files.size} file(s) found"
49
- types = [%r{^text/}, %r{application/xml}]
50
- files
51
- .select { |f| types.index { |re| @magic.file(f) =~ re } }
52
- .map do |file|
53
- VerboseSource.new(
54
- file,
55
- Source.new(file, file[@dir.length + 1, file.length])
56
- )
57
- end
48
+ files.select { |f| !File.directory?(f) && !File.binary?(f) }.map do |file|
49
+ VerboseSource.new(
50
+ file,
51
+ Source.new(file, file[@dir.length + 1, file.length])
52
+ )
53
+ end
58
54
  end
59
55
 
60
56
  def exclude(ptn)
data/lib/pdd/version.rb CHANGED
@@ -26,5 +26,5 @@
26
26
  # Copyright:: Copyright (c) 2014-2016 Yegor Bugayenko
27
27
  # License:: MIT
28
28
  module PDD
29
- VERSION = '0.16.1'.freeze
29
+ VERSION = '0.16.2'.freeze
30
30
  end
data/pdd.gemspec CHANGED
@@ -46,7 +46,7 @@ Gem::Specification.new do |s|
46
46
  s.rdoc_options = ['--charset=UTF-8']
47
47
  s.extra_rdoc_files = ['README.md', 'LICENSE.txt']
48
48
  s.add_runtime_dependency 'nokogiri', '~>1.6'
49
- s.add_runtime_dependency 'ruby-filemagic', '~>0.7'
49
+ s.add_runtime_dependency 'ptools', '~>1.3'
50
50
  s.add_runtime_dependency 'slop', '~>3.6'
51
51
  s.add_development_dependency 'rake', '10.5.0'
52
52
  s.add_development_dependency 'coveralls', '0.7.2'
data/test/test_sources.rb CHANGED
@@ -23,6 +23,7 @@
23
23
 
24
24
  require 'minitest/autorun'
25
25
  require 'pdd/sources'
26
+ require 'fileutils'
26
27
  require 'tmpdir'
27
28
 
28
29
  # Sources test.
@@ -38,8 +39,8 @@ class TestSources < Minitest::Test
38
39
  end
39
40
 
40
41
  def test_ignores_binary_files
41
- in_temp(['c', 'd.png']) do |dir|
42
- File.write(File.join(dir, 'd.png'), '')
42
+ in_temp(['c']) do |dir|
43
+ FileUtils.cp(File.join(Dir.pwd, '.git/index'), dir)
43
44
  list = PDD::Sources.new(dir).fetch
44
45
  assert_equal 1, list.size
45
46
  end
@@ -71,6 +72,8 @@ class TestSources < Minitest::Test
71
72
  end
72
73
  end
73
74
 
75
+ private
76
+
74
77
  def in_temp(files)
75
78
  Dir.mktmpdir 'x' do |dir|
76
79
  files.each do |path|
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.16.1
4
+ version: 0.16.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
@@ -25,19 +25,19 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.6'
27
27
  - !ruby/object:Gem::Dependency
28
- name: ruby-filemagic
28
+ name: ptools
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.7'
33
+ version: '1.3'
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: '0.7'
40
+ version: '1.3'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: slop
43
43
  requirement: !ruby/object:Gem::Requirement