[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: PATCH for gem2deb: gem2tgz will pick the newest gemfile instead of the first one



It would be much better if you stopped changing the names of gems (as
all this seems to imply) and started keeping them the same.

On Tue, Feb 28, 2012 at 8:42 AM, Matijs van Zuijlen <matijs@matijs.net> wrote:
> On 02/28/2012 03:18 PM, Antonio Terceiro wrote:
>>
>> Cédric Boutillier escreveu isso aí:
>>>
>>> On Mon, Feb 27, 2012 at 05:18:34PM +0100, Matijs van Zuijlen wrote:
>>>
>>>> I would definitely check the actual version of the gem rather than
>>>> the mtime. There are all kinds of reasons an earlier version might
>>>> have a later mtime accidentally.
>>>
>>>
>>> Thanks for your feedback. Here is thus a second attempt, with the use of
>>> Gem::Version.
>>
>>
>> A simpler solution that does not require Gem::Version is to glob before
>> and
>> after fetching:
>>
>> before = Dir::glob("#{gemfile}-*.gem")
>> run("gem fetch #{gemfile}")
>> after = Dir::glob("#{gemfile}-*.gem")
>> gemfile = (after - before).first
>
>
> Then, running `gem2tgz <basename>` twice would result in a failure.

what do you expect when the entirety of gem2tgz is pretty buggy and
badly implemented? No joking, after looking at the source and thinking
about sending a patch up to fix this problem I wrote it off because I
ended up rewriting the entire bin/gem2tgz file to be more intuitive
and I figured you guys wouldn't like entire refactors.  There are
several small little things including accepting a full gem name but
not enforcing proper gem name structure (which would have made this
entire problem easier to handle) while at the same time using gem
fetch (which would have pulled it with the proper gem name structure)
using File.exists? instead of File.file? (unless you expect a
directory but I saw no checks for that), not checking and raising
early if the file is an invalid gem format.

I think the entire idea needs to be that if ARGV[0] ends with .gem
then you need to split it, validate it, use Gem to validate it's
version (or steal the Regex from Gem), then put it back in place, if
they send (for example) pry.gem then refuse to compile it, if they
send (for example) pry glob pry-*-.gem then sort it and do last and
call it a day (because sorting files with proper gem name structure
will always list the latest gem -- well in theory you could break I
guess.)


Reply to: