starscope 1.5.2 → 1.5.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: 969b72b51c36bc5fb5af62efb738bd2ed0d57c05
4
- data.tar.gz: b05bd74d881bb79826405fbd3634dcf05e3f1b6b
3
+ metadata.gz: 9cc8ef281696106211f68e80221f662c49393bc0
4
+ data.tar.gz: 489ce33b9f7a6db5c7206178e7bfdbbbc4d0f1ad
5
5
  SHA512:
6
- metadata.gz: c9ec1c3d339a5ad78088bfae6ae8c3296358b4fbe1b01c6e1edbda52c9fb16891b33648b55aa90f896dbaa3124a7d92f4792536c4bb9942fb5f321ad7a9ded29
7
- data.tar.gz: 308ad3a1c065f3bdc97ee92602830c12c517c215914f348f6abb3339e8417cb73dbeb7614051566220cd52a1d7d38b201cd91b2f153e52e8c82d2eedcc17072e
6
+ metadata.gz: 1c1ebeefeb796053f86aeed6e774bdea8bc0848b6666ac0a26b37a06f39a0b2bdcaf0d90921685722dfcefbcf72feb8cc3de057f26ecf5fc34d6f1363eb4e146
7
+ data.tar.gz: 896f6fd5750d5a41e4121e18e4f8b843bb8fae491b74408608f819202953df75e0d52919736e82a4d2442e642ffd76c2e5092a8e047cb79c47d5c6763c9ef96c
@@ -1,6 +1,3 @@
1
- Lint/UnusedBlockArgument:
2
- Enabled: false
3
-
4
1
  Lint/UnusedMethodArgument:
5
2
  Enabled: false
6
3
 
@@ -17,7 +14,7 @@ Metrics/CyclomaticComplexity:
17
14
  Enabled: false
18
15
 
19
16
  Metrics/LineLength:
20
- Enabled: false
17
+ Max: 120
21
18
 
22
19
  Metrics/MethodLength:
23
20
  Enabled: false
@@ -40,3 +37,6 @@ Style/Next:
40
37
 
41
38
  Style/SpecialGlobalVars:
42
39
  Enabled: false
40
+
41
+ Style/FrozenStringLiteralComment:
42
+ Enabled: false
@@ -7,3 +7,4 @@ rvm:
7
7
  - 2.0
8
8
  - 2.1
9
9
  - 2.2
