ripper-tags 0.3.0 → 0.3.1
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/ripper-tags +8 -1
- data/lib/ripper-tags.rb +1 -1
- data/lib/ripper-tags/data_reader.rb +21 -6
- data/lib/ripper-tags/default_formatter.rb +7 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 290bd07700cddff930025f82db6f37b0bd964ae1
|
4
|
+
data.tar.gz: 3a7a292de4d1dc789a34d5b74a8f70cf0875d34d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79cf2b4df184edb33d7cae195666ece7cf22adbc9840349bd62dc0e6724a0060141f256a8e2562b1c360364dd0ebbe09228a415bc8f52c57fd437c5306f2f5fb
|
7
|
+
data.tar.gz: f40040c5fd7ad7085b1c250c8244dadaee5463237b7a2e2ab5a33a015e2472782edec9c1eb6c3b44e65d6a732c5f8a2bb82de75fd7a1b94bb0d39f58580ee5af
|
data/bin/ripper-tags
CHANGED
@@ -2,7 +2,12 @@
|
|
2
2
|
require 'ripper-tags'
|
3
3
|
|
4
4
|
trap(:INT) { abort }
|
5
|
-
|
5
|
+
|
6
|
+
begin
|
7
|
+
trap(:PIPE) { abort }
|
8
|
+
rescue ArgumentError
|
9
|
+
# SIGPIPE is unsupported on Windows
|
10
|
+
end
|
6
11
|
|
7
12
|
program_name = File.basename($0)
|
8
13
|
|
@@ -10,4 +15,6 @@ begin
|
|
10
15
|
RipperTags.process_args(ARGV)
|
11
16
|
rescue Errno::ENOENT, OptionParser::InvalidOption => err
|
12
17
|
abort "#{program_name}: #{err.message}"
|
18
|
+
rescue RipperTags::BrokenPipe
|
19
|
+
abort
|
13
20
|
end
|
data/lib/ripper-tags.rb
CHANGED
@@ -6,7 +6,7 @@ module RipperTags
|
|
6
6
|
class FileFinder
|
7
7
|
attr_reader :options
|
8
8
|
|
9
|
-
|
9
|
+
RUBY_EXT = '.rb'.freeze
|
10
10
|
DIR_CURRENT = '.'.freeze
|
11
11
|
DIR_PARENT = '..'.freeze
|
12
12
|
|
@@ -26,26 +26,36 @@ module RipperTags
|
|
26
26
|
|
27
27
|
def exclude_file?(file)
|
28
28
|
base = File.basename(file)
|
29
|
-
exclude_patterns.
|
29
|
+
match = exclude_patterns.find { |ex|
|
30
30
|
case ex
|
31
31
|
when Regexp then base =~ ex
|
32
32
|
else base == ex
|
33
33
|
end
|
34
|
-
} || exclude_patterns.
|
34
|
+
} || exclude_patterns.find { |ex|
|
35
35
|
case ex
|
36
36
|
when Regexp then file =~ ex
|
37
37
|
else file.include?(ex)
|
38
38
|
end
|
39
39
|
}
|
40
|
+
|
41
|
+
if match && options.verbose
|
42
|
+
$stderr.puts "Ignoring %s because of exclude rule: %p" % [file, match]
|
43
|
+
end
|
44
|
+
|
45
|
+
match
|
46
|
+
end
|
47
|
+
|
48
|
+
def ruby_file?(file)
|
49
|
+
file.end_with?(RUBY_EXT)
|
40
50
|
end
|
41
51
|
|
42
52
|
def include_file?(file)
|
43
|
-
(options.all_files || file
|
53
|
+
(options.all_files || ruby_file?(file)) && !exclude_file?(file)
|
44
54
|
end
|
45
55
|
|
46
56
|
def resolve_file(file, depth = 0, &block)
|
47
57
|
if File.directory?(file)
|
48
|
-
if options.recursive
|
58
|
+
if options.recursive && !exclude_file?(file)
|
49
59
|
Dir.entries(file).each do |name|
|
50
60
|
if name != DIR_CURRENT && name != DIR_PARENT
|
51
61
|
subfile = File.join(file, name)
|
@@ -54,9 +64,14 @@ module RipperTags
|
|
54
64
|
end
|
55
65
|
end
|
56
66
|
end
|
57
|
-
|
67
|
+
elsif depth > 0 || File.exist?(file)
|
58
68
|
file = clean_path(file) if depth == 0
|
59
69
|
yield file if include_file?(file)
|
70
|
+
elsif
|
71
|
+
$stderr.puts "%s: %p: no such file or directory" % [
|
72
|
+
File.basename($0),
|
73
|
+
file
|
74
|
+
]
|
60
75
|
end
|
61
76
|
end
|
62
77
|
|
@@ -2,6 +2,8 @@ require 'pathname'
|
|
2
2
|
require 'set'
|
3
3
|
|
4
4
|
module RipperTags
|
5
|
+
BrokenPipe = Class.new(RuntimeError)
|
6
|
+
|
5
7
|
class DefaultFormatter
|
6
8
|
attr_reader :options
|
7
9
|
|
@@ -31,7 +33,11 @@ module RipperTags
|
|
31
33
|
|
32
34
|
def with_output
|
33
35
|
if stdout?
|
34
|
-
|
36
|
+
begin
|
37
|
+
yield $stdout
|
38
|
+
rescue Errno::EINVAL
|
39
|
+
raise BrokenPipe
|
40
|
+
end
|
35
41
|
else
|
36
42
|
File.open(options.tag_file_name, 'w+') do |outfile|
|
37
43
|
yield outfile
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ripper-tags
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aman Gupta
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: fast, accurate ctags generator for ruby source code using Ripper
|
14
14
|
email:
|