Skip to content
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

Can't get it to work without modifying ReferenceCollectorCLI.gd #63

Closed
1 task
eh-jogos opened this issue Sep 1, 2020 · 3 comments · Fixed by #78
Closed
1 task

Can't get it to work without modifying ReferenceCollectorCLI.gd #63

eh-jogos opened this issue Sep 1, 2020 · 3 comments · Fixed by #78

Comments

@eh-jogos
Copy link

eh-jogos commented Sep 1, 2020

I'm submitting a...

  • [ x] Bug report.
  • Feature request.

Bug report

I'm trying to use this for a plugin I'm making to integrate games with GameJolt API. I'm still at the beginning and this is mostly for learning purposes. I wanted to do a plugin and also set up a documentation page with this plugin and hugo here at github pages. But I can barely get past the ./generate_reference part because of errors with the directories path and I can only get it to work by modifying the ReferenceCollectorCLI.gd

The repository I'm working on is: https://github.com/eh-jogos/eh_GameJolt and the docs page at https://eh-jogos.github.io/eh_GameJolt/reference/classes/eh_gjusersauthrequest/ (that's the only half decent page so far)

What is the current behavior?
So when I just use ./generate_reference ../demo-project I get a "The directory does not exist: res://src" error, and If I try to pass anything to -d nothing works and the only way I got it to work was editing ReferenceCollectorCLI.gd directly so that it's var directories := ["res://src"] became var directories := ["res://"] and not passing anything to -d

When I try to pass something to -d here are some results:
./generate_reference ../demo-project -d "addons" or ./generate_reference ../demo-project -d . -gives no "The directory does not exist: res://src" and generates some kind of reference.json, but hugo export turns out to be just a single ".md" file (with no name, it just "empty-string.md") with nothing in it or something from one of my files

./generate_reference ../demo-project -d "res://addons/"or ./generate_reference ../demo-project -d res://addons/ gives me the same "The directory does not exist: res://src" error and a few lines before it prints

sed: -e expression #1, char 50: unknown option to `s'

When I try to modify the "generate_reference" script to echo the result of $args it prints "res",://"addons",/ and I have no Idea what that regex is trying to do, I tried to modify it by trial and error and got nowhere.

What is the expected behavior?
I guess either I'm using the -d wrong, as I didn't find any documentation talking about it, I only discovered it existed when I started to read the source to try and find the "The directory does not exist: res://src" error, or that option is not working correctly? Anyway I assume that option would be there so I could give if a folder and not have to change the directory directly in ReferenceCollectorCLI.gd.

Tell us the steps to reproduce the bug, and if possible share a minimal demo of the problem.
Well for me its just trying to run ./generate_reference on my project or trying to run this script passing a -d argument in the form of a godot path "res://some_folder"

Feature request

Describe the problem you're trying to solve.

Tell us which solutions you've explored, the solution you would pick, and why you think it would be the best for everyone.

Other

Other information

@NathanLovato
Copy link
Contributor

I just updated the script, the help function name was incorrect. You can run generate_reference -h to get usage information.

Then, I'd need a complete log to see what isn't working. Could you open the script and add a line with set -x at the top? Then run the program and copy and paste the instructions output by your shell along with any errors.

The -d option stands for directory, you need to pass it a directory name and not a path. Here's an example:

./generate_reference ~/Repositories/other/nakama-godot/project/ -o export-nakama -d addons

I'll update the docstring right away to clear the confusion.

@eh-jogos
Copy link
Author

eh-jogos commented Sep 2, 2020

Yeah the first command I tried when I discovered -d was "." and the second one was
./generate_reference ../demo-project -d addons

Here is the full log after editing the script and adding set -x

