starscope 1.1.0 → 1.1.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.
data/CHANGELOG.md CHANGED
@@ -1,7 +1,17 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
- v1.1.0 (trunk)
4
+ v1.1.1 (trunk)
5
+ --------------------
6
+
7
+ New Features:
8
+ * Export of ctags `language` tag (needed for `YouCompleteMe` support).
9
+
10
+ Bug Fixes:
11
+ * In ruby, correctly report calls to functions such as `foo=` as assignments to
12
+ `foo`.
13
+
14
+ v1.1.0 (2014-07-16)
5
15
  --------------------
6
16
 
7
17
  Bug Fixes:
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- starscope (1.1.0)
4
+ starscope (1.1.1)
5
5
  oj (~> 2.9)
6
6
  parser (~> 2.1)
7
7
  ruby-progressbar (~> 1.5)
data/README.md CHANGED
@@ -4,14 +4,14 @@ StarScope
4
4
  [![Gem Version](https://badge.fury.io/rb/starscope.png)](http://badge.fury.io/rb/starscope)
5
5
  [![Build Status](https://travis-ci.org/eapache/starscope.png?branch=master)](https://travis-ci.org/eapache/starscope)
6
6
 
7
- Anyone who has done much programming in C (or C++) on a unix-based OS has come
7
+ Anyone who has done much programming in C (or C++) on a Unix-based OS has come
8
8
  across the fantastic [Cscope](http://cscope.sourceforge.net/) tool. Sadly, it
9
9
  only works for C (and sort of works for C++).
10
10
 
11
11
  StarScope is a similar tool for [Ruby](https://www.ruby-lang.org/) and
12
12
  [Golang](http://golang.org/), with a design intended to make it easy to add
13
- support for other languages within the same framework (thus the name StarScope,
14
- i.e. \*scope).
13
+ [support for other languages](doc/LANGUAGE_SUPPORT.md) within the same framework
14
+ (thus the name StarScope, i.e. \*scope).
15
15
 
16
16
  Install it as a gem:
17
17
  ```
data/doc/USER_GUIDE.md CHANGED
@@ -1,6 +1,17 @@
1
1
  StarScope User Guide
2
2
  ====================
3
3
 
4
+ About
5
+ -----
6
+
7
+ Anyone who has done much programming in C (or C++) on a Unix-based OS has come
8
+ across the fantastic [Cscope](http://cscope.sourceforge.net/) tool. Sadly, it
9
+ only works for C (and sort of works for C++).
10
+
11
+ StarScope is a similar tool for [Ruby](https://www.ruby-lang.org/) and
12
+ [Golang](http://golang.org/), with a design intended to make it easy to add
13
+ [support for other languages](doc/LANGUAGE_SUPPORT.md) within the same framework
14
+ (thus the name StarScope, i.e. \*scope).
4
15
 
5
16
  Installation
6
17
  ------------
data/lib/starscope/db.rb CHANGED
@@ -193,7 +193,7 @@ class StarScope::DB
193
193
  END
194
194
  defs = (@tables[:defs] || {}).sort_by {|x| x[:name][-1].to_s}
195
195
  defs.each do |record|
196
- file.puts StarScope::Record.ctag_line(record)
196
+ file.puts StarScope::Record.ctag_line(record, @meta[:files][record[:file]])
197
197
  end
198
198
  end
199
199
 
@@ -55,8 +55,13 @@ module StarScope::Lang
55
55
 
56
56
  case node.type
57
57
  when :send
58
- yield :calls, scoped_name(node), :line_no => loc.line, :col => loc.column
59
- if node.children[0].nil? and node.children[1] == :require and node.children[2].type == :str
58
+ name = scoped_name(node)
59
+ yield :calls, name, :line_no => loc.line, :col => loc.column
60
+
61
+ if name.last.to_s =~ /\w+=$/
62
+ name[-1] = name.last.to_s.chop.to_sym
63
+ yield :assigns, name, :line_no => loc.line, :col => loc.column
64
+ elsif node.children[0].nil? and node.children[1] == :require and node.children[2].type == :str
60
65
  yield :requires, node.children[2].children[0].split("/"),
61
66
  :line_no => loc.line, :col => loc.column
62
67
  end
@@ -28,13 +28,13 @@ class StarScope::Record
28
28
  "#{rec[:name].join " "} -- #{rec[:file]}:#{rec[:line_no]} (#{rec[:line].strip})"
29
29
  end
30
30
 
31
- def self.ctag_line(rec)
31
+ def self.ctag_line(rec, file)
32
32
  ret = "#{rec[:name][-1]}\t#{rec[:file]}\t/^#{rec[:line]}$/"
33
33
 
34
- ext = self.ctag_ext_tags(rec)
34
+ ext = self.ctag_ext_tags(rec, file)
35
35
  if not ext.empty?
36
36
  ret << ";\""
37
- ext.each do |k, v|
37
+ ext.sort.each do |k, v|
38
38
  ret << "\t#{k}:#{v}"
39
39
  end
40
40
  end
@@ -42,7 +42,7 @@ class StarScope::Record
42
42
  ret
43
43
  end
44
44
 
45
- def self.ctag_ext_tags(rec)
45
+ def self.ctag_ext_tags(rec, file)
46
46
  tag = {}
47
47
 
48
48
  # these extensions are documented at http://ctags.sourceforge.net/FORMAT
@@ -53,6 +53,8 @@ class StarScope::Record
53
53
  tag["kind"] = "c"
54
54
  end
55
55
 
56
+ tag["language"] = file[:lang]
57
+
56
58
  tag
57
59
  end
58
60
 
@@ -1,3 +1,3 @@
1
1
  module StarScope
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
@@ -17,6 +17,7 @@ class StarScope::DB
17
17
  @paths = []
18
18
  @files = {}
19
19
  @tables = {}
20
+ self.foo = :bar
20
21
  end
21
22
 
22
23
  def load(file)
data/test/unit/test_db.rb CHANGED
@@ -96,7 +96,7 @@ describe StarScope::DB do
96
96
  @db.export_ctags(file)
97
97
  file.rewind
98
98
  lines = file.lines.to_a
99
- lines.must_include "NoTableError\t#{FIXTURES}/sample_ruby.rb\t/^ class NoTableError < StandardError; end$/;\"\tkind:c\n"
99
+ lines.must_include "NoTableError\t#{FIXTURES}/sample_ruby.rb\t/^ class NoTableError < StandardError; end$/;\"\tkind:c\tlanguage:Ruby\n"
100
100
  ensure
101
101
  file.close
102
102
  file.unlink
@@ -25,7 +25,7 @@ describe StarScope::Record do
25
25
  rec = StarScope::Record.build(RUBY_SAMPLE, :a, {:line_no => 1})
26
26
  rec[:line].must_equal "require 'date'"
27
27
 
28
- rec = StarScope::Record.build(RUBY_SAMPLE, :a, {:line_no => 163})
28
+ rec = StarScope::Record.build(RUBY_SAMPLE, :a, {:line_no => 164})
29
29
  rec[:line].must_equal "end"
30
30
 
31
31
  rec = StarScope::Record.build(GOLANG_SAMPLE, :a, {:line_no => 67})
@@ -49,7 +49,12 @@ class TestRuby < Minitest::Test
49
49
  assigns = @db[:assigns].group_by {|x| x[:name][-1]}
50
50
  assert assigns.keys.include? :pbar
51
51
  assert assigns.keys.include? :PBAR_FORMAT
52
+ assert assigns.keys.include? :foo
52
53
  assert assigns[:pbar].count == 2
53
54
  assert assigns[:PBAR_FORMAT].count == 1
55
+ assert assigns[:foo].count == 1
56
+
57
+ refute assigns.keys.include? "=".to_sym
58
+ refute assigns.keys.include? "<".to_sym
54
59
  end
55
60
  end
metadata CHANGED
@@ -1,18 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: starscope
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Evan Huus
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2014-07-16 00:00:00.000000000 Z
12
+ date: 2014-07-21 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: oj
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
19
  - - ~>
18
20
  - !ruby/object:Gem::Version
@@ -20,6 +22,7 @@ dependencies:
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
27
  - - ~>
25
28
  - !ruby/object:Gem::Version
@@ -27,6 +30,7 @@ dependencies:
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: parser
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
35
  - - ~>
32
36
  - !ruby/object:Gem::Version
@@ -34,6 +38,7 @@ dependencies:
34
38
  type: :runtime
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
43
  - - ~>
39
44
  - !ruby/object:Gem::Version
@@ -41,6 +46,7 @@ dependencies:
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: ruby-progressbar
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
51
  - - ~>
46
52
  - !ruby/object:Gem::Version
@@ -48,6 +54,7 @@ dependencies:
48
54
  type: :runtime
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
59
  - - ~>
53
60
  - !ruby/object:Gem::Version
@@ -55,6 +62,7 @@ dependencies:
55
62
  - !ruby/object:Gem::Dependency
56
63
  name: bundler
57
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
58
66
  requirements:
59
67
  - - ~>
60
68
  - !ruby/object:Gem::Version
@@ -62,6 +70,7 @@ dependencies:
62
70
  type: :development
63
71
  prerelease: false
64
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
65
74
  requirements:
66
75
  - - ~>
67
76
  - !ruby/object:Gem::Version
@@ -69,43 +78,49 @@ dependencies:
69
78
  - !ruby/object:Gem::Dependency
70
79
  name: rake
71
80
  requirement: !ruby/object:Gem::Requirement
81
+ none: false
72
82
  requirements:
73
- - - '>='
83
+ - - ! '>='
74
84
  - !ruby/object:Gem::Version
75
85
  version: '0'
76
86
  type: :development
77
87
  prerelease: false
78
88
  version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
79
90
  requirements:
80
- - - '>='
91
+ - - ! '>='
81
92
  - !ruby/object:Gem::Version
82
93
  version: '0'
83
94
  - !ruby/object:Gem::Dependency
84
95
  name: pry
85
96
  requirement: !ruby/object:Gem::Requirement
97
+ none: false
86
98
  requirements:
87
- - - '>='
99
+ - - ! '>='
88
100
  - !ruby/object:Gem::Version
89
101
  version: '0'
90
102
  type: :development
91
103
  prerelease: false
92
104
  version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
93
106
  requirements:
94
- - - '>='
107
+ - - ! '>='
95
108
  - !ruby/object:Gem::Version
96
109
  version: '0'
97
110
  - !ruby/object:Gem::Dependency
98
111
  name: minitest
99
112
  requirement: !ruby/object:Gem::Requirement
113
+ none: false
100
114
  requirements:
101
- - - '>='
115
+ - - ! '>='
102
116
  - !ruby/object:Gem::Version
103
117
  version: '0'
104
118
  type: :development
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
107
122
  requirements:
108
- - - '>='
123
+ - - ! '>='
109
124
  - !ruby/object:Gem::Version
110
125
  version: '0'
111
126
  description: A tool like the venerable cscope, but for ruby, golang and other languages
@@ -151,26 +166,30 @@ files:
151
166
  homepage: https://github.com/eapache/starscope
152
167
  licenses:
153
168
  - MIT
154
- metadata: {}
155
169
  post_install_message:
156
170
  rdoc_options: []
157
171
  require_paths:
158
172
  - lib
159
173
  required_ruby_version: !ruby/object:Gem::Requirement
174
+ none: false
160
175
  requirements:
161
- - - '>='
176
+ - - ! '>='
162
177
  - !ruby/object:Gem::Version
163
178
  version: 1.8.7
164
179
  required_rubygems_version: !ruby/object:Gem::Requirement
180
+ none: false
165
181
  requirements:
166
- - - '>='
182
+ - - ! '>='
167
183
  - !ruby/object:Gem::Version
168
184
  version: '0'
185
+ segments:
186
+ - 0
187
+ hash: 4529526884689841888
169
188
  requirements: []
170
189
  rubyforge_project:
171
- rubygems_version: 2.0.14
190
+ rubygems_version: 1.8.23
172
191
  signing_key:
173
- specification_version: 4
192
+ specification_version: 3
174
193
  summary: A code indexer and analyzer
175
194
  test_files:
176
195
  - test/fixtures/db_old.json.gz
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 9f58bc7549fa2f4d8d7da61d2771a1e6f75939e2
4
- data.tar.gz: 1452b9af5221dc6bc2147d0149870e564e2344fc
5
- SHA512:
6
- metadata.gz: d9c15bef6cef5e856d023944439efac3a0caa9c2b55f1b018e50d8f7c4fa6f2ced00b8bb595639958547426db52ae23abb9487611ff883638950dbac9876da48
7
- data.tar.gz: 821ec54d44933500bffc87b871410fbd08cdbc3b9c2e9c0f28a9c4dadb289d07fd12215993763e0982b26013d82e1fd589a1cb3eba876bd852e958c495c17df5