bitboxer / manpages Goto Github PK
View Code? Open in Web Editor NEWGem to add man pages support to ruby gems
License: MIT License
Gem to add man pages support to ruby gems
License: MIT License
After a gem is installed, we need to find out if it has a man page (example in gem-man) and
copy the file to BIN_DIR/../share/man
. We also need to create the directory structure inside of the share/man
to match the section number of that man page ( share/man/man1
... ) .
If a gem is uninstalled, remove the symlink if it is the version that is deleted now
If a man file already exists, check if you need to overwrite it. We only overwrite symlinks that are already present and point to the gem directory.
$ ruby --version
ruby 2.3.2p217 (2016-11-15 revision 56796) [x86_64-linux]
$ gem --version
2.6.8
$ gem list
*** LOCAL GEMS ***
bigdecimal (default: 1.2.8)
io-console (default: 0.4.5)
json (default: 1.8.3)
psych (default: 2.1.0)
rdoc (default: 4.2.1)
$ gem install manpages
Fetching: manpages-0.5.2.gem (100%)
Successfully installed manpages-0.5.2
1 gem installed
$ gem install gem-man
Fetching: gem-man-0.3.0.gem (100%)
Successfully installed gem-man-0.3.0
1 gem installed
$ man gem-man
No existe entrada de manual para gem-man
$ # mmmm, maybe it's not done on installation and I need to generate them?
$ gem manpages --update-all
Installing man pages for gem-man 0.3.0
$ # Nice, it looks like something good was done
$ man gem-man
No existe entrada de manual para gem-man
$ # But still can't see man pages, maybe it's something with my "man setup"?
I wanted to try this gem, but couldn't get it working.
$ ruby-install ruby 2.3.2
# ... lots of output
>>> Successfully installed ruby 2.3.2 into /home/deivid/.rubies/ruby-2.3.2
$ source ~/.profile
$ chruby 2.3.2
$ ruby --version
ruby 2.3.2p217 (2016-11-15 revision 56796) [x86_64-linux]
$ gem install manpages && gem manpages --update-all
Error loading RubyGems plugin "/home/deivid/.gem/ruby/2.3.2/gems/manpages-0.5.1/lib/rubygems_plugin.rb": cannot load such file -- rubygems/gem/specification (LoadError)
Successfully installed manpages-0.5.1
1 gem installed
Error loading RubyGems plugin "/home/deivid/.gem/ruby/2.3.2/gems/manpages-0.5.1/lib/rubygems_plugin.rb": cannot load such file -- rubygems/gem/specification (LoadError)
ERROR: While executing gem ... (Gem::CommandLineError)
Unknown command manpages
Maybe it needs a more recent rubygems
?
$ gem --version
Error loading RubyGems plugin "/home/deivid/.gem/ruby/2.3.2/gems/manpages-0.5.1/lib/rubygems_plugin.rb": cannot load such file -- rubygems/gem/specification (LoadError)
2.5.2
$ gem update --system
Error loading RubyGems plugin "/home/deivid/.gem/ruby/2.3.2/gems/manpages-0.5.1/lib/rubygems_plugin.rb": cannot load such file -- rubygems/gem/specification (LoadError)
Updating rubygems-update
Fetching: rubygems-update-2.6.8.gem (100%)
Successfully installed rubygems-update-2.6.8
Installing RubyGems 2.6.8
Error loading RubyGems plugin "/home/deivid/.gem/ruby/2.3.2/gems/manpages-0.5.1/lib/rubygems_plugin.rb": cannot load such file -- rubygems/gem/specification (LoadError)
RubyGems 2.6.8 installed
# ... ChangeLog here
$ gem uninstall manpages
Error loading RubyGems plugin "/home/deivid/.gem/ruby/2.3.2/gems/manpages-0.5.1/lib/rubygems_plugin.rb": cannot load such file -- rubygems/gem/specification (LoadError)
Successfully uninstalled manpages-0.5.1
$ gem --version
2.6.8
$ gem install manpages && gem manpages --update-all
Fetching: manpages-0.5.1.gem (100%)
Successfully installed manpages-0.5.1
1 gem installed
Error loading RubyGems plugin "/home/deivid/.gem/ruby/2.3.2/gems/manpages-0.5.1/lib/rubygems_plugin.rb": cannot load such file -- rubygems/gem/specification (LoadError)
ERROR: While executing gem ... (Gem::CommandLineError)
Unknown command manpages
Same thing... :(
My gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.6.8
- RUBY VERSION: 2.3.2 (2016-11-15 patchlevel 217) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/deivid/.gem/ruby/2.3.2
- USER INSTALLATION DIRECTORY: /home/deivid/.gem/ruby/2.3.0
- RUBY EXECUTABLE: /home/deivid/.rubies/ruby-2.3.2/bin/ruby
- EXECUTABLE DIRECTORY: /home/deivid/.gem/ruby/2.3.2/bin
- SPEC CACHE DIRECTORY: /home/deivid/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /home/deivid/.rubies/ruby-2.3.2/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/deivid/.gem/ruby/2.3.2
- /home/deivid/.rubies/ruby-2.3.2/lib/ruby/gems/2.3.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--no-document"
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /home/deivid/.gem/ruby/2.3.2/bin
- /home/deivid/.rubies/ruby-2.3.2/lib/ruby/gems/2.3.0/bin
- /home/deivid/.rubies/ruby-2.3.2/bin
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/games
- /usr/local/games
- /home/deivid/.cabal/bin
- /usr/local/texlive/2015/bin/x86_64-linux
- /home/deivid/.local/bin
Thanks!
In #36 @gettalong mentioned that the "handles permission problems gracefull" test fails on his system because of an run order problem. I will need to investigate this.
The gemspec makes the target system rely on Git being installed. No need, really.
I noted this while looking at the gemspec, which has no runtime dependencies.
For rbenv we need to change the MANPATH
environment variable and make it point to the correct directory. This is done using hooks in rbenv. Sadly rbenv does not override the
cd
command. Because of that we only have the execute hook
that will let us change the dir after/before a command is executed. Meaning the man page will be found after the command was run first.
hi!
You should be able to replace the File.join
on line 8 and File.absolute_path(File.join(...))
on line 16 with File.expand_path
E.g.,
target_dir = File.expand_path(installer.bin_dir, "../share/man")
and
target_dir = File.expand_path(bin_dir, "../share/man")
For rvm we need to add a hook at each version change to manipulate the MANPATH
environment variable to point to the correct version.
If a gem is installed with multiple versions, make sure only the man page of the latest version is installed. This is the executable that by default is called by the rubygems system if not otherwise specified.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.