$ gdscript-docs-maker git:(master) ✗ ./generate_reference ../demo-project -d addons
+ project_directory=../demo-project
+ output_directory=export
+ directories_override=
++ getopt --name generate_reference -o h,o:,d: -l help,output-directory:,directories: -- ../demo-project -d addons
+ arguments=' -d '\''addons'\'' -- '\''../demo-project'\'''
+ eval set -- ' -d '\''addons'\'' -- '\''../demo-project'\'''
++ set -- -d addons -- ../demo-project
+ true
+ case "$1" in
+ directories_override=' addons'
+ shift 2
+ true
+ case "$1" in
+ shift
+ break
+ test -z ../demo-project
+ test -d ../demo-project
++ find ../demo-project -iname project.godot -print -quit
+ godot_project_file=../demo-project/project.godot
+ test -f ../demo-project/project.godot
++ dirname ../demo-project/project.godot
+ godot_project_dir=../demo-project
+ path_ref_collector=godot-scripts/ReferenceCollectorCLI.gd
+ path_collector=godot-scripts/Collector.gd
++ mktemp
+ file_ref_collector=/tmp/tmp.kHEsa7dNJb
+ cat godot-scripts/ReferenceCollectorCLI.gd
+ test addons '!=' ''
++ echo addons
++ sed -r 's/([-._a-zA-Z0-9]+)/"\1",/g'
++ sed -r 's/,$//'
+ args='"addons"'
+ sed -ri 's/^var directories.+/var directories := ["addons"]/' /tmp/tmp.kHEsa7dNJb
++ basename godot-scripts/ReferenceCollectorCLI.gd
+ cp -v /tmp/tmp.kHEsa7dNJb ../demo-project/ReferenceCollectorCLI.gd
'/tmp/tmp.kHEsa7dNJb' -> '../demo-project/ReferenceCollectorCLI.gd'
+ cp -v godot-scripts/Collector.gd ../demo-project
'godot-scripts/Collector.gd' -> '../demo-project/Collector.gd'
+ echo 'Generating reference json data...'
Generating reference json data...
+ /mnt/24847D5F847D3500/Daniel/00_Resources/_softwares/Godot/32x/Godot_v3.2.2-stable_x11.64 --editor --quit --script --no-window --path ../demo-project ReferenceCollectorCLI.gd
WARNING: _get: Property not found: application/config/version
   At: core/project_settings.cpp:209.
ERROR: notify_client: Condition "!clients.has(p_client_id)" is true.
   At: modules/gdscript/language_server/gdscript_language_protocol.cpp:281.
ERROR: notify_client: Condition "!clients.has(p_client_id)" is true.
   At: modules/gdscript/language_server/gdscript_language_protocol.cpp:281.
ERROR: notify_client: Condition "!clients.has(p_client_id)" is true.
   At: modules/gdscript/language_server/gdscript_language_protocol.cpp:281.
ERROR: notify_client: Condition "!clients.has(p_client_id)" is true.
   At: modules/gdscript/language_server/gdscript_language_protocol.cpp:281.
ERROR: notify_client: Condition "!clients.has(p_client_id)" is true.
   At: modules/gdscript/language_server/gdscript_language_protocol.cpp:281.
ERROR: notify_client: Condition "!clients.has(p_client_id)" is true.
   At: modules/gdscript/language_server/gdscript_language_protocol.cpp:281.
ERROR: notify_client: Condition "!clients.has(p_client_id)" is true.
   At: modules/gdscript/language_server/gdscript_language_protocol.cpp:281.
ERROR: notify_client: Condition "!clients.has(p_client_id)" is true.
   At: modules/gdscript/language_server/gdscript_language_protocol.cpp:281.
ERROR: notify_client: Condition "!clients.has(p_client_id)" is true.
   At: modules/gdscript/language_server/gdscript_language_protocol.cpp:281.
ERROR: notify_client: Condition "!clients.has(p_client_id)" is true.
   At: modules/gdscript/language_server/gdscript_language_protocol.cpp:281.
ERROR: notify_client: Condition "!clients.has(p_client_id)" is true.
   At: modules/gdscript/language_server/gdscript_language_protocol.cpp:281.
ERROR: notify_client: Condition "!clients.has(p_client_id)" is true.
   At: modules/gdscript/language_server/gdscript_language_protocol.cpp:281.
ERROR: notify_client: Condition "!clients.has(p_client_id)" is true.
   At: modules/gdscript/language_server/gdscript_language_protocol.cpp:281.
