-
Notifications
You must be signed in to change notification settings - Fork 1
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
Introduce a Parser module stub #146
base: master
Are you sure you want to change the base?
Conversation
I created a dummy module to start working on the Parser component. It lists all files in the current working directory with no extension. In a directory that only contains files owned by Onigumo, such files are those fetched by the Downloader.
I am creating the pull request as a draft because there are no tests yet. I think the file listing routine is worth being tested. The only way to run the new code is to manually edit Onigumo.CLI and replace the call to Onigumo.Downloader with Onigumo.Parser. #145 solves this by allowing to specify a module name. Because the existing executive module is in a broadly-named file onigumo.ex, I added the new code into that file. If this gets into master first, the patch renaming the file (#141) will turn into one splitting it into two. Currently, the downloaded files have no extension. It is not as straightforward to get all such files instead of getting those that do. With the file population in place, I see this will become a standalone module, as already suggested in #90 (comment). |
I d like to add |
Currently, the root path is the current working directory, emerging in Onigumo.CLI. This value is always a real path that doesn’t require expansion. However, if the path becomes user-specified, it will need expanding by Thank you for pointing this out! I created an issue #182 to track the possibility of setting the path via CLI. |
lib/onigumo/parser.ex
Outdated
|> File.ls!() | ||
|> Enum.reject(&File.dir?(&1)) | ||
|> Enum.reject(&String.contains?(&1, ".")) | ||
|> Enum.join("\n") |
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.
this line seems to be unnecessary, we can collect filename one by one, we dont have to print all filenames as one output.
Merged current master dc0b3fc. |
Thanks to pull request #147, downloaded files now have the .raw extension. This has simplified the process of loading downloaded files. Without the extension, it was more complicated. |
I’ve noticed that retrieving all files without an extension also includes the executable file |
Downloaded files now have .raw extesion, they are no longer without an extension at all.
Used Enum.map to trigger IO.puts instead of joining and printing in a single blob.
I introduced two changes:
|
Replace tabs with spaces.
493e10f
to
8d2185b
Compare
Merged with the current master: * Implemented behavior for Onigumo.Parser. * Added Parser to CLI and environment.
Currently it doesn’t test anything for real. It’s just a test file with a single test to be filled in.
In the light of #232, this module stub may look unnecessary. Yet it contains a draft of a file discovery logic, that can be re-used by the new Feeder module. Also, at this point, only tests are remaining. For the sake of continuity and code re-use, I’d finish this pull request as it is. |
The Onigumo.Component behavior requires main to return :ok.
Made the function public, so it is testable.
Test an empty directory. Made list_downloaded public for it to be testable.
Values are compared with ==, not with =. Fixing an unused variable warning.
The parametrization allows to test various combinations of expected and unexpected files.
I created a dummy module to start working on the Parser component. It lists all files in the current working directory with no extension. In a directory that only contains files owned by Onigumo, such files are those fetched by the Downloader.