* [PATCH] Completion/Unix/Commands/_ri: updated for Ruby 1.9.2
@ 2010-12-30 22:41 Alexey I. Froloff
2011-01-04 11:32 ` Alexey I. Froloff
2011-01-06 6:01 ` [PATCH] Completion/Unix/Commands/_ri: missed format change Benjamin R. Haskell
0 siblings, 2 replies; 6+ messages in thread
From: Alexey I. Froloff @ 2010-12-30 22:41 UTC (permalink / raw)
To: Zsh list
In Ruby 1.9.2 extension of compiled RI files changed from .yaml
to .ri, choose extension accorting to RI version.
"plain" formatter was removed, use "bs" formatter and filter output
through "col".
Signed-off-by: Alexey I. Froloff <raorn@altlinux.org>
---
Completion/Unix/Command/_ri | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/Completion/Unix/Command/_ri b/Completion/Unix/Command/_ri
index a7f2692..7474374 100644
--- a/Completion/Unix/Command/_ri
+++ b/Completion/Unix/Command/_ri
@@ -21,17 +21,23 @@ _arguments \
'*:ri name:->ri-name' && ret=0
if [[ "$state" = ri-name ]]; then
- local -a ri_dirs ri_names ri_wants ri_names
+ local -a ri_dirs ri_ext ri_names ri_wants ri_names
local class_dir esc_name dir curtag tag descr expl
ret=1
- if "ruby${words[1]#ri}" -rrdoc/ri/ri_options.rb -e 1 >/dev/null 2>&1; then
+ if "ruby${words[1]#ri}" -rrdoc/ri/ri_options -e 1 >/dev/null 2>&1; then
# Old-style Ruby 1.8.x RI
ri_dirs=( ${(f)"$(_call_program ri-names "ruby${words[1]#ri}" -rrdoc/ri/ri_options -e '"o = RI::Options.instance; o.parse(ARGV); o.path.each { |p| puts p }"' -- ${(kv)opt_args[(I)-d|--doc-dir|--(system|site|gems|home)]})"} )
+ ri_ext=yaml
+ elif "ruby${words[1]#ri}" -rrdoc/ri -rrdoc/ri/store -e 1 >/dev/null 2>&1; then
+ # Newer-style Ruby 1.9.2 RI
+ ri_dirs=( ${(f)"$(_call_program ri-names "$words[1]" ${(kv)opt_args[(I)-d|--doc-dir|--((no-|)(system|site|gems|home)|standard-docs)]} --list-doc-dirs -f plain -T)"} )
+ ri_ext=ri
else
# New-style Ruby 1.9+ RI
ri_dirs=( ${(f)"$(_call_program ri-names "$words[1]" ${(kv)opt_args[(I)-d|--doc-dir|--((no-|)(system|site|gems|home)|standard-docs)]} --list-doc-dirs -f plain -T)"} )
+ ri_ext=yaml
fi
if compset -P '?*(::|\#|.)'; then
@@ -64,14 +70,14 @@ if [[ "$state" = ri-name ]]; then
;;
(class-methods)
for dir in $ri_dirs[@]; do
- fnames=( $dir/$class_dir*-c.yaml(-.:t) )
- ri_wants+=( ${${fnames%-c.yaml}//(#b)%(??)/$(print "\\x$match[1]")} )
+ fnames=( $dir/$class_dir*-c.$ri_ext(-.:t) )
+ ri_wants+=( ${${fnames%-c.$ri_ext}//(#b)%(??)/$(print "\\x$match[1]")} )
done
;;
(instance-methods)
for dir in $ri_dirs[@]; do
- fnames=( $dir/$class_dir*-i.yaml(-.:t) )
- ri_wants+=( ${${fnames%-i.yaml}//(#b)%(??)/$(print "\\x$match[1]")} )
+ fnames=( $dir/$class_dir*-i.$ri_ext(-.:t) )
+ ri_wants+=( ${${fnames%-i.$ri_ext}//(#b)%(??)/$(print "\\x$match[1]")} )
done
;;
esac
--
1.7.3.2
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Completion/Unix/Commands/_ri: updated for Ruby 1.9.2
2010-12-30 22:41 [PATCH] Completion/Unix/Commands/_ri: updated for Ruby 1.9.2 Alexey I. Froloff
@ 2011-01-04 11:32 ` Alexey I. Froloff
2011-01-05 21:27 ` Benjamin R. Haskell
2011-01-06 6:01 ` [PATCH] Completion/Unix/Commands/_ri: missed format change Benjamin R. Haskell
1 sibling, 1 reply; 6+ messages in thread
From: Alexey I. Froloff @ 2011-01-04 11:32 UTC (permalink / raw)
To: zsh-workers
[-- Attachment #1: Type: text/plain, Size: 285 bytes --]
On Fri, Dec 31, 2010 at 01:41:22AM +0300, Alexey I. Froloff wrote:
> In Ruby 1.9.2 extension of compiled RI files changed from .yaml
> to .ri, choose extension accorting to RI version.
Comments, anyone?
--
Regards, --
Sir Raorn. --- http://thousandsofhate.blogspot.com/
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Completion/Unix/Commands/_ri: updated for Ruby 1.9.2
2011-01-04 11:32 ` Alexey I. Froloff
@ 2011-01-05 21:27 ` Benjamin R. Haskell
2011-01-06 0:30 ` Alexey I. Froloff
0 siblings, 1 reply; 6+ messages in thread
From: Benjamin R. Haskell @ 2011-01-05 21:27 UTC (permalink / raw)
To: Alexey I. Froloff; +Cc: zsh-workers
On Tue, 4 Jan 2011, Alexey I. Froloff wrote:
> On Fri, Dec 31, 2010 at 01:41:22AM +0300, Alexey I. Froloff wrote:
>> In Ruby 1.9.2 extension of compiled RI files changed from .yaml to
>> .ri, choose extension accorting to RI version.
> Comments, anyone?
(Apologies in advance if this isn't useful feedback, I'm a Ruby noob.)
Maybe it makes sense, but it seems weird that the tests are conditioned
on running Ruby scripts rather than looking at `ri --version`.
And how does this fare against different Ruby implementations? Would
JRuby 1.9.2 necessarily use the same 'ri' conventions as MRI Ruby 1.9.2?
And more generally, since it's looking in directories that would only
contain Ruby documentation, would it hurt to include both .yaml and .ri
for versions that support .ri?
--
Best,
Ben
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Completion/Unix/Commands/_ri: updated for Ruby 1.9.2
2011-01-05 21:27 ` Benjamin R. Haskell
@ 2011-01-06 0:30 ` Alexey I. Froloff
2011-01-06 6:07 ` Benjamin R. Haskell
0 siblings, 1 reply; 6+ messages in thread
From: Alexey I. Froloff @ 2011-01-06 0:30 UTC (permalink / raw)
To: zsh-workers
[-- Attachment #1: Type: text/plain, Size: 1368 bytes --]
On Wed, Jan 05, 2011 at 04:27:35PM -0500, Benjamin R. Haskell wrote:
> Maybe it makes sense, but it seems weird that the tests are conditioned
> on running Ruby scripts rather than looking at `ri --version`.
ri --version reports something weird. I don't know since when
things were changed, checking for modules that have been removed
or added seems to be fair enough.
Are you thinking there's too much (and too direct) ruby
invocations?
> And how does this fare against different Ruby implementations? Would
> JRuby 1.9.2 necessarily use the same 'ri' conventions as MRI Ruby 1.9.2?
Yes. Latest JRuby supports both 1.8 and 1.9 Ruby versions and
have copies of standard runtime libraries (both versions) which
includes RI.
> And more generally, since it's looking in directories that would only
> contain Ruby documentation, would it hurt to include both .yaml and .ri
> for versions that support .ri?
I thought about it, yes. Newer RI doesn't read .yaml
documentation. It wouldn't hurt, but it would complete something
that can't be shown.
This patch will un-break ri completion for latest stable MRI Ruby
version. I wrote this completion and I am responsible for that.
However, I am not satisfied with current implementation, I'm
working on it.
--
Regards, --
Sir Raorn. --- http://thousandsofhate.blogspot.com/
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] Completion/Unix/Commands/_ri: missed format change
2010-12-30 22:41 [PATCH] Completion/Unix/Commands/_ri: updated for Ruby 1.9.2 Alexey I. Froloff
2011-01-04 11:32 ` Alexey I. Froloff
@ 2011-01-06 6:01 ` Benjamin R. Haskell
1 sibling, 0 replies; 6+ messages in thread
From: Benjamin R. Haskell @ 2011-01-06 6:01 UTC (permalink / raw)
To: Zsh Workers; +Cc: zsh
Comment from workers/28557 said:
"plain" formatter was removed, use "bs" formatter [...]
But the "Newer Style Ruby 1.9.2 RI" section was still using '-f plain'
(so, not completing anything for me).
---
Completion/Unix/Command/_ri | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/Completion/Unix/Command/_ri b/Completion/Unix/Command/_ri
index 7474374..feb10ec 100644
--- a/Completion/Unix/Command/_ri
+++ b/Completion/Unix/Command/_ri
@@ -32,7 +32,7 @@ if [[ "$state" = ri-name ]]; then
ri_ext=yaml
elif "ruby${words[1]#ri}" -rrdoc/ri -rrdoc/ri/store -e 1 >/dev/null 2>&1; then
# Newer-style Ruby 1.9.2 RI
- ri_dirs=( ${(f)"$(_call_program ri-names "$words[1]" ${(kv)opt_args[(I)-d|--doc-dir|--((no-|)(system|site|gems|home)|standard-docs)]} --list-doc-dirs -f plain -T)"} )
+ ri_dirs=( ${(f)"$(_call_program ri-names "$words[1]" ${(kv)opt_args[(I)-d|--doc-dir|--((no-|)(system|site|gems|home)|standard-docs)]} --list-doc-dirs -f bs -T)"} )
ri_ext=ri
else
# New-style Ruby 1.9+ RI
--
1.7.3.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Completion/Unix/Commands/_ri: updated for Ruby 1.9.2
2011-01-06 0:30 ` Alexey I. Froloff
@ 2011-01-06 6:07 ` Benjamin R. Haskell
0 siblings, 0 replies; 6+ messages in thread
From: Benjamin R. Haskell @ 2011-01-06 6:07 UTC (permalink / raw)
To: Alexey I. Froloff; +Cc: zsh-workers
On Thu, 6 Jan 2011, Alexey I. Froloff wrote:
> On Wed, Jan 05, 2011 at 04:27:35PM -0500, Benjamin R. Haskell wrote:
>> Maybe it makes sense, but it seems weird that the tests are
>> conditioned on running Ruby scripts rather than looking at `ri
>> --version`.
> ri --version reports something weird. I don't know since when things
> were changed, checking for modules that have been removed or added
> seems to be fair enough.
>
> Are you thinking there's too much (and too direct) ruby invocations?
Yes, that was the concern. I guess it's not really that much. The
repetitive portion that keeps the arguments that the user has already
passed:
${(kv)opt_args[(I)-d|--doc-dir|...etc...]}
made me think at first glance that there was more coding than there
actually is.
>> And how does this fare against different Ruby implementations? Would
>> JRuby 1.9.2 necessarily use the same 'ri' conventions as MRI Ruby
>> 1.9.2?
> Yes. Latest JRuby supports both 1.8 and 1.9 Ruby versions and have
> copies of standard runtime libraries (both versions) which includes
> RI.
Okay. (Didn't know whether Ruby implementations had different
arguments [ala C++ compilers].)
>> And more generally, since it's looking in directories that would only
>> contain Ruby documentation, would it hurt to include both .yaml and
>> .ri for versions that support .ri?
> I thought about it, yes. Newer RI doesn't read .yaml documentation.
> It wouldn't hurt, but it would complete something that can't be shown.
Saynomore. I was in the process of trying to install 1.9.2 alongside
1.8.7 on my Gentoo machine, so I couldn't check as much: if the newer
version can't read it, it makes sense to not show it.
> This patch will un-break ri completion for latest stable MRI Ruby
> version. I wrote this completion and I am responsible for that.
Was still broken for me until I added the patch that I just sent.
> However, I am not satisfied with current implementation, I'm working
> on it.
Out of curiosity, what don't you like at this point?
--
Best,
Ben
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-01-06 6:07 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-30 22:41 [PATCH] Completion/Unix/Commands/_ri: updated for Ruby 1.9.2 Alexey I. Froloff
2011-01-04 11:32 ` Alexey I. Froloff
2011-01-05 21:27 ` Benjamin R. Haskell
2011-01-06 0:30 ` Alexey I. Froloff
2011-01-06 6:07 ` Benjamin R. Haskell
2011-01-06 6:01 ` [PATCH] Completion/Unix/Commands/_ri: missed format change Benjamin R. Haskell
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).