10
+ - 2.3.0
@@ -1,7 +1,17 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
- v1.5.2 (trunk)
4
+ Trunk
5
+ --------------------
6
+
7
+ Improvements:
8
+ * Skip minified javascript files.
9
+
10
+ Bug Fixes:
11
+ * Fix javascript parsing of `require` calls that are actually methods and not
12
+ CommonJS-style imports (#158).
13
+
14
+ v1.5.2 (2016-01-12)
5
15
  --------------------
6
16
 
7
17
  Misc:
@@ -8,7 +8,7 @@ require 'optparse'
8
8
  require 'readline'
9
9
  require 'starscope'
10
10
 
11
- DEFAULT_DB = '.starscope.db'
11
+ DEFAULT_DB = '.starscope.db'.freeze
12
12
  CONFIG_FILE = File.join(Dir.home, '.starscope.json')
13
13
  GLOBAL_CONFIG = File.exist?(CONFIG_FILE) ? Oj.load_file(CONFIG_FILE, symbol_keys: true) : {}
14
14
 
@@ -99,7 +99,7 @@ by yielding to the special `FRAGMENT` table, with the name of the language as
99
99
  the name, and a `frag` argument containing the actual raw text. For example:
100
100
 
101
101
  ```ruby
102
- yield FRAGMENT, :Ruby, :frag => my_extracted_ruby_code, :line_no => line_no
102
+ yield Starscope::DB::FRAGMENT, :Ruby, :frag => my_extracted_ruby_code, :line_no => line_no
103
103
  ```
104
104
 
105
105
  Fragments will be accumulated by the database and passed to the appropriate
@@ -8,24 +8,25 @@ require 'starscope/fragment_extractor'
8
8
  require 'starscope/queryable'
9
9
  require 'starscope/output'
10
10
 
11
- # dynamically load all our language extractors
12
- LANGS = {}
13
- EXTRACTORS = []
14
- Dir.glob("#{File.dirname(__FILE__)}/langs/*.rb").each { |path| require path }
15
-
16
- Starscope::Lang.constants.each do |lang|
17
- extractor = Starscope::Lang.const_get(lang)
18
- EXTRACTORS << extractor
19
- LANGS[lang.to_sym] = extractor.const_get(:VERSION)
20
- end
21
-
22
- FRAGMENT = :'!fragment'
23
-
24
11
  class Starscope::DB
25
12
  include Starscope::Exportable
26
13
  include Starscope::Queryable
27
14
 
28
15
  DB_FORMAT = 5
16
+ FRAGMENT = :'!fragment'
17
+
18
+ # dynamically load all our language extractors
19
+ Dir.glob("#{File.dirname(__FILE__)}/langs/*.rb").each { |path| require path }
20
+
21
+ langs = {}
22
+ extractors = []
23
+ Starscope::Lang.constants.each do |lang|
24
+ extractor = Starscope::Lang.const_get(lang)
25
+ extractors << extractor
26
+ langs[lang.to_sym] = extractor.const_get(:VERSION)
27
+ end
28
+ LANGS = langs.freeze
29
+ EXTRACTORS = extractors.freeze
29
30
 
30
31
  class NoTableError < StandardError; end
31
32
  class UnknownDBFormatError < StandardError; end
@@ -33,7 +34,7 @@ class Starscope::DB
33
34
  def initialize(output, config = {})
34
35
  @output = output
35
36
  @meta = { paths: [], files: {}, excludes: [],
36
- langs: LANGS, version: Starscope::VERSION }
37
+ langs: LANGS.dup, version: Starscope::VERSION }
37
38
  @tables = {}
38
39
  @config = config
39
40
  end
@@ -125,7 +126,7 @@ class Starscope::DB
125
126
  end
126
127
 
127
128
  def records(table)
128
- fail NoTableError unless @tables[table]
129
+ raise NoTableError unless @tables[table]
129
130
 
130
131
  @tables[table]
131
132
  end
@@ -133,7 +134,7 @@ class Starscope::DB
133
134
  def metadata(key = nil)
134
135
  return @meta.keys if key.nil?
135
136
 
136
- fail NoTableError unless @meta[key]
137
+ raise NoTableError unless @meta[key]
137
138
 
138
139
  @meta[key]
139
140
  end
@@ -175,7 +176,7 @@ class Starscope::DB
175
176
  add_paths(Marshal.load(stream.read(len)))
176
177
  return false
177
178
  else
178
- fail UnknownDBFormatError
179
+ raise UnknownDBFormatError
179
180
  end
180
181
  rescue Oj::ParseError
181
182
  stream.rewind
@@ -193,29 +194,6 @@ class Starscope::DB
193
194
  @meta[:langs] ||= {}
194
195
  end
195
196
 
196
- # File.fnmatch treats a "**" to match files and directories recursively
197
- def self.normalize_fnmatch(path)
198
- if path == '.'
199
- '**'
200
- elsif File.directory?(path)
201
- File.join(path, '**')
202
- else
203
- path
204
- end
205
- end
206
-
207
- # Dir.glob treats a "**" to only match directories recursively; you need
208
- # "**/*" to match all files recursively
209
- def self.normalize_glob(path)
210
- if path == '.'
211
- File.join('**', '*')
212
- elsif File.directory?(path)
213
- File.join(path, '**', '*')
214
- else
215
- path
216
- end
217
- end
218
-
219
197
  def all_excludes