ERROR: notify_client: Condition "!clients.has(p_client_id)" is true.
   At: modules/gdscript/language_server/gdscript_language_protocol.cpp:281.
ERROR: notify_client: Condition "!clients.has(p_client_id)" is true.
   At: modules/gdscript/language_server/gdscript_language_protocol.cpp:281.
ERROR: notify_client: Condition "!clients.has(p_client_id)" is true.
   At: modules/gdscript/language_server/gdscript_language_protocol.cpp:281.
ERROR: notify_client: Condition "!clients.has(p_client_id)" is true.
   At: modules/gdscript/language_server/gdscript_language_protocol.cpp:281.
WARNING: _notification: Scan thread aborted...
   At: editor/editor_file_system.cpp:1129.
ERROR: ~List: Condition "_first != __null" is true.
   At: ./core/self_list.h:112.
ERROR: ~List: Condition "_first != __null" is true.
   At: ./core/self_list.h:112.
WARNING: cleanup: ObjectDB instances leaked at exit (run with --verbose for details).
   At: core/object.cpp:2135.
ERROR: clear: Resources still in use at exit (run with --verbose for details).
   At: core/resource.cpp:477.
ERROR: cleanup: There are still MemoryPool allocs in use at exit!
   At: core/pool_vector.cpp:69.
+ test 0 -gt 0
+ echo Done.
Done.
+ test -f ../demo-project/reference.json
++ basename godot-scripts/ReferenceCollectorCLI.gd
+ rm -v ../demo-project/ReferenceCollectorCLI.gd
removed '../demo-project/ReferenceCollectorCLI.gd'
++ basename godot-scripts/Collector.gd
+ rm -v ../demo-project/Collector.gd
removed '../demo-project/Collector.gd'
+ echo 'Generating markdown files in export'
Generating markdown files in export
+ test -d export
+ python3 -m gdscript_docs_maker ../demo-project/reference.json --path export

Then the resulting reference.json is attached below (faulty_files.zip) and when I run

python3 -m gdscript_docs_maker ../demo-project/reference.json --format hugo  --path ../demo-project/.docs-site/content/reference/classes/ -i

The resulting .md are also attached in the faulty_files.zip below.

Since I was already editing the ReferenceCollectorCLI.gd I decided to copy the folder with the scripts to my project, and when I run ReferenceCollector.gd from within Godot and edit the paths in the variable there it seems to work fine and when I run the gdscript_docs_maker command it exports better files, which is the version that is published right now on https://eh-jogos.github.io/eh_GameJolt/

But I noticed:

I don't know if these things weren't supposed to work out of the box and if I'm missing some setups, either in the plugin/project or in hugos configurations, I literally just started learning hugo last weekend.

The files for this are in the good_files.zip or in the repository (master branch has the json and the godot project files, docs-project branch has the docs hugo project, and gh-pages branch is the public folder of the hugo project, where the site is published)

faulty_files.zip
good_files.zip

@davcri
Copy link
Contributor

davcri commented Dec 26, 2020

If you are reading this through an email or notification, just enjoy your holidays and don't bother looking at the issue :) but if you have a bit of time...

I just wanted to report that I had a similar issue running ./generate_reference on Manjaro Linux.

What I did:

  • pull the repo
  • executed pip install gdscript_docs_maker (on Arch Linux pip and python commands are defaulted to use Python3)
  • executed ./generate_reference ../godot-game-template/ -d scenes (you can find godot-game-template here)

Expected output

  • ../godot-game-template/reference.json filled with script documentation metadata
  • something in ./export/

Actual output

  • empty ../godot-game-template/reference.json (see Problem 1)
{
  "name": "godot-template",
  "description": "",
  "version": null,
  "classes": [

  ]
}
  • nothing in ./export/ (see Problem 2)

Problem 1 (fixed)

I got the script to produce a correct output for reference.json by removing the set -x instruction from generate_reference.

See diff here: #74

Problem 2

./export/ is still empty.

I guess this is because gdscript_docs_maker doesn't install correctly (at least on my machine), see #76 :

image

@NathanLovato NathanLovato linked a pull request Jan 3, 2021 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants