Coder Social home page Coder Social logo

version_sorter's Issues

Allow sorting of arrays of arbitrary objects

For example if I have a Tag class with an attribute name, and an array tags of objects of that class, currently I have to do something like this:

VersionSorter.sort(tags.map(&:name)).map do |tag_name|
  tags.find { |tag| tag.name == tag_name }
end

... which is rather inefficient.

Implementing some kind of "sort by" could be really helpful.

bin/rake and bin/readygo

Hi,
I am packaging version_sorter for Debian and have some doubts

  1. Is the file bin/rake same as the common rake (The one provided by the gem "rake" ). Or is there any difference?
  2. What does the readygo file do? Is it a similar replacement to any existing program (like rake).

Hope you help me. Thanks.

Memory leak in rb_version_sort_1

rb_version_sort_1 manually allocates/frees versions which doesn't play nice with exceptions.

This is reasonably hard to hit but can be triggered by:

VersionSorter.sort(["1"]) { |x| raise 'oh noes' }

which causes an exception to be throw by rb_yield:

if (rb_block_given_p())
rb_version_string = rb_yield(rb_version);

and

VersionSorter.sort ["\0"]

which causes an exception to be thrown by StringValueCStr because it contains embedded NULs:

versions[i] = parse_version_number(StringValueCStr(rb_version_string));

Sorter changes encoding of sort items

Given following example:

require 'version_sorter'
versions = %w( 1.0 1.1-täst)

versions.each do |v|
  puts v.encoding
end

sorted = VersionSorter.rsort(versions)

sorted.each do |v|
  puts v.encoding
end

Expected

Input, as well as out has same encoding.

Observed

Input and output have different encoding. The encoding is changed from UTF8 to ASCII-8BIT

UTF-8
UTF-8
ASCII-8BIT
ASCII-8BIT

Does not contain LICENSE

I'm porting version_sorter to FreeBSD, and noticed that this repository does not contain any license information.

I suggest adding one (most ruby gems I've seen use MIT) for clarity.

Best
xmj

C code from master doesn't pass CI

Hi @vmg I will need your help here please.

On "enable-travis" branch I've tried enabling Travis CI but it fails with errors:

  1. Rubies 1.8–2.0 fail with "undefined symbol RARRAY_AREF";
  2. Rubies 2.1–2.2 fail with segfaults.

All tests pass for me on these Ruby versions on Darwin except 1.8 which fails with:

Edyld: lazy symbol binding failed: Symbol not found: _RARRAY_AREF
  Referenced from: /Users/mislav/github/version_sorter/lib/version_sorter.bundle
  Expected in: flat namespace

dyld: Symbol not found: _RARRAY_AREF
  Referenced from: /Users/mislav/github/version_sorter/lib/version_sorter.bundle
  Expected in: flat namespace

I'm not adamant about 1.8 support but since it worked in the 1.1.1 version of this library I'm trying to see whether we can keep compatibility or official drop it.

And as for other Ruby versions, do you have an idea what's going on here?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.