decode 0.12.0 → 0.15.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/bake/decode/index.rb +1 -1
- data/lib/decode/comment/attribute.rb +53 -0
- data/lib/decode/comment/node.rb +90 -0
- data/lib/decode/comment/parameter.rb +58 -0
- data/lib/decode/comment/pragma.rb +50 -0
- data/lib/decode/comment/raises.rb +32 -0
- data/lib/decode/comment/returns.rb +32 -0
- data/lib/decode/comment/tag.rb +50 -0
- data/lib/decode/comment/tags.rb +80 -0
- data/lib/decode/comment/text.rb +37 -0
- data/lib/decode/comment/throws.rb +32 -0
- data/lib/decode/comment/yields.rb +52 -0
- data/lib/decode/definition.rb +26 -19
- data/lib/decode/documentation.rb +21 -66
- data/lib/decode/index.rb +16 -8
- data/lib/decode/language.rb +1 -19
- data/lib/decode/language/generic.rb +51 -0
- data/lib/decode/language/reference.rb +108 -0
- data/lib/decode/language/ruby.rb +50 -8
- data/lib/decode/language/ruby/block.rb +1 -1
- data/lib/decode/language/ruby/class.rb +2 -2
- data/lib/decode/language/ruby/code.rb +85 -0
- data/lib/decode/language/ruby/definition.rb +1 -1
- data/lib/decode/language/ruby/method.rb +7 -1
- data/lib/decode/language/ruby/parser.rb +11 -3
- data/lib/decode/language/ruby/reference.rb +29 -30
- data/lib/decode/language/ruby/segment.rb +1 -1
- data/lib/decode/languages.rb +92 -0
- data/lib/decode/scope.rb +3 -0
- data/lib/decode/segment.rb +4 -4
- data/lib/decode/source.rb +26 -16
- data/lib/decode/syntax/link.rb +44 -0
- data/lib/decode/syntax/match.rb +53 -0
- data/lib/decode/syntax/rewriter.rb +70 -0
- data/lib/decode/trie.rb +13 -13
- data/lib/decode/version.rb +1 -1
- metadata +27 -16
- data/.github/workflows/development.yml +0 -50
- data/.gitignore +0 -13
- data/.rspec +0 -2
- data/README.md +0 -47
- data/decode.gemspec +0 -33
- data/gems.rb +0 -3
- data/guides/extract-symbols/extract.rb +0 -26
data/lib/decode/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decode
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.15.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|
@@ -108,31 +108,38 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
-
description:
|
111
|
+
description:
|
112
112
|
email:
|
113
113
|
- samuel.williams@oriontransfer.co.nz
|
114
114
|
executables: []
|
115
115
|
extensions: []
|
116
116
|
extra_rdoc_files: []
|
117
117
|
files:
|
118
|
-
- ".github/workflows/development.yml"
|
119
|
-
- ".gitignore"
|
120
|
-
- ".rspec"
|
121
|
-
- README.md
|
122
118
|
- bake/decode/index.rb
|
123
|
-
- decode.gemspec
|
124
|
-
- gems.rb
|
125
|
-
- guides/extract-symbols/extract.rb
|
126
119
|
- lib/decode.rb
|
120
|
+
- lib/decode/comment/attribute.rb
|
121
|
+
- lib/decode/comment/node.rb
|
122
|
+
- lib/decode/comment/parameter.rb
|
123
|
+
- lib/decode/comment/pragma.rb
|
124
|
+
- lib/decode/comment/raises.rb
|
125
|
+
- lib/decode/comment/returns.rb
|
126
|
+
- lib/decode/comment/tag.rb
|
127
|
+
- lib/decode/comment/tags.rb
|
128
|
+
- lib/decode/comment/text.rb
|
129
|
+
- lib/decode/comment/throws.rb
|
130
|
+
- lib/decode/comment/yields.rb
|
127
131
|
- lib/decode/definition.rb
|
128
132
|
- lib/decode/documentation.rb
|
129
133
|
- lib/decode/index.rb
|
130
134
|
- lib/decode/language.rb
|
135
|
+
- lib/decode/language/generic.rb
|
136
|
+
- lib/decode/language/reference.rb
|
131
137
|
- lib/decode/language/ruby.rb
|
132
138
|
- lib/decode/language/ruby/attribute.rb
|
133
139
|
- lib/decode/language/ruby/block.rb
|
134
140
|
- lib/decode/language/ruby/call.rb
|
135
141
|
- lib/decode/language/ruby/class.rb
|
142
|
+
- lib/decode/language/ruby/code.rb
|
136
143
|
- lib/decode/language/ruby/constant.rb
|
137
144
|
- lib/decode/language/ruby/definition.rb
|
138
145
|
- lib/decode/language/ruby/function.rb
|
@@ -141,32 +148,36 @@ files:
|
|
141
148
|
- lib/decode/language/ruby/parser.rb
|
142
149
|
- lib/decode/language/ruby/reference.rb
|
143
150
|
- lib/decode/language/ruby/segment.rb
|
151
|
+
- lib/decode/languages.rb
|
144
152
|
- lib/decode/scope.rb
|
145
153
|
- lib/decode/segment.rb
|
146
154
|
- lib/decode/source.rb
|
155
|
+
- lib/decode/syntax/link.rb
|
156
|
+
- lib/decode/syntax/match.rb
|
157
|
+
- lib/decode/syntax/rewriter.rb
|
147
158
|
- lib/decode/trie.rb
|
148
159
|
- lib/decode/version.rb
|
149
160
|
homepage: https://github.com/ioquatix/decode
|
150
161
|
licenses:
|
151
162
|
- MIT
|
152
163
|
metadata: {}
|
153
|
-
post_install_message:
|
164
|
+
post_install_message:
|
154
165
|
rdoc_options: []
|
155
166
|
require_paths:
|
156
167
|
- lib
|
157
168
|
required_ruby_version: !ruby/object:Gem::Requirement
|
158
169
|
requirements:
|
159
|
-
- - "
|
170
|
+
- - "~>"
|
160
171
|
- !ruby/object:Gem::Version
|
161
|
-
version: 2.
|
172
|
+
version: '2.5'
|
162
173
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
163
174
|
requirements:
|
164
175
|
- - ">="
|
165
176
|
- !ruby/object:Gem::Version
|
166
177
|
version: '0'
|
167
178
|
requirements: []
|
168
|
-
rubygems_version: 3.
|
169
|
-
signing_key:
|
179
|
+
rubygems_version: 3.0.3
|
180
|
+
signing_key:
|
170
181
|
specification_version: 4
|
171
182
|
summary: Code analysis for documentation generation.
|
172
183
|
test_files: []
|
@@ -1,50 +0,0 @@
|
|
1
|
-
name: Development
|
2
|
-
|
3
|
-
on: [push, pull_request]
|
4
|
-
|
5
|
-
jobs:
|
6
|
-
test:
|
7
|
-
runs-on: ${{matrix.os}}-latest
|
8
|
-
continue-on-error: ${{matrix.experimental}}
|
9
|
-
|
10
|
-
strategy:
|
11
|
-
matrix:
|
12
|
-
os:
|
13
|
-
- ubuntu
|
14
|
-
|
15
|
-
ruby:
|
16
|
-
- 2.5
|
17
|
-
- 2.6
|
18
|
-
- 2.7
|
19
|
-
|
20
|
-
experimental: [false]
|
21
|
-
env: [""]
|
22
|
-
|
23
|
-
include:
|
24
|
-
- os: ubuntu
|
25
|
-
ruby: truffleruby
|
26
|
-
experimental: true
|
27
|
-
- os: ubuntu
|
28
|
-
ruby: jruby
|
29
|
-
experimental: true
|
30
|
-
- os: ubuntu
|
31
|
-
ruby: head
|
32
|
-
experimental: true
|
33
|
-
- os: ubuntu
|
34
|
-
ruby: 2.6
|
35
|
-
experimental: false
|
36
|
-
env: COVERAGE=PartialSummary,Coveralls
|
37
|
-
|
38
|
-
steps:
|
39
|
-
- uses: actions/checkout@v1
|
40
|
-
- uses: ruby/setup-ruby@v1
|
41
|
-
with:
|
42
|
-
ruby-version: ${{matrix.ruby}}
|
43
|
-
|
44
|
-
- name: Install dependencies
|
45
|
-
run: ${{matrix.env}} bundle install
|
46
|
-
|
47
|
-
- name: Run tests
|
48
|
-
timeout-minutes: 5
|
49
|
-
run: |
|
50
|
-
${{matrix.env}} bundle exec rspec
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/README.md
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
# Decode
|
2
|
-
|
3
|
-
A Ruby code analysis tool and documentation generator.
|
4
|
-
|
5
|
-
[](https://github.com/ioquatix/decode/actions?workflow=Development)
|
6
|
-
|
7
|
-
## Motivation
|
8
|
-
|
9
|
-
As part of my effort to build [better project documentation](https://github.com/socketry/utopia-project), I needed a better code analysis tool. While less featured than some of the more mature alternatives, this library focuses on the needs of documentation generation, including speed, cross-referencing and (eventually) multi-language support.
|
10
|
-
|
11
|
-
## Usage
|
12
|
-
|
13
|
-
Please see the <a href="https://ioquatix.github.io/decode/">project documentation</a> or run it locally using `bake utopia:project:serve`.
|
14
|
-
|
15
|
-
## Contributing
|
16
|
-
|
17
|
-
We welcome contributions to this project.
|
18
|
-
|
19
|
-
1. Fork it
|
20
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
21
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
22
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
23
|
-
5. Create new Pull Request
|
24
|
-
|
25
|
-
## License
|
26
|
-
|
27
|
-
Released under the MIT license.
|
28
|
-
|
29
|
-
Copyright, 2020, by [Samuel G. D. Williams](http://www.codeotaku.com).
|
30
|
-
|
31
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
32
|
-
of this software and associated documentation files (the "Software"), to deal
|
33
|
-
in the Software without restriction, including without limitation the rights
|
34
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
35
|
-
copies of the Software, and to permit persons to whom the Software is
|
36
|
-
furnished to do so, subject to the following conditions:
|
37
|
-
|
38
|
-
The above copyright notice and this permission notice shall be included in
|
39
|
-
all copies or substantial portions of the Software.
|
40
|
-
|
41
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
42
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
43
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
44
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
45
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
46
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
47
|
-
THE SOFTWARE.
|
data/decode.gemspec
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
|
2
|
-
require_relative 'lib/decode/version'
|
3
|
-
|
4
|
-
Gem::Specification.new do |spec|
|
5
|
-
spec.name = "decode"
|
6
|
-
spec.version = Decode::VERSION
|
7
|
-
spec.authors = ["Samuel Williams"]
|
8
|
-
spec.email = ["samuel.williams@oriontransfer.co.nz"]
|
9
|
-
|
10
|
-
spec.summary = "Code analysis for documentation generation."
|
11
|
-
spec.homepage = "https://github.com/ioquatix/decode"
|
12
|
-
spec.license = "MIT"
|
13
|
-
|
14
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
15
|
-
|
16
|
-
# Specify which files should be added to the gem when it is released.
|
17
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
18
|
-
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
19
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(docs|test|spec|features)/}) }
|
20
|
-
end
|
21
|
-
|
22
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
|
-
spec.require_paths = ["lib"]
|
24
|
-
|
25
|
-
spec.add_dependency "parser"
|
26
|
-
|
27
|
-
spec.add_development_dependency 'build-files'
|
28
|
-
spec.add_development_dependency 'bake-bundler'
|
29
|
-
spec.add_development_dependency 'utopia-project'
|
30
|
-
spec.add_development_dependency 'covered'
|
31
|
-
spec.add_development_dependency 'bundler'
|
32
|
-
spec.add_development_dependency 'rspec'
|
33
|
-
end
|
data/gems.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
# This example demonstrates how to extract symbols using the index. An instance of {Decode::Index} is used for loading symbols from source code files. These symbols are available as a flat list and as a trie structure. You can look up specific symbols using a reference using {Decode::Index:lookup}.
|
4
|
-
require_relative '../../lib/decode/index'
|
5
|
-
|
6
|
-
# Firstly, construct the index:
|
7
|
-
index = Decode::Index.new
|
8
|
-
|
9
|
-
# Then, update the index by loading paths from the file system:
|
10
|
-
paths = Dir.glob(File.expand_path("../../lib/**/*.rb", __dir__))
|
11
|
-
index.update(paths)
|
12
|
-
|
13
|
-
# Finally, you can print out the loaded symbols:
|
14
|
-
index.symbols.each do |name, symbol|
|
15
|
-
puts symbol.long_form
|
16
|
-
end
|
17
|
-
|
18
|
-
# Lookup a specific symbol:
|
19
|
-
absolute_reference = Decode::Language::Ruby.reference("Decode::Index:lookup")
|
20
|
-
lookup_symbol = index.lookup(absolute_reference).first
|
21
|
-
puts lookup_symbol.long_form
|
22
|
-
|
23
|
-
# Lookup a method relative to that symbol:
|
24
|
-
relative_reference = Decode::Language::Ruby.reference("trie")
|
25
|
-
trie_attribute = index.lookup(relative_reference, relative_to: lookup_symbol).first
|
26
|
-
puts trie_attribute.long_form
|