manpages 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 836087ab188069543a0d1bf8a428bab0068df271
4
- data.tar.gz: b6927431e0f94f8347dad3d27dd01648a61fed4d
3
+ metadata.gz: 88713453a394e93be00536e4ea25d068aed8e407
4
+ data.tar.gz: a5543a28271ab62d36ecfd9ab110849ab5e74228
5
5
  SHA512:
6
- metadata.gz: 6eb39868aff19cf9a68c1eb47afa29e670ee80d4f52bc03f497de85eb48cb6a4a351ff858a3a4807209ac68b3679c9080bc28b170edca8dd2eb0959fd1f97b74
7
- data.tar.gz: 8d6593ba5828ebc76721be716fa0e781650834b26de6458f86683a567a0210fea448751d8b27e2d4062fd73164b500f0815ee77145954abd17d032544f4796ff
6
+ metadata.gz: 5d9efae3bd6c9b240ccf0be50478bcef825328781ac92d5263a82e424299f3d5d8d1d5c47993d70915128b8598aaa31f1ad442449b7ffa5e9e6778ac85db3e48
7
+ data.tar.gz: bb69e48ef80123442e11d6ff2cbe3cfc4e545b44a4b60d88b31ba031a8895d4fa881686f5c96fe9439d5f99212d1fcdc98dabfbdc6858eefae570a0b279c04c5
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- manpages (0.3.2)
4
+ manpages (0.4.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1,15 +1,16 @@
1
1
  # Manpages
2
2
 
3
3
  [![Build Status](https://travis-ci.org/bitboxer/manpages.svg?branch=master)](https://travis-ci.org/bitboxer/manpages)
4
- [![Gem](https://img.shields.io/gem/v/manpages.svg?maxAge=2592000)](https://rubygems.org/gems/manpages)
4
+ [![Gem](https://img.shields.io/gem/v/manpages.svg)](https://rubygems.org/gems/manpages)
5
5
 
6
6
  This plugin will add man pages support to ruby gems. Instead
7
7
  of adding a new command like [gem-man](https://github.com/defunkt/gem-man)
8
8
  it will try to link the files to a place the `man` command automatically
9
9
  discovers.
10
10
 
11
- With rvm and chruby it works out of the box, but sadly for rbenv we need to [add
12
- hooks that](#using-this-with-rbenv) modify the `MANPATH` depending on the ruby version currently used.
11
+ With rvm and chruby it works out of the box, but sadly for rbenv we need to
12
+ [add hooks that](#using-this-with-rbenv) modify the `man` symlink depending on
13
+ the ruby version currently used.
13
14
 
14
15
  # Installation
15
16
 
@@ -21,11 +22,21 @@ exposes them to the `man` command.
21
22
 
22
23
  # Using this with rbenv
23
24
 
24
- Sadly rbenv uses shims to hide the actual executables. This makes it impossible for
25
- man to find the pages. The only solution is to add hooks that modify the `MANPATH`
26
- environment variable.
25
+ Sadly rbenv uses shims to hide the actual executables. This makes it a bit
26
+ harder to make this gem work in that environment.
27
27
 
28
- This gem will [soon](https://github.com/bitboxer/manpages/issues/2) provide a hook to fix this problem.
28
+ This gem provides hooks to change the man path for the current used ruby version.
29
+ To install them execute the following line:
30
+
31
+ ```
32
+ curl -o- https://raw.githubusercontent.com/bitboxer/manpages/master/rbenv/rbenv_hook_install.sh | bash
33
+ ```
34
+
35
+ After the hooks are installed, rbenv will always change the man symlink to the
36
+ currently used ruby version. Sadly rbenv does not provide a hook that is fired
37
+ when switching ruby versions. This means that the path can only be corrected
38
+ when executing a command provided by a gem. If you want to have the correct
39
+ man page for a gem, you need to execute the command of that gem, first.
29
40
 
30
41
  # How this works
31
42
 
@@ -1,3 +1,3 @@
1
1
  module Manpages
2
- VERSION = "0.4.0".freeze
2
+ VERSION = "0.5.0".freeze
3
3
  end
@@ -11,12 +11,12 @@ Gem::Specification.new do |spec|
11
11
  spec.email = ["bodo@tasche.me"]
12
12
 
13
13
  spec.summary = "Adds support for man pages to rubygems"
14
- spec.description = "This is a little experiment that adds man pages support to rubygems"
14
+ spec.description = "With this gem the rubygems command will detect man pages within gems and exposes them to the man command."
15
15
  spec.license = "MIT"
16
16
  spec.homepage = "https://github.com/bitboxer/manpages"
17
17
 
18
18
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
19
- f.match(%r{^(test|spec|features)/})
19
+ f.match(%r{^(test|spec|features|Gemfile|Gemfile.lock)/})
20
20
  end
21
21
  spec.bindir = "exe"
22
22
  spec.executables = spec.files.grep(%r{^exe/}) {|f| File.basename(f) }
@@ -0,0 +1,13 @@
1
+ #!/bin/bash
2
+
3
+ if declare -Ff after_install >/dev/null; then
4
+ after_install install_manpages
5
+ else
6
+ echo "rbenv: rbenv-default-gems plugin requires ruby-build 20130129$"
7
+ fi
8
+
9
+ install_manpages() {
10
+ gem install manpages < /dev/null || {
11
+ echo "rbenv: error installing gem 'manpages'"
12
+ } >&2
13
+ }
@@ -0,0 +1,14 @@
1
+ #!/bin/bash
2
+
3
+ set -e
4
+ [ -n "$RBENV_DEBUG" ] && set -x
5
+
6
+ SHARE_MAN="$(rbenv root)/share"
7
+ ROOT_MAN="$SHARE_MAN/man"
8
+ PREFIX_MAN="$(rbenv prefix)/share/man"
9
+
10
+ if [ "$(readlink $ROOT_MAN)" != "$PREFIX_MAN" ]; then
11
+ [ -n "$RBENV_DEBUG" ] && echo "linking ${PREFIX_MAN} -> ${ROOT_MAN}"
12
+ mkdir -p $SHARE_MAN
13
+ ln -f -s $PREFIX_MAN $SHARE_MAN
14
+ fi
@@ -0,0 +1,35 @@
1
+ #!/bin/bash
2
+
3
+ SCRIPT_DIR="$( cd "$( dirname "$0" )/../" && pwd )"
4
+
5
+ if [ -z $GEM_NAME ]; then
6
+ GEM_NAME="manpages"
7
+ fi
8
+ if ! $(gem list -i "$GEM_NAME") ;then
9
+ gem install "$GEM_NAME"
10
+ fi
11
+
12
+ if [ -n "$(command -v git)" ] && \
13
+ [ "$(basename $(git config --local remote.origin.url) 2>/dev/null)" = "manpages.git" ]; then
14
+ DIR=$SCRIPT_DIR
15
+ else
16
+ LIB_DIR="$(dirname "$(gem which manpages)")"
17
+ DIR="$(readlink -f ${LIB_DIR}/../)"
18
+ fi
19
+
20
+ if [ "$DIR" != "$(rbenv root)" ]; then
21
+ . "${DIR}/rbenv/vars.sh"
22
+
23
+ mkdir -p "${PREFIX_MAN}"
24
+
25
+ mkdir -p $EXEC_HOOK_DIR
26
+ mkdir -p $INSTALL_HOOK_DIR
27
+
28
+ cp "${DIR}/rbenv/hooks/version-name-change-man.bash" $EXEC_HOOK_DIR/
29
+ cp "${DIR}/rbenv/hooks/install-man.bash" $INSTALL_HOOK_DIR/
30
+
31
+ ln -sf $PREFIX_MAN "${ROOT_MAN}"
32
+ echo "manpages gem installed"
33
+ else
34
+ echo "cannot find gem folder"
35
+ fi
@@ -0,0 +1,19 @@
1
+ #!/bin/bash
2
+ DIR="$( cd "$( dirname "$0" )/../" && pwd )"
3
+
4
+ . ${DIR}/rbenv/vars.sh
5
+
6
+ echo "removing $ROOT_MAN"
7
+ rm -rf "$ROOT_MAN"
8
+ echo "removing $PREFIX_MAN"
9
+ rm -rf "$PREFIX_MAN"
10
+ echo "removing $INSTALL_HOOK_DIR"
11
+ rm -rf "$INSTALL_HOOK_DIR"
12
+ echo "removing $EXEC_HOOK_DIR"
13
+ rm -rf "$EXEC_HOOK_DIR"
14
+
15
+ if [ -z $GEM_NAME ]; then
16
+ GEM_NAME="manpages"
17
+ fi
18
+
19
+ gem uninstall "$GEM_NAME"
@@ -0,0 +1,6 @@
1
+ RBENV_ROOT=`rbenv root`
2
+
3
+ PREFIX_MAN="$(rbenv prefix)/share/man"
4
+ ROOT_MAN="${RBENV_ROOT}/share/man"
5
+ EXEC_HOOK_DIR="${RBENV_ROOT}/plugins/manpages/etc/rbenv.d/exec"
6
+ INSTALL_HOOK_DIR="${RBENV_ROOT}/plugins/manpages/etc/rbenv.d/install"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: manpages
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bodo Tasche
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-11-04 00:00:00.000000000 Z
11
+ date: 2016-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -80,7 +80,8 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: 0.44.1
83
- description: This is a little experiment that adds man pages support to rubygems
83
+ description: With this gem the rubygems command will detect man pages within gems
84
+ and exposes them to the man command.
84
85
  email:
85
86
  - bodo@tasche.me
86
87
  executables: []
@@ -106,6 +107,11 @@ files:
106
107
  - lib/manpages/version.rb
107
108
  - lib/rubygems_plugin.rb
108
109
  - manpages.gemspec
110
+ - rbenv/hooks/install-man.bash
111
+ - rbenv/hooks/version-name-change-man.bash
112
+ - rbenv/rbenv_hook_install.sh
113
+ - rbenv/remove_hook_folders.sh
114
+ - rbenv/vars.sh
109
115
  homepage: https://github.com/bitboxer/manpages
110
116
  licenses:
111
117
  - MIT