I often want to look at the README.txt before and after installing a Drupal module. It would be great if there was a command like pm-releasenotes that would show the README.txt file for any module on d.o or on the local system.
I looked at the code for pm-releasenotes to see if I could hack something together from that but it was a bit over my head. Anyone else think this would be useful? Anyone want to take this on or point me in the right direction?
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | pm_readme_v2.patch | 6 KB | beltofte |
| #5 | initial_pm_readme.patch | 4.25 KB | beltofte |
Comments
Comment #1
greg.1.anderson commented+1 for pm-readme. Patches welcome; this would be a simple call to wget/curl, and there is a drush_download_file that will do that for you. For example:
http://drupalcode.org/project/drush.git/blob/HEAD:/README.txt
Comment #2
beltofteWould it make sense to name it different and let it support an extra type argument? So it could print README.txt, CHANGELOG.txt, INSTALL.txt etc.?
And instead of HEAD should it print the file from the recommended release tag, for example http://drupalcode.org/project/views.git/blob_plain/refs/tags/6.x-2.16:/R....
Comment #3
robloachThe majority of projects out there don't even have the .txt extension for their documentation files:
https://github.com/apenwarr/git-subtree
Comment #4
greg.1.anderson commentedI have also seen README.md.
Comment #5
beltofteFast made a patch to implement a pm-readme command. It has some issues....
Comment #6
greg.1.anderson commentedGood start. The next step would be to pull down a directory listing (e.g. http://drupalcode.org/project/drush.git/tree) and scan through it, looking for files that match README.*. After grabbing the contents of the above URL, I would do a preg_match for
<a href="([^"]*)">raw</a>(n.b. hand-typed, not tested); then you'd have a bunch of matches that contained URLs of stuff to download, and you could just do a case-insensitve compare against the end of each URL, ignoring extensions, to find the file to grab.If you did that, then handling the awkward internal server error pages in drush_download_file wouldn't be too important.
Comment #7
beltofteThanks, Greg. I will make a new patch implementing your suggestions. It will probably first be tomorrow though.
Comment #8
beltofteAttached an updated patch based on the suggestions in #6. It know uses the Git tree listing for finding a README file. It's no longer hardcoded to README.txt, but just takes the first and best README file. Logging is also implemented.
Comment #9
greg.1.anderson commentedLooks good, and works great. I am seeing a couple of warnings in updatexml, but that's someone else's code.
I think this works well enough to be committed, but I'll wait for other maintainers to review.
Comment #10
moshe weitzman commentedThis scraping of updatecode might be too hackish for drush core. I'll mull it. Also, this might want integration into pm-download and pm-updatecode like our --notes option
Please don't commit yet.
Comment #11
greg.1.anderson commentedI don't know if I would call this "scraping" of updatecode; maybe it is inappropriate intimacy. Perhaps a good way to handle this would be to call pm-releases via backend invoke, and parse the $values array returned. We'd first have to make sure that pm-releases returned its releases array as the function result of its command callback, so that this info is available in the values array.
Comment #12
moshe weitzman commentedI'm kinda disinterested in this for drush core. Please submit it as a contrib extension. I think it will be popular there. Thanks for the contribution.
Comment #13
beltofteI will make a pm-readme patch for drush_extras, and try to get it into that module.
Comment #14
greg.1.anderson commentedI'll take pm-readme in drush extras.
Comment #15
greg.1.anderson commentedMoving to Drush extras queue.
Comment #16
elijah lynnIs this implemented now?
Comment #17
greg.1.anderson commentedI think there's a dup issue somewhere in the Drush queue with most of an implementation sitting around somewhere. If I remember correctly, it was not accepted for Drush, but could be committed here if someone found and finished it.
Comment #18
elijah lynnThanks Greg, maybe that would be a good project for me to get my feet wet with :D.
Comment #19
greg.1.anderson commentedOh, the last patch is above, in #8. :p Didn't scroll up. Just needs a little re-work to call pm-releases with drush_invoke_process, and it's good to go.
Comment #20
elijah lynnK, I will play with it sometime. No promises :D