guides icon indicating copy to clipboard operation
guides copied to clipboard

Gems with extensions: Gem layout: confusing content

Open igneus opened this issue 5 years ago • 1 comments

The Gem layout section of the Gems with extensions page is quite confusing. So far I don't know enough about C extensions to improve the text myself, so I'm just opening an issue for it.

Some extensions will be partially written in C and partially written in ruby. If you are going to support multiple languages, such as C and Java extensions, you should put the C-specific ruby files under the ext/ directory as well in a lib/ directory.

What exactly does the portion highlighted by bold typeface mean? I'm also not sure if it is syntactically correct or not.

When the extension is built the files in ext/my_malloc/lib/ will be installed into the lib/ directory for you.

As a reader, I expect this paragraph, following immediately after an example directory listing, to refer to paths contained in the listing. But the listing does not include the directory ext/my_malloc/lib. I'm confused.

igneus avatar Oct 17 '20 16:10 igneus

I don't know of any example gem of what's being described there but it sounds like the intended meaning is that if your specific extension (say, a C-extension) needs specific ruby files, they should be placed inside a lib subfolder under ext, not inside the "main" lib/ folder.

Not being a native speaker, I'm not sure about the sentence, but maybe changing "directory" with "subdirectory" and adding a comma and an example, could make it better?

under the ext/ directory as well, in a lib/ subdirectory (e.g. ext/my_malloc/lib).

Regarding the listing, I guess the fix would be to add the directory to it.

deivid-rodriguez avatar Oct 19 '20 12:10 deivid-rodriguez