220
198
  @all_excludes ||= @meta[:excludes] + (@config[:excludes] || []).map { |x| self.class.normalize_fnmatch(x) }
221
199
  end
@@ -238,7 +216,7 @@ class Starscope::DB
238
216
  @meta[:files].delete(file)
239
217
  end
240
218
  files = files.to_set
241
- @tables.each do |name, tbl|
219
+ @tables.each do |_, tbl|
242
220
  tbl.delete_if { |val| files.include?(val[:file]) }
243
221
  end
244
222
  end
@@ -251,7 +229,7 @@ class Starscope::DB
251
229
  def parse_file(file)
252
230
  @meta[:files][file] = { last_updated: File.mtime(file).to_i }
253
231
 
254
- EXTRACTORS.each do |extractor|
232
+ self.class.extractors.each do |extractor|
255
233
  begin
256
234
  next unless extractor.match_file file
257
235
  rescue => e
@@ -323,15 +301,38 @@ class Starscope::DB
323
301
  (@meta[:langs][lang] || 0) < LANGS[lang]
324
302
  end
325
303
 
326
- def self.normalize_record(file, name, args)
327
- args[:file] = file
304
+ class << self
305
+ # File.fnmatch treats a "**" to match files and directories recursively
306
+ def normalize_fnmatch(path)
307
+ if path == '.'
308
+ '**'
309
+ elsif File.directory?(path)
310
+ File.join(path, '**')
311
+ else
312
+ path
313
+ end
314
+ end
328
315
 
329
- if name.is_a? Array
330
- args[:name] = name.map(&:to_sym)
331
- else
332
- args[:name] = [name.to_sym]
316
+ # Dir.glob treats a "**" to only match directories recursively; you need
317
+ # "**/*" to match all files recursively
318
+ def normalize_glob(path)
319
+ if path == '.'
320
+ File.join('**', '*')
321
+ elsif File.directory?(path)
322
+ File.join(path, '**', '*')
323
+ else
324
+ path
325
+ end
333
326
  end
334
327
 
335
- args
328
+ def normalize_record(file, name, args)
329
+ args[:file] = file
330
+ args[:name] = Array(name).map(&:to_sym)
331
+ args
332
+ end
333
+
334
+ def extractors # so we can stub it in tests
335
+ EXTRACTORS
336
+ end
336
337
  end
337
338
  end
@@ -1,6 +1,6 @@
1
1
  module Starscope::Exportable
2
- CTAGS_DEFAULT_PATH = 'tags'
3
- CSCOPE_DEFAULT_PATH = 'cscope.out'
2
+ CTAGS_DEFAULT_PATH = 'tags'.freeze
3
+ CSCOPE_DEFAULT_PATH = 'cscope.out'.freeze
4
4
 
5
5
  class UnknownExportFormatError < StandardError; end
6
6
 
@@ -11,7 +11,7 @@ module Starscope::Exportable
11
11
  when :cscope
12
12
  path ||= CSCOPE_DEFAULT_PATH
13
13
  else
14
- fail UnknownExportFormatError
14
+ raise UnknownExportFormatError
15
15
  end
16
16
 
17
17
  @output.normal("Exporting to '#{path}' in format '#{format}'...")
@@ -28,7 +28,7 @@ module Starscope::Exportable
28
28
  when :cscope
29
29
  export_cscope(io)
30
30
  else
31
- fail UnknownExportFormatError
31
+ raise UnknownExportFormatError
32
32
  end
33
33
  end
34
34
 
@@ -55,7 +55,7 @@ END
55
55
 
56
56
  ext = ctag_ext_tags(rec, file)
57
57
  unless ext.empty?
58
- ret << ";\""
58
+ ret << ';"'
59
59
  ext.sort.each do |k, v|
60
60
  ret << "\t#{k}:#{v}"
61
61
  end
@@ -85,8 +85,8 @@ END
85
85
  # calls must occur in a function, but in ruby et al. it is perfectly legal to
86
86
  # write normal code outside the "scope" of a function definition - we insert a
87
87
  # fake shim "global" function everywhere we can to work around this
88
- CSCOPE_GLOBAL_HACK_START = " \n\t$-\n"
89
- CSCOPE_GLOBAL_HACK_STOP = " \n\t}\n"
88
+ CSCOPE_GLOBAL_HACK_START = " \n\t$-\n".freeze
89
+ CSCOPE_GLOBAL_HACK_STOP = " \n\t}\n".freeze
90
90
 
91
91
  # ftp://ftp.eeng.dcu.ie/pub/ee454/cygwin/usr/share/doc/mlcscope-14.1.8/html/cscope.html
92
92
  def export_cscope(file)
@@ -268,7 +268,7 @@ END
268
268
  when :calls
269
269
  ret = '`'
270
270
  when :requires
271
- ret = "~\""
271
+ ret = '~"'
272
272
  when :imports
273
273
  ret = '~<'
274
274
  when :assigns
@@ -18,18 +18,18 @@ module Starscope::Lang
18
18
  if multiline
19
19
  term = line.index(ERB_END)
20
20
  if term
21
- yield FRAGMENT, :Ruby, frag: line[0...term], line_no: line_no
21
+ yield Starscope::DB::FRAGMENT, :Ruby, frag: line[0...term], line_no: line_no
22
22
  line = line[term + 1..-1]
23
23
  multiline = false
24
24
  else
25
- yield FRAGMENT, :Ruby, frag: line, line_no: line_no
25
+ yield Starscope::DB::FRAGMENT, :Ruby, frag: line, line_no: line_no
26
26
  end
27
27
  end
28
28
 
29
29
  next if multiline
30
30
 
31
31
  line.scan(/#{ERB_START}(.*?)#{ERB_END}/) do |match|
32
- yield FRAGMENT, :Ruby, frag: match[0], line_no: line_no
32
+ yield Starscope::DB::FRAGMENT, :Ruby, frag: match[0], line_no: line_no
33
33
  end
34
34
 
35
35
  line.gsub!(/<%.*?%>/, '')
@@ -37,7 +37,7 @@ module Starscope::Lang
37
37
  match = /#{ERB_START}(.*)$/.match(line)
38
38
  next unless match
39
39
 
40
- yield FRAGMENT, :Ruby, frag: match[1], line_no: line_no
40
+ yield Starscope::DB::FRAGMENT, :Ruby, frag: match[1], line_no: line_no
41
41
  multiline = true
42
42
  end
43
43
  end
@@ -6,8 +6,9 @@ module Starscope::Lang
6
6
  END_OF_BLOCK = /^\s*\}\s*$/
7
7
  END_OF_GROUP = /^\s*\)\s*$/
8
8
  STRING_LITERAL = /".+?"/
9
- BUILTIN_FUNCS = %w(new make len close copy delete int int8 int16 int32 int64 uint uint8 uint16 uint32 uint64 string byte)
10
- CONTROL_KEYS = %w(if for switch case)
9
+ BUILTIN_FUNCS = %w(new make len close copy delete int int8 int16 int32 int64
10
+ uint uint8 uint16 uint32 uint64 string byte).freeze
11
+ CONTROL_KEYS = %w(if for switch case).freeze
11
12
 
12
13
  def self.match_file(name)
13
14
  name.end_with?('.go')
@@ -11,6 +11,8 @@ module Starscope::Lang
11
11
  end
12
12
 
13
13
  def self.extract(path, contents, &block)
14
+ return if path.end_with?('.min.js')
15
+
14
16
  transform = Babel::Transpiler.transform(contents,
15
17
  'stage' => 0,
16
18
  'blacklist' => ['validation.react'],
@@ -58,7 +60,7 @@ module Starscope::Lang
58
60
  name = node_name(node.value)
59
61
  next unless name
60
62
 
61
- node = node.arguments.value[0] if name == 'require'
63
+ node = node.arguments.value[0] if name == 'require' && !node.value.is_a?(RKelly::Nodes::DotAccessorNode)
62
64
 
63
65
  line = find_line(node.range.from, map, lines, name)
64
66
  next unless line
@@ -66,7 +68,7 @@ module Starscope::Lang
66
68
  found[name] ||= Set.new
67
69
  found[name].add(line)
68
70
 
69
- if name == 'require'
71
+ if name == 'require' && node.is_a?(RKelly::Nodes::StringNode)
70
72
  yield :requires, node.value[1...-1], line_no: line
71
73
  else
72
74
  yield :calls, name, line_no: line
@@ -5,7 +5,7 @@ module Starscope::Lang
5
5
  VERSION = 2
6
6
 
7
7
  def self.match_file(name)
8
- return true if name.end_with?('.rb') || name.end_with?('.rake')
8
+ return true if name.end_with?('.rb', '.rake')
9
9
  File.open(name) do |f|
10
10
  head = f.read(2)
11
11
  return false if head.nil? || !head.start_with?('#!')
@@ -1,6 +1,6 @@
1
1
  module Starscope
2
2
  class Matcher
3
- MATCH_TYPES = [:literal_match, :regexp_match]
3
+ MATCH_TYPES = [:literal_match, :regexp_match].freeze
4
4
 
5
5
  def initialize(query)
6
6
  @query = query
@@ -1,7 +1,7 @@
1
1
  require 'ruby-progressbar'
2
2
 
3
3
  class Starscope::Output
4
- PBAR_FORMAT = '%t: %c/%C %E ||%b>%i||'
4
+ PBAR_FORMAT = '%t: %c/%C %E ||%b>%i||'.freeze
5
5
 
6
6
  def initialize(level, out = STDOUT)
7
7
  @out = out
@@ -3,7 +3,7 @@ require 'starscope/matcher'
3
3
  module Starscope::Queryable
4
4
  def query(tables, value, filters = {})
5
5
  tables = [tables] if tables.is_a?(Symbol)
6
- tables.each { |t| fail Starscope::DB::NoTableError, "Table '#{t}' not found" unless @tables[t] }
6
+ tables.each { |t| raise Starscope::DB::NoTableError, "Table '#{t}' not found" unless @tables[t] }
7
7
  input = Enumerator.new do |y|
8
8
  tables.each do |t|
9
9
  @tables[t].each do |elem|
@@ -1,3 +1,3 @@
1
1
  module Starscope
2
- VERSION = '1.5.2'
2
+ VERSION = '1.5.3'.freeze
3
3
  end
@@ -31,5 +31,5 @@ Gem::Specification.new do |gem|
31
31
  gem.add_development_dependency 'pry', '~> 0.10.1'
32
32
  gem.add_development_dependency 'minitest', '~> 5.8'
33
33
  gem.add_development_dependency 'mocha', '~> 1.1'
34
- gem.add_development_dependency 'rubocop', '~> 0.35'
34
+ gem.add_development_dependency 'rubocop', '~> 0.37.0'
35
35
  end
@@ -118,3 +118,6 @@ class Navigation extends Component {
118
118
  }
119
119
 
120
120
  export default Navigation;
121
+
122
+ madness.require("NOPE")
123
+ require(true || false);
@@ -4,10 +4,10 @@ require 'zlib'
4
4
  LANGS = [
5
5
  Starscope::Lang::Go,
6
6
  Starscope::Lang::Ruby
7
- ]
7
+ ].freeze
8
8
 
9
9
  class Starscope::DB
10
- PBAR_FORMAT = '%t: %c/%C %E ||%b>%i||'
10
+ PBAR_FORMAT = '%t: %c/%C %E ||%b>%i||'.freeze
11
11
 
12
12
  class NoTableError < StandardError; end
13
13
 
@@ -35,7 +35,7 @@ class Starscope::DB
35
35
  # Old format, so read the directories segment then rebuild
36
36
  add_paths(Oj.load(stream.gets))
37
37
  elsif format > DB_FORMAT
38
- fail UnknownDBFormatError
38
+ raise UnknownDBFormatError
39
39
  end
40
40
  end
41
41
  end
@@ -68,9 +68,10 @@ class Starscope::DB
68
68
  end
69
69
 
70
70
  def update
71
- new_files = (@paths.map { |p| self.class.files_from_path(p) }.flatten) - @files.keys
71
+ new_files = @paths.map { |p| self.class.files_from_path(p) }.flatten - @files.keys
72
72
  if @progress
73
- pbar = ProgressBar.create(title: 'Updating', total: new_files.length + @files.length, format: PBAR_FORMAT, length: 80)
73
+ pbar = ProgressBar.create(title: 'Updating', total: new_files.length + @files.length,
74
+ format: PBAR_FORMAT, length: 80)
74
75
  end
75
76
  changed = @files.keys.map do |f|
76
77
  changed = update_file(f)
@@ -94,8 +95,6 @@ class Starscope::DB
94
95
  ret
95
96
  end
96
97
 
97
- private
98
-
99
98
  def self.files_from_path(path)
100
99
  if File.file?(path)
101
100
  [path]
@@ -106,6 +105,8 @@ class Starscope::DB
106
105
  end
107
106
  end
108
107
 
108
+ private
109
+
109
110
  def db_by_line
110
111
  tmpdb = {}
111
112
  @tables.each do |tbl, vals|
@@ -140,8 +141,8 @@ class Starscope::DB
140
141
 
141
142
  def remove_file(file)
142
143
  @files.delete(file)
143
- @tables.each do |name, tbl|
144
- tbl.each do |key, val|
144
+ @tables.each do |_, tbl|
145
+ tbl.each do |_, val|
145
146
  val.delete_if { |dat| dat[:file] == file }
146
147
  end
147
148
  end
@@ -1,8 +1,8 @@
1
1
  require_relative '../test_helper'
2
2
 
3
3
  describe 'starscope executable script' do
4
- BASE = 'bundle exec bin/starscope --quiet'
5
- EXTRACT = "#{BASE} --no-read --no-write #{FIXTURES}"
4
+ BASE = 'bundle exec bin/starscope --quiet'.freeze
5
+ EXTRACT = "#{BASE} --no-read --no-write #{FIXTURES}".freeze
6
6
 
7
7
  it 'must not produce help wider than 80 characters' do
8
8
  `#{BASE} -h`.each_line do |line|
@@ -3,10 +3,10 @@ require 'minitest/pride'
3
3
  require 'mocha/mini_test'
4
4
  require_relative '../lib/starscope'
5
5
 
6
- FIXTURES = 'test/fixtures'
6
+ FIXTURES = 'test/fixtures'.freeze
7
7
 
8
- GOLANG_SAMPLE = "#{FIXTURES}/sample_golang.go"
9
- JAVASCRIPT_EXAMPLE = "#{FIXTURES}/sample_javascript.js"
10
- RUBY_SAMPLE = "#{FIXTURES}/sample_ruby.rb"
11
- ERB_SAMPLE = "#{FIXTURES}/sample_erb.erb"
12
- EMPTY_FILE = "#{FIXTURES}/empty"
8
+ GOLANG_SAMPLE = "#{FIXTURES}/sample_golang.go".freeze
9
+ JAVASCRIPT_EXAMPLE = "#{FIXTURES}/sample_javascript.js".freeze
10
+ RUBY_SAMPLE = "#{FIXTURES}/sample_ruby.rb".freeze
11
+ ERB_SAMPLE = "#{FIXTURES}/sample_erb.erb".freeze
12
+ EMPTY_FILE = "#{FIXTURES}/empty".freeze
@@ -45,7 +45,7 @@ describe Starscope::DB do
45
45
 
46
46
  it "must update stale existing files when extractor hasn't changed" do
