Opened 5 years ago

Last modified 5 weeks ago

#58975 assigned enhancement

vim: ruby variants

Reported by: iefdev (Eric F) Owned by: raimue (Rainer Müller)
Priority: Normal Milestone:
Component: ports Version: 2.5.4
Keywords: Cc:
Port: vim

Description

I just wanted to bounce a couple of ideas before going further (PR), or if you want to add it in yourself.

All the ruby variants… They keep growing, so I thought maybe it could be automated some way - and easier to update later.

So, could this be a good idea?

(see the attached diff/patch)

# Set latest version of ruby
set rb_latest 26
variant ruby requires ruby18 description {Compatibility variant, requires +ruby18} {}

set rb_versions {}

for {set v 18} {$v <= ${rb_latest}} {incr v} {
    lappend rb_versions ruby${v}
}

foreach rb_version ${rb_versions} {
    set rbi [lsearch ${rb_versions} ${rb_version}]
    set rb_conflict_versions [lreplace ${rb_versions} ${rbi} ${rbi}]
    set rb_bin_version [regsub {(\d{1})(\d){1}} ${rb_version} {\1.\2}]

    variant ${rb_version} conflicts $rb_conflict_versions description {Enable Ruby scripting} {
        configure.args-append   --enable-rubyinterp
        configure.args-append   --with-ruby-command=${prefix}/bin/${rb_bin_version}
    }

    if {[variant_isset ${rb_version}]} {
        depends_lib-append      port:[expr {${rb_version} eq {ruby18} ? {ruby} : ${rb_version}}]
    }
}

That's all of them. It's about half the code of all variants written out.

Had to put the depends_lib-append outside, or it chose the wrong port:rubyXX when specifying a variant.

---

The other idea was about the default/compatibility variant.

variant ruby requires ruby18 description {Compatibility variant, requires +ruby18} {}

Instead of using the very old ruby18… I'm thinking something like:

variant ruby description {Defaults to `ruby', and can be used with `ruby_select'} {
    configure.args-append   --enable-rubyinterp
    configure.args-append   --with-ruby-command=${prefix}/bin/ruby
    depends_lib-append      port:ruby
}

And it will use whatever version responds to ruby. If users don't have ruby installed, it will still pull the 1.8 version, to start with.

Just an idea…

Attachments (1)

vim_ruby-loops.patch (3.3 KB) - added by iEFdev 5 years ago.

Download all attachments as: .zip

Change History (2)

Changed 5 years ago by iEFdev

Attachment: vim_ruby-loops.patch added

comment:1 Changed 5 weeks ago by barracuda156

Perhaps archaic Rubies should be removed, we only need 2.7+ or even 3.0+.

Note: See TracTickets for help on using tickets.