-
Notifications
You must be signed in to change notification settings - Fork 13
Add RDoc documentation site for Rubydex APIs #874
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
st0012
wants to merge
3
commits into
main
Choose a base branch
from
codex/rdoc-docs-api
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| README.md | ||
| CONTRIBUTING.md | ||
| docs/*.md | ||
| lib/**/*.rb | ||
| ext/rubydex/*.c |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| name: Deploy documentation to GitHub Pages | ||
|
|
||
| on: | ||
| push: | ||
| branches: ["main"] | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
| pages: write | ||
| id-token: write | ||
|
|
||
| concurrency: | ||
| group: pages | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| if: ${{ github.repository == 'Shopify/rubydex' }} | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | ||
|
|
||
| - name: Set up Ruby | ||
| uses: ruby/setup-ruby@89f90524b88a01fe6e0b732220432cc6142926af # v1.313.0 | ||
| with: | ||
| ruby-version: "4.0.0" | ||
| bundler-cache: true | ||
|
|
||
| - name: Setup Pages | ||
| uses: actions/configure-pages@v6.0.0 | ||
|
|
||
| - name: Build documentation | ||
| run: bundle exec rake rdoc | ||
|
|
||
| - name: Upload artifact | ||
| uses: actions/upload-pages-artifact@v5.0.0 | ||
|
|
||
| deploy: | ||
| environment: | ||
| name: github-pages | ||
| url: ${{ steps.deployment.outputs.page_url }} | ||
| runs-on: ubuntu-latest | ||
| needs: build | ||
| steps: | ||
| - name: Deploy to GitHub Pages | ||
| id: deployment | ||
| uses: actions/deploy-pages@v5.0.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| /.bundle/ | ||
| /.yardoc | ||
| /_yardoc/ | ||
| /_site/ | ||
| /coverage/ | ||
| /doc/ | ||
| /pkg/ | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| op_dir: _site | ||
| title: Rubydex | ||
| main_page: README.md | ||
|
|
||
| footer_content: | ||
| DOCUMENTATION: | ||
| Home: index.html | ||
| RESOURCES: | ||
| GitHub Repository: https://github.com/Shopify/rubydex | ||
| Issue Tracker: https://github.com/Shopify/rubydex/issues |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,8 @@ | |
| #include "rustbindings.h" | ||
| #include "utils.h" | ||
|
|
||
| /* RDoc parses C files independently: mRubydex = rb_define_module("Rubydex") */ | ||
|
|
||
| VALUE cDeclaration; | ||
| VALUE cNamespace; | ||
| VALUE cClass; | ||
|
|
@@ -46,7 +48,12 @@ VALUE rdxi_declaration_class_for_kind(CDeclarationKind kind) { | |
| } | ||
| } | ||
|
|
||
| // Declaration#name -> String | ||
| /* | ||
| * call-seq: | ||
| * name -> String? | ||
| * | ||
| * Returns the fully qualified declaration name. | ||
| */ | ||
| static VALUE rdxr_declaration_name(VALUE self) { | ||
| HandleData *data; | ||
| TypedData_Get_Struct(self, HandleData, &handle_type, data); | ||
|
|
@@ -65,7 +72,12 @@ static VALUE rdxr_declaration_name(VALUE self) { | |
| return str; | ||
| } | ||
|
|
||
| // Declaration#unqualified_name -> String | ||
| /* | ||
| * call-seq: | ||
| * unqualified_name -> String? | ||
| * | ||
| * Returns the declaration name without namespace qualification. | ||
| */ | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. RDoc's C parser only recognizes this style of C comments. |
||
| static VALUE rdxr_declaration_unqualified_name(VALUE self) { | ||
| HandleData *data; | ||
| TypedData_Get_Struct(self, HandleData, &handle_type, data); | ||
|
|
@@ -126,8 +138,12 @@ static VALUE declaration_definitions_size(VALUE self, VALUE _args, VALUE _eobj) | |
| return SIZET2NUM(len); | ||
| } | ||
|
|
||
| // Declaration#definitions: () -> Enumerator[Definition] | ||
| // Returns an enumerator that yields all definitions for this declaration lazily | ||
| /* | ||
| * call-seq: | ||
| * definitions -> Enumerator[Rubydex::Definition] | ||
| * | ||
| * Returns an enumerator that yields all definitions for this declaration lazily. | ||
| */ | ||
| static VALUE rdxr_declaration_definitions(VALUE self) { | ||
| if (!rb_block_given_p()) { | ||
| return rb_enumeratorize_with_size(self, rb_str_new2("definitions"), 0, NULL, declaration_definitions_size); | ||
|
|
@@ -146,8 +162,12 @@ static VALUE rdxr_declaration_definitions(VALUE self) { | |
| return self; | ||
| } | ||
|
|
||
| // Declaration#member: (String member) -> Declaration | ||
| // Returns a declaration handle for the given member | ||
| /* | ||
| * call-seq: | ||
| * member(name) -> Rubydex::Declaration? | ||
| * | ||
| * Returns a declaration handle for the named member, or nil if no member exists. | ||
| */ | ||
| static VALUE rdxr_declaration_member(VALUE self, VALUE name) { | ||
| HandleData *data; | ||
| TypedData_Get_Struct(self, HandleData, &handle_type, data); | ||
|
|
@@ -171,8 +191,12 @@ static VALUE rdxr_declaration_member(VALUE self, VALUE name) { | |
| return rb_class_new_instance(2, argv, decl_class); | ||
| } | ||
|
|
||
| // Namespace#find_member: (String member, only_inherited: false) -> Declaration? | ||
| // Searches for a member in the ancestor chain of the declaration | ||
| /* | ||
| * call-seq: | ||
| * find_member(name, only_inherited: false) -> Rubydex::Declaration? | ||
| * | ||
| * Searches for a member in the declaration's ancestor chain. | ||
| */ | ||
| static VALUE rdxr_declaration_find_member(int argc, VALUE *argv, VALUE self) { | ||
| VALUE member, opts; | ||
| rb_scan_args(argc, argv, "1:", &member, &opts); | ||
|
|
@@ -207,7 +231,12 @@ static VALUE rdxr_declaration_find_member(int argc, VALUE *argv, VALUE self) { | |
| return rb_class_new_instance(2, result_argv, decl_class); | ||
| } | ||
|
|
||
| // Declaration#singleton_class -> SingletonClass | ||
| /* | ||
| * call-seq: | ||
| * singleton_class -> Rubydex::SingletonClass? | ||
| * | ||
| * Returns the singleton class declaration, or nil if none exists. | ||
| */ | ||
| static VALUE rdxr_declaration_singleton_class(VALUE self) { | ||
| HandleData *data; | ||
| TypedData_Get_Struct(self, HandleData, &handle_type, data); | ||
|
|
@@ -227,7 +256,12 @@ static VALUE rdxr_declaration_singleton_class(VALUE self) { | |
| return rb_class_new_instance(2, argv, decl_class); | ||
| } | ||
|
|
||
| // Declaration#owner -> Declaration | ||
| /* | ||
| * call-seq: | ||
| * owner -> Rubydex::Declaration | ||
| * | ||
| * Returns the owner declaration. | ||
| */ | ||
| static VALUE rdxr_declaration_owner(VALUE self) { | ||
| HandleData *data; | ||
| TypedData_Get_Struct(self, HandleData, &handle_type, data); | ||
|
|
@@ -247,7 +281,12 @@ static VALUE rdxr_declaration_owner(VALUE self) { | |
| return rb_class_new_instance(2, argv, decl_class); | ||
| } | ||
|
|
||
| // Declaration#ancestors: () -> Enumerator[Declaration] | ||
| /* | ||
| * call-seq: | ||
| * ancestors -> Enumerator[Rubydex::Namespace] | ||
| * | ||
| * Returns an enumerator that yields ancestor namespaces. | ||
| */ | ||
| static VALUE rdxr_declaration_ancestors(VALUE self) { | ||
| if (!rb_block_given_p()) { | ||
| return rb_enumeratorize(self, rb_str_new2("ancestors"), 0, NULL); | ||
|
|
@@ -270,7 +309,12 @@ static VALUE rdxr_declaration_ancestors(VALUE self) { | |
| return self; | ||
| } | ||
|
|
||
| // Declaration#descendants: () -> Enumerator[Declaration] | ||
| /* | ||
| * call-seq: | ||
| * descendants -> Enumerator[Rubydex::Namespace] | ||
| * | ||
| * Returns an enumerator that yields descendant namespaces. | ||
| */ | ||
| static VALUE rdxr_declaration_descendants(VALUE self) { | ||
| if (!rb_block_given_p()) { | ||
| return rb_enumeratorize(self, rb_str_new2("descendants"), 0, NULL); | ||
|
|
@@ -293,7 +337,12 @@ static VALUE rdxr_declaration_descendants(VALUE self) { | |
| return self; | ||
| } | ||
|
|
||
| // Namespace#members: () -> Enumerator[Declaration] | ||
| /* | ||
| * call-seq: | ||
| * members -> Enumerator[Rubydex::Declaration] | ||
| * | ||
| * Returns an enumerator that yields member declarations. | ||
| */ | ||
| static VALUE rdxr_declaration_members(VALUE self) { | ||
| if (!rb_block_given_p()) { | ||
| return rb_enumeratorize(self, rb_str_new2("members"), 0, NULL); | ||
|
|
@@ -334,8 +383,12 @@ static VALUE constant_declaration_references_size(VALUE self, VALUE _args, VALUE | |
| return SIZET2NUM(len); | ||
| } | ||
|
|
||
| // Namespace#references, Constant#references, ConstantAlias#references | ||
| // Returns an enumerator that yields constant references to this declaration | ||
| /* | ||
| * call-seq: | ||
| * references -> Enumerator[Rubydex::ConstantReference] | ||
| * | ||
| * Returns an enumerator that yields constant references to this declaration. | ||
| */ | ||
| static VALUE rdxr_constant_declaration_references(VALUE self) { | ||
| if (!rb_block_given_p()) { | ||
| return rb_enumeratorize_with_size(self, rb_str_new2("references"), 0, NULL, | ||
|
|
@@ -377,8 +430,12 @@ static VALUE method_declaration_references_size(VALUE self, VALUE _args, VALUE _ | |
| return SIZET2NUM(len); | ||
| } | ||
|
|
||
| // Method#references | ||
| // Returns an enumerator that yields method references to this declaration | ||
| /* | ||
| * call-seq: | ||
| * references -> Enumerator[Rubydex::MethodReference] | ||
| * | ||
| * Returns an enumerator that yields method references to this declaration. | ||
| */ | ||
| static VALUE rdxr_method_declaration_references(VALUE self) { | ||
| if (!rb_block_given_p()) { | ||
| return rb_enumeratorize_with_size(self, rb_str_new2("references"), 0, NULL, | ||
|
|
@@ -402,7 +459,12 @@ static VALUE rdxr_method_declaration_references(VALUE self) { | |
| return self; | ||
| } | ||
|
|
||
| // Placeholder for variable declarations that don't yet support references | ||
| /* | ||
| * call-seq: | ||
| * references -> Array[untyped] | ||
| * | ||
| * Returns an empty array because variable declarations do not yet support reference lookup. | ||
| */ | ||
| static VALUE rdxr_variable_declaration_references(VALUE self) { | ||
| return rb_ary_new(); | ||
| } | ||
|
|
@@ -420,7 +482,12 @@ static VALUE rdxi_visibility_to_symbol(CVisibility visibility) { | |
| } | ||
| } | ||
|
|
||
| // Declaration#visibility -> Symbol | ||
| /* | ||
| * call-seq: | ||
| * visibility -> Symbol | ||
| * | ||
| * Returns the declaration visibility. | ||
| */ | ||
| static VALUE rdxr_declaration_visibility(VALUE self) { | ||
| HandleData *data; | ||
| TypedData_Get_Struct(self, HandleData, &handle_type, data); | ||
|
|
@@ -439,9 +506,13 @@ static VALUE rdxr_declaration_visibility(VALUE self) { | |
| return symbol; | ||
| } | ||
|
|
||
| // ConstantAlias#target -> Declaration? | ||
| // Returns the first resolved target declaration for this constant alias, or nil if none of its definitions resolved to | ||
| // a target | ||
| /* | ||
| * call-seq: | ||
| * target -> Rubydex::Declaration? | ||
| * | ||
| * Returns the first resolved target declaration for this constant alias, or nil if none of its definitions resolved to | ||
| * a target. | ||
| */ | ||
| static VALUE rdxr_constant_alias_target(VALUE self) { | ||
| HandleData *data; | ||
| TypedData_Get_Struct(self, HandleData, &handle_type, data); | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RDoc currently doesn't have a way to read RBS sigs from C files yet. So let's use call-seq for now.