47
47
  @db.load("#{FIXTURES}/db_out_of_date.json")
48
- @db.metadata(:langs)[:Golang].must_be :>=, LANGS[:Golang]
48
+ @db.metadata(:langs)[:Golang].must_be :>=, Starscope::DB::LANGS[:Golang]
49
49
 
50
50
  cur_mtime = @db.metadata(:files)[GOLANG_SAMPLE][:last_updated]
51
51
  File.expects(:mtime).twice.returns(cur_mtime + 1)
@@ -163,7 +163,7 @@ describe Starscope::DB do
163
163
  extractor.expects(:match_file).with(GOLANG_SAMPLE).returns(true)
164
164
  extractor.expects(:extract).with(GOLANG_SAMPLE, File.read(GOLANG_SAMPLE)).returns(a: 1)
165
165
  extractor.expects(:name).returns('Foo')
166
- EXTRACTORS.stubs(:each).yields(extractor)
166
+ Starscope::DB.stubs(:extractors).returns([extractor])
167
167
 
168
168
  @db.add_paths([GOLANG_SAMPLE])
169
169
 
@@ -11,7 +11,13 @@ describe Starscope::Exportable do
11
11
  @db.export_to(:ctags, @buf)
12
12
  @buf.rewind
13
13
  lines = @buf.each_line.to_a
14
- lines.must_include "NoTableError\t#{FIXTURES}/sample_ruby.rb\t/^ class NoTableError < StandardError; end$/;\"\tkind:c\tlanguage:Ruby\n"
14
+ lines.must_include(
15
+ "NoTableError\t" \
16
+ "#{FIXTURES}/sample_ruby.rb\t" \
17
+ "/^ class NoTableError < StandardError; end$/;\"\t" \
18
+ "kind:c\t" \
19
+ "language:Ruby\n"
20
+ )
15
21
  end
16
22
 
17
23
  it 'must export to cscope' do
@@ -4,11 +4,13 @@ describe Starscope::FragmentExtractor do
4
4
  module ::Starscope::Lang::Dummy; end
5
5
 
6
6
  before do
7
- @extractor = Starscope::FragmentExtractor.new(:Dummy, [
8
- { frag: "def foo; end\n", line_no: 12 },
9
- { frag: "def bar\n", line_no: 15 },
10
- { frag: "end\n", line_no: 29 }
11
- ])
7
+ @extractor = Starscope::FragmentExtractor.new(
8
+ :Dummy,
9
+ [
10
+ { frag: "def foo; end\n", line_no: 12 },
11
+ { frag: "def bar\n", line_no: 15 },
12
+ { frag: "end\n", line_no: 29 }
13
+ ])
12
14
  @reconstructed = "def foo; end\ndef bar\nend"
13
15
  end
14
16
 
@@ -4,7 +4,7 @@ describe Starscope::Lang::ERB do
4
4
  before do
5
5
  @frags = []
6
6
  Starscope::Lang::ERB.extract(ERB_SAMPLE, File.read(ERB_SAMPLE)) do |tbl, name, args|
7
- tbl.must_equal FRAGMENT
7
+ tbl.must_equal Starscope::DB::FRAGMENT
8
8
  name.must_equal :Ruby
9
9
  @frags << args
10
10
  end
@@ -80,5 +80,8 @@ describe Starscope::Lang::Javascript do
80
80
 
81
81
  requires.keys.must_include :'foo-bar'
82
82
  requires.keys.must_include :'react-native'
83
+ requires.keys.wont_include :NOPE
84
+ requires.keys.wont_include :true
85
+ requires.keys.wont_include :false
83
86
  end
84
87
  end
@@ -5,7 +5,7 @@ describe Starscope::Queryable do
5
5
  { name: [:"[abc"], foo: 'baz' },
6
6
  { name: [:"not a match"], foo: 'bar', x: 'y' },
7
7
  { name: [:a, :b, :c, :d], file: :somefile }
