ripper-tags 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ripper-tags.rb +6 -3
- data/lib/ripper-tags/data_reader.rb +10 -7
- data/lib/ripper-tags/vim_formatter.rb +7 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c01afeab62bc05b48461054c69302ea2c6df300
|
4
|
+
data.tar.gz: 15381e892cf46a2c712059e9ec1a5cc1275fb17a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 855d584aca0e552f9bd6cefd849255dad0a7119beeccd38465bfc62310f0c0ddad586721e3e4adf1ad27911764d50d6dc96103210e00837163aa5203693173f1
|
7
|
+
data.tar.gz: 47f730f13d9ff65c9ceeda5361b153f6117459546d2a5ddd4954cc06ba8d4fcb046f4ac4d3743abb0e83268ca19a14e828f96129e9dd86202dc51990ba1de2d6
|
data/lib/ripper-tags.rb
CHANGED
@@ -9,7 +9,7 @@ require 'ripper-tags/vim_formatter'
|
|
9
9
|
require 'ripper-tags/json_formatter'
|
10
10
|
|
11
11
|
module RipperTags
|
12
|
-
def self.version() "0.
|
12
|
+
def self.version() "0.6.0" end
|
13
13
|
|
14
14
|
FatalError = Class.new(RuntimeError)
|
15
15
|
|
@@ -109,7 +109,7 @@ module RipperTags
|
|
109
109
|
opts.on("-n", "Equivalent to --excmd=number.") do
|
110
110
|
options.excmd = "number"
|
111
111
|
end
|
112
|
-
opts.on("--fields=+
|
112
|
+
opts.on("--fields=+ln", "Add extra fields to output") do |flags|
|
113
113
|
flags_string_to_set.call(flags, options.fields)
|
114
114
|
end
|
115
115
|
opts.on("--all-files", "Parse all files in recursive mode (default: parse `*.rb' files)") do
|
@@ -139,7 +139,7 @@ module RipperTags
|
|
139
139
|
opts.on_tail("-V", "--verbose", "Print additional information on stderr") do
|
140
140
|
options.verbose = true
|
141
141
|
end
|
142
|
-
opts.on_tail("--force", "
|
142
|
+
opts.on_tail("--force", "Always exit with error code 0, even when parse errors occur") do
|
143
143
|
options.force = true
|
144
144
|
end
|
145
145
|
opts.on_tail("--list-kinds=LANG", "Print tag kinds that this parser supports and exit") do |lang|
|
@@ -210,6 +210,9 @@ module RipperTags
|
|
210
210
|
formatter.write(tag, out)
|
211
211
|
end
|
212
212
|
end
|
213
|
+
if reader.error_count > 0 && !options.force && reader.error_count == reader.file_count
|
214
|
+
exit 1
|
215
|
+
end
|
213
216
|
rescue FatalError => err
|
214
217
|
$stderr.puts "%s: %s" % [
|
215
218
|
File.basename($0),
|
@@ -101,12 +101,14 @@ module RipperTags
|
|
101
101
|
end
|
102
102
|
|
103
103
|
class DataReader
|
104
|
-
attr_reader :options
|
104
|
+
attr_reader :options, :file_count, :error_count
|
105
105
|
|
106
106
|
READ_MODE = 'r:utf-8'
|
107
107
|
|
108
108
|
def initialize(options)
|
109
109
|
@options = options
|
110
|
+
@file_count = 0
|
111
|
+
@error_count = 0
|
110
112
|
end
|
111
113
|
|
112
114
|
def file_finder
|
@@ -130,20 +132,21 @@ module RipperTags
|
|
130
132
|
|
131
133
|
def each_tag
|
132
134
|
return to_enum(__method__) unless block_given?
|
135
|
+
|
133
136
|
file_finder.each_file do |file|
|
134
137
|
begin
|
135
|
-
$stderr.puts "Parsing file
|
138
|
+
$stderr.puts "Parsing file `#{file}'" if options.verbose
|
136
139
|
extractor = tag_extractor(file)
|
137
140
|
rescue => err
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
raise err
|
142
|
-
end
|
141
|
+
# print the error and continue
|
142
|
+
$stderr.puts "#{err.class.name} parsing `#{file}': #{err.message}"
|
143
|
+
@error_count += 1
|
143
144
|
else
|
144
145
|
extractor.tags.each do |tag|
|
145
146
|
yield tag
|
146
147
|
end
|
148
|
+
ensure
|
149
|
+
@file_count += 1
|
147
150
|
end
|
148
151
|
end
|
149
152
|
end
|
@@ -3,7 +3,7 @@ require 'ripper-tags/default_formatter'
|
|
3
3
|
module RipperTags
|
4
4
|
class VimFormatter < DefaultFormatter
|
5
5
|
def supported_flags() ['q'] end
|
6
|
-
def supported_fields() ['n'] end
|
6
|
+
def supported_fields() ['l', 'n'] end
|
7
7
|
|
8
8
|
def include_qualified_names?
|
9
9
|
return @include_qualified_names if defined? @include_qualified_names
|
@@ -72,6 +72,10 @@ module RipperTags
|
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
|
+
def display_language
|
76
|
+
"\tlanguage:Ruby" if field?('l')
|
77
|
+
end
|
78
|
+
|
75
79
|
def display_kind(tag)
|
76
80
|
case tag.fetch(:kind)
|
77
81
|
when 'method' then 'f'
|
@@ -84,13 +88,14 @@ module RipperTags
|
|
84
88
|
end
|
85
89
|
|
86
90
|
def format(tag, name_field = :name)
|
87
|
-
"%s\t%s\t%s\t%s%s%s%s" % [
|
91
|
+
"%s\t%s\t%s\t%s%s%s%s%s" % [
|
88
92
|
tag.fetch(name_field),
|
89
93
|
relative_path(tag),
|
90
94
|
display_excmd_info(tag),
|
91
95
|
display_kind(tag),
|
92
96
|
display_line_number(tag),
|
93
97
|
name_field == :full_name ? nil : display_class(tag),
|
98
|
+
display_language,
|
94
99
|
display_inheritance(tag),
|
95
100
|
]
|
96
101
|
end
|
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.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aman Gupta
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: fast, accurate ctags generator for ruby source code using Ripper
|
14
14
|
email:
|
@@ -48,7 +48,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
48
48
|
version: '0'
|
49
49
|
requirements: []
|
50
50
|
rubyforge_project:
|
51
|
-
rubygems_version: 2.
|
51
|
+
rubygems_version: 2.5.2
|
52
52
|
signing_key:
|
53
53
|
specification_version: 4
|
54
54
|
summary: ctags generator for ruby code
|