-
Notifications
You must be signed in to change notification settings - Fork 379
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
Man page #158
Man page #158
Conversation
@avdv - Is there a way we can automatically generate the man page by passing the |
Also, the formed man file from |
This is handled by the manpages gem: This plugin automatically hooks into the ruby gems system. Every gem installed afterwards is checked for manpages. If this gem finds them, it exposes them to the man command. I can confirm that it works for Linux. They say it works for Mac, too. Just try it! If you wanted to install it to the system, you would need to run this as root... Also, throughout the net, consensus seemed to be that this would be the job of a package manager, like rpm or homebrew. |
Yes, I am looking into it... |
I have updated this branch, the options of the man page are now generated. |
998dee3
to
8216394
Compare
Another update... alas, the travis build still fails. The problem is the rubocop violation of:
I had introduced the global method, since otherwise rubocop complained about the number of lines in the block:
What are the options here? Exclude the gemspec file? Increase the limit? |
Disable the |
Thanks! Done. |
35edf61
to
1692c79
Compare
Can the |
Rakefile
Outdated
task default: %w[spec rubocop] | ||
|
||
task install: 'man/colorls.1' |
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.
Works well. The formed man file is automatically exposed to manpath - cool! Confirmed for Mac.
One question though - if there's already a man/colorls.1
file, rake install
ing doesn't re-form the man file. So, any changes in the ronn file doesn't get reflected unless the existing man/colorls.1
is manually removed? Can a File.delete('man/colorls.1')
be included within the task?
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.
Can the man/colorls.1 be gitignored?
Yes, good point!
I'll look into the rake task issue, probably need to define a phony target...
I have updated the branch according to your comments:
|
@avdv - Awesome work. Just add "Man pages have been added. Checkout |
|
||
spec.add_development_dependency 'bundler', '~> 1.15' | ||
spec.add_development_dependency 'diffy' | ||
spec.add_development_dependency 'rake' | ||
spec.add_development_dependency 'ronn' |
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.
Should ronn
rather be a runtime dependency? When a user does gem install colorls
, is the manpages created by default by ronn
? For that, we'd require ronn
to be installed while installing colorls right?
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.
No, the man page is generated when building the package/gem, ie. when running rake.
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.
Hmm, so how does the user generate the man page? The user is going to only do gem install. Not git clone and rake install. Should we have a --setup flag for that?
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.
The manpage is part of the gem, it is included. This way it is only generated once and then uploaded to the gem server.
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.
If it's part of the gem, should it NOT be git-ignored? I thought that the user would be generating the man pages after installing colorls, that's why I asked to gitignore colorls.1 file. But if we're to generate the man file and push to Rubygems too, it shouldn't be gitignored.
I have adjusted the message and README as per your comment. :-) |
One final query: If the man file is a part of the gem, it should NOT be gitignored right? I thought that the user would be generating the man pages after installing colorls, that's why I asked to gitignore colorls.1 file. But if we're to generate the man file and push to Rubygems too, it shouldn't be gitignored. |
I guess that depends on your policy. Usually my policy is to never check in something that is generated. Thusly, it should be added to git ignore. But I also have seen projects using ronn, that commit the generated files. Actually, I do not see the benefit of it... except that you would not have to add the files to the gemspec manually. So, OK. I'll change that. |
When this gem is installed, it automatically symlinks man pages of other gems so that you can view them with `man`.
@athityakumar OK, done! |
Description
This PR adds a manual page for colorls. It tries to automatically make it work on the user's system by using the manpages gem.
The man page is written in ronn format.
In the future, the man page could probably be semi-generated using the defined options in the code...