-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| 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@9eb537ca036ebaed86729dcb9309076e4c5c3b74 # v1.314.0 | ||
| with: | ||
| bundler-cache: true | ||
|
|
||
| - 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 | ||
|
Member
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. Doesn't GH pages deploy automatically if For example, the Ruby LSP GH pages website just builds everything in
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. That's the branch-based deployment approach. I chose a different approach here as explained in #874 (comment) |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| /.bundle/ | ||
| /.yardoc | ||
| /_yardoc/ | ||
| /_site/ | ||
| /coverage/ | ||
| /doc/ | ||
| /pkg/ | ||
|
|
||
| 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 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,11 @@ | |
| #include "rustbindings.h" | ||
| #include "utils.h" | ||
|
|
||
| /* | ||
| * RDoc parser workaround for https://github.com/ruby/rdoc/issues/1744: | ||
| * mRubydex = rb_define_module("Rubydex") | ||
| */ | ||
|
|
||
| VALUE cDeclaration; | ||
| VALUE cNamespace; | ||
| VALUE cClass; | ||
|
|
@@ -46,7 +51,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 +75,12 @@ static VALUE rdxr_declaration_name(VALUE self) { | |
| return str; | ||
| } | ||
|
|
||
| // Declaration#unqualified_name -> String | ||
| /* | ||
| * call-seq: | ||
| * unqualified_name -> String? | ||
|
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 currently doesn't have a way to read RBS sigs from C files yet. So let's use call-seq for now. |
||
| * | ||
| * 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 +141,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 +165,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 +194,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 +234,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 +259,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 +284,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 +312,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 +340,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 +386,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 +433,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 +462,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 +485,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 +509,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); | ||
|
|
||
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.
After this, we really ought to give some love to the architecture docs, which are really behind and lacking at the moment. I ended up never finishing #423