8
- ]
8
+ ].freeze
9
9
 
10
10
  class MockQuerable
11
11
  include Starscope::Queryable
metadata CHANGED
@@ -1,183 +1,183 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: starscope
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.2
4
+ version: 1.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan Huus
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-12 00:00:00.000000000 Z
11
+ date: 2016-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oj
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '2.9'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.9'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: parser
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: 2.2.2
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
40
  version: 2.2.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: ruby-progressbar
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.5'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ~>
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.5'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rkelly-remix
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ~>
60
60
  - !ruby/object:Gem::Version
61
61
  version: 0.0.7
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ~>
67
67
  - !ruby/object:Gem::Version
68
68
  version: 0.0.7
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: babel-transpiler
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ~>
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0.7'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ~>
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0.7'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: sourcemap
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ~>
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0.1'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ~>
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0.1'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: bundler
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - ~>
102
102
  - !ruby/object:Gem::Version
103
103
  version: '1.7'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - ~>
109
109
  - !ruby/object:Gem::Version
110
110
  version: '1.7'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rake
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - "~>"
115
+ - - ~>
116
116
  - !ruby/object:Gem::Version
117
117
  version: '10.4'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - "~>"
122
+ - - ~>
123
123
  - !ruby/object:Gem::Version
124
124
  version: '10.4'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: pry
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - "~>"
129
+ - - ~>
130
130
  - !ruby/object:Gem::Version
131
131
  version: 0.10.1
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - "~>"
136
+ - - ~>
137
137
  - !ruby/object:Gem::Version
138
138
  version: 0.10.1
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: minitest
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - "~>"
143
+ - - ~>
144
144
  - !ruby/object:Gem::Version
145
145
  version: '5.8'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - "~>"
150
+ - - ~>
151
151
  - !ruby/object:Gem::Version
152
152
  version: '5.8'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: mocha
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - "~>"
157
+ - - ~>
158
158
  - !ruby/object:Gem::Version
159
159
  version: '1.1'
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - "~>"
164
+ - - ~>
165
165
  - !ruby/object:Gem::Version
166
166
  version: '1.1'
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: rubocop
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
- - - "~>"
171
+ - - ~>
172
172
  - !ruby/object:Gem::Version
173
- version: '0.35'
173
+ version: 0.37.0
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
- - - "~>"
178
+ - - ~>
179
179
  - !ruby/object:Gem::Version
180
- version: '0.35'
180
+ version: 0.37.0
181
181
  description: |2
182
182
  Starscope is a code indexer, search and navigation tool for Ruby, Golang, and JavaScript.
183
183
  Inspired by the extremely popular Ctags and Cscope utilities, Starscope can
@@ -188,9 +188,9 @@ executables:
188
188
  extensions: []
189
189
  extra_rdoc_files: []
190
190
  files:
191
- - ".gitignore"
192
- - ".rubocop.yml"
193
- - ".travis.yml"
191
+ - .gitignore
192
+ - .rubocop.yml
193
+ - .travis.yml
194
194
  - CHANGELOG.md
195
195
  - Gemfile
196
196
  - LICENSE.txt
@@ -247,17 +247,17 @@ require_paths:
247
247
  - lib
248
248
  required_ruby_version: !ruby/object:Gem::Requirement
249
249
  requirements:
250
- - - ">="
250
+ - - '>='
251
251
  - !ruby/object:Gem::Version
252
252
  version: 1.9.3
253
253
  required_rubygems_version: !ruby/object:Gem::Requirement
254
254
  requirements:
255
- - - ">="
255
+ - - '>='
256
256
  - !ruby/object:Gem::Version
257
257
  version: '0'
258
258
  requirements: []
259
259
  rubyforge_project:
260
- rubygems_version: 2.4.5.1
260
+ rubygems_version: 2.0.14
261
261
  signing_key:
262
262
  specification_version: 4
263
263
  summary: Smart code